From 50fb255df80198566298b0c79919ef44878cb3be Mon Sep 17 00:00:00 2001 From: eileenmcnaughton Date: Thu, 15 Jan 2015 07:16:04 +0000 Subject: [PATCH] update examples" --- .../Activity/ContactRefCustomField.php | 145 +- .../Activity/ContactRefCustomFieldGet.php | 121 +- api/v3/examples/Activity/Create.php | 144 +- api/v3/examples/Activity/DateTimeHigh.php | 111 +- api/v3/examples/Activity/DateTimeLow.php | 109 +- api/v3/examples/Activity/Delete.php | 74 +- api/v3/examples/Activity/Get.php | 108 +- .../Activity/GetTargetandAssignee.php | 147 +- api/v3/examples/Activity/Getfields.php | 585 ++-- .../Activity/ReturnAssigneeContact.php | 267 +- api/v3/examples/ActivityContact/Create.php | 92 +- api/v3/examples/ActivityContact/Delete.php | 74 +- api/v3/examples/ActivityType/Create.php | 123 +- api/v3/examples/ActivityType/Get.php | 73 +- api/v3/examples/Address/AddressLike.php | 105 +- api/v3/examples/Address/AddressParse.php | 109 +- api/v3/examples/Address/AddressSort.php | 134 +- api/v3/examples/Address/Create.php | 118 +- api/v3/examples/Address/Delete.php | 74 +- api/v3/examples/Address/Get.php | 106 +- api/v3/examples/Batch/Create.php | 124 +- api/v3/examples/Batch/Delete.php | 74 +- api/v3/examples/Batch/Get.php | 88 +- api/v3/examples/Batch/Update.php | 124 +- api/v3/examples/Campaign/Create.php | 117 +- api/v3/examples/Campaign/Delete.php | 74 +- api/v3/examples/Campaign/Get.php | 94 +- api/v3/examples/Case/Create.php | 98 +- api/v3/examples/Constant/Get.php | 74 +- api/v3/examples/Contact/APIChainedArray.php | 377 ++- .../Contact/APIChainedArrayFormats.php | 249 +- .../Contact/APIChainedArrayMultipleCustom.php | 329 +- ...IChainedArrayValuesFromSiblingFunction.php | 195 +- api/v3/examples/Contact/ChainTwoWebsites.php | 313 +- .../Contact/ChainTwoWebsitesSyntax2.php | 325 +- api/v3/examples/Contact/Create.php | 183 +- api/v3/examples/Contact/CustomFieldGet.php | 89 +- .../CustomFieldGetReturnSyntaxVariation.php | 89 +- api/v3/examples/Contact/Delete.php | 74 +- .../examples/Contact/FormatIsSuccess_Fail.php | 67 +- .../examples/Contact/FormatIsSuccess_True.php | 67 +- api/v3/examples/Contact/FormatOnlyID.php | 67 +- api/v3/examples/Contact/FormatSingleValue.php | 67 +- api/v3/examples/Contact/Get.php | 210 +- api/v3/examples/Contact/GetActions.php | 108 +- api/v3/examples/Contact/GetCountContact.php | 65 +- api/v3/examples/Contact/GetFieldsOptions.php | 1395 ++++---- api/v3/examples/Contact/GetSingleContact.php | 199 +- api/v3/examples/Contact/Getoptions.php | 75 +- .../Contact/GroupFilterUsingContactAPI.php | 213 +- .../ContributionCreateWithHonoreeContact.php | 155 +- .../ContributionCreateWithNote.php | 161 +- .../ContributionCreateWithSoftCredit.php | 163 +- ...ntributionCreateWithSoftCreditDefaults.php | 155 +- api/v3/examples/Contribution/Create.php | 152 +- .../CreateWithNestedLineItems.php | 277 +- api/v3/examples/Contribution/Delete.php | 76 +- api/v3/examples/Contribution/Get.php | 172 +- api/v3/examples/ContributionPage/Create.php | 180 +- api/v3/examples/ContributionPage/Delete.php | 74 +- api/v3/examples/ContributionPage/Get.php | 122 +- api/v3/examples/ContributionPage/Submit.php | 105 +- api/v3/examples/ContributionRecur/Create.php | 146 +- api/v3/examples/ContributionRecur/Delete.php | 74 +- api/v3/examples/ContributionRecur/Get.php | 110 +- api/v3/examples/ContributionSoft/Create.php | 108 +- api/v3/examples/ContributionSoft/Delete.php | 64 +- api/v3/examples/ContributionSoft/Get.php | 92 +- api/v3/examples/Country/Create.php | 102 +- api/v3/examples/Country/Delete.php | 74 +- api/v3/examples/Country/Get.php | 90 +- api/v3/examples/CustomField/Create.php | 156 +- api/v3/examples/CustomField/Delete.php | 74 +- api/v3/examples/CustomGroup/Create.php | 134 +- api/v3/examples/CustomGroup/Delete.php | 74 +- api/v3/examples/CustomGroup/Get.php | 102 +- api/v3/examples/CustomValue/Create.php | 76 +- api/v3/examples/CustomValue/Get.php | 157 +- .../examples/CustomValue/formatFieldName.php | 159 +- api/v3/examples/Domain/Create.php | 100 +- api/v3/examples/Domain/Get.php | 168 +- api/v3/examples/Email/Create.php | 108 +- api/v3/examples/Email/Delete.php | 74 +- api/v3/examples/Email/NestedReplaceEmail.php | 409 +-- api/v3/examples/Email/Replace.php | 246 +- api/v3/examples/EntityTag/Create.php | 76 +- api/v3/examples/EntityTag/Delete.php | 76 +- api/v3/examples/EntityTag/Get.php | 76 +- api/v3/examples/Event/Create.php | 237 +- api/v3/examples/Event/Delete.php | 74 +- api/v3/examples/Event/Get.php | 127 +- api/v3/examples/Event/IsCurrentOption.php | 144 +- api/v3/examples/Event/IsFullOption.php | 122 +- api/v3/examples/Grant/Create.php | 122 +- api/v3/examples/Grant/Delete.php | 74 +- api/v3/examples/Grant/Get.php | 96 +- api/v3/examples/Group/Get.php | 106 +- api/v3/examples/Group/getfields.php | 300 +- api/v3/examples/GroupContact/Create.php | 84 +- api/v3/examples/GroupContact/Delete.php | 82 +- api/v3/examples/GroupContact/Get.php | 92 +- .../examples/GroupContact/GetWithGroupID.php | 167 +- api/v3/examples/GroupNesting/Create.php | 78 +- api/v3/examples/GroupNesting/Delete.php | 74 +- api/v3/examples/GroupNesting/Get.php | 86 +- api/v3/examples/GroupOrganization/Create.php | 84 +- api/v3/examples/GroupOrganization/Delete.php | 74 +- api/v3/examples/GroupOrganization/Get.php | 74 +- api/v3/examples/Im/Create.php | 98 +- api/v3/examples/Im/Delete.php | 74 +- api/v3/examples/Im/Get.php | 100 +- api/v3/examples/Job/Create.php | 112 +- api/v3/examples/Job/Delete.php | 64 +- api/v3/examples/LineItem/Create.php | 121 +- api/v3/examples/LineItem/Delete.php | 74 +- api/v3/examples/LineItem/Get.php | 104 +- api/v3/examples/LocBlock/createEntities.php | 191 +- api/v3/examples/LocBlock/getEntities.php | 153 +- api/v3/examples/LocBlock/simpleCreate.php | 101 +- .../MailSettings/ChainedGetDelete.php | 129 +- api/v3/examples/MailSettings/Create.php | 120 +- api/v3/examples/MailSettings/Delete.php | 74 +- api/v3/examples/MailSettings/Get.php | 110 +- api/v3/examples/Mailing/Create.php | 197 +- api/v3/examples/Mailing/Delete.php | 74 +- api/v3/examples/Mailing/Submit.php | 120 + api/v3/examples/MailingGroup/Subscribe.php | 92 +- api/v3/examples/Membership/Create.php | 124 +- api/v3/examples/Membership/Delete.php | 74 +- api/v3/examples/Membership/Get.php | 108 +- api/v3/examples/Membership/Update.php | 124 +- .../examples/Membership/filterIsCurrent.php | 107 +- api/v3/examples/MembershipPayment/Create.php | 86 +- api/v3/examples/MembershipPayment/Get.php | 88 +- api/v3/examples/MembershipStatus/Create.php | 108 +- api/v3/examples/MembershipStatus/Get.php | 98 +- api/v3/examples/MembershipType/Create.php | 140 +- api/v3/examples/MembershipType/Delete.php | 74 +- api/v3/examples/MembershipType/Get.php | 102 +- api/v3/examples/MessageTemplate/Create.php | 113 +- api/v3/examples/MessageTemplate/Delete.php | 74 +- api/v3/examples/MessageTemplate/Get.php | 113 +- api/v3/examples/Note/Create.php | 106 +- api/v3/examples/Note/Delete.php | 74 +- api/v3/examples/Note/Get.php | 88 +- api/v3/examples/OptionGroup/Create.php | 102 +- api/v3/examples/OptionGroup/Delete.php | 74 +- api/v3/examples/OptionGroup/Get.php | 90 +- api/v3/examples/OptionValue/Get.php | 174 +- api/v3/examples/OptionValue/SortOption.php | 87 +- api/v3/examples/Participant/Create.php | 126 +- .../Participant/CreateParticipantPayment.php | 211 +- api/v3/examples/Participant/Get.php | 132 +- api/v3/examples/Participant/NestedDelete.php | 209 +- .../examples/Participant/NestedEventGet.php | 216 +- api/v3/examples/ParticipantPayment/Create.php | 86 +- api/v3/examples/ParticipantPayment/Delete.php | 74 +- api/v3/examples/ParticipantPayment/Get.php | 88 +- .../examples/ParticipantStatusType/Create.php | 110 +- .../examples/ParticipantStatusType/Delete.php | 74 +- api/v3/examples/ParticipantStatusType/Get.php | 112 +- api/v3/examples/PaymentProcessor/Create.php | 128 +- api/v3/examples/PaymentProcessor/Delete.php | 74 +- .../examples/PaymentProcessorType/Create.php | 132 +- .../examples/PaymentProcessorType/Delete.php | 74 +- api/v3/examples/Phone/Create.php | 108 +- api/v3/examples/Phone/Delete.php | 74 +- api/v3/examples/Phone/Get.php | 98 +- api/v3/examples/Pledge/Create.php | 148 +- api/v3/examples/Pledge/Delete.php | 76 +- api/v3/examples/Pledge/Get.php | 120 +- api/v3/examples/Pledge/GetFilterHighDate.php | 121 +- api/v3/examples/PledgePayment/Create.php | 106 +- api/v3/examples/PledgePayment/Delete.php | 76 +- api/v3/examples/PledgePayment/Get.php | 150 +- api/v3/examples/PledgePayment/Update.php | 100 +- api/v3/examples/PriceField/Create.php | 122 +- api/v3/examples/PriceField/Delete.php | 74 +- api/v3/examples/PriceField/Get.php | 102 +- api/v3/examples/PriceFieldValue/Create.php | 124 +- api/v3/examples/PriceFieldValue/Delete.php | 74 +- api/v3/examples/PriceFieldValue/Get.php | 98 +- api/v3/examples/PriceSet/Create.php | 120 +- api/v3/examples/PriceSet/Delete.php | 74 +- api/v3/examples/PriceSet/Get.php | 94 +- api/v3/examples/Profile/Apply.php | 122 +- api/v3/examples/Profile/Get.php | 132 +- api/v3/examples/Profile/GetFields.php | 403 +-- api/v3/examples/Profile/Submit.php | 190 +- .../Relationship/BetweenRelationshipType.php | 141 +- api/v3/examples/Relationship/Create.php | 112 +- api/v3/examples/Relationship/Delete.php | 74 +- api/v3/examples/Relationship/Get.php | 100 +- .../Relationship/INRelationshipType.php | 121 +- .../NotBetweenRelationshipType.php | 103 +- .../Relationship/NotInRelationshipType.php | 121 +- .../examples/Relationship/filterIsCurrent.php | 97 +- api/v3/examples/RelationshipType/Create.php | 114 +- api/v3/examples/RelationshipType/Delete.php | 74 +- api/v3/examples/ReportTemplate/Getrows.php | 103 +- .../examples/ReportTemplate/Getstatistics.php | 93 +- api/v3/examples/Setting/Create.php | 82 +- api/v3/examples/Setting/CreateAllDomains.php | 89 +- .../Setting/CreateSettingCurrentDomain.php | 81 +- .../Setting/CreateSpecifiedDomains.php | 85 +- api/v3/examples/Setting/Get.php | 82 +- api/v3/examples/Setting/GetAllDomains.php | 89 +- api/v3/examples/Setting/GetDefaults.php | 81 +- api/v3/examples/Setting/GetFields.php | 2993 +++++++++-------- .../Setting/GetSettingCurrentDomain.php | 81 +- .../examples/Setting/GetSpecifiedDomains.php | 85 +- api/v3/examples/Setting/GetValue.php | 67 +- api/v3/examples/Setting/Revert.php | 83 +- api/v3/examples/Survey/ChainedGetDelete.php | 113 +- api/v3/examples/Survey/Create.php | 124 +- api/v3/examples/Survey/Delete.php | 74 +- api/v3/examples/Survey/Get.php | 106 +- api/v3/examples/SurveyRespondant/Get.php | 76 +- api/v3/examples/System/Flush.php | 71 +- api/v3/examples/Tag/Create.php | 100 +- api/v3/examples/Tag/Delete.php | 74 +- api/v3/examples/Tag/Get.php | 96 +- api/v3/examples/Tag/GetList.php | 99 +- api/v3/examples/Tag/Getfields.php | 201 +- api/v3/examples/Tag/getReturnArray.php | 87 +- .../examples/TaxContributionPage/Create.php | 118 + .../CreateWithNestedLineItems.php | 193 ++ .../examples/TaxContributionPage/Delete.php | 80 + api/v3/examples/UFField/Create.php | 134 +- api/v3/examples/UFField/Delete.php | 74 +- api/v3/examples/UFField/Get.php | 104 +- api/v3/examples/UFField/Replace.php | 252 +- api/v3/examples/UFGroup/Create.php | 162 +- api/v3/examples/UFGroup/Delete.php | 74 +- api/v3/examples/UFGroup/Get.php | 122 +- api/v3/examples/UFJoin/Create.php | 106 +- api/v3/examples/UFJoin/Get.php | 96 +- api/v3/examples/UFMatch/Get.php | 86 +- api/v3/examples/Website/Create.php | 90 +- api/v3/examples/Website/Delete.php | 74 +- api/v3/examples/Website/Get.php | 92 +- api/v3/examples/Website/GetFields.php | 143 +- api/v3/examples/Website/GetWithMetadata.php | 164 +- 243 files changed, 18909 insertions(+), 14471 deletions(-) create mode 100644 api/v3/examples/Mailing/Submit.php create mode 100644 api/v3/examples/TaxContributionPage/Create.php create mode 100644 api/v3/examples/TaxContributionPage/CreateWithNestedLineItems.php create mode 100644 api/v3/examples/TaxContributionPage/Delete.php diff --git a/api/v3/examples/Activity/ContactRefCustomField.php b/api/v3/examples/Activity/ContactRefCustomField.php index 59aecdce51..18a75b92e2 100644 --- a/api/v3/examples/Activity/ContactRefCustomField.php +++ b/api/v3/examples/Activity/ContactRefCustomField.php @@ -1,84 +1,101 @@ 1, - 'activity_type_id' => '49', - 'subject' => 'test activity type id', - 'activity_date_time' => '2011-06-02 14:36:13', - 'status_id' => 2, - 'priority_id' => 1, - 'duration' => 120, - 'location' => 'Pensulvania', - 'details' => 'a test activity', - 'custom_2' => '1', -); -try{ - $result = civicrm_api3('activity', 'Create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity Create API. + * + * demonstrates create with Contact Reference Custom Field + * + * @return array + * API result array + */ +function activity_create_example() { + $params = array( + 'source_contact_id' => 1, + 'activity_type_id' => '51', + 'subject' => 'test activity type id', + 'activity_date_time' => '2011-06-02 14:36:13', + 'status_id' => 2, + 'priority_id' => 1, + 'duration' => 120, + 'location' => 'Pensulvania', + 'details' => 'a test activity', + 'custom_2' => '1', + ); -return $result; + try{ + $result = civicrm_api3('activity', 'Create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_create_expectedresult(){ +function activity_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'source_record_id' => '', - 'activity_type_id' => '49', - 'subject' => 'test activity type id', - 'activity_date_time' => '20110602143613', - 'duration' => '120', - 'location' => 'Pensulvania', - 'phone_id' => '', - 'phone_number' => '', - 'details' => 'a test activity', - 'status_id' => '2', - 'priority_id' => '1', - 'parent_id' => '', - 'is_test' => '', - 'medium_id' => '', - 'is_auto' => '', - 'relationship_id' => '', - 'is_current_revision' => '', - 'original_id' => '', - 'result' => '', - 'is_deleted' => '', - 'campaign_id' => '', - 'engagement_level' => '', - 'weight' => '', - ), + 'id' => '1', + 'source_record_id' => '', + 'activity_type_id' => '51', + 'subject' => 'test activity type id', + 'activity_date_time' => '20110602143613', + 'duration' => '120', + 'location' => 'Pensulvania', + 'phone_id' => '', + 'phone_number' => '', + 'details' => 'a test activity', + 'status_id' => '2', + 'priority_id' => '1', + 'parent_id' => '', + 'is_test' => '', + 'medium_id' => '', + 'is_auto' => '', + 'relationship_id' => '', + 'is_current_revision' => '', + 'original_id' => '', + 'result' => '', + 'is_deleted' => '', + 'campaign_id' => '', + 'engagement_level' => '', + 'weight' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testActivityCreateCustomContactRefField and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testActivityCreateCustomContactRefField +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/ContactRefCustomFieldGet.php b/api/v3/examples/Activity/ContactRefCustomFieldGet.php index cdd214c6f7..18273b9bf8 100644 --- a/api/v3/examples/Activity/ContactRefCustomFieldGet.php +++ b/api/v3/examples/Activity/ContactRefCustomFieldGet.php @@ -1,72 +1,89 @@ 1, - 'id' => 1, -); -try{ - $result = civicrm_api3('activity', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity get API. + * + * Get with Contact Ref Custom Field + * + * @return array + * API result array + */ +function activity_get_example() { + $params = array( + 'return.custom_2' => 1, + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('activity', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_get_expectedresult(){ +function activity_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'activity_type_id' => '49', - 'subject' => 'test activity type id', - 'activity_date_time' => '2011-06-02 14:36:13', - 'duration' => '120', - 'location' => 'Pensulvania', - 'details' => 'a test activity', - 'status_id' => '2', - 'priority_id' => '1', - 'is_test' => 0, - 'is_auto' => 0, - 'is_current_revision' => '1', - 'is_deleted' => 0, - 'source_contact_id' => '1', - 'custom_1' => 'defaultValue', - 'custom_1_1' => 'defaultValue', - 'custom_2' => 'Anderson, Anthony', - 'custom_2_1' => 'Anderson, Anthony', - 'custom_2_1_id' => '1', - 'custom_2_id' => '1', - ), + 'id' => '1', + 'activity_type_id' => '51', + 'subject' => 'test activity type id', + 'activity_date_time' => '2011-06-02 14:36:13', + 'duration' => '120', + 'location' => 'Pensulvania', + 'details' => 'a test activity', + 'status_id' => '2', + 'priority_id' => '1', + 'is_test' => 0, + 'is_auto' => 0, + 'is_current_revision' => '1', + 'is_deleted' => 0, + 'source_contact_id' => '1', + 'custom_1' => 'defaultValue', + 'custom_1_1' => 'defaultValue', + 'custom_2' => 'Anderson, Anthony', + 'custom_2_1' => 'Anderson, Anthony', + 'custom_2_1_id' => '1', + 'custom_2_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testActivityCreateCustomContactRefField and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testActivityCreateCustomContactRefField +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/Create.php b/api/v3/examples/Activity/Create.php index b8fffb7e7c..8fd89f938c 100644 --- a/api/v3/examples/Activity/Create.php +++ b/api/v3/examples/Activity/Create.php @@ -1,84 +1,100 @@ 1, - 'activity_type_id' => '49', - 'subject' => 'test activity type id', - 'activity_date_time' => '2011-06-02 14:36:13', - 'status_id' => 2, - 'priority_id' => 1, - 'duration' => 120, - 'location' => 'Pensulvania', - 'details' => 'a test activity', - 'custom_1' => 'custom string', -); -try{ - $result = civicrm_api3('activity', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity create API. + * + * + * @return array + * API result array + */ +function activity_create_example() { + $params = array( + 'source_contact_id' => 1, + 'activity_type_id' => '51', + 'subject' => 'test activity type id', + 'activity_date_time' => '2011-06-02 14:36:13', + 'status_id' => 2, + 'priority_id' => 1, + 'duration' => 120, + 'location' => 'Pensulvania', + 'details' => 'a test activity', + 'custom_1' => 'custom string', + ); -return $result; + try{ + $result = civicrm_api3('activity', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_create_expectedresult(){ +function activity_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'source_record_id' => '', - 'activity_type_id' => '49', - 'subject' => 'test activity type id', - 'activity_date_time' => '20110602143613', - 'duration' => '120', - 'location' => 'Pensulvania', - 'phone_id' => '', - 'phone_number' => '', - 'details' => 'a test activity', - 'status_id' => '2', - 'priority_id' => '1', - 'parent_id' => '', - 'is_test' => '', - 'medium_id' => '', - 'is_auto' => '', - 'relationship_id' => '', - 'is_current_revision' => '', - 'original_id' => '', - 'result' => '', - 'is_deleted' => '', - 'campaign_id' => '', - 'engagement_level' => '', - 'weight' => '', - ), + 'id' => '1', + 'source_record_id' => '', + 'activity_type_id' => '51', + 'subject' => 'test activity type id', + 'activity_date_time' => '20110602143613', + 'duration' => '120', + 'location' => 'Pensulvania', + 'phone_id' => '', + 'phone_number' => '', + 'details' => 'a test activity', + 'status_id' => '2', + 'priority_id' => '1', + 'parent_id' => '', + 'is_test' => '', + 'medium_id' => '', + 'is_auto' => '', + 'relationship_id' => '', + 'is_current_revision' => '', + 'original_id' => '', + 'result' => '', + 'is_deleted' => '', + 'campaign_id' => '', + 'engagement_level' => '', + 'weight' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testActivityCreateCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testActivityCreateCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/DateTimeHigh.php b/api/v3/examples/Activity/DateTimeHigh.php index 906dbd6169..c00406e342 100644 --- a/api/v3/examples/Activity/DateTimeHigh.php +++ b/api/v3/examples/Activity/DateTimeHigh.php @@ -1,67 +1,84 @@ 1, - 'filter.activity_date_time_high' => '20120101000000', - 'sequential' => 1, -); -try{ - $result = civicrm_api3('activity', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity get API. + * + * demonstrates _high filter (at time of writing doesn't work if contact_id is set + * + * @return array + * API result array + */ +function activity_get_example() { + $params = array( + 'source_contact_id' => 1, + 'filter.activity_date_time_high' => '20120101000000', + 'sequential' => 1, + ); -return $result; + try{ + $result = civicrm_api3('activity', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_get_expectedresult(){ +function activity_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '0' => array( - 'id' => '1', - 'activity_type_id' => '49', - 'subject' => 'Make-it-Happen Meeting', - 'activity_date_time' => '2011-01-01 00:00:00', - 'duration' => '120', - 'location' => 'Pensulvania', - 'details' => 'a test activity', - 'status_id' => '1', - 'priority_id' => '1', - 'is_test' => 0, - 'is_auto' => 0, - 'is_current_revision' => '1', - 'is_deleted' => 0, - 'source_contact_id' => '1', - ), + 'id' => '1', + 'activity_type_id' => '51', + 'subject' => 'Make-it-Happen Meeting', + 'activity_date_time' => '2011-01-01 00:00:00', + 'duration' => '120', + 'location' => 'Pensulvania', + 'details' => 'a test activity', + 'status_id' => '1', + 'priority_id' => '1', + 'is_test' => 0, + 'is_auto' => 0, + 'is_current_revision' => '1', + 'is_deleted' => 0, + 'source_contact_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetFilterMaxDate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetFilterMaxDate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/DateTimeLow.php b/api/v3/examples/Activity/DateTimeLow.php index 6e40ca7db0..9b5876833c 100644 --- a/api/v3/examples/Activity/DateTimeLow.php +++ b/api/v3/examples/Activity/DateTimeLow.php @@ -1,66 +1,83 @@ '20120101000000', - 'sequential' => 1, -); -try{ - $result = civicrm_api3('activity', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity get API. + * + * demonstrates _low filter (at time of writing doesn't work if contact_id is set + * + * @return array + * API result array + */ +function activity_get_example() { + $params = array( + 'filter.activity_date_time_low' => '20120101000000', + 'sequential' => 1, + ); -return $result; + try{ + $result = civicrm_api3('activity', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_get_expectedresult(){ +function activity_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '0' => array( - 'id' => '2', - 'activity_type_id' => '49', - 'subject' => 'Make-it-Happen Meeting', - 'activity_date_time' => '2012-02-16 00:00:00', - 'duration' => '120', - 'location' => 'Pensulvania', - 'details' => 'a test activity', - 'status_id' => '1', - 'priority_id' => '1', - 'is_test' => 0, - 'is_auto' => 0, - 'is_current_revision' => '1', - 'is_deleted' => 0, - 'source_contact_id' => '1', - ), + 'id' => '2', + 'activity_type_id' => '51', + 'subject' => 'Make-it-Happen Meeting', + 'activity_date_time' => '2012-02-16 00:00:00', + 'duration' => '120', + 'location' => 'Pensulvania', + 'details' => 'a test activity', + 'status_id' => '1', + 'priority_id' => '1', + 'is_test' => 0, + 'is_auto' => 0, + 'is_current_revision' => '1', + 'is_deleted' => 0, + 'source_contact_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetFilterMaxDate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetFilterMaxDate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/Delete.php b/api/v3/examples/Activity/Delete.php index e6b3779ebe..537c11ae7a 100644 --- a/api/v3/examples/Activity/Delete.php +++ b/api/v3/examples/Activity/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('activity', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity delete API. + * + * + * @return array + * API result array + */ +function activity_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('activity', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_delete_expectedresult(){ +function activity_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteActivity and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteActivity +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/Get.php b/api/v3/examples/Activity/Get.php index b56306c981..41dd137696 100644 --- a/api/v3/examples/Activity/Get.php +++ b/api/v3/examples/Activity/Get.php @@ -1,66 +1,82 @@ 1, - 'activity_type_id' => '49', - 'sequential' => 1, - 'return.custom_1' => 1, -); -try{ - $result = civicrm_api3('activity', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity get API. + * + * + * @return array + * API result array + */ +function activity_get_example() { + $params = array( + 'contact_id' => 1, + 'activity_type_id' => '51', + 'sequential' => 1, + 'return.custom_1' => 1, + ); -return $result; + try{ + $result = civicrm_api3('activity', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_get_expectedresult(){ +function activity_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '0' => array( - 'source_contact_id' => '1', - 'id' => '1', - 'activity_type_id' => '49', - 'subject' => 'test activity type id', - 'location' => 'Pensulvania', - 'activity_date_time' => '2011-06-02 14:36:13', - 'details' => 'a test activity', - 'status_id' => '2', - 'activity_name' => 'Test activity type', - 'status' => 'Completed', - 'custom_1' => 'custom string', - 'custom_1_1' => 'custom string', - ), + 'source_contact_id' => '1', + 'id' => '1', + 'activity_type_id' => '51', + 'subject' => 'test activity type id', + 'location' => 'Pensulvania', + 'activity_date_time' => '2011-06-02 14:36:13', + 'details' => 'a test activity', + 'status_id' => '2', + 'activity_name' => 'Test activity type', + 'status' => 'Completed', + 'custom_1' => 'custom string', + 'custom_1_1' => 'custom string', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testActivityGetContact_idCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testActivityGetContact_idCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/GetTargetandAssignee.php b/api/v3/examples/Activity/GetTargetandAssignee.php index 98d33e5914..b309ada5ab 100644 --- a/api/v3/examples/Activity/GetTargetandAssignee.php +++ b/api/v3/examples/Activity/GetTargetandAssignee.php @@ -1,85 +1,102 @@ 1, - 'subject' => 'Make-it-Happen Meeting', - 'activity_date_time' => '20110316', - 'duration' => 120, - 'location' => 'Pensulvania', - 'details' => 'a test activity', - 'status_id' => 1, - 'activity_type_id' => 1, - 'priority_id' => 1, - 'target_contact_id' => 1, - 'assignee_contact_id' => 1, -); -try{ - $result = civicrm_api3('activity', '', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity API. + * + * Example demonstrates setting & retrieving the target & source + * + * @return array + * API result array + */ +function activity__example() { + $params = array( + 'source_contact_id' => 1, + 'subject' => 'Make-it-Happen Meeting', + 'activity_date_time' => '20110316', + 'duration' => 120, + 'location' => 'Pensulvania', + 'details' => 'a test activity', + 'status_id' => 1, + 'activity_type_id' => 1, + 'priority_id' => 1, + 'target_contact_id' => 1, + 'assignee_contact_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('activity', '', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity__expectedresult(){ +function activity__expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'source_record_id' => '', - 'activity_type_id' => '1', - 'subject' => 'Make-it-Happen Meeting', - 'activity_date_time' => '20110316000000', - 'duration' => '120', - 'location' => 'Pensulvania', - 'phone_id' => '', - 'phone_number' => '', - 'details' => 'a test activity', - 'status_id' => '1', - 'priority_id' => '1', - 'parent_id' => '', - 'is_test' => '', - 'medium_id' => '', - 'is_auto' => '', - 'relationship_id' => '', - 'is_current_revision' => '', - 'original_id' => '', - 'result' => '', - 'is_deleted' => '', - 'campaign_id' => '', - 'engagement_level' => '', - 'weight' => '', - ), + 'id' => '1', + 'source_record_id' => '', + 'activity_type_id' => '1', + 'subject' => 'Make-it-Happen Meeting', + 'activity_date_time' => '20110316000000', + 'duration' => '120', + 'location' => 'Pensulvania', + 'phone_id' => '', + 'phone_number' => '', + 'details' => 'a test activity', + 'status_id' => '1', + 'priority_id' => '1', + 'parent_id' => '', + 'is_test' => '', + 'medium_id' => '', + 'is_auto' => '', + 'relationship_id' => '', + 'is_current_revision' => '', + 'original_id' => '', + 'result' => '', + 'is_deleted' => '', + 'campaign_id' => '', + 'engagement_level' => '', + 'weight' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testActivityReturnTargetAssignee and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testActivityReturnTargetAssignee +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/Getfields.php b/api/v3/examples/Activity/Getfields.php index 74243d755a..08e3dd68ec 100644 --- a/api/v3/examples/Activity/Getfields.php +++ b/api/v3/examples/Activity/Getfields.php @@ -1,347 +1,368 @@ 'create', -); -try{ - $result = civicrm_api3('activity', 'getfields', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity getfields API. + * + * + * @return array + * API result array + */ +function activity_getfields_example() { + $params = array( + 'action' => 'create', + ); + + try{ + $result = civicrm_api3('activity', 'getfields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_getfields_expectedresult(){ +function activity_getfields_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 27, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 27, + 'values' => array( 'source_record_id' => array( - 'name' => 'source_record_id', - 'type' => 1, - 'title' => 'Source Record', - ), + 'name' => 'source_record_id', + 'type' => 1, + 'title' => 'Source Record', + ), 'activity_type_id' => array( - 'name' => 'activity_type_id', - 'type' => 1, - 'title' => 'Activity Type', - 'required' => true, - 'import' => true, - 'where' => 'civicrm_activity.activity_type_id', - 'headerPattern' => '/(activity.)?type(.id$)/i', - 'default' => '1', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'activity_type', - ), + 'name' => 'activity_type_id', + 'type' => 1, + 'title' => 'Activity Type', + 'required' => TRUE, + 'import' => TRUE, + 'where' => 'civicrm_activity.activity_type_id', + 'headerPattern' => '/(activity.)?type(.id$)/i', + 'default' => '1', + 'html' => array( + 'type' => 'Select', ), + 'pseudoconstant' => array( + 'optionGroupName' => 'activity_type', + ), + ), 'activity_date_time' => array( - 'name' => 'activity_date_time', - 'type' => 12, - 'title' => 'Activity Date', - 'import' => true, - 'where' => 'civicrm_activity.activity_date_time', - 'headerPattern' => '/(activity.)?date(.time$)?/i', - 'export' => true, - 'html' => array( - 'type' => 'Select Date', - ), + 'name' => 'activity_date_time', + 'type' => 12, + 'title' => 'Activity Date', + 'import' => TRUE, + 'where' => 'civicrm_activity.activity_date_time', + 'headerPattern' => '/(activity.)?date(.time$)?/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select Date', ), + ), 'phone_id' => array( - 'name' => 'phone_id', - 'type' => 1, - 'title' => 'Phone (called) ID', - 'FKClassName' => 'CRM_Core_DAO_Phone', - 'html' => array( - 'type' => 'Autocomplete-Select', - ), + 'name' => 'phone_id', + 'type' => 1, + 'title' => 'Phone (called) ID', + 'FKClassName' => 'CRM_Core_DAO_Phone', + 'html' => array( + 'type' => 'Autocomplete-Select', ), + 'FKApiName' => 'Phone', + ), 'phone_number' => array( - 'name' => 'phone_number', - 'type' => 2, - 'title' => 'Phone (called) Number', - 'maxlength' => 64, - 'size' => 30, - 'html' => array( - 'type' => 'Text', - ), + 'name' => 'phone_number', + 'type' => 2, + 'title' => 'Phone (called) Number', + 'maxlength' => 64, + 'size' => 30, + 'html' => array( + 'type' => 'Text', ), + ), 'priority_id' => array( - 'name' => 'priority_id', - 'type' => 1, - 'title' => 'Priority', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'priority', - ), + 'name' => 'priority_id', + 'type' => 1, + 'title' => 'Priority', + 'html' => array( + 'type' => 'Select', ), - 'parent_id' => array( - 'name' => 'parent_id', - 'type' => 1, - 'title' => 'Parent Activity Id', - 'FKClassName' => 'CRM_Activity_DAO_Activity', + 'pseudoconstant' => array( + 'optionGroupName' => 'priority', ), + ), + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => 1, + 'title' => 'Parent Activity Id', + 'FKClassName' => 'CRM_Activity_DAO_Activity', + 'FKApiName' => 'Activity', + ), 'is_auto' => array( - 'name' => 'is_auto', - 'type' => 16, - 'title' => 'Auto', - ), + 'name' => 'is_auto', + 'type' => 16, + 'title' => 'Auto', + ), 'relationship_id' => array( - 'name' => 'relationship_id', - 'type' => 1, - 'title' => 'Relationship Id', - 'default' => 'NULL', - 'FKClassName' => 'CRM_Contact_DAO_Relationship', - ), + 'name' => 'relationship_id', + 'type' => 1, + 'title' => 'Relationship Id', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Contact_DAO_Relationship', + 'FKApiName' => 'Relationship', + ), 'is_current_revision' => array( - 'name' => 'is_current_revision', - 'type' => 16, - 'title' => 'Is this activity a current revision in versioning chain?', - 'import' => true, - 'where' => 'civicrm_activity.is_current_revision', - 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i', - 'export' => true, - 'default' => '1', - 'html' => array( - 'type' => 'CheckBox', - ), + 'name' => 'is_current_revision', + 'type' => 16, + 'title' => 'Is this activity a current revision in versioning chain?', + 'import' => TRUE, + 'where' => 'civicrm_activity.is_current_revision', + 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i', + 'export' => TRUE, + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', ), + ), 'original_id' => array( - 'name' => 'original_id', - 'type' => 1, - 'title' => 'Original Activity ID ', - 'FKClassName' => 'CRM_Activity_DAO_Activity', - ), + 'name' => 'original_id', + 'type' => 1, + 'title' => 'Original Activity ID ', + 'FKClassName' => 'CRM_Activity_DAO_Activity', + 'FKApiName' => 'Activity', + ), 'weight' => array( - 'name' => 'weight', - 'type' => 1, - 'title' => 'Weight', - 'html' => array( - 'type' => 'Text', - ), + 'name' => 'weight', + 'type' => 1, + 'title' => 'Weight', + 'html' => array( + 'type' => 'Text', ), + ), 'id' => array( - 'name' => 'id', - 'type' => 1, - 'title' => 'Activity ID', - 'required' => true, - 'import' => true, - 'where' => 'civicrm_activity.id', - 'export' => true, - 'uniqueName' => 'activity_id', - 'api.aliases' => array( - '0' => 'activity_id', - ), + 'name' => 'id', + 'type' => 1, + 'title' => 'Activity ID', + 'required' => TRUE, + 'import' => TRUE, + 'where' => 'civicrm_activity.id', + 'export' => TRUE, + 'uniqueName' => 'activity_id', + 'api.aliases' => array( + '0' => 'activity_id', ), + ), 'subject' => array( - 'name' => 'subject', - 'type' => 2, - 'title' => 'Subject', - 'maxlength' => 255, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_activity.subject', - 'headerPattern' => '/(activity.)?subject/i', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - 'uniqueName' => 'activity_subject', + 'name' => 'subject', + 'type' => 2, + 'title' => 'Subject', + 'maxlength' => 255, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_activity.subject', + 'headerPattern' => '/(activity.)?subject/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', ), + 'uniqueName' => 'activity_subject', + ), 'duration' => array( - 'name' => 'duration', - 'type' => 1, - 'title' => 'Duration', - 'import' => true, - 'where' => 'civicrm_activity.duration', - 'headerPattern' => '/(activity.)?duration(s)?$/i', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - 'uniqueName' => 'activity_duration', + 'name' => 'duration', + 'type' => 1, + 'title' => 'Duration', + 'import' => TRUE, + 'where' => 'civicrm_activity.duration', + 'headerPattern' => '/(activity.)?duration(s)?$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', ), + 'uniqueName' => 'activity_duration', + ), 'location' => array( - 'name' => 'location', - 'type' => 2, - 'title' => 'Location', - 'maxlength' => 255, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_activity.location', - 'headerPattern' => '/(activity.)?location$/i', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - 'uniqueName' => 'activity_location', + 'name' => 'location', + 'type' => 2, + 'title' => 'Location', + 'maxlength' => 255, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_activity.location', + 'headerPattern' => '/(activity.)?location$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', ), + 'uniqueName' => 'activity_location', + ), 'details' => array( - 'name' => 'details', - 'type' => 32, - 'title' => 'Details', - 'rows' => 8, - 'cols' => 60, - 'import' => true, - 'where' => 'civicrm_activity.details', - 'headerPattern' => '/(activity.)?detail(s)?$/i', - 'export' => true, - 'html' => array( - 'type' => 'RichTextEditor', - ), - 'uniqueName' => 'activity_details', + 'name' => 'details', + 'type' => 32, + 'title' => 'Details', + 'rows' => 8, + 'cols' => 60, + 'import' => TRUE, + 'where' => 'civicrm_activity.details', + 'headerPattern' => '/(activity.)?detail(s)?$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'RichTextEditor', ), + 'uniqueName' => 'activity_details', + ), 'status_id' => array( - 'name' => 'status_id', - 'type' => 1, - 'title' => 'Activity Status', - 'import' => true, - 'where' => 'civicrm_activity.status_id', - 'headerPattern' => '/(activity.)?status(.label$)?/i', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'activity_status', - ), - 'uniqueName' => 'activity_status_id', - 'api.aliases' => array( - '0' => 'activity_status', - ), + 'name' => 'status_id', + 'type' => 1, + 'title' => 'Activity Status', + 'import' => TRUE, + 'where' => 'civicrm_activity.status_id', + 'headerPattern' => '/(activity.)?status(.label$)?/i', + 'html' => array( + 'type' => 'Select', ), + 'pseudoconstant' => array( + 'optionGroupName' => 'activity_status', + ), + 'uniqueName' => 'activity_status_id', + 'api.aliases' => array( + '0' => 'activity_status', + ), + ), 'is_test' => array( - 'name' => 'is_test', - 'type' => 16, - 'title' => 'Test', - 'import' => true, - 'where' => 'civicrm_activity.is_test', - 'headerPattern' => '/(is.)?test(.activity)?/i', - 'export' => true, - 'html' => array( - 'type' => 'Select', - ), - 'uniqueName' => 'activity_is_test', + 'name' => 'is_test', + 'type' => 16, + 'title' => 'Test', + 'import' => TRUE, + 'where' => 'civicrm_activity.is_test', + 'headerPattern' => '/(is.)?test(.activity)?/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select', ), + 'uniqueName' => 'activity_is_test', + ), 'medium_id' => array( - 'name' => 'medium_id', - 'type' => 1, - 'title' => 'Activity Medium', - 'default' => 'NULL', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'encounter_medium', - ), - 'uniqueName' => 'activity_medium_id', + 'name' => 'medium_id', + 'type' => 1, + 'title' => 'Activity Medium', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'optionGroupName' => 'encounter_medium', ), + 'uniqueName' => 'activity_medium_id', + ), 'result' => array( - 'name' => 'result', - 'type' => 2, - 'title' => 'Result', - 'maxlength' => 255, - 'size' => 45, - 'html' => array( - 'type' => 'Text', - ), - 'uniqueName' => 'activity_result', + 'name' => 'result', + 'type' => 2, + 'title' => 'Result', + 'maxlength' => 255, + 'size' => 45, + 'html' => array( + 'type' => 'Text', ), + 'uniqueName' => 'activity_result', + ), 'is_deleted' => array( - 'name' => 'is_deleted', - 'type' => 16, - 'title' => 'Activity is in the Trash', - 'import' => true, - 'where' => 'civicrm_activity.is_deleted', - 'headerPattern' => '/(activity.)?(trash|deleted)/i', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - 'uniqueName' => 'activity_is_deleted', + 'name' => 'is_deleted', + 'type' => 16, + 'title' => 'Activity is in the Trash', + 'import' => TRUE, + 'where' => 'civicrm_activity.is_deleted', + 'headerPattern' => '/(activity.)?(trash|deleted)/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', ), + 'uniqueName' => 'activity_is_deleted', + ), 'campaign_id' => array( - 'name' => 'campaign_id', - 'type' => 1, - 'title' => 'Campaign', - 'import' => true, - 'where' => 'civicrm_activity.campaign_id', - 'export' => true, - 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( - 'type' => 'CheckBox', - ), - 'pseudoconstant' => array( - 'table' => 'civicrm_campaign', - 'keyColumn' => 'id', - 'labelColumn' => 'title', - ), - 'uniqueName' => 'activity_campaign_id', + 'name' => 'campaign_id', + 'type' => 1, + 'title' => 'Campaign', + 'import' => TRUE, + 'where' => 'civicrm_activity.campaign_id', + 'export' => TRUE, + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'html' => array( + 'type' => 'CheckBox', ), + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ), + 'uniqueName' => 'activity_campaign_id', + 'FKApiName' => 'Campaign', + ), 'engagement_level' => array( - 'name' => 'engagement_level', - 'type' => 1, - 'title' => 'Engagement Index', - 'import' => true, - 'where' => 'civicrm_activity.engagement_level', - 'export' => true, - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'engagement_index', - ), - 'uniqueName' => 'activity_engagement_level', + 'name' => 'engagement_level', + 'type' => 1, + 'title' => 'Engagement Index', + 'import' => TRUE, + 'where' => 'civicrm_activity.engagement_level', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select', ), - 'source_contact_id' => array( - 'name' => 'source_contact_id', - 'title' => 'Activity Source Contact', - 'type' => 1, - 'FKClassName' => 'CRM_Activity_DAO_ActivityContact', - 'api.default' => 'user_contact_id', + 'pseudoconstant' => array( + 'optionGroupName' => 'engagement_index', ), + 'uniqueName' => 'activity_engagement_level', + ), + 'source_contact_id' => array( + 'name' => 'source_contact_id', + 'title' => 'Activity Source Contact', + 'type' => 1, + 'FKClassName' => 'CRM_Activity_DAO_ActivityContact', + 'api.default' => 'user_contact_id', + ), 'assignee_contact_id' => array( - 'name' => 'assignee_id', - 'title' => 'assigned to', - 'type' => 1, - 'FKClassName' => 'CRM_Activity_DAO_ActivityContact', - ), + 'name' => 'assignee_id', + 'title' => 'assigned to', + 'type' => 1, + 'FKClassName' => 'CRM_Activity_DAO_ActivityContact', + ), 'target_contact_id' => array( - 'name' => 'target_id', - 'title' => 'Activity Target', - 'type' => 1, - 'FKClassName' => 'CRM_Activity_DAO_ActivityContact', - ), + 'name' => 'target_id', + 'title' => 'Activity Target', + 'type' => 1, + 'FKClassName' => 'CRM_Activity_DAO_ActivityContact', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetFields and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetFields +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Activity/ReturnAssigneeContact.php b/api/v3/examples/Activity/ReturnAssigneeContact.php index 60950c3c74..e3e4cea2cc 100644 --- a/api/v3/examples/Activity/ReturnAssigneeContact.php +++ b/api/v3/examples/Activity/ReturnAssigneeContact.php @@ -1,149 +1,166 @@ 1, - 'sequential' => 1, - 'return.assignee_contact_id' => 1, - 'api.contact.get' => array( + +/** + * Test Generated example of using activity get API. + * + * Function demonstrates getting asignee_contact_id & using it to get the contact + * + * @return array + * API result array + */ +function activity_get_example() { + $params = array( + 'activity_id' => 1, + 'sequential' => 1, + 'return.assignee_contact_id' => 1, + 'api.contact.get' => array( 'id' => '$value.source_contact_id', ), -); + ); -try{ - $result = civicrm_api3('activity', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('activity', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_get_expectedresult(){ +function activity_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '0' => array( - 'id' => '1', - 'activity_type_id' => '49', - 'subject' => 'test activity type id', - 'activity_date_time' => '2011-06-02 14:36:13', - 'duration' => '120', - 'location' => 'Pensulvania', - 'details' => 'a test activity', - 'status_id' => '2', - 'priority_id' => '1', - 'is_test' => 0, - 'is_auto' => 0, - 'is_current_revision' => '1', - 'is_deleted' => 0, - 'assignee_contact_id' => array( - '0' => '3', - ), - 'source_contact_id' => '1', - 'api.contact.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'contact_id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'Anderson, Anthony', - 'display_name' => 'Mr. Anthony Anderson II', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'first_name' => 'Anthony', - 'middle_name' => 'J.', - 'last_name' => 'Anderson', - 'prefix_id' => '3', - 'suffix_id' => '3', - 'formal_title' => '', - 'communication_style_id' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'organization_name' => '', - 'sic_code' => '', - 'contact_is_deleted' => 0, - 'current_employer' => '', - 'address_id' => '', - 'street_address' => '', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'postal_code_suffix' => '', - 'postal_code' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - 'state_province_id' => '', - 'country_id' => '', - 'phone_id' => '', - 'phone_type_id' => '', - 'phone' => '', - 'email_id' => '1', - 'email' => 'anthony_anderson@civicrm.org', - 'on_hold' => 0, - 'im_id' => '', - 'provider_id' => '', - 'im' => '', - 'worldregion_id' => '', - 'world_region' => '', - 'individual_prefix' => 'Mr.', - 'individual_suffix' => 'II', - 'communication_style' => '', - 'gender' => '', - 'state_province_name' => '', - 'state_province' => '', - 'country' => '', - 'id' => '1', - ), - ), + 'id' => '1', + 'activity_type_id' => '51', + 'subject' => 'test activity type id', + 'activity_date_time' => '2011-06-02 14:36:13', + 'duration' => '120', + 'location' => 'Pensulvania', + 'details' => 'a test activity', + 'status_id' => '2', + 'priority_id' => '1', + 'is_test' => 0, + 'is_auto' => 0, + 'is_current_revision' => '1', + 'is_deleted' => 0, + 'assignee_contact_id' => array( + '0' => '3', + ), + 'source_contact_id' => '1', + 'api.contact.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'contact_id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'first_name' => 'Anthony', + 'middle_name' => 'J.', + 'last_name' => 'Anderson', + 'prefix_id' => '3', + 'suffix_id' => '3', + 'formal_title' => '', + 'communication_style_id' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'organization_name' => '', + 'sic_code' => '', + 'contact_is_deleted' => 0, + 'current_employer' => '', + 'address_id' => '', + 'street_address' => '', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'postal_code_suffix' => '', + 'postal_code' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + 'state_province_id' => '', + 'country_id' => '', + 'phone_id' => '', + 'phone_type_id' => '', + 'phone' => '', + 'email_id' => '1', + 'email' => 'anthony_anderson@civicrm.org', + 'on_hold' => 0, + 'im_id' => '', + 'provider_id' => '', + 'im' => '', + 'worldregion_id' => '', + 'world_region' => '', + 'individual_prefix' => 'Mr.', + 'individual_suffix' => 'II', + 'communication_style' => '', + 'gender' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '1', ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testActivityGetGoodID1 and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testActivityGetGoodID1 +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ActivityContact/Create.php b/api/v3/examples/ActivityContact/Create.php index 2919adb3b1..c984f86097 100644 --- a/api/v3/examples/ActivityContact/Create.php +++ b/api/v3/examples/ActivityContact/Create.php @@ -1,57 +1,73 @@ 3, - 'activity_id' => 1, - 'record_type_id' => 2, -); -try{ - $result = civicrm_api3('activity_contact', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity_contact create API. + * + * + * @return array + * API result array + */ +function activity_contact_create_example() { + $params = array( + 'contact_id' => 3, + 'activity_id' => 1, + 'record_type_id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('activity_contact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_contact_create_expectedresult(){ +function activity_contact_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'activity_id' => '1', - 'contact_id' => '3', - 'record_type_id' => '2', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 4, + 'values' => array( + '4' => array( + 'id' => '4', + 'activity_id' => '1', + 'contact_id' => '3', + 'record_type_id' => '2', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateActivityContact and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateActivityContact +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ActivityContact/Delete.php b/api/v3/examples/ActivityContact/Delete.php index f9783f4939..c708787fa8 100644 --- a/api/v3/examples/ActivityContact/Delete.php +++ b/api/v3/examples/ActivityContact/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('activity_contact', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity_contact delete API. + * + * + * @return array + * API result array + */ +function activity_contact_delete_example() { + $params = array( + 'id' => 8, + ); -return $result; + try{ + $result = civicrm_api3('activity_contact', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_contact_delete_expectedresult(){ +function activity_contact_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteActivityContact and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteActivityContact +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ActivityType/Create.php b/api/v3/examples/ActivityType/Create.php index ca223a613d..64bfe2683a 100644 --- a/api/v3/examples/ActivityType/Create.php +++ b/api/v3/examples/ActivityType/Create.php @@ -1,72 +1,89 @@ '2', - 'label' => 'send out letters', - 'filter' => 0, - 'is_active' => 1, - 'is_optgroup' => 1, - 'is_default' => 0, -); -try{ - $result = civicrm_api3('activity_type', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity_type create API. + * + * + * @return array + * API result array + */ +function activity_type_create_example() { + $params = array( + 'weight' => '2', + 'label' => 'send out letters', + 'filter' => 0, + 'is_active' => 1, + 'is_optgroup' => 1, + 'is_default' => 0, + ); -return $result; + try{ + $result = civicrm_api3('activity_type', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_type_create_expectedresult(){ +function activity_type_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 764, - 'values' => array( - '764' => array( - 'id' => '764', - 'option_group_id' => '2', - 'label' => 'send out letters', - 'value' => '49', - 'name' => 'send out letters', - 'grouping' => '', - 'filter' => 0, - 'is_default' => 0, - 'weight' => '2', - 'description' => '', - 'is_optgroup' => '1', - 'is_reserved' => '', - 'is_active' => '1', - 'component_id' => '', - 'domain_id' => '', - 'visibility_id' => '', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 780, + 'values' => array( + '780' => array( + 'id' => '780', + 'option_group_id' => '2', + 'label' => 'send out letters', + 'value' => '51', + 'name' => 'send out letters', + 'grouping' => '', + 'filter' => 0, + 'is_default' => 0, + 'weight' => '2', + 'description' => '', + 'is_optgroup' => '1', + 'is_reserved' => '', + 'is_active' => '1', + 'component_id' => '', + 'domain_id' => '', + 'visibility_id' => '', + ), ), -); + 'deprecated' => 'The activity_type api is deprecated. Please use the option_value api instead.', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testActivityTypeCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testActivityTypeCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ActivityType/Get.php b/api/v3/examples/ActivityType/Get.php index 7bbfc2d4a2..26aaeff97b 100644 --- a/api/v3/examples/ActivityType/Get.php +++ b/api/v3/examples/ActivityType/Get.php @@ -1,35 +1,51 @@ getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using activity_type get API. + * + * + * @return array + * API result array + */ +function activity_type_get_example() { + $params = array(); -return $result; + try{ + $result = civicrm_api3('activity_type', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function activity_type_get_expectedresult(){ +function activity_type_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 48, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 50, + 'values' => array( '1' => 'Meeting', '2' => 'Phone Call', '3' => 'Email', @@ -78,17 +94,20 @@ function activity_type_get_expectedresult(){ '46' => 'Payment', '47' => 'Refund', '48' => 'Change Registration', + '49' => 'Downloaded Invoice', + '50' => 'Emailed Invoice', ), -); + 'deprecated' => 'The activity_type api is deprecated. Please use the option_value api instead.', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testActivityTypeGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testActivityTypeGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Address/AddressLike.php b/api/v3/examples/Address/AddressLike.php index f79170c2a7..c9938ce6b9 100644 --- a/api/v3/examples/Address/AddressLike.php +++ b/api/v3/examples/Address/AddressLike.php @@ -1,66 +1,83 @@ array( + +/** + * Test Generated example of using address get API. + * + * Demonstrates Use of Like + * + * @return array + * API result array + */ +function address_get_example() { + $params = array( + 'street_address' => array( 'LIKE' => '%mb%', ), - 'sequential' => 1, -); + 'sequential' => 1, + ); -try{ - $result = civicrm_api3('address', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('address', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function address_get_expectedresult(){ +function address_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 10, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '0' => array( - 'id' => '10', - 'contact_id' => '12', - 'location_type_id' => '15', - 'is_primary' => '1', - 'is_billing' => 0, - 'street_address' => 'Ambachtstraat 23', - 'street_number' => '23', - 'street_name' => 'Ambachtstraat', - 'city' => 'Brummen', - 'postal_code' => '6971 BN', - 'country_id' => '1152', - 'manual_geo_code' => 0, - ), + 'id' => '1', + 'contact_id' => '20', + 'location_type_id' => '18', + 'is_primary' => '1', + 'is_billing' => 0, + 'street_address' => 'Ambachtstraat 23', + 'street_number' => '23', + 'street_name' => 'Ambachtstraat', + 'city' => 'Brummen', + 'postal_code' => '6971 BN', + 'country_id' => '1152', + 'manual_geo_code' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetAddressLikeSuccess and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetAddressLikeSuccess +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Address/AddressParse.php b/api/v3/examples/Address/AddressParse.php index 70b23ffaf1..aa9adae153 100644 --- a/api/v3/examples/Address/AddressParse.php +++ b/api/v3/examples/Address/AddressParse.php @@ -1,65 +1,82 @@ 1, - 'street_address' => '54A Excelsior Ave. Apt 1C', - 'location_type_id' => 7, - 'contact_id' => 4, -); -try{ - $result = civicrm_api3('address', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using address create API. + * + * Demonstrates Use of address parsing param + * + * @return array + * API result array + */ +function address_create_example() { + $params = array( + 'street_parsing' => 1, + 'street_address' => '54A Excelsior Ave. Apt 1C', + 'location_type_id' => 7, + 'contact_id' => 4, + ); -return $result; + try{ + $result = civicrm_api3('address', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function address_create_expectedresult(){ +function address_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 3, - 'values' => array( - '3' => array( - 'id' => '3', - 'contact_id' => '4', - 'location_type_id' => '7', - 'is_primary' => '1', - 'is_billing' => 0, - 'street_address' => '54A Excelsior Ave. Apt 1C', - 'street_number' => '54', - 'street_number_suffix' => 'A', - 'street_name' => 'Excelsior Ave.', - 'street_unit' => 'Apt 1C', - 'manual_geo_code' => 0, - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '1' => array( + 'id' => '1', + 'contact_id' => '4', + 'location_type_id' => '7', + 'is_primary' => '1', + 'is_billing' => 0, + 'street_address' => '54A Excelsior Ave. Apt 1C', + 'street_number' => '54', + 'street_number_suffix' => 'A', + 'street_name' => 'Excelsior Ave.', + 'street_unit' => 'Apt 1C', + 'manual_geo_code' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateAddressParsing and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateAddressParsing +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Address/AddressSort.php b/api/v3/examples/Address/AddressSort.php index 661f045a44..57508f4802 100644 --- a/api/v3/examples/Address/AddressSort.php +++ b/api/v3/examples/Address/AddressSort.php @@ -1,85 +1,97 @@ array( + +/** + * Test Generated example of using address get API. + * + * Demonstrates Use of sort filter + * + * @return array + * API result array + */ +function address_get_example() { + $params = array( + 'options' => array( 'sort' => 'street_address DESC', 'limit' => 2, ), - 'sequential' => 1, -); + 'sequential' => 1, + ); -try{ - $result = civicrm_api3('address', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('address', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function address_get_expectedresult(){ +function address_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '0' => array( - 'id' => '9', - 'contact_id' => '11', - 'location_type_id' => '14', - 'is_primary' => '1', - 'is_billing' => 0, - 'street_address' => 'Ambachtstraat 23', - 'street_number' => '23', - 'street_name' => 'Ambachtstraat', - 'city' => 'Brummen', - 'postal_code' => '6971 BN', - 'country_id' => '1152', - 'manual_geo_code' => 0, - ), + 'id' => '2', + 'contact_id' => '19', + 'location_type_id' => '17', + 'is_primary' => '1', + 'is_billing' => 0, + 'street_address' => 'yzy', + 'street_number' => '23', + 'street_name' => 'Ambachtstraat', + 'city' => 'Brummen', + 'postal_code' => '6971 BN', + 'country_id' => '1152', + 'manual_geo_code' => 0, + ), '1' => array( - 'id' => '1', - 'contact_id' => '2', - 'location_type_id' => '1', - 'is_primary' => '1', - 'is_billing' => '1', - 'street_address' => '15 Main St', - 'street_number' => '15', - 'street_number_suffix' => 'S', - 'street_name' => 'Main', - 'street_type' => 'St', - 'city' => 'Collinsville', - 'state_province_id' => '1006', - 'postal_code' => '6022', - 'country_id' => '1228', - 'geo_code_1' => '41.8328', - 'geo_code_2' => '-72.9253', - 'manual_geo_code' => 0, - ), + 'id' => '1', + 'contact_id' => '19', + 'location_type_id' => '17', + 'is_primary' => 0, + 'is_billing' => 0, + 'street_address' => 'Ambachtstraat 23', + 'street_number' => '23', + 'street_name' => 'Ambachtstraat', + 'city' => 'Brummen', + 'postal_code' => '6971 BN', + 'country_id' => '1152', + 'manual_geo_code' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetAddressSort and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetAddressSort +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Address/Create.php b/api/v3/examples/Address/Create.php index 4bf7651c31..eb28a04fdd 100644 --- a/api/v3/examples/Address/Create.php +++ b/api/v3/examples/Address/Create.php @@ -1,71 +1,87 @@ 3, - 'location_type_id' => 6, - 'street_name' => 'Ambachtstraat', - 'street_number' => '23', - 'street_address' => 'Ambachtstraat 23', - 'postal_code' => '6971 BN', - 'country_id' => '1152', - 'city' => 'Brummen', - 'is_primary' => 1, -); -try{ - $result = civicrm_api3('address', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using address create API. + * + * + * @return array + * API result array + */ +function address_create_example() { + $params = array( + 'contact_id' => 3, + 'location_type_id' => 6, + 'street_name' => 'Ambachtstraat', + 'street_number' => '23', + 'street_address' => 'Ambachtstraat 23', + 'postal_code' => '6971 BN', + 'country_id' => '1152', + 'city' => 'Brummen', + 'is_primary' => 1, + ); -return $result; + try{ + $result = civicrm_api3('address', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function address_create_expectedresult(){ +function address_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'contact_id' => '3', - 'location_type_id' => '6', - 'is_primary' => '1', - 'is_billing' => 0, - 'street_address' => 'Ambachtstraat 23', - 'street_number' => '23', - 'street_name' => 'Ambachtstraat', - 'city' => 'Brummen', - 'postal_code' => '6971 BN', - 'country_id' => '1152', - 'manual_geo_code' => 0, - ), + 'id' => '2', + 'contact_id' => '3', + 'location_type_id' => '6', + 'is_primary' => '1', + 'is_billing' => 0, + 'street_address' => 'Ambachtstraat 23', + 'street_number' => '23', + 'street_name' => 'Ambachtstraat', + 'city' => 'Brummen', + 'postal_code' => '6971 BN', + 'country_id' => '1152', + 'manual_geo_code' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateAddress and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateAddress +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Address/Delete.php b/api/v3/examples/Address/Delete.php index f7f0595712..8fbd3120eb 100644 --- a/api/v3/examples/Address/Delete.php +++ b/api/v3/examples/Address/Delete.php @@ -1,47 +1,63 @@ 6, -); -try{ - $result = civicrm_api3('address', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using address delete API. + * + * + * @return array + * API result array + */ +function address_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('address', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function address_delete_expectedresult(){ +function address_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteAddress and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteAddress +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Address/Get.php b/api/v3/examples/Address/Get.php index 668815c815..ca99c19856 100644 --- a/api/v3/examples/Address/Get.php +++ b/api/v3/examples/Address/Get.php @@ -1,64 +1,80 @@ 9, - 'street_name' => 'Ambachtstraat', -); -try{ - $result = civicrm_api3('address', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using address get API. + * + * + * @return array + * API result array + */ +function address_get_example() { + $params = array( + 'contact_id' => 17, + 'street_name' => 'Ambachtstraat', + ); -return $result; + try{ + $result = civicrm_api3('address', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function address_get_expectedresult(){ +function address_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 7, - 'values' => array( - '7' => array( - 'id' => '7', - 'contact_id' => '9', - 'location_type_id' => '12', - 'is_primary' => '1', - 'is_billing' => 0, - 'street_address' => 'Ambachtstraat 23', - 'street_number' => '23', - 'street_name' => 'Ambachtstraat', - 'city' => 'Brummen', - 'postal_code' => '6971 BN', - 'country_id' => '1152', - 'manual_geo_code' => 0, - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '1' => array( + 'id' => '1', + 'contact_id' => '17', + 'location_type_id' => '15', + 'is_primary' => '1', + 'is_billing' => 0, + 'street_address' => 'Ambachtstraat 23', + 'street_number' => '23', + 'street_name' => 'Ambachtstraat', + 'city' => 'Brummen', + 'postal_code' => '6971 BN', + 'country_id' => '1152', + 'manual_geo_code' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetAddress and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetAddress +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Batch/Create.php b/api/v3/examples/Batch/Create.php index abc7aa1ae8..14ea9def54 100644 --- a/api/v3/examples/Batch/Create.php +++ b/api/v3/examples/Batch/Create.php @@ -1,73 +1,89 @@ 'New_Batch_03', - 'title' => 'New Batch 03', - 'description' => 'This is description for New Batch 03', - 'total' => '300.33', - 'item_count' => 3, - 'status_id' => 1, -); -try{ - $result = civicrm_api3('batch', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using batch create API. + * + * + * @return array + * API result array + */ +function batch_create_example() { + $params = array( + 'name' => 'New_Batch_03', + 'title' => 'New Batch 03', + 'description' => 'This is description for New Batch 03', + 'total' => '300.33', + 'item_count' => 3, + 'status_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('batch', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function batch_create_expectedresult(){ +function batch_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'name' => 'New_Batch_03', - 'title' => 'New Batch 03', - 'description' => 'This is description for New Batch 03', - 'created_id' => '', - 'created_date' => '', - 'modified_id' => '', - 'modified_date' => '2012-11-14 16:02:35', - 'saved_search_id' => '', - 'status_id' => '1', - 'type_id' => '', - 'mode_id' => '', - 'total' => '300.33', - 'item_count' => '3', - 'payment_instrument_id' => '', - 'exported_date' => '', - 'data' => '', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'name' => 'New_Batch_03', + 'title' => 'New Batch 03', + 'description' => 'This is description for New Batch 03', + 'created_id' => '', + 'created_date' => '', + 'modified_id' => '', + 'modified_date' => '2012-11-14 16:02:35', + 'saved_search_id' => '', + 'status_id' => '1', + 'type_id' => '', + 'mode_id' => '', + 'total' => '300.33', + 'item_count' => '3', + 'payment_instrument_id' => '', + 'exported_date' => '', + 'data' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Batch/Delete.php b/api/v3/examples/Batch/Delete.php index 04c5786a41..bf8987d16d 100644 --- a/api/v3/examples/Batch/Delete.php +++ b/api/v3/examples/Batch/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('batch', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using batch delete API. + * + * + * @return array + * API result array + */ +function batch_delete_example() { + $params = array( + 'id' => 5, + ); -return $result; + try{ + $result = civicrm_api3('batch', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function batch_delete_expectedresult(){ +function batch_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testBatchDeleteCorrectSyntax and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testBatchDeleteCorrectSyntax +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Batch/Get.php b/api/v3/examples/Batch/Get.php index a7c2bedfe0..157ccd4ad4 100644 --- a/api/v3/examples/Batch/Get.php +++ b/api/v3/examples/Batch/Get.php @@ -1,56 +1,72 @@ 1, -); -try{ - $result = civicrm_api3('batch', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using batch get API. + * + * + * @return array + * API result array + */ +function batch_get_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('batch', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function batch_get_expectedresult(){ +function batch_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'name' => 'Batch_433397', - 'title' => 'Batch_433397', - 'modified_date' => '2012-11-14 16:02:35', - 'status_id' => '1', - ), + 'id' => '1', + 'name' => 'Batch_433397', + 'title' => 'Batch_433397', + 'modified_date' => '2012-11-14 16:02:35', + 'status_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Batch/Update.php b/api/v3/examples/Batch/Update.php index 988677ff79..22e827f025 100644 --- a/api/v3/examples/Batch/Update.php +++ b/api/v3/examples/Batch/Update.php @@ -1,73 +1,89 @@ 'New_Batch_04', - 'title' => 'New Batch 04', - 'description' => 'This is description for New Batch 04', - 'total' => '400.44', - 'item_count' => 4, - 'id' => 1, -); -try{ - $result = civicrm_api3('batch', 'update', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using batch update API. + * + * + * @return array + * API result array + */ +function batch_update_example() { + $params = array( + 'name' => 'New_Batch_04', + 'title' => 'New Batch 04', + 'description' => 'This is description for New Batch 04', + 'total' => '400.44', + 'item_count' => 4, + 'id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('batch', 'update', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function batch_update_expectedresult(){ +function batch_update_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'name' => 'New_Batch_04', - 'title' => 'New Batch 04', - 'description' => 'This is description for New Batch 04', - 'created_id' => '', - 'created_date' => '', - 'modified_id' => '', - 'modified_date' => '', - 'saved_search_id' => '', - 'status_id' => '', - 'type_id' => '', - 'mode_id' => '', - 'total' => '400.44', - 'item_count' => '4', - 'payment_instrument_id' => '', - 'exported_date' => '', - 'data' => '', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( + '3' => array( + 'id' => '3', + 'name' => 'New_Batch_04', + 'title' => 'New Batch 04', + 'description' => 'This is description for New Batch 04', + 'created_id' => '', + 'created_date' => '', + 'modified_id' => '', + 'modified_date' => '', + 'saved_search_id' => '', + 'status_id' => '', + 'type_id' => '', + 'mode_id' => '', + 'total' => '400.44', + 'item_count' => '4', + 'payment_instrument_id' => '', + 'exported_date' => '', + 'data' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testUpdate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testUpdate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Campaign/Create.php b/api/v3/examples/Campaign/Create.php index db10057f56..08e6f39b1b 100644 --- a/api/v3/examples/Campaign/Create.php +++ b/api/v3/examples/Campaign/Create.php @@ -1,70 +1,87 @@ 'campaign title', - 'description' => 'Call people, ask for money', - 'created_date' => 'first sat of July 2008', -); -try{ - $result = civicrm_api3('campaign', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using campaign create API. + * + * Create a campaign - Note use of relative dates here http://www.php.net/manual/en/datetime.formats.relative.php + * + * @return array + * API result array + */ +function campaign_create_example() { + $params = array( + 'title' => 'campaign title', + 'description' => 'Call people, ask for money', + 'created_date' => 'first sat of July 2008', + ); -return $result; + try{ + $result = civicrm_api3('campaign', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function campaign_create_expectedresult(){ +function campaign_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'name' => 'campaign_title', - 'title' => 'campaign title', - 'description' => 'Call people, ask for money', - 'start_date' => '', - 'end_date' => '', - 'campaign_type_id' => '', - 'status_id' => '', - 'external_identifier' => '', - 'parent_id' => '', - 'is_active' => '', - 'created_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'last_modified_id' => '', - 'last_modified_date' => '', - 'goal_general' => '', - 'goal_revenue' => '', - ), + 'id' => '1', + 'name' => 'campaign_title', + 'title' => 'campaign title', + 'description' => 'Call people, ask for money', + 'start_date' => '', + 'end_date' => '', + 'campaign_type_id' => '', + 'status_id' => '', + 'external_identifier' => '', + 'parent_id' => '', + 'is_active' => '', + 'created_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'last_modified_id' => '', + 'last_modified_date' => '', + 'goal_general' => '', + 'goal_revenue' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateCampaign and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateCampaign +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Campaign/Delete.php b/api/v3/examples/Campaign/Delete.php index 2ff722001f..f5560431bc 100644 --- a/api/v3/examples/Campaign/Delete.php +++ b/api/v3/examples/Campaign/Delete.php @@ -1,47 +1,63 @@ 2, -); -try{ - $result = civicrm_api3('campaign', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using campaign delete API. + * + * + * @return array + * API result array + */ +function campaign_delete_example() { + $params = array( + 'id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('campaign', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function campaign_delete_expectedresult(){ +function campaign_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteCampaign and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteCampaign +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Campaign/Get.php b/api/v3/examples/Campaign/Get.php index de1cb1423c..b74d75a678 100644 --- a/api/v3/examples/Campaign/Get.php +++ b/api/v3/examples/Campaign/Get.php @@ -1,59 +1,75 @@ 'campaign title', - 'description' => 'Call people, ask for money', - 'created_date' => 'first sat of July 2008', -); -try{ - $result = civicrm_api3('campaign', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using campaign get API. + * + * + * @return array + * API result array + */ +function campaign_get_example() { + $params = array( + 'title' => 'campaign title', + 'description' => 'Call people, ask for money', + 'created_date' => 'first sat of July 2008', + ); -return $result; + try{ + $result = civicrm_api3('campaign', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function campaign_get_expectedresult(){ +function campaign_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'name' => 'campaign_title', - 'title' => 'campaign title', - 'description' => 'Call people, ask for money', - 'is_active' => '1', - 'created_date' => '2013-07-28 08:49:19', - ), + 'id' => '2', + 'name' => 'campaign_title', + 'title' => 'campaign title', + 'description' => 'Call people, ask for money', + 'is_active' => '1', + 'created_date' => '2013-07-28 08:49:19', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetCampaign and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetCampaign +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Case/Create.php b/api/v3/examples/Case/Create.php index b7327d0dd5..77cc2cff2f 100644 --- a/api/v3/examples/Case/Create.php +++ b/api/v3/examples/Case/Create.php @@ -1,61 +1,77 @@ 'Test case', - 'contact_id' => 17, - 'case_type' => 'housing_support', -); -try{ - $result = civicrm_api3('case', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using case create API. + * + * + * @return array + * API result array + */ +function case_create_example() { + $params = array( + 'subject' => 'Test case', + 'contact_id' => 17, + 'case_type' => 'housing_support', + ); -return $result; + try{ + $result = civicrm_api3('case', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function case_create_expectedresult(){ +function case_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'case_type_id' => '1', - 'subject' => 'Test case', - 'start_date' => '2013-07-29 00:00:00', - 'end_date' => '', - 'details' => '', - 'status_id' => '1', - 'is_deleted' => '', - ), + 'id' => '2', + 'case_type_id' => '1', + 'subject' => 'Test case', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '', + 'details' => '', + 'status_id' => '1', + 'is_deleted' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCaseCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCaseCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Constant/Get.php b/api/v3/examples/Constant/Get.php index a48977eaab..00665d32a5 100644 --- a/api/v3/examples/Constant/Get.php +++ b/api/v3/examples/Constant/Get.php @@ -1,53 +1,69 @@ 'location_type_id', -); -try{ - $result = civicrm_api3('constant', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using constant get API. + * + * + * @return array + * API result array + */ +function constant_get_example() { + $params = array( + 'field' => 'location_type_id', + ); -return $result; + try{ + $result = civicrm_api3('constant', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function constant_get_expectedresult(){ +function constant_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 5, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 5, + 'values' => array( '5' => 'Billing', '1' => 'Home', '3' => 'Main', '4' => 'Other', '2' => 'Work', ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testLocationTypeGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testLocationTypeGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/APIChainedArray.php b/api/v3/examples/Contact/APIChainedArray.php index 697d93470d..05365f4e7c 100644 --- a/api/v3/examples/Contact/APIChainedArray.php +++ b/api/v3/examples/Contact/APIChainedArray.php @@ -1,205 +1,222 @@ 1, - 'api.website.get' => array(), - 'api.Contribution.get' => array( + +/** + * Test Generated example of using contact get API. + * + * /*this demonstrates the usage of chained api functions. In this case no notes or custom fields have been created + * + * @return array + * API result array + */ +function contact_get_example() { + $params = array( + 'id' => 1, + 'api.website.get' => array(), + 'api.Contribution.get' => array( 'total_amount' => '120.00', ), - 'api.CustomValue.get' => 1, - 'api.Note.get' => 1, -); + 'api.CustomValue.get' => 1, + 'api.Note.get' => 1, + ); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'xyz3, abc3', - 'display_name' => 'abc3 xyz3', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'first_name' => 'abc3', - 'middle_name' => '', - 'last_name' => 'xyz3', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'organization_name' => '', - 'sic_code' => '', - 'contact_is_deleted' => 0, - 'current_employer' => '', - 'address_id' => '2', - 'street_address' => '1 my road', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'postal_code_suffix' => '', - 'postal_code' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - 'state_province_id' => '', - 'country_id' => '', - 'phone_id' => '', - 'phone_type_id' => '', - 'phone' => '', - 'email_id' => '1', - 'email' => 'man3@yahoo.com', - 'on_hold' => 0, - 'im_id' => '', - 'provider_id' => '', - 'im' => '', - 'worldregion_id' => '', - 'world_region' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', - 'gender' => '', - 'state_province_name' => '', - 'state_province' => '', - 'country' => '', - 'id' => '1', - 'api.website.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'contact_id' => '1', - 'url' => 'http://civicrm.org', - ), - ), - ), - 'api.Contribution.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( - '0' => array( - 'contact_id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'xyz3, abc3', - 'display_name' => 'abc3 xyz3', - 'contribution_id' => '2', - 'currency' => 'USD', - 'receive_date' => '2011-01-01 00:00:00', - 'non_deductible_amount' => '10.00', - 'total_amount' => '120.00', - 'fee_amount' => '50.00', - 'net_amount' => '90.00', - 'trxn_id' => '12335', - 'invoice_id' => '67830', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'contribution_source' => 'SSF', - 'amount_level' => '', - 'is_test' => 0, - 'is_pay_later' => 0, - 'contribution_status_id' => '1', - 'check_number' => '', - 'contribution_campaign_id' => '', - 'financial_type_id' => '1', - 'financial_type' => 'Donation', - 'instrument_id' => '84', - 'payment_instrument' => 'Credit Card', - 'product_id' => '', - 'product_name' => '', - 'sku' => '', - 'contribution_product_id' => '', - 'product_option' => '', - 'fulfilled_date' => '', - 'contribution_start_date' => '', - 'contribution_end_date' => '', - 'contribution_recur_id' => '', - 'financial_account_id' => '1', - 'accounting_code' => '4200', - 'contribution_note' => '', - 'contribution_batch' => '', - 'contribution_status' => 'Completed', - 'contribution_payment_instrument' => 'Credit Card', - 'contribution_check_number' => '', - 'id' => '2', - 'contribution_type_id' => '1', - ), - ), - ), - 'api.CustomValue.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 0, - 'values' => array(), + 'contact_id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'xyz3, abc3', + 'display_name' => 'abc3 xyz3', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'first_name' => 'abc3', + 'middle_name' => '', + 'last_name' => 'xyz3', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'organization_name' => '', + 'sic_code' => '', + 'contact_is_deleted' => 0, + 'current_employer' => '', + 'address_id' => '2', + 'street_address' => '1 my road', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'postal_code_suffix' => '', + 'postal_code' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + 'state_province_id' => '', + 'country_id' => '', + 'phone_id' => '', + 'phone_type_id' => '', + 'phone' => '', + 'email_id' => '1', + 'email' => 'man3@yahoo.com', + 'on_hold' => 0, + 'im_id' => '', + 'provider_id' => '', + 'im' => '', + 'worldregion_id' => '', + 'world_region' => '', + 'individual_prefix' => '', + 'individual_suffix' => '', + 'communication_style' => '', + 'gender' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '1', + 'api.website.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'contact_id' => '1', + 'url' => 'http://civicrm.org', ), - 'api.Note.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 0, - 'values' => array(), + ), + ), + 'api.Contribution.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '0' => array( + 'contact_id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'xyz3, abc3', + 'display_name' => 'abc3 xyz3', + 'contribution_id' => '2', + 'currency' => 'USD', + 'receive_date' => '2011-01-01 00:00:00', + 'non_deductible_amount' => '10.00', + 'total_amount' => '120.00', + 'fee_amount' => '50.00', + 'net_amount' => '90.00', + 'trxn_id' => '12335', + 'invoice_id' => '67830', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'contribution_source' => 'SSF', + 'amount_level' => '', + 'is_test' => 0, + 'is_pay_later' => 0, + 'contribution_status_id' => '1', + 'check_number' => '', + 'contribution_campaign_id' => '', + 'financial_type_id' => '1', + 'financial_type' => 'Donation', + 'instrument_id' => '86', + 'payment_instrument' => 'Credit Card', + 'product_id' => '', + 'product_name' => '', + 'sku' => '', + 'contribution_product_id' => '', + 'product_option' => '', + 'fulfilled_date' => '', + 'contribution_start_date' => '', + 'contribution_end_date' => '', + 'contribution_recur_id' => '', + 'financial_account_id' => '1', + 'accounting_code' => '4200', + 'contribution_note' => '', + 'contribution_batch' => '', + 'contribution_status' => 'Completed', + 'contribution_payment_instrument' => 'Credit Card', + 'contribution_check_number' => '', + 'id' => '2', + 'contribution_type_id' => '1', ), + ), + ), + 'api.CustomValue.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => array(), + ), + 'api.Note.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => array(), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetIndividualWithChainedArrays and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetIndividualWithChainedArrays +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/APIChainedArrayFormats.php b/api/v3/examples/Contact/APIChainedArrayFormats.php index 98e8d34e26..14eb3eb7be 100644 --- a/api/v3/examples/Contact/APIChainedArrayFormats.php +++ b/api/v3/examples/Contact/APIChainedArrayFormats.php @@ -1,140 +1,157 @@ 1, - 'api.website.getValue' => array( +function contact_get_example() { + $params = array( + 'id' => 1, + 'api.website.getValue' => array( 'return' => 'url', ), - 'api.Contribution.getCount' => array(), - 'api.CustomValue.get' => 1, - 'api.Note.get' => 1, - 'api.Membership.getCount' => array(), -); + 'api.Contribution.getCount' => array(), + 'api.CustomValue.get' => 1, + 'api.Note.get' => 1, + 'api.Membership.getCount' => array(), + ); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'xyz3, abc3', - 'display_name' => 'abc3 xyz3', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'first_name' => 'abc3', - 'middle_name' => '', - 'last_name' => 'xyz3', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'organization_name' => '', - 'sic_code' => '', - 'contact_is_deleted' => 0, - 'current_employer' => '', - 'address_id' => '2', - 'street_address' => '1 my road', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'postal_code_suffix' => '', - 'postal_code' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - 'state_province_id' => '', - 'country_id' => '', - 'phone_id' => '', - 'phone_type_id' => '', - 'phone' => '', - 'email_id' => '1', - 'email' => 'man3@yahoo.com', - 'on_hold' => 0, - 'im_id' => '', - 'provider_id' => '', - 'im' => '', - 'worldregion_id' => '', - 'world_region' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', - 'gender' => '', - 'state_province_name' => '', - 'state_province' => '', - 'country' => '', - 'id' => '1', - 'api.website.getValue' => 'http://civicrm.org', - 'api.Contribution.getCount' => 2, - 'api.CustomValue.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 0, - 'values' => array(), - ), - 'api.Note.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 0, - 'values' => array(), - ), - 'api.Membership.getCount' => 0, + 'contact_id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'xyz3, abc3', + 'display_name' => 'abc3 xyz3', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'first_name' => 'abc3', + 'middle_name' => '', + 'last_name' => 'xyz3', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'organization_name' => '', + 'sic_code' => '', + 'contact_is_deleted' => 0, + 'current_employer' => '', + 'address_id' => '2', + 'street_address' => '1 my road', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'postal_code_suffix' => '', + 'postal_code' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + 'state_province_id' => '', + 'country_id' => '', + 'phone_id' => '', + 'phone_type_id' => '', + 'phone' => '', + 'email_id' => '1', + 'email' => 'man3@yahoo.com', + 'on_hold' => 0, + 'im_id' => '', + 'provider_id' => '', + 'im' => '', + 'worldregion_id' => '', + 'world_region' => '', + 'individual_prefix' => '', + 'individual_suffix' => '', + 'communication_style' => '', + 'gender' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '1', + 'api.website.getValue' => 'http://civicrm.org', + 'api.Contribution.getCount' => 2, + 'api.CustomValue.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => array(), ), + 'api.Note.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => array(), + ), + 'api.Membership.getCount' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetIndividualWithChainedArraysFormats and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetIndividualWithChainedArraysFormats +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php b/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php index c6e1c4b194..aec99c1e61 100644 --- a/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php +++ b/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php @@ -1,180 +1,197 @@ 1, - 'api.website.getValue' => array( + +/** + * Test Generated example of using contact get API. + * + * /*this demonstrates the usage of chained api functions. A variety of techniques are used + * + * @return array + * API result array + */ +function contact_get_example() { + $params = array( + 'id' => 1, + 'api.website.getValue' => array( 'return' => 'url', ), - 'api.Contribution.getCount' => array(), - 'api.CustomValue.get' => 1, -); + 'api.Contribution.getCount' => array(), + 'api.CustomValue.get' => 1, + ); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'xyz3, abc3', - 'display_name' => 'abc3 xyz3', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'first_name' => 'abc3', - 'middle_name' => '', - 'last_name' => 'xyz3', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'organization_name' => '', - 'sic_code' => '', - 'contact_is_deleted' => 0, - 'current_employer' => '', - 'address_id' => '2', - 'street_address' => '1 my road', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'postal_code_suffix' => '', - 'postal_code' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - 'state_province_id' => '', - 'country_id' => '', - 'phone_id' => '', - 'phone_type_id' => '', - 'phone' => '', - 'email_id' => '1', - 'email' => 'man3@yahoo.com', - 'on_hold' => 0, - 'im_id' => '', - 'provider_id' => '', - 'im' => '', - 'worldregion_id' => '', - 'world_region' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', - 'gender' => '', - 'state_province_name' => '', - 'state_province' => '', - 'country' => '', - 'id' => '1', - 'api.website.getValue' => 'http://civicrm.org', - 'api.Contribution.getCount' => 2, - 'api.CustomValue.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 8, - 'values' => array( - '0' => array( - 'entity_id' => '1', - 'latest' => 'value 4', - 'id' => '1', - 'entity_table' => 'Contact', - ), - '1' => array( - 'entity_table' => 'Contact', - ), - '2' => array( - 'entity_id' => '1', - 'latest' => 'value 3', - 'id' => '2', - '1' => 'value 2', - 'entity_table' => 'Contact', - '2' => 'value 3', - ), - '3' => array( - 'entity_id' => '1', - 'latest' => '', - 'id' => '3', - '1' => 'warm beer', - '2' => '', - ), - '4' => array( - 'entity_id' => '1', - 'latest' => '', - 'id' => '4', - '1' => '', - '2' => '', - ), - '5' => array( - 'entity_id' => '1', - 'latest' => 'defaultValue', - 'id' => '5', - '1' => 'defaultValue', - ), - '6' => array( - 'entity_id' => '1', - 'latest' => 'vegemite', - 'id' => '6', - '1' => 'vegemite', - ), - '7' => array( - 'entity_id' => '1', - 'latest' => '', - 'id' => '7', - '1' => '', - ), - ), + 'contact_id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'xyz3, abc3', + 'display_name' => 'abc3 xyz3', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'first_name' => 'abc3', + 'middle_name' => '', + 'last_name' => 'xyz3', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'organization_name' => '', + 'sic_code' => '', + 'contact_is_deleted' => 0, + 'current_employer' => '', + 'address_id' => '2', + 'street_address' => '1 my road', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'postal_code_suffix' => '', + 'postal_code' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + 'state_province_id' => '', + 'country_id' => '', + 'phone_id' => '', + 'phone_type_id' => '', + 'phone' => '', + 'email_id' => '1', + 'email' => 'man3@yahoo.com', + 'on_hold' => 0, + 'im_id' => '', + 'provider_id' => '', + 'im' => '', + 'worldregion_id' => '', + 'world_region' => '', + 'individual_prefix' => '', + 'individual_suffix' => '', + 'communication_style' => '', + 'gender' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '1', + 'api.website.getValue' => 'http://civicrm.org', + 'api.Contribution.getCount' => 2, + 'api.CustomValue.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 8, + 'values' => array( + '0' => array( + 'entity_id' => '1', + 'latest' => 'value 4', + 'id' => '1', + 'entity_table' => 'Contact', + ), + '1' => array( + 'entity_table' => 'Contact', + ), + '2' => array( + 'entity_id' => '1', + 'latest' => 'value 3', + 'id' => '2', + '1' => 'value 2', + 'entity_table' => 'Contact', + '2' => 'value 3', + ), + '3' => array( + 'entity_id' => '1', + 'latest' => '', + 'id' => '3', + '1' => 'warm beer', + '2' => '', ), + '4' => array( + 'entity_id' => '1', + 'latest' => '', + 'id' => '4', + '1' => '', + '2' => '', + ), + '5' => array( + 'entity_id' => '1', + 'latest' => 'defaultValue', + 'id' => '5', + '1' => 'defaultValue', + ), + '6' => array( + 'entity_id' => '1', + 'latest' => 'vegemite', + 'id' => '6', + '1' => 'vegemite', + ), + '7' => array( + 'entity_id' => '1', + 'latest' => '', + 'id' => '7', + '1' => '', + ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetIndividualWithChainedArraysAndMultipleCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetIndividualWithChainedArraysAndMultipleCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php b/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php index 88f03c4624..d5340153d5 100644 --- a/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php +++ b/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php @@ -1,117 +1,134 @@ 'batman', - 'contact_type' => 'Individual', - 'api.tag.create' => array( +function contact_create_example() { + $params = array( + 'display_name' => 'batman', + 'contact_type' => 'Individual', + 'api.tag.create' => array( 'name' => '$value.id', 'description' => '$value.display_name', 'format.only_id' => 1, ), - 'api.entity_tag.create' => array( + 'api.entity_tag.create' => array( 'tag_id' => '$value.api.tag.create', ), -); + ); -try{ - $result = civicrm_api3('contact', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_create_expectedresult(){ +function contact_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'sort_name' => '', - 'display_name' => 'batman', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'hash' => '67eac7789eaee00', - 'api_key' => '', - 'first_name' => '', - 'middle_name' => '', - 'last_name' => '', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'email_greeting_id' => '1', - 'email_greeting_custom' => '', - 'email_greeting_display' => '', - 'postal_greeting_id' => '1', - 'postal_greeting_custom' => '', - 'postal_greeting_display' => '', - 'addressee_id' => '1', - 'addressee_custom' => '', - 'addressee_display' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'primary_contact_id' => '', - 'organization_name' => '', - 'sic_code' => '', - 'user_unique_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'modified_date' => '2012-11-14 16:02:35', - 'api.tag.create' => 6, - 'api.entity_tag.create' => array( - 'is_error' => 0, - 'not_added' => 1, - 'added' => 1, - 'total_count' => 2, - ), + 'id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'sort_name' => '', + 'display_name' => 'batman', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'hash' => '67eac7789eaee00', + 'api_key' => '', + 'first_name' => '', + 'middle_name' => '', + 'last_name' => '', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'email_greeting_id' => '1', + 'email_greeting_custom' => '', + 'email_greeting_display' => '', + 'postal_greeting_id' => '1', + 'postal_greeting_custom' => '', + 'postal_greeting_display' => '', + 'addressee_id' => '1', + 'addressee_custom' => '', + 'addressee_display' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'primary_contact_id' => '', + 'organization_name' => '', + 'sic_code' => '', + 'user_unique_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', + 'api.tag.create' => 6, + 'api.entity_tag.create' => array( + 'is_error' => 0, + 'not_added' => 1, + 'added' => 1, + 'total_count' => 2, ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testChainingValuesCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testChainingValuesCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/ChainTwoWebsites.php b/api/v3/examples/Contact/ChainTwoWebsites.php index 422aedeee6..0d5eeaf2f1 100644 --- a/api/v3/examples/Contact/ChainTwoWebsites.php +++ b/api/v3/examples/Contact/ChainTwoWebsites.php @@ -1,15 +1,25 @@ 'abc3', - 'last_name' => 'xyz3', - 'contact_type' => 'Individual', - 'email' => 'man3@yahoo.com', - 'api.contribution.create' => array( + +/** + * Test Generated example of using contact create API. + * + * test demonstrates the syntax to create 2 chained entities + * + * @return array + * API result array + */ +function contact_create_example() { + $params = array( + 'first_name' => 'abc3', + 'last_name' => 'xyz3', + 'contact_type' => 'Individual', + 'email' => 'man3@yahoo.com', + 'api.contribution.create' => array( 'receive_date' => '2010-01-01', 'total_amount' => '100', 'financial_type_id' => 1, @@ -22,166 +32,175 @@ $params = array( 'source' => 'SSF', 'contribution_status_id' => 1, ), - 'api.website.create' => array( + 'api.website.create' => array( 'url' => 'http://civicrm.org', ), - 'api.website.create.2' => array( + 'api.website.create.2' => array( 'url' => 'http://chained.org', ), -); + ); -try{ - $result = civicrm_api3('contact', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_create_expectedresult(){ +function contact_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'sort_name' => 'xyz3, abc3', - 'display_name' => 'abc3 xyz3', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'hash' => '67eac7789eaee00', - 'api_key' => '', - 'first_name' => 'abc3', - 'middle_name' => '', - 'last_name' => 'xyz3', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'email_greeting_id' => '1', - 'email_greeting_custom' => '', - 'email_greeting_display' => '', - 'postal_greeting_id' => '1', - 'postal_greeting_custom' => '', - 'postal_greeting_display' => '', - 'addressee_id' => '1', - 'addressee_custom' => '', - 'addressee_display' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'primary_contact_id' => '', - 'organization_name' => '', - 'sic_code' => '', - 'user_unique_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'modified_date' => '2012-11-14 16:02:35', - 'api.contribution.create' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'contact_id' => '1', - 'financial_type_id' => '1', - 'contribution_page_id' => '', - 'payment_instrument_id' => '1', - 'receive_date' => '20100101000000', - 'non_deductible_amount' => '10', - 'total_amount' => '100', - 'fee_amount' => '50', - 'net_amount' => '90', - 'trxn_id' => '15345', - 'invoice_id' => '67990', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'SSF', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '1', - 'address_id' => '', - 'check_number' => '', - 'campaign_id' => '', - 'contribution_type_id' => '1', - ), - ), + 'id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'sort_name' => 'xyz3, abc3', + 'display_name' => 'abc3 xyz3', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'hash' => '67eac7789eaee00', + 'api_key' => '', + 'first_name' => 'abc3', + 'middle_name' => '', + 'last_name' => 'xyz3', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'email_greeting_id' => '1', + 'email_greeting_custom' => '', + 'email_greeting_display' => '', + 'postal_greeting_id' => '1', + 'postal_greeting_custom' => '', + 'postal_greeting_display' => '', + 'addressee_id' => '1', + 'addressee_custom' => '', + 'addressee_display' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'primary_contact_id' => '', + 'organization_name' => '', + 'sic_code' => '', + 'user_unique_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', + 'api.contribution.create' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'contact_id' => '1', + 'financial_type_id' => '1', + 'contribution_page_id' => '', + 'payment_instrument_id' => '1', + 'receive_date' => '20100101000000', + 'non_deductible_amount' => '10', + 'total_amount' => '100', + 'fee_amount' => '50', + 'net_amount' => '90', + 'trxn_id' => '15345', + 'invoice_id' => '67990', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '1', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '', + 'contribution_type_id' => '1', ), - 'api.website.create' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'contact_id' => '1', - 'url' => 'http://civicrm.org', - 'website_type_id' => '', - ), - ), + ), + ), + 'api.website.create' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'contact_id' => '1', + 'url' => 'http://civicrm.org', + 'website_type_id' => '', ), - 'api.website.create.2' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( - '0' => array( - 'id' => '2', - 'contact_id' => '1', - 'url' => 'http://chained.org', - 'website_type_id' => '', - ), - ), + ), + ), + 'api.website.create.2' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '0' => array( + 'id' => '2', + 'contact_id' => '1', + 'url' => 'http://chained.org', + 'website_type_id' => '', ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateIndividualWithContributionDottedSyntax and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateIndividualWithContributionDottedSyntax +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php b/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php index 34690ede4d..e5ff6921db 100644 --- a/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php +++ b/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php @@ -1,15 +1,25 @@ 'abc3', - 'last_name' => 'xyz3', - 'contact_type' => 'Individual', - 'email' => 'man3@yahoo.com', - 'api.contribution.create' => array( + +/** + * Test Generated example of using contact create API. + * + * demonstrates creating two websites as an array + * + * @return array + * API result array + */ +function contact_create_example() { + $params = array( + 'first_name' => 'abc3', + 'last_name' => 'xyz3', + 'contact_type' => 'Individual', + 'email' => 'man3@yahoo.com', + 'api.contribution.create' => array( 'receive_date' => '2010-01-01', 'total_amount' => '100', 'financial_type_id' => 1, @@ -22,171 +32,180 @@ $params = array( 'source' => 'SSF', 'contribution_status_id' => 1, ), - 'api.website.create' => array( + 'api.website.create' => array( '0' => array( - 'url' => 'http://civicrm.org', - ), + 'url' => 'http://civicrm.org', + ), '1' => array( - 'url' => 'http://chained.org', - 'website_type_id' => 2, - ), + 'url' => 'http://chained.org', + 'website_type_id' => 2, + ), ), -); + ); -try{ - $result = civicrm_api3('contact', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_create_expectedresult(){ +function contact_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'sort_name' => 'xyz3, abc3', - 'display_name' => 'abc3 xyz3', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'hash' => '67eac7789eaee00', - 'api_key' => '', - 'first_name' => 'abc3', - 'middle_name' => '', - 'last_name' => 'xyz3', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'email_greeting_id' => '1', - 'email_greeting_custom' => '', - 'email_greeting_display' => '', - 'postal_greeting_id' => '1', - 'postal_greeting_custom' => '', - 'postal_greeting_display' => '', - 'addressee_id' => '1', - 'addressee_custom' => '', - 'addressee_display' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'primary_contact_id' => '', - 'organization_name' => '', - 'sic_code' => '', - 'user_unique_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'modified_date' => '2012-11-14 16:02:35', - 'api.contribution.create' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'contact_id' => '1', - 'financial_type_id' => '1', - 'contribution_page_id' => '', - 'payment_instrument_id' => '1', - 'receive_date' => '20100101000000', - 'non_deductible_amount' => '10', - 'total_amount' => '100', - 'fee_amount' => '50', - 'net_amount' => '90', - 'trxn_id' => '12345', - 'invoice_id' => '67890', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'SSF', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '1', - 'address_id' => '', - 'check_number' => '', - 'campaign_id' => '', - 'contribution_type_id' => '1', - ), - ), + 'id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'sort_name' => 'xyz3, abc3', + 'display_name' => 'abc3 xyz3', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'hash' => '67eac7789eaee00', + 'api_key' => '', + 'first_name' => 'abc3', + 'middle_name' => '', + 'last_name' => 'xyz3', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'email_greeting_id' => '1', + 'email_greeting_custom' => '', + 'email_greeting_display' => '', + 'postal_greeting_id' => '1', + 'postal_greeting_custom' => '', + 'postal_greeting_display' => '', + 'addressee_id' => '1', + 'addressee_custom' => '', + 'addressee_display' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'primary_contact_id' => '', + 'organization_name' => '', + 'sic_code' => '', + 'user_unique_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', + 'api.contribution.create' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'contact_id' => '1', + 'financial_type_id' => '1', + 'contribution_page_id' => '', + 'payment_instrument_id' => '1', + 'receive_date' => '20100101000000', + 'non_deductible_amount' => '10', + 'total_amount' => '100', + 'fee_amount' => '50', + 'net_amount' => '90', + 'trxn_id' => '12345', + 'invoice_id' => '67890', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '1', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '', + 'contribution_type_id' => '1', ), - 'api.website.create' => array( + ), + ), + 'api.website.create' => array( + '0' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'contact_id' => '1', + 'url' => 'http://civicrm.org', + 'website_type_id' => '', + ), + ), + ), + '1' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '0' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'contact_id' => '1', - 'url' => 'http://civicrm.org', - 'website_type_id' => '', - ), - ), - ), - '1' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( - '0' => array( - 'id' => '2', - 'contact_id' => '1', - 'url' => 'http://chained.org', - 'website_type_id' => '2', - ), - ), - ), + 'id' => '2', + 'contact_id' => '1', + 'url' => 'http://chained.org', + 'website_type_id' => '2', + ), ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateIndividualWithContributionChainedArrays and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateIndividualWithContributionChainedArrays +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/Create.php b/api/v3/examples/Contact/Create.php index 3eeb35b611..b14ed5c77c 100644 --- a/api/v3/examples/Contact/Create.php +++ b/api/v3/examples/Contact/Create.php @@ -1,103 +1,120 @@ 'abc1', - 'contact_type' => 'Individual', - 'last_name' => 'xyz1', - 'custom_1' => 'custom string', -); -try{ - $result = civicrm_api3('contact', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contact create API. + * + * /*this demonstrates setting a custom field through the API + * + * @return array + * API result array + */ +function contact_create_example() { + $params = array( + 'first_name' => 'abc1', + 'contact_type' => 'Individual', + 'last_name' => 'xyz1', + 'custom_1' => 'custom string', + ); -return $result; + try{ + $result = civicrm_api3('contact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_create_expectedresult(){ +function contact_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'sort_name' => 'xyz1, abc1', - 'display_name' => 'abc1 xyz1', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'hash' => '67eac7789eaee00', - 'api_key' => '', - 'first_name' => 'abc1', - 'middle_name' => '', - 'last_name' => 'xyz1', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'email_greeting_id' => '1', - 'email_greeting_custom' => '', - 'email_greeting_display' => '', - 'postal_greeting_id' => '1', - 'postal_greeting_custom' => '', - 'postal_greeting_display' => '', - 'addressee_id' => '1', - 'addressee_custom' => '', - 'addressee_display' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'primary_contact_id' => '', - 'organization_name' => '', - 'sic_code' => '', - 'user_unique_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'modified_date' => '2012-11-14 16:02:35', - ), + 'id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'sort_name' => 'xyz1, abc1', + 'display_name' => 'abc1 xyz1', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'hash' => '67eac7789eaee00', + 'api_key' => '', + 'first_name' => 'abc1', + 'middle_name' => '', + 'last_name' => 'xyz1', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'email_greeting_id' => '1', + 'email_greeting_custom' => '', + 'email_greeting_display' => '', + 'postal_greeting_id' => '1', + 'postal_greeting_custom' => '', + 'postal_greeting_display' => '', + 'addressee_id' => '1', + 'addressee_custom' => '', + 'addressee_display' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'primary_contact_id' => '', + 'organization_name' => '', + 'sic_code' => '', + 'user_unique_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateWithCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateWithCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/CustomFieldGet.php b/api/v3/examples/Contact/CustomFieldGet.php index 14a0fccf3b..c6409e5d81 100644 --- a/api/v3/examples/Contact/CustomFieldGet.php +++ b/api/v3/examples/Contact/CustomFieldGet.php @@ -1,56 +1,73 @@ 1, - 'id' => 1, -); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contact get API. + * + * /*this demonstrates setting a custom field through the API + * + * @return array + * API result array + */ +function contact_get_example() { + $params = array( + 'return.custom_1' => 1, + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '1', - 'civicrm_value_testgetwithcu_1_id' => '1', - 'custom_1' => 'custom string', - 'id' => '1', - ), + 'contact_id' => '1', + 'civicrm_value_testgetwithcu_1_id' => '1', + 'custom_1' => 'custom string', + 'id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetWithCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetWithCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php b/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php index 9ee0fbe8f4..8568539b8b 100644 --- a/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php +++ b/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php @@ -1,56 +1,73 @@ 'custom_1', - 'id' => 1, -); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contact get API. + * + * /*this demonstrates setting a custom field through the API + * + * @return array + * API result array + */ +function contact_get_example() { + $params = array( + 'return' => 'custom_1', + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '1', - 'civicrm_value_testgetwithcu_1_id' => '1', - 'custom_1' => 'custom string', - 'id' => '1', - ), + 'contact_id' => '1', + 'civicrm_value_testgetwithcu_1_id' => '1', + 'custom_1' => 'custom string', + 'id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetWithCustomReturnSyntax and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetWithCustomReturnSyntax +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/Delete.php b/api/v3/examples/Contact/Delete.php index e845ca0b55..f33093c3d5 100644 --- a/api/v3/examples/Contact/Delete.php +++ b/api/v3/examples/Contact/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('contact', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contact delete API. + * + * + * @return array + * API result array + */ +function contact_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('contact', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_delete_expectedresult(){ +function contact_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/FormatIsSuccess_Fail.php b/api/v3/examples/Contact/FormatIsSuccess_Fail.php index c8241ae9fc..2aa9dd395b 100644 --- a/api/v3/examples/Contact/FormatIsSuccess_Fail.php +++ b/api/v3/examples/Contact/FormatIsSuccess_Fail.php @@ -1,44 +1,61 @@ 500, - 'format.is_success' => 1, -); +function contact_create_example() { + $params = array( + 'id' => 500, + 'format.is_success' => 1, + ); -try{ - $result = civicrm_api3('contact', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_create_expectedresult(){ +function contact_create_expectedresult() { $expectedResult = 0; return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactCreateFormatIsSuccessFalse and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactCreateFormatIsSuccessFalse +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/FormatIsSuccess_True.php b/api/v3/examples/Contact/FormatIsSuccess_True.php index 0c57c1262c..6fb4583556 100644 --- a/api/v3/examples/Contact/FormatIsSuccess_True.php +++ b/api/v3/examples/Contact/FormatIsSuccess_True.php @@ -1,44 +1,61 @@ 17, - 'format.is_success' => 1, -); +function contact_get_example() { + $params = array( + 'id' => 17, + 'format.is_success' => 1, + ); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = 1; return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactGetFormatIsSuccessTrue and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactGetFormatIsSuccessTrue +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/FormatOnlyID.php b/api/v3/examples/Contact/FormatOnlyID.php index 641e8b3ea2..c7273d1099 100644 --- a/api/v3/examples/Contact/FormatOnlyID.php +++ b/api/v3/examples/Contact/FormatOnlyID.php @@ -1,45 +1,62 @@ 17, - 'format.only_id' => 1, -); +function contact_get_example() { + $params = array( + 'id' => 17, + 'format.only_id' => 1, + ); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = 17; return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactGetFormatID_only and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactGetFormatID_only +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/FormatSingleValue.php b/api/v3/examples/Contact/FormatSingleValue.php index 18c6200571..8678de3c84 100644 --- a/api/v3/examples/Contact/FormatSingleValue.php +++ b/api/v3/examples/Contact/FormatSingleValue.php @@ -1,45 +1,62 @@ 17, - 'return' => 'display_name', -); +function contact_getvalue_example() { + $params = array( + 'id' => 17, + 'return' => 'display_name', + ); -try{ - $result = civicrm_api3('contact', 'getvalue', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'getvalue', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_getvalue_expectedresult(){ +function contact_getvalue_expectedresult() { $expectedResult = 'Test Contact'; return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactGetFormatSingleValue and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactGetFormatSingleValue +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/Get.php b/api/v3/examples/Contact/Get.php index 13e368caa0..d14a2c7159 100644 --- a/api/v3/examples/Contact/Get.php +++ b/api/v3/examples/Contact/Get.php @@ -1,117 +1,133 @@ 'man2@yahoo.com', -); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contact get API. + * + * + * @return array + * API result array + */ +function contact_get_example() { + $params = array( + 'email' => 'man2@yahoo.com', + ); -return $result; + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'man2@yahoo.com', - 'display_name' => 'man2@yahoo.com', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'first_name' => '', - 'middle_name' => '', - 'last_name' => '', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'organization_name' => '', - 'sic_code' => '', - 'contact_is_deleted' => 0, - 'current_employer' => '', - 'address_id' => '2', - 'street_address' => '1 my road', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'postal_code_suffix' => '', - 'postal_code' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - 'state_province_id' => '', - 'country_id' => '', - 'phone_id' => '', - 'phone_type_id' => '', - 'phone' => '', - 'email_id' => '1', - 'email' => 'man2@yahoo.com', - 'on_hold' => 0, - 'im_id' => '', - 'provider_id' => '', - 'im' => '', - 'worldregion_id' => '', - 'world_region' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', - 'gender' => '', - 'state_province_name' => '', - 'state_province' => '', - 'country' => '', - 'id' => '1', - ), + 'contact_id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'man2@yahoo.com', + 'display_name' => 'man2@yahoo.com', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'first_name' => '', + 'middle_name' => '', + 'last_name' => '', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'organization_name' => '', + 'sic_code' => '', + 'contact_is_deleted' => 0, + 'current_employer' => '', + 'address_id' => '2', + 'street_address' => '1 my road', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'postal_code_suffix' => '', + 'postal_code' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + 'state_province_id' => '', + 'country_id' => '', + 'phone_id' => '', + 'phone_type_id' => '', + 'phone' => '', + 'email_id' => '1', + 'email' => 'man2@yahoo.com', + 'on_hold' => 0, + 'im_id' => '', + 'provider_id' => '', + 'im' => '', + 'worldregion_id' => '', + 'world_region' => '', + 'individual_prefix' => '', + 'individual_suffix' => '', + 'communication_style' => '', + 'gender' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactGetEmail and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactGetEmail +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/GetActions.php b/api/v3/examples/Contact/GetActions.php index 5e9ebfc99e..efd03c4a9e 100644 --- a/api/v3/examples/Contact/GetActions.php +++ b/api/v3/examples/Contact/GetActions.php @@ -1,67 +1,89 @@ getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contact getactions API. + * + * Getting the available actions for an entity. + * + * @return array + * API result array + */ +function contact_getactions_example() { + $params = array(); -return $result; + try{ + $result = civicrm_api3('contact', 'getactions', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_getactions_expectedresult(){ +function contact_getactions_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 17, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 22, + 'values' => array( '0' => 'create', '1' => 'delete', - '2' => 'get', - '3' => 'getactions', - '4' => 'getcount', - '5' => 'getfields', - '6' => 'getlist', - '7' => 'getoptions', - '8' => 'getquick', - '9' => 'getrefcount', - '10' => 'getsingle', - '11' => 'getvalue', - '12' => 'merge', - '13' => 'proximity', - '14' => 'replace', - '15' => 'setvalue', - '16' => 'update', + '2' => 'example_action1', + '3' => 'example_action2', + '4' => 'get', + '5' => 'getactions', + '6' => 'getcount', + '7' => 'getfields', + '8' => 'getlist', + '9' => 'getoptions', + '10' => 'getquick', + '11' => 'getrefcount', + '12' => 'getsingle', + '13' => 'getvalue', + '14' => 'merge', + '15' => 'proximity', + '16' => 'replace', + '17' => 'setvalue', + '18' => 'type_create', + '19' => 'type_delete', + '20' => 'type_get', + '21' => 'update', ), - 'deprecated' => array( + 'deprecated' => array( 'getquick' => 'The "getquick" action is deprecated in favor of "getlist".', 'update' => 'The "update" action is deprecated. Use "create" with an id instead.', ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetActions and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetActions +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/GetCountContact.php b/api/v3/examples/Contact/GetCountContact.php index 466acc181a..dc8cf026aa 100644 --- a/api/v3/examples/Contact/GetCountContact.php +++ b/api/v3/examples/Contact/GetCountContact.php @@ -1,43 +1,60 @@ 17, -); +function contact_get_example() { + $params = array( + 'id' => 17, + ); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = 1; return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactGetFormatcount_only and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactGetFormatcount_only +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/GetFieldsOptions.php b/api/v3/examples/Contact/GetFieldsOptions.php index 36309b48a0..7425c141fe 100644 --- a/api/v3/examples/Contact/GetFieldsOptions.php +++ b/api/v3/examples/Contact/GetFieldsOptions.php @@ -1,765 +1,784 @@ array( + +/** + * Test Generated example of using contact GetFields API. + * + * Demonstrate retrieving metadata with custom field options + * + * @return array + * API result array + */ +function contact_getfields_example() { + $params = array( + 'options' => array( 'get_options' => 'custom_1', ), - 'action' => 'create', -); + 'action' => 'create', + ); -try{ - $result = civicrm_api3('contact', 'GetFields', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'GetFields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_getfields_expectedresult(){ +function contact_getfields_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 55, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 55, + 'values' => array( 'id' => array( - 'name' => 'id', - 'type' => 1, - 'title' => 'Internal Contact ID', - 'required' => true, - 'import' => true, - 'where' => 'civicrm_contact.id', - 'headerPattern' => '/internal|contact?|id$/i', - 'export' => true, - 'api.aliases' => array( - '0' => 'contact_id', - ), - ), + 'name' => 'id', + 'type' => 1, + 'title' => 'Internal Contact ID', + 'required' => TRUE, + 'import' => TRUE, + 'where' => 'civicrm_contact.id', + 'headerPattern' => '/internal|contact?|id$/i', + 'export' => TRUE, + 'api.aliases' => array( + '0' => 'contact_id', + ), + ), 'contact_type' => array( - 'name' => 'contact_type', - 'type' => 2, - 'title' => 'Contact Type', - 'maxlength' => 64, - 'size' => 30, - 'export' => true, - 'where' => 'civicrm_contact.contact_type', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'table' => 'civicrm_contact_type', - 'keyColumn' => 'name', - 'labelColumn' => 'label', - 'condition' => 'parent_id IS NULL', - ), - 'api.required' => 1, - ), + 'name' => 'contact_type', + 'type' => 2, + 'title' => 'Contact Type', + 'maxlength' => 64, + 'size' => 30, + 'export' => TRUE, + 'where' => 'civicrm_contact.contact_type', + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NULL', + ), + 'api.required' => 1, + ), 'contact_sub_type' => array( - 'name' => 'contact_sub_type', - 'type' => 2, - 'title' => 'Contact Subtype', - 'maxlength' => 255, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_contact.contact_sub_type', - 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i', - 'export' => true, - 'html' => array( - 'type' => 'Multi-Select', - ), - 'pseudoconstant' => array( - 'table' => 'civicrm_contact_type', - 'keyColumn' => 'name', - 'labelColumn' => 'label', - 'condition' => 'parent_id IS NOT NULL', - ), - ), + 'name' => 'contact_sub_type', + 'type' => 2, + 'title' => 'Contact Subtype', + 'maxlength' => 255, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_contact.contact_sub_type', + 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Multi-Select', + ), + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NOT NULL', + ), + ), 'do_not_email' => array( - 'name' => 'do_not_email', - 'type' => 16, - 'title' => 'Do Not Email', - 'import' => true, - 'where' => 'civicrm_contact.do_not_email', - 'headerPattern' => '/d(o )?(not )?(email)/i', - 'dataPattern' => '/^\\d{1,}$/', - 'export' => true, - 'html' => array( - 'type' => 'CheckBox', - ), - ), + 'name' => 'do_not_email', + 'type' => 16, + 'title' => 'Do Not Email', + 'import' => TRUE, + 'where' => 'civicrm_contact.do_not_email', + 'headerPattern' => '/d(o )?(not )?(email)/i', + 'dataPattern' => '/^\\d{1,}$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'CheckBox', + ), + ), 'do_not_phone' => array( - 'name' => 'do_not_phone', - 'type' => 16, - 'title' => 'Do Not Phone', - 'import' => true, - 'where' => 'civicrm_contact.do_not_phone', - 'headerPattern' => '/d(o )?(not )?(call|phone)/i', - 'dataPattern' => '/^\\d{1,}$/', - 'export' => true, - 'html' => array( - 'type' => 'CheckBox', - ), - ), + 'name' => 'do_not_phone', + 'type' => 16, + 'title' => 'Do Not Phone', + 'import' => TRUE, + 'where' => 'civicrm_contact.do_not_phone', + 'headerPattern' => '/d(o )?(not )?(call|phone)/i', + 'dataPattern' => '/^\\d{1,}$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'CheckBox', + ), + ), 'do_not_mail' => array( - 'name' => 'do_not_mail', - 'type' => 16, - 'title' => 'Do Not Mail', - 'import' => true, - 'where' => 'civicrm_contact.do_not_mail', - 'headerPattern' => '/^(d(o\\s)?n(ot\\s)?mail)|(\\w*)?bulk\\s?(\\w*)$/i', - 'dataPattern' => '/^\\d{1,}$/', - 'export' => true, - 'html' => array( - 'type' => 'CheckBox', - ), - ), + 'name' => 'do_not_mail', + 'type' => 16, + 'title' => 'Do Not Mail', + 'import' => TRUE, + 'where' => 'civicrm_contact.do_not_mail', + 'headerPattern' => '/^(d(o\\s)?n(ot\\s)?mail)|(\\w*)?bulk\\s?(\\w*)$/i', + 'dataPattern' => '/^\\d{1,}$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'CheckBox', + ), + ), 'do_not_sms' => array( - 'name' => 'do_not_sms', - 'type' => 16, - 'title' => 'Do Not Sms', - 'import' => true, - 'where' => 'civicrm_contact.do_not_sms', - 'headerPattern' => '/d(o )?(not )?(sms)/i', - 'dataPattern' => '/^\\d{1,}$/', - 'export' => true, - 'html' => array( - 'type' => 'CheckBox', - ), - ), + 'name' => 'do_not_sms', + 'type' => 16, + 'title' => 'Do Not Sms', + 'import' => TRUE, + 'where' => 'civicrm_contact.do_not_sms', + 'headerPattern' => '/d(o )?(not )?(sms)/i', + 'dataPattern' => '/^\\d{1,}$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'CheckBox', + ), + ), 'do_not_trade' => array( - 'name' => 'do_not_trade', - 'type' => 16, - 'title' => 'Do Not Trade', - 'import' => true, - 'where' => 'civicrm_contact.do_not_trade', - 'headerPattern' => '/d(o )?(not )?(trade)/i', - 'dataPattern' => '/^\\d{1,}$/', - 'export' => true, - 'html' => array( - 'type' => 'CheckBox', - ), - ), + 'name' => 'do_not_trade', + 'type' => 16, + 'title' => 'Do Not Trade', + 'import' => TRUE, + 'where' => 'civicrm_contact.do_not_trade', + 'headerPattern' => '/d(o )?(not )?(trade)/i', + 'dataPattern' => '/^\\d{1,}$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'CheckBox', + ), + ), 'is_opt_out' => array( - 'name' => 'is_opt_out', - 'type' => 16, - 'title' => 'No Bulk Emails (User Opt Out)', - 'required' => true, - 'import' => true, - 'where' => 'civicrm_contact.is_opt_out', - 'export' => true, - 'html' => array( - 'type' => 'CheckBox', - ), - ), + 'name' => 'is_opt_out', + 'type' => 16, + 'title' => 'No Bulk Emails (User Opt Out)', + 'required' => TRUE, + 'import' => TRUE, + 'where' => 'civicrm_contact.is_opt_out', + 'export' => TRUE, + 'html' => array( + 'type' => 'CheckBox', + ), + ), 'legal_identifier' => array( - 'name' => 'legal_identifier', - 'type' => 2, - 'title' => 'Legal Identifier', - 'maxlength' => 32, - 'size' => 20, - 'import' => true, - 'where' => 'civicrm_contact.legal_identifier', - 'headerPattern' => '/legal\\s?id/i', - 'dataPattern' => '/\\w+?\\d{5,}/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'legal_identifier', + 'type' => 2, + 'title' => 'Legal Identifier', + 'maxlength' => 32, + 'size' => 20, + 'import' => TRUE, + 'where' => 'civicrm_contact.legal_identifier', + 'headerPattern' => '/legal\\s?id/i', + 'dataPattern' => '/\\w+?\\d{5,}/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'external_identifier' => array( - 'name' => 'external_identifier', - 'type' => 2, - 'title' => 'External Identifier', - 'maxlength' => 32, - 'size' => 8, - 'import' => true, - 'where' => 'civicrm_contact.external_identifier', - 'headerPattern' => '/external\\s?id/i', - 'dataPattern' => '/^\\d{11,}$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'external_identifier', + 'type' => 2, + 'title' => 'External Identifier', + 'maxlength' => 32, + 'size' => 8, + 'import' => TRUE, + 'where' => 'civicrm_contact.external_identifier', + 'headerPattern' => '/external\\s?id/i', + 'dataPattern' => '/^\\d{11,}$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'sort_name' => array( - 'name' => 'sort_name', - 'type' => 2, - 'title' => 'Sort Name', - 'maxlength' => 128, - 'size' => 30, - 'export' => true, - 'where' => 'civicrm_contact.sort_name', - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'sort_name', + 'type' => 2, + 'title' => 'Sort Name', + 'maxlength' => 128, + 'size' => 30, + 'export' => TRUE, + 'where' => 'civicrm_contact.sort_name', + 'html' => array( + 'type' => 'Text', + ), + ), 'display_name' => array( - 'name' => 'display_name', - 'type' => 2, - 'title' => 'Display Name', - 'maxlength' => 128, - 'size' => 30, - 'export' => true, - 'where' => 'civicrm_contact.display_name', - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'display_name', + 'type' => 2, + 'title' => 'Display Name', + 'maxlength' => 128, + 'size' => 30, + 'export' => TRUE, + 'where' => 'civicrm_contact.display_name', + 'html' => array( + 'type' => 'Text', + ), + ), 'nick_name' => array( - 'name' => 'nick_name', - 'type' => 2, - 'title' => 'Nickname', - 'maxlength' => 128, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.nick_name', - 'headerPattern' => '/n(ick\\s)name|nick$/i', - 'dataPattern' => '/^\\w+$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'nick_name', + 'type' => 2, + 'title' => 'Nickname', + 'maxlength' => 128, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.nick_name', + 'headerPattern' => '/n(ick\\s)name|nick$/i', + 'dataPattern' => '/^\\w+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'legal_name' => array( - 'name' => 'legal_name', - 'type' => 2, - 'title' => 'Legal Name', - 'maxlength' => 128, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.legal_name', - 'headerPattern' => '/^legal|(l(egal\\s)?name)$/i', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'legal_name', + 'type' => 2, + 'title' => 'Legal Name', + 'maxlength' => 128, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.legal_name', + 'headerPattern' => '/^legal|(l(egal\\s)?name)$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'image_URL' => array( - 'name' => 'image_URL', - 'type' => 2, - 'title' => 'Image Url', - 'maxlength' => 255, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_contact.image_URL', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'image_URL', + 'type' => 2, + 'title' => 'Image Url', + 'maxlength' => 255, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_contact.image_URL', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'preferred_communication_method' => array( - 'name' => 'preferred_communication_method', - 'type' => 2, - 'title' => 'Preferred Communication Method', - 'maxlength' => 255, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_contact.preferred_communication_method', - 'headerPattern' => '/^p(ref\\w*\\s)?c(omm\\w*)|( meth\\w*)$/i', - 'dataPattern' => '/^\\w+$/', - 'export' => true, - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'preferred_communication_method', - ), - ), + 'name' => 'preferred_communication_method', + 'type' => 2, + 'title' => 'Preferred Communication Method', + 'maxlength' => 255, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_contact.preferred_communication_method', + 'headerPattern' => '/^p(ref\\w*\\s)?c(omm\\w*)|( meth\\w*)$/i', + 'dataPattern' => '/^\\w+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'optionGroupName' => 'preferred_communication_method', + ), + ), 'preferred_language' => array( - 'name' => 'preferred_language', - 'type' => 2, - 'title' => 'Preferred Language', - 'maxlength' => 5, - 'size' => 6, - 'import' => true, - 'where' => 'civicrm_contact.preferred_language', - 'headerPattern' => '/^lang/i', - 'export' => true, - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'languages', - 'keyColumn' => 'name', - ), - ), + 'name' => 'preferred_language', + 'type' => 2, + 'title' => 'Preferred Language', + 'maxlength' => 5, + 'size' => 6, + 'import' => TRUE, + 'where' => 'civicrm_contact.preferred_language', + 'headerPattern' => '/^lang/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'optionGroupName' => 'languages', + 'keyColumn' => 'name', + ), + ), 'preferred_mail_format' => array( - 'name' => 'preferred_mail_format', - 'type' => 2, - 'title' => 'Preferred Mail Format', - 'maxlength' => 8, - 'size' => 8, - 'import' => true, - 'where' => 'civicrm_contact.preferred_mail_format', - 'headerPattern' => '/^p(ref\\w*\\s)?m(ail\\s)?f(orm\\w*)$/i', - 'export' => true, - 'default' => 'Both', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'callback' => 'CRM_Core_SelectValues::pmf', - ), - ), + 'name' => 'preferred_mail_format', + 'type' => 2, + 'title' => 'Preferred Mail Format', + 'maxlength' => 8, + 'size' => 8, + 'import' => TRUE, + 'where' => 'civicrm_contact.preferred_mail_format', + 'headerPattern' => '/^p(ref\\w*\\s)?m(ail\\s)?f(orm\\w*)$/i', + 'export' => TRUE, + 'default' => 'Both', + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::pmf', + ), + ), 'hash' => array( - 'name' => 'hash', - 'type' => 2, - 'title' => 'Contact Hash', - 'maxlength' => 32, - 'size' => 20, - 'export' => true, - 'where' => 'civicrm_contact.hash', - ), + 'name' => 'hash', + 'type' => 2, + 'title' => 'Contact Hash', + 'maxlength' => 32, + 'size' => 20, + 'export' => TRUE, + 'where' => 'civicrm_contact.hash', + ), 'api_key' => array( - 'name' => 'api_key', - 'type' => 2, - 'title' => 'Api Key', - 'maxlength' => 32, - 'size' => 20, - ), + 'name' => 'api_key', + 'type' => 2, + 'title' => 'Api Key', + 'maxlength' => 32, + 'size' => 20, + ), 'first_name' => array( - 'name' => 'first_name', - 'type' => 2, - 'title' => 'First Name', - 'maxlength' => 64, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.first_name', - 'headerPattern' => '/^first|(f(irst\\s)?name)$/i', - 'dataPattern' => '/^\\w+$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'first_name', + 'type' => 2, + 'title' => 'First Name', + 'maxlength' => 64, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.first_name', + 'headerPattern' => '/^first|(f(irst\\s)?name)$/i', + 'dataPattern' => '/^\\w+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'middle_name' => array( - 'name' => 'middle_name', - 'type' => 2, - 'title' => 'Middle Name', - 'maxlength' => 64, - 'size' => 20, - 'import' => true, - 'where' => 'civicrm_contact.middle_name', - 'headerPattern' => '/^middle|(m(iddle\\s)?name)$/i', - 'dataPattern' => '/^\\w+$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'middle_name', + 'type' => 2, + 'title' => 'Middle Name', + 'maxlength' => 64, + 'size' => 20, + 'import' => TRUE, + 'where' => 'civicrm_contact.middle_name', + 'headerPattern' => '/^middle|(m(iddle\\s)?name)$/i', + 'dataPattern' => '/^\\w+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'last_name' => array( - 'name' => 'last_name', - 'type' => 2, - 'title' => 'Last Name', - 'maxlength' => 64, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.last_name', - 'headerPattern' => '/^last|(l(ast\\s)?name)$/i', - 'dataPattern' => '/^\\w+(\\s\\w+)?+$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'last_name', + 'type' => 2, + 'title' => 'Last Name', + 'maxlength' => 64, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.last_name', + 'headerPattern' => '/^last|(l(ast\\s)?name)$/i', + 'dataPattern' => '/^\\w+(\\s\\w+)?+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'prefix_id' => array( - 'name' => 'prefix_id', - 'type' => 1, - 'title' => 'Individual Prefix', - 'import' => true, - 'where' => 'civicrm_contact.prefix_id', - 'headerPattern' => '/^(prefix|title)/i', - 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\\.?$/i', - 'export' => true, - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'individual_prefix', - ), - 'api.aliases' => array( - '0' => 'individual_prefix', - '1' => 'individual_prefix_id', - ), - ), + 'name' => 'prefix_id', + 'type' => 1, + 'title' => 'Individual Prefix', + 'import' => TRUE, + 'where' => 'civicrm_contact.prefix_id', + 'headerPattern' => '/^(prefix|title)/i', + 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\\.?$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'optionGroupName' => 'individual_prefix', + ), + 'api.aliases' => array( + '0' => 'individual_prefix', + '1' => 'individual_prefix_id', + ), + ), 'suffix_id' => array( - 'name' => 'suffix_id', - 'type' => 1, - 'title' => 'Individual Suffix', - 'import' => true, - 'where' => 'civicrm_contact.suffix_id', - 'headerPattern' => '/^suffix$/i', - 'dataPattern' => '/^(sr|jr)\\.?|i{2,}$/', - 'export' => true, - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'individual_suffix', - ), - 'api.aliases' => array( - '0' => 'individual_suffix', - '1' => 'individual_suffix_id', - ), - ), + 'name' => 'suffix_id', + 'type' => 1, + 'title' => 'Individual Suffix', + 'import' => TRUE, + 'where' => 'civicrm_contact.suffix_id', + 'headerPattern' => '/^suffix$/i', + 'dataPattern' => '/^(sr|jr)\\.?|i{2,}$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'optionGroupName' => 'individual_suffix', + ), + 'api.aliases' => array( + '0' => 'individual_suffix', + '1' => 'individual_suffix_id', + ), + ), 'formal_title' => array( - 'name' => 'formal_title', - 'type' => 2, - 'title' => 'Formal Title', - 'maxlength' => 64, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.formal_title', - 'headerPattern' => '/^title/i', - 'export' => true, - ), + 'name' => 'formal_title', + 'type' => 2, + 'title' => 'Formal Title', + 'maxlength' => 64, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.formal_title', + 'headerPattern' => '/^title/i', + 'export' => TRUE, + ), 'communication_style_id' => array( - 'name' => 'communication_style_id', - 'type' => 1, - 'title' => 'Communication Style', - 'export' => true, - 'where' => 'civicrm_contact.communication_style_id', - 'pseudoconstant' => array( - 'optionGroupName' => 'communication_style', - ), - ), + 'name' => 'communication_style_id', + 'type' => 1, + 'title' => 'Communication Style', + 'export' => TRUE, + 'where' => 'civicrm_contact.communication_style_id', + 'pseudoconstant' => array( + 'optionGroupName' => 'communication_style', + ), + ), 'email_greeting_id' => array( - 'name' => 'email_greeting_id', - 'type' => 1, - 'title' => 'Email Greeting ID', - ), + 'name' => 'email_greeting_id', + 'type' => 1, + 'title' => 'Email Greeting ID', + ), 'email_greeting_custom' => array( - 'name' => 'email_greeting_custom', - 'type' => 2, - 'title' => 'Email Greeting Custom', - 'maxlength' => 128, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_contact.email_greeting_custom', - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'email_greeting_custom', + 'type' => 2, + 'title' => 'Email Greeting Custom', + 'maxlength' => 128, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_contact.email_greeting_custom', + 'html' => array( + 'type' => 'Text', + ), + ), 'email_greeting_display' => array( - 'name' => 'email_greeting_display', - 'type' => 2, - 'title' => 'Email Greeting', - 'maxlength' => 255, - 'size' => 45, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'email_greeting_display', + 'type' => 2, + 'title' => 'Email Greeting', + 'maxlength' => 255, + 'size' => 45, + 'html' => array( + 'type' => 'Text', + ), + ), 'postal_greeting_id' => array( - 'name' => 'postal_greeting_id', - 'type' => 1, - 'title' => 'Postal Greeting ID', - 'html' => array( - 'type' => 'Text', - ), + 'name' => 'postal_greeting_id', + 'type' => 1, + 'title' => 'Postal Greeting ID', + 'html' => array( + 'type' => 'Text', ), + ), 'postal_greeting_custom' => array( - 'name' => 'postal_greeting_custom', - 'type' => 2, - 'title' => 'Postal Greeting Custom', - 'maxlength' => 128, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_contact.postal_greeting_custom', - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'postal_greeting_custom', + 'type' => 2, + 'title' => 'Postal Greeting Custom', + 'maxlength' => 128, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_contact.postal_greeting_custom', + 'html' => array( + 'type' => 'Text', + ), + ), 'postal_greeting_display' => array( - 'name' => 'postal_greeting_display', - 'type' => 2, - 'title' => 'Postal Greeting', - 'maxlength' => 255, - 'size' => 45, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'postal_greeting_display', + 'type' => 2, + 'title' => 'Postal Greeting', + 'maxlength' => 255, + 'size' => 45, + 'html' => array( + 'type' => 'Text', + ), + ), 'addressee_id' => array( - 'name' => 'addressee_id', - 'type' => 1, - 'title' => 'Addressee ID', - ), + 'name' => 'addressee_id', + 'type' => 1, + 'title' => 'Addressee ID', + ), 'addressee_custom' => array( - 'name' => 'addressee_custom', - 'type' => 2, - 'title' => 'Addressee Custom', - 'maxlength' => 128, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_contact.addressee_custom', - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'addressee_custom', + 'type' => 2, + 'title' => 'Addressee Custom', + 'maxlength' => 128, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_contact.addressee_custom', + 'html' => array( + 'type' => 'Text', + ), + ), 'addressee_display' => array( - 'name' => 'addressee_display', - 'type' => 2, - 'title' => 'Addressee', - 'maxlength' => 255, - 'size' => 45, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'addressee_display', + 'type' => 2, + 'title' => 'Addressee', + 'maxlength' => 255, + 'size' => 45, + 'html' => array( + 'type' => 'Text', + ), + ), 'job_title' => array( - 'name' => 'job_title', - 'type' => 2, - 'title' => 'Job Title', - 'maxlength' => 255, - 'size' => 20, - 'import' => true, - 'where' => 'civicrm_contact.job_title', - 'headerPattern' => '/^job|(j(ob\\s)?title)$/i', - 'dataPattern' => '//', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'job_title', + 'type' => 2, + 'title' => 'Job Title', + 'maxlength' => 255, + 'size' => 20, + 'import' => TRUE, + 'where' => 'civicrm_contact.job_title', + 'headerPattern' => '/^job|(j(ob\\s)?title)$/i', + 'dataPattern' => '//', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'gender_id' => array( - 'name' => 'gender_id', - 'type' => 1, - 'title' => 'Gender', - 'import' => true, - 'where' => 'civicrm_contact.gender_id', - 'headerPattern' => '/^gender$/i', - 'export' => true, - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'gender', - ), - ), + 'name' => 'gender_id', + 'type' => 1, + 'title' => 'Gender', + 'import' => TRUE, + 'where' => 'civicrm_contact.gender_id', + 'headerPattern' => '/^gender$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'optionGroupName' => 'gender', + ), + ), 'birth_date' => array( - 'name' => 'birth_date', - 'type' => 4, - 'title' => 'Birth Date', - 'import' => true, - 'where' => 'civicrm_contact.birth_date', - 'headerPattern' => '/^birth|(b(irth\\s)?date)|D(\\W*)O(\\W*)B(\\W*)$/i', - 'dataPattern' => '/\\d{4}-?\\d{2}-?\\d{2}/', - 'export' => true, - 'html' => array( - 'type' => 'Select Date', - ), - ), + 'name' => 'birth_date', + 'type' => 4, + 'title' => 'Birth Date', + 'import' => TRUE, + 'where' => 'civicrm_contact.birth_date', + 'headerPattern' => '/^birth|(b(irth\\s)?date)|D(\\W*)O(\\W*)B(\\W*)$/i', + 'dataPattern' => '/\\d{4}-?\\d{2}-?\\d{2}/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select Date', + ), + ), 'is_deceased' => array( - 'name' => 'is_deceased', - 'type' => 16, - 'title' => 'Is Deceased', - 'import' => true, - 'where' => 'civicrm_contact.is_deceased', - 'headerPattern' => '/i(s\\s)?d(eceased)$/i', - 'export' => true, - 'html' => array( - 'type' => 'CheckBox', - ), - ), + 'name' => 'is_deceased', + 'type' => 16, + 'title' => 'Is Deceased', + 'import' => TRUE, + 'where' => 'civicrm_contact.is_deceased', + 'headerPattern' => '/i(s\\s)?d(eceased)$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'CheckBox', + ), + ), 'deceased_date' => array( - 'name' => 'deceased_date', - 'type' => 4, - 'title' => 'Deceased Date', - 'import' => true, - 'where' => 'civicrm_contact.deceased_date', - 'headerPattern' => '/^deceased|(d(eceased\\s)?date)$/i', - 'export' => true, - 'html' => array( - 'type' => 'Select Date', - ), - ), + 'name' => 'deceased_date', + 'type' => 4, + 'title' => 'Deceased Date', + 'import' => TRUE, + 'where' => 'civicrm_contact.deceased_date', + 'headerPattern' => '/^deceased|(d(eceased\\s)?date)$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Select Date', + ), + ), 'household_name' => array( - 'name' => 'household_name', - 'type' => 2, - 'title' => 'Household Name', - 'maxlength' => 128, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.household_name', - 'headerPattern' => '/^household|(h(ousehold\\s)?name)$/i', - 'dataPattern' => '/^\\w+$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'household_name', + 'type' => 2, + 'title' => 'Household Name', + 'maxlength' => 128, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.household_name', + 'headerPattern' => '/^household|(h(ousehold\\s)?name)$/i', + 'dataPattern' => '/^\\w+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'primary_contact_id' => array( - 'name' => 'primary_contact_id', - 'type' => 1, - 'title' => 'Household Primary Contact ID', - 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( - 'type' => 'Select', - ), - ), + 'name' => 'primary_contact_id', + 'type' => 1, + 'title' => 'Household Primary Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'Select', + ), + 'FKApiName' => 'Contact', + ), 'organization_name' => array( - 'name' => 'organization_name', - 'type' => 2, - 'title' => 'Organization Name', - 'maxlength' => 128, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.organization_name', - 'headerPattern' => '/^organization|(o(rganization\\s)?name)$/i', - 'dataPattern' => '/^\\w+$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'organization_name', + 'type' => 2, + 'title' => 'Organization Name', + 'maxlength' => 128, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.organization_name', + 'headerPattern' => '/^organization|(o(rganization\\s)?name)$/i', + 'dataPattern' => '/^\\w+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'sic_code' => array( - 'name' => 'sic_code', - 'type' => 2, - 'title' => 'Sic Code', - 'maxlength' => 8, - 'size' => 8, - 'import' => true, - 'where' => 'civicrm_contact.sic_code', - 'headerPattern' => '/^sic|(s(ic\\s)?code)$/i', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'sic_code', + 'type' => 2, + 'title' => 'Sic Code', + 'maxlength' => 8, + 'size' => 8, + 'import' => TRUE, + 'where' => 'civicrm_contact.sic_code', + 'headerPattern' => '/^sic|(s(ic\\s)?code)$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + ), 'user_unique_id' => array( - 'name' => 'user_unique_id', - 'type' => 2, - 'title' => 'Unique ID (OpenID)', - 'maxlength' => 255, - 'size' => 45, - 'import' => true, - 'where' => 'civicrm_contact.user_unique_id', - 'headerPattern' => '/^Open\\s?ID|u(niq\\w*)?\\s?ID/i', - 'dataPattern' => '/^[\\w\\/\\:\\.]+$/', - 'export' => true, - 'rule' => 'url', - 'html' => array( - 'type' => 'Text', - ), - ), + 'name' => 'user_unique_id', + 'type' => 2, + 'title' => 'Unique ID (OpenID)', + 'maxlength' => 255, + 'size' => 45, + 'import' => TRUE, + 'where' => 'civicrm_contact.user_unique_id', + 'headerPattern' => '/^Open\\s?ID|u(niq\\w*)?\\s?ID/i', + 'dataPattern' => '/^[\\w\\/\\:\\.]+$/', + 'export' => TRUE, + 'rule' => 'url', + 'html' => array( + 'type' => 'Text', + ), + ), 'created_date' => array( - 'name' => 'created_date', - 'type' => 256, - 'title' => 'Created Date', - 'required' => '', - 'export' => true, - 'where' => 'civicrm_contact.created_date', - 'default' => 'NULL', - ), + 'name' => 'created_date', + 'type' => 256, + 'title' => 'Created Date', + 'required' => '', + 'export' => TRUE, + 'where' => 'civicrm_contact.created_date', + 'default' => 'NULL', + ), 'modified_date' => array( - 'name' => 'modified_date', - 'type' => 256, - 'title' => 'Modified Date', - 'required' => '', - 'export' => true, - 'where' => 'civicrm_contact.modified_date', - 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', - ), + 'name' => 'modified_date', + 'type' => 256, + 'title' => 'Modified Date', + 'required' => '', + 'export' => TRUE, + 'where' => 'civicrm_contact.modified_date', + 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', + ), 'source' => array( - 'name' => 'source', - 'type' => 2, - 'title' => 'Source of Contact Data', - 'maxlength' => 255, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.source', - 'headerPattern' => '/(S(ource\\s)?o(f\\s)?C(ontact\\s)?Data)$/i', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - 'uniqueName' => 'contact_source', - ), + 'name' => 'source', + 'type' => 2, + 'title' => 'Source of Contact Data', + 'maxlength' => 255, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.source', + 'headerPattern' => '/(S(ource\\s)?o(f\\s)?C(ontact\\s)?Data)$/i', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', + ), + 'uniqueName' => 'contact_source', + ), 'employer_id' => array( - 'name' => 'employer_id', - 'type' => 1, - 'title' => 'Current Employer ID', - 'export' => true, - 'where' => 'civicrm_contact.employer_id', - 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( - 'type' => 'Autocomplete-Select', - ), - 'uniqueName' => 'current_employer_id', - ), + 'name' => 'employer_id', + 'type' => 1, + 'title' => 'Current Employer ID', + 'export' => TRUE, + 'where' => 'civicrm_contact.employer_id', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'Autocomplete-Select', + ), + 'uniqueName' => 'current_employer_id', + 'FKApiName' => 'Contact', + ), 'is_deleted' => array( - 'name' => 'is_deleted', - 'type' => 16, - 'title' => 'Contact is in Trash', - 'required' => true, - 'export' => true, - 'where' => 'civicrm_contact.is_deleted', - 'html' => array( - 'type' => 'CheckBox', - ), - 'uniqueName' => 'contact_is_deleted', - ), + 'name' => 'is_deleted', + 'type' => 16, + 'title' => 'Contact is in Trash', + 'required' => TRUE, + 'export' => TRUE, + 'where' => 'civicrm_contact.is_deleted', + 'html' => array( + 'type' => 'CheckBox', + ), + 'uniqueName' => 'contact_is_deleted', + ), 'custom_1' => array( - 'label' => 'Our special field', - 'groupTitle' => 'select_test_g', - 'data_type' => 'String', - 'html_type' => 'Select', - 'default_value' => '', - 'text_length' => '', - 'options_per_line' => '', - 'custom_group_id' => '1', - 'extends' => 'Contact', - 'is_search_range' => 0, - 'extends_entity_column_value' => '', - 'extends_entity_column_id' => '', - 'is_view' => 0, - 'is_multiple' => 0, - 'option_group_id' => '102', - 'date_format' => '', - 'time_format' => '', - 'is_required' => '1', - 'name' => 'custom_1', - 'title' => 'Our special field', - 'type' => 2, - 'options' => array( - '1' => 'Label1', - '2' => 'Label2', - ), - ), + 'label' => 'Our special field', + 'groupTitle' => 'select_test_g', + 'data_type' => 'String', + 'html_type' => 'Select', + 'default_value' => '', + 'text_length' => '', + 'options_per_line' => '', + 'custom_group_id' => '1', + 'extends' => 'Contact', + 'is_search_range' => 0, + 'extends_entity_column_value' => '', + 'extends_entity_column_id' => '', + 'is_view' => 0, + 'is_multiple' => 0, + 'option_group_id' => '105', + 'date_format' => '', + 'time_format' => '', + 'is_required' => '1', + 'name' => 'custom_1', + 'title' => 'Our special field', + 'type' => 2, + 'options' => array( + '1' => 'Label1', + '2' => 'Label2', + ), + ), 'current_employer' => array( - 'title' => 'Current Employer', - 'description' => 'Name of Current Employer', - 'type' => 2, - ), + 'title' => 'Current Employer', + 'description' => 'Name of Current Employer', + 'type' => 2, + ), 'dupe_check' => array( - 'title' => 'Check for Duplicates', - 'description' => 'Throw error if contact create matches dedupe rule', - ), + 'title' => 'Check for Duplicates', + 'description' => 'Throw error if contact create matches dedupe rule', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCustomFieldCreateWithOptionValues and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCustomFieldCreateWithOptionValues +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/GetSingleContact.php b/api/v3/examples/Contact/GetSingleContact.php index c2fa77de64..ef15484569 100644 --- a/api/v3/examples/Contact/GetSingleContact.php +++ b/api/v3/examples/Contact/GetSingleContact.php @@ -1,111 +1,128 @@ 17, -); +function contact_getsingle_example() { + $params = array( + 'id' => 17, + ); -try{ - $result = civicrm_api3('contact', 'getsingle', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'getsingle', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_getsingle_expectedresult(){ +function contact_getsingle_expectedresult() { $expectedResult = array( - 'contact_id' => '17', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => '', - 'display_name' => 'Test Contact', - 'do_not_email' => '', - 'do_not_phone' => '', - 'do_not_mail' => '', - 'do_not_sms' => '', - 'do_not_trade' => '', - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => '', - 'preferred_mail_format' => '', - 'first_name' => 'Test', - 'middle_name' => '', - 'last_name' => 'Contact', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'organization_name' => '', - 'sic_code' => '', - 'contact_is_deleted' => 0, - 'current_employer' => '', - 'address_id' => '', - 'street_address' => '', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'postal_code_suffix' => '', - 'postal_code' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - 'state_province_id' => '', - 'country_id' => '', - 'phone_id' => '', - 'phone_type_id' => '', - 'phone' => '', - 'email_id' => '', - 'email' => '', - 'on_hold' => '', - 'im_id' => '', - 'provider_id' => '', - 'im' => '', - 'worldregion_id' => '', - 'world_region' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', - 'gender' => '', - 'state_province_name' => '', - 'state_province' => '', - 'country' => '', - 'id' => '17', -); + 'contact_id' => '17', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => '', + 'display_name' => 'Test Contact', + 'do_not_email' => '', + 'do_not_phone' => '', + 'do_not_mail' => '', + 'do_not_sms' => '', + 'do_not_trade' => '', + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => '', + 'preferred_mail_format' => '', + 'first_name' => 'Test', + 'middle_name' => '', + 'last_name' => 'Contact', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'organization_name' => '', + 'sic_code' => '', + 'contact_is_deleted' => 0, + 'current_employer' => '', + 'address_id' => '', + 'street_address' => '', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'postal_code_suffix' => '', + 'postal_code' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + 'state_province_id' => '', + 'country_id' => '', + 'phone_id' => '', + 'phone_type_id' => '', + 'phone' => '', + 'email_id' => '', + 'email' => '', + 'on_hold' => '', + 'im_id' => '', + 'provider_id' => '', + 'im' => '', + 'worldregion_id' => '', + 'world_region' => '', + 'individual_prefix' => '', + 'individual_suffix' => '', + 'communication_style' => '', + 'gender' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '17', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactGetSingle_entity_array and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactGetSingle_entity_array +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/Getoptions.php b/api/v3/examples/Contact/Getoptions.php index 23997f5a63..c7ed0a575f 100644 --- a/api/v3/examples/Contact/Getoptions.php +++ b/api/v3/examples/Contact/Getoptions.php @@ -1,50 +1,67 @@ 'custom_1', -); -try{ - $result = civicrm_api3('contact', 'getoptions', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contact getoptions API. + * + * Demonstrates retrieving options for a custom field + * + * @return array + * API result array + */ +function contact_getoptions_example() { + $params = array( + 'field' => 'custom_1', + ); -return $result; + try{ + $result = civicrm_api3('contact', 'getoptions', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_getoptions_expectedresult(){ +function contact_getoptions_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '1' => 'Label1', '2' => 'Label2', ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCustomFieldCreateWithOptionValues and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCustomFieldCreateWithOptionValues +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contact/GroupFilterUsingContactAPI.php b/api/v3/examples/Contact/GroupFilterUsingContactAPI.php index 7099c96631..9d3df4cf95 100644 --- a/api/v3/examples/Contact/GroupFilterUsingContactAPI.php +++ b/api/v3/examples/Contact/GroupFilterUsingContactAPI.php @@ -1,121 +1,138 @@ array( + +/** + * Test Generated example of using contact get API. + * + * Get all from group and display contacts + * + * @return array + * API result array + */ +function contact_get_example() { + $params = array( + 'filter.group_id' => array( '0' => 1, '1' => 26, ), - 'contact_type' => 'Individual', -); + 'contact_type' => 'Individual', + ); -try{ - $result = civicrm_api3('contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contact_get_expectedresult(){ +function contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'man2@yahoo.com', - 'display_name' => 'man2@yahoo.com', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'first_name' => '', - 'middle_name' => '', - 'last_name' => '', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'organization_name' => '', - 'sic_code' => '', - 'contact_is_deleted' => 0, - 'current_employer' => '', - 'address_id' => '2', - 'street_address' => '1 my road', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'postal_code_suffix' => '', - 'postal_code' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - 'state_province_id' => '', - 'country_id' => '', - 'phone_id' => '', - 'phone_type_id' => '', - 'phone' => '', - 'email_id' => '1', - 'email' => 'man2@yahoo.com', - 'on_hold' => 0, - 'im_id' => '', - 'provider_id' => '', - 'im' => '', - 'worldregion_id' => '', - 'world_region' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', - 'gender' => '', - 'state_province_name' => '', - 'state_province' => '', - 'country' => '', - 'id' => '1', - ), + 'contact_id' => '1', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'man2@yahoo.com', + 'display_name' => 'man2@yahoo.com', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'first_name' => '', + 'middle_name' => '', + 'last_name' => '', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'organization_name' => '', + 'sic_code' => '', + 'contact_is_deleted' => 0, + 'current_employer' => '', + 'address_id' => '2', + 'street_address' => '1 my road', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'postal_code_suffix' => '', + 'postal_code' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + 'state_province_id' => '', + 'country_id' => '', + 'phone_id' => '', + 'phone_type_id' => '', + 'phone' => '', + 'email_id' => '1', + 'email' => 'man2@yahoo.com', + 'on_hold' => 0, + 'im_id' => '', + 'provider_id' => '', + 'im' => '', + 'worldregion_id' => '', + 'world_region' => '', + 'individual_prefix' => '', + 'individual_suffix' => '', + 'communication_style' => '', + 'gender' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetGroupIDFromContact and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetGroupIDFromContact +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php b/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php index 1b5edf550e..fb2a044465 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php +++ b/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php @@ -1,89 +1,106 @@ 3, - 'receive_date' => '20120511', - 'total_amount' => '100', - 'financial_type_id' => 1, - 'non_deductible_amount' => '10', - 'fee_amount' => '5', - 'net_amount' => '95', - 'source' => 'SSF', - 'contribution_status_id' => 1, - 'honor_contact_id' => 4, -); -try{ - $result = civicrm_api3('contribution', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution create API. + * + * Demonstrates creating contribution with Soft Credit by passing in honor_contact_id + * + * @return array + * API result array + */ +function contribution_create_example() { + $params = array( + 'contact_id' => 24, + 'receive_date' => '20120511', + 'total_amount' => '100', + 'financial_type_id' => 1, + 'non_deductible_amount' => '10', + 'fee_amount' => '5', + 'net_amount' => '95', + 'source' => 'SSF', + 'contribution_status_id' => 1, + 'honor_contact_id' => 25, + ); -return $result; + try{ + $result = civicrm_api3('contribution', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_create_expectedresult(){ +function contribution_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '3', - 'financial_type_id' => '1', - 'contribution_page_id' => '', - 'payment_instrument_id' => '4', - 'receive_date' => '20120511000000', - 'non_deductible_amount' => '10', - 'total_amount' => '100', - 'fee_amount' => '5', - 'net_amount' => '95', - 'trxn_id' => '', - 'invoice_id' => '', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'SSF', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '1', - 'address_id' => '', - 'check_number' => '', - 'campaign_id' => '', - 'creditnote_id' => '', - 'tax_amount' => '', - 'contribution_type_id' => '1', - ), + 'id' => '1', + 'contact_id' => '24', + 'financial_type_id' => '1', + 'contribution_page_id' => '', + 'payment_instrument_id' => '4', + 'receive_date' => '20120511000000', + 'non_deductible_amount' => '10', + 'total_amount' => '100', + 'fee_amount' => '5', + 'net_amount' => '95', + 'trxn_id' => '', + 'invoice_id' => '', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '1', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '', + 'contribution_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionWithHonoreeContact and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionWithHonoreeContact +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contribution/ContributionCreateWithNote.php b/api/v3/examples/Contribution/ContributionCreateWithNote.php index 6cd86fea80..d8e1fb903d 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithNote.php +++ b/api/v3/examples/Contribution/ContributionCreateWithNote.php @@ -1,92 +1,109 @@ 1, - 'receive_date' => '2012-01-01', - 'total_amount' => '100', - 'financial_type_id' => 1, - 'payment_instrument_id' => 1, - 'non_deductible_amount' => '10', - 'fee_amount' => '50', - 'net_amount' => '90', - 'trxn_id' => 12345, - 'invoice_id' => 67890, - 'source' => 'SSF', - 'contribution_status_id' => 1, - 'note' => 'my contribution note', -); -try{ - $result = civicrm_api3('contribution', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution create API. + * + * Demonstrates creating contribution with Note Entity + * + * @return array + * API result array + */ +function contribution_create_example() { + $params = array( + 'contact_id' => 18, + 'receive_date' => '2012-01-01', + 'total_amount' => '100', + 'financial_type_id' => 1, + 'payment_instrument_id' => 1, + 'non_deductible_amount' => '10', + 'fee_amount' => '50', + 'net_amount' => '90', + 'trxn_id' => 12345, + 'invoice_id' => 67890, + 'source' => 'SSF', + 'contribution_status_id' => 1, + 'note' => 'my contribution note', + ); -return $result; + try{ + $result = civicrm_api3('contribution', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_create_expectedresult(){ +function contribution_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '1', - 'financial_type_id' => '1', - 'contribution_page_id' => '', - 'payment_instrument_id' => '1', - 'receive_date' => '20120101000000', - 'non_deductible_amount' => '10', - 'total_amount' => '100', - 'fee_amount' => '50', - 'net_amount' => '90', - 'trxn_id' => '12345', - 'invoice_id' => '67890', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'SSF', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '1', - 'address_id' => '', - 'check_number' => '', - 'campaign_id' => '', - 'creditnote_id' => '', - 'tax_amount' => '', - 'contribution_type_id' => '1', - ), + 'id' => '1', + 'contact_id' => '18', + 'financial_type_id' => '1', + 'contribution_page_id' => '', + 'payment_instrument_id' => '1', + 'receive_date' => '20120101000000', + 'non_deductible_amount' => '10', + 'total_amount' => '100', + 'fee_amount' => '50', + 'net_amount' => '90', + 'trxn_id' => '12345', + 'invoice_id' => '67890', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '1', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '', + 'contribution_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionWithNote and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionWithNote +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php b/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php index 5b4e1cfe1e..3bb8a9baca 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php +++ b/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php @@ -1,95 +1,112 @@ 1, - 'receive_date' => '20120511', - 'total_amount' => '100', - 'financial_type_id' => 1, - 'non_deductible_amount' => '10', - 'fee_amount' => '5', - 'net_amount' => '95', - 'source' => 'SSF', - 'contribution_status_id' => 1, - 'soft_credit' => array( + +/** + * Test Generated example of using contribution create API. + * + * Demonstrates creating contribution with SoftCredit + * + * @return array + * API result array + */ +function contribution_create_example() { + $params = array( + 'contact_id' => 20, + 'receive_date' => '20120511', + 'total_amount' => '100', + 'financial_type_id' => 1, + 'non_deductible_amount' => '10', + 'fee_amount' => '5', + 'net_amount' => '95', + 'source' => 'SSF', + 'contribution_status_id' => 1, + 'soft_credit' => array( '1' => array( - 'contact_id' => 2, - 'amount' => 50, - 'soft_credit_type_id' => 3, - ), + 'contact_id' => 21, + 'amount' => 50, + 'soft_credit_type_id' => 3, + ), ), -); + ); -try{ - $result = civicrm_api3('contribution', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contribution', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_create_expectedresult(){ +function contribution_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '1', - 'financial_type_id' => '1', - 'contribution_page_id' => '', - 'payment_instrument_id' => '4', - 'receive_date' => '20120511000000', - 'non_deductible_amount' => '10', - 'total_amount' => '100', - 'fee_amount' => '5', - 'net_amount' => '95', - 'trxn_id' => '', - 'invoice_id' => '', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'SSF', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '1', - 'address_id' => '', - 'check_number' => '', - 'campaign_id' => '', - 'creditnote_id' => '', - 'tax_amount' => '', - 'contribution_type_id' => '1', - ), + 'id' => '1', + 'contact_id' => '20', + 'financial_type_id' => '1', + 'contribution_page_id' => '', + 'payment_instrument_id' => '4', + 'receive_date' => '20120511000000', + 'non_deductible_amount' => '10', + 'total_amount' => '100', + 'fee_amount' => '5', + 'net_amount' => '95', + 'trxn_id' => '', + 'invoice_id' => '', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '1', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '', + 'contribution_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionWithSoftCredt and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionWithSoftCredt +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php b/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php index 15b486beaa..ed48e642c9 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php +++ b/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php @@ -1,89 +1,106 @@ 3, - 'receive_date' => '20120511', - 'total_amount' => '100', - 'financial_type_id' => 1, - 'non_deductible_amount' => '10', - 'fee_amount' => '5', - 'net_amount' => '95', - 'source' => 'SSF', - 'contribution_status_id' => 1, - 'soft_credit_to' => 4, -); -try{ - $result = civicrm_api3('contribution', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution create API. + * + * Demonstrates creating contribution with Soft Credit defaults for amount and type + * + * @return array + * API result array + */ +function contribution_create_example() { + $params = array( + 'contact_id' => 22, + 'receive_date' => '20120511', + 'total_amount' => '100', + 'financial_type_id' => 1, + 'non_deductible_amount' => '10', + 'fee_amount' => '5', + 'net_amount' => '95', + 'source' => 'SSF', + 'contribution_status_id' => 1, + 'soft_credit_to' => 23, + ); -return $result; + try{ + $result = civicrm_api3('contribution', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_create_expectedresult(){ +function contribution_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '3', - 'financial_type_id' => '1', - 'contribution_page_id' => '', - 'payment_instrument_id' => '4', - 'receive_date' => '20120511000000', - 'non_deductible_amount' => '10', - 'total_amount' => '100', - 'fee_amount' => '5', - 'net_amount' => '95', - 'trxn_id' => '', - 'invoice_id' => '', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'SSF', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '1', - 'address_id' => '', - 'check_number' => '', - 'campaign_id' => '', - 'creditnote_id' => '', - 'tax_amount' => '', - 'contribution_type_id' => '1', - ), + 'id' => '1', + 'contact_id' => '22', + 'financial_type_id' => '1', + 'contribution_page_id' => '', + 'payment_instrument_id' => '4', + 'receive_date' => '20120511000000', + 'non_deductible_amount' => '10', + 'total_amount' => '100', + 'fee_amount' => '5', + 'net_amount' => '95', + 'trxn_id' => '', + 'invoice_id' => '', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '1', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '', + 'contribution_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionWithSoftCreditDefaults and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionWithSoftCreditDefaults +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contribution/Create.php b/api/v3/examples/Contribution/Create.php index b95cd2a3d7..a1d467c21f 100644 --- a/api/v3/examples/Contribution/Create.php +++ b/api/v3/examples/Contribution/Create.php @@ -1,88 +1,104 @@ 1, - 'receive_date' => '20120511', - 'total_amount' => '100', - 'financial_type_id' => 1, - 'contribution_page_id' => 1, - 'trxn_id' => 12345, - 'invoice_id' => 67890, - 'source' => 'SSF', - 'contribution_status_id' => 2, -); -try{ - $result = civicrm_api3('contribution', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution create API. + * + * + * @return array + * API result array + */ +function contribution_create_example() { + $params = array( + 'contact_id' => 32, + 'receive_date' => '20120511', + 'total_amount' => '100', + 'financial_type_id' => 1, + 'contribution_page_id' => 1, + 'trxn_id' => 12345, + 'invoice_id' => 67890, + 'source' => 'SSF', + 'contribution_status_id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('contribution', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_create_expectedresult(){ +function contribution_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '1', - 'financial_type_id' => '1', - 'contribution_page_id' => '1', - 'payment_instrument_id' => '4', - 'receive_date' => '20120511000000', - 'non_deductible_amount' => '', - 'total_amount' => '100', - 'fee_amount' => 0, - 'net_amount' => '100', - 'trxn_id' => '12345', - 'invoice_id' => '67890', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'SSF', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '2', - 'address_id' => '', - 'check_number' => '', - 'campaign_id' => '', - 'creditnote_id' => '', - 'tax_amount' => '', - 'contribution_type_id' => '1', - ), + 'id' => '1', + 'contact_id' => '32', + 'financial_type_id' => '1', + 'contribution_page_id' => '1', + 'payment_instrument_id' => '4', + 'receive_date' => '20120511000000', + 'non_deductible_amount' => '', + 'total_amount' => '100', + 'fee_amount' => 0, + 'net_amount' => '100', + 'trxn_id' => '12345', + 'invoice_id' => '67890', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '2', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '', + 'contribution_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionPendingOnline and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionPendingOnline +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contribution/CreateWithNestedLineItems.php b/api/v3/examples/Contribution/CreateWithNestedLineItems.php index cb73ee2c99..e36b07fafd 100644 --- a/api/v3/examples/Contribution/CreateWithNestedLineItems.php +++ b/api/v3/examples/Contribution/CreateWithNestedLineItems.php @@ -1,156 +1,173 @@ 1, - 'receive_date' => '20120511', - 'total_amount' => '100', - 'financial_type_id' => 1, - 'payment_instrument_id' => 1, - 'non_deductible_amount' => '10', - 'fee_amount' => '50', - 'net_amount' => '90', - 'trxn_id' => 12345, - 'invoice_id' => 67890, - 'source' => 'SSF', - 'contribution_status_id' => 1, - 'skipLineItem' => 1, - 'api.line_item.create' => array( + +/** + * Test Generated example of using contribution create API. + * + * Create Contribution with Nested Line Items + * + * @return array + * API result array + */ +function contribution_create_example() { + $params = array( + 'contact_id' => 10, + 'receive_date' => '20120511', + 'total_amount' => '100', + 'financial_type_id' => 1, + 'payment_instrument_id' => 1, + 'non_deductible_amount' => '10', + 'fee_amount' => '50', + 'net_amount' => '90', + 'trxn_id' => 12345, + 'invoice_id' => 67890, + 'source' => 'SSF', + 'contribution_status_id' => 1, + 'skipLineItem' => 1, + 'api.line_item.create' => array( '0' => array( - 'price_field_id' => 1, - 'qty' => 2, - 'line_total' => '20', - 'unit_price' => '10', - ), + 'price_field_id' => 1, + 'qty' => 2, + 'line_total' => '20', + 'unit_price' => '10', + ), '1' => array( - 'price_field_id' => 1, - 'qty' => 1, - 'line_total' => '80', - 'unit_price' => '80', - ), + 'price_field_id' => 1, + 'qty' => 1, + 'line_total' => '80', + 'unit_price' => '80', + ), ), -); + ); -try{ - $result = civicrm_api3('contribution', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contribution', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_create_expectedresult(){ +function contribution_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '1', - 'financial_type_id' => '1', - 'contribution_page_id' => '', - 'payment_instrument_id' => '1', - 'receive_date' => '20120511000000', - 'non_deductible_amount' => '10', - 'total_amount' => '100', - 'fee_amount' => '50', - 'net_amount' => '90', - 'trxn_id' => '12345', - 'invoice_id' => '67890', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'SSF', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '1', - 'address_id' => '', - 'check_number' => '', - 'campaign_id' => '', - 'creditnote_id' => '', - 'tax_amount' => 0, - 'contribution_type_id' => '1', - 'api.line_item.create' => array( + 'id' => '1', + 'contact_id' => '10', + 'financial_type_id' => '1', + 'contribution_page_id' => '', + 'payment_instrument_id' => '1', + 'receive_date' => '20120511000000', + 'non_deductible_amount' => '10', + 'total_amount' => '100', + 'fee_amount' => '50', + 'net_amount' => '90', + 'trxn_id' => '12345', + 'invoice_id' => '67890', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '1', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => 0, + 'contribution_type_id' => '1', + 'api.line_item.create' => array( + '0' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'entity_table' => 'civicrm_contribution', + 'entity_id' => '1', + 'contribution_id' => '1', + 'price_field_id' => '1', + 'label' => 'line item', + 'qty' => '2', + 'unit_price' => '10', + 'line_total' => '20', + 'participant_count' => '', + 'price_field_value_id' => '', + 'financial_type_id' => '', + 'deductible_amount' => '', + 'tax_amount' => '', + ), + ), + ), + '1' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '0' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'entity_table' => 'civicrm_contribution', - 'entity_id' => '1', - 'contribution_id' => '1', - 'price_field_id' => '1', - 'label' => 'line item', - 'qty' => '2', - 'unit_price' => '10', - 'line_total' => '20', - 'participant_count' => '', - 'price_field_value_id' => '', - 'financial_type_id' => '', - 'deductible_amount' => '', - 'tax_amount' => '', - ), - ), - ), - '1' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( - '0' => array( - 'id' => '2', - 'entity_table' => 'civicrm_contribution', - 'entity_id' => '1', - 'contribution_id' => '1', - 'price_field_id' => '1', - 'label' => 'line item', - 'qty' => '1', - 'unit_price' => '80', - 'line_total' => '80', - 'participant_count' => '', - 'price_field_value_id' => '', - 'financial_type_id' => '', - 'deductible_amount' => '', - 'tax_amount' => '', - ), - ), - ), + 'id' => '2', + 'entity_table' => 'civicrm_contribution', + 'entity_id' => '1', + 'contribution_id' => '1', + 'price_field_id' => '1', + 'label' => 'line item', + 'qty' => '1', + 'unit_price' => '80', + 'line_total' => '80', + 'participant_count' => '', + 'price_field_value_id' => '', + 'financial_type_id' => '', + 'deductible_amount' => '', + 'tax_amount' => '', + ), ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionChainedLineItems and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionChainedLineItems +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contribution/Delete.php b/api/v3/examples/Contribution/Delete.php index 5db1595662..dea4e1e419 100644 --- a/api/v3/examples/Contribution/Delete.php +++ b/api/v3/examples/Contribution/Delete.php @@ -1,50 +1,66 @@ 1, -); -try{ - $result = civicrm_api3('contribution', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution delete API. + * + * + * @return array + * API result array + */ +function contribution_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('contribution', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_delete_expectedresult(){ +function contribution_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => 1, ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteContribution and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteContribution +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Contribution/Get.php b/api/v3/examples/Contribution/Get.php index 4636716e0b..549a7e4b17 100644 --- a/api/v3/examples/Contribution/Get.php +++ b/api/v3/examples/Contribution/Get.php @@ -1,98 +1,114 @@ 1, -); -try{ - $result = civicrm_api3('contribution', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution get API. + * + * + * @return array + * API result array + */ +function contribution_get_example() { + $params = array( + 'contribution_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('contribution', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_get_expectedresult(){ +function contribution_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '1', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'Anderson, Anthony', - 'display_name' => 'Mr. Anthony Anderson II', - 'contribution_id' => '1', - 'currency' => 'USD', - 'receive_date' => '2010-01-20 00:00:00', - 'non_deductible_amount' => '10.00', - 'total_amount' => '100.00', - 'fee_amount' => '5.00', - 'net_amount' => '95.00', - 'trxn_id' => '23456', - 'invoice_id' => '78910', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'contribution_source' => 'SSF', - 'amount_level' => '', - 'is_test' => 0, - 'is_pay_later' => 0, - 'contribution_status_id' => '1', - 'check_number' => '', - 'contribution_campaign_id' => '', - 'financial_type_id' => '1', - 'financial_type' => 'Donation', - 'instrument_id' => '87', - 'payment_instrument' => 'Check', - 'product_id' => '', - 'product_name' => '', - 'sku' => '', - 'contribution_product_id' => '', - 'product_option' => '', - 'fulfilled_date' => '', - 'contribution_start_date' => '', - 'contribution_end_date' => '', - 'contribution_recur_id' => '', - 'financial_account_id' => '1', - 'accounting_code' => '4200', - 'contribution_note' => '', - 'contribution_batch' => '', - 'contribution_status' => 'Completed', - 'contribution_payment_instrument' => 'Check', - 'contribution_check_number' => '', - 'id' => '1', - 'contribution_type_id' => '1', - ), + 'contact_id' => '4', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'contribution_id' => '1', + 'currency' => 'USD', + 'receive_date' => '2010-01-20 00:00:00', + 'non_deductible_amount' => '10.00', + 'total_amount' => '100.00', + 'fee_amount' => '5.00', + 'net_amount' => '95.00', + 'trxn_id' => '23456', + 'invoice_id' => '78910', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'contribution_source' => 'SSF', + 'amount_level' => '', + 'is_test' => 0, + 'is_pay_later' => 0, + 'contribution_status_id' => '1', + 'check_number' => '', + 'contribution_campaign_id' => '', + 'financial_type_id' => '1', + 'financial_type' => 'Donation', + 'instrument_id' => '89', + 'payment_instrument' => 'Check', + 'product_id' => '', + 'product_name' => '', + 'sku' => '', + 'contribution_product_id' => '', + 'product_option' => '', + 'fulfilled_date' => '', + 'contribution_start_date' => '', + 'contribution_end_date' => '', + 'contribution_recur_id' => '', + 'financial_account_id' => '1', + 'accounting_code' => '4200', + 'contribution_note' => '', + 'contribution_batch' => '', + 'contribution_status' => 'Completed', + 'contribution_payment_instrument' => 'Check', + 'contribution_check_number' => '', + 'id' => '1', + 'contribution_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetContributionLegacyBehaviour and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetContributionLegacyBehaviour +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionPage/Create.php b/api/v3/examples/ContributionPage/Create.php index b03529023e..893abfbb57 100644 --- a/api/v3/examples/ContributionPage/Create.php +++ b/api/v3/examples/ContributionPage/Create.php @@ -1,102 +1,118 @@ 'Test Contribution Page', - 'financial_type_id' => 1, - 'currency' => 'NZD', - 'goal_amount' => 34567, - 'is_pay_later' => 1, - 'is_monetary' => true, -); -try{ - $result = civicrm_api3('contribution_page', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_page create API. + * + * + * @return array + * API result array + */ +function contribution_page_create_example() { + $params = array( + 'title' => 'Test Contribution Page', + 'financial_type_id' => 1, + 'currency' => 'NZD', + 'goal_amount' => 34567, + 'is_pay_later' => 1, + 'is_monetary' => TRUE, + ); -return $result; + try{ + $result = civicrm_api3('contribution_page', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_page_create_expectedresult(){ +function contribution_page_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'title' => 'Test Contribution Page', - 'intro_text' => '', - 'financial_type_id' => '1', - 'payment_processor' => '', - 'is_credit_card_only' => '', - 'is_monetary' => '1', - 'is_recur' => '', - 'is_confirm_enabled' => '', - 'recur_frequency_unit' => '', - 'is_recur_interval' => '', - 'is_recur_installments' => '', - 'is_pay_later' => '1', - 'pay_later_text' => '', - 'pay_later_receipt' => '', - 'is_partial_payment' => '', - 'initial_amount_label' => '', - 'initial_amount_help_text' => '', - 'min_initial_amount' => '', - 'is_allow_other_amount' => '', - 'default_amount_id' => '', - 'min_amount' => '', - 'max_amount' => '', - 'goal_amount' => '34567', - 'thankyou_title' => '', - 'thankyou_text' => '', - 'thankyou_footer' => '', - 'is_for_organization' => '', - 'for_organization' => '', - 'is_email_receipt' => '', - 'receipt_from_name' => '', - 'receipt_from_email' => '', - 'cc_receipt' => '', - 'bcc_receipt' => '', - 'receipt_text' => '', - 'is_active' => '1', - 'footer_text' => '', - 'amount_block_is_active' => '', - 'start_date' => '', - 'end_date' => '', - 'created_id' => '', - 'created_date' => '', - 'currency' => 'NZD', - 'campaign_id' => '', - 'is_share' => '', - 'is_billing_required' => '', - ), + 'id' => '1', + 'title' => 'Test Contribution Page', + 'intro_text' => '', + 'financial_type_id' => '1', + 'payment_processor' => '', + 'is_credit_card_only' => '', + 'is_monetary' => '1', + 'is_recur' => '', + 'is_confirm_enabled' => '', + 'recur_frequency_unit' => '', + 'is_recur_interval' => '', + 'is_recur_installments' => '', + 'is_pay_later' => '1', + 'pay_later_text' => '', + 'pay_later_receipt' => '', + 'is_partial_payment' => '', + 'initial_amount_label' => '', + 'initial_amount_help_text' => '', + 'min_initial_amount' => '', + 'is_allow_other_amount' => '', + 'default_amount_id' => '', + 'min_amount' => '', + 'max_amount' => '', + 'goal_amount' => '34567', + 'thankyou_title' => '', + 'thankyou_text' => '', + 'thankyou_footer' => '', + 'is_for_organization' => '', + 'for_organization' => '', + 'is_email_receipt' => '', + 'receipt_from_name' => '', + 'receipt_from_email' => '', + 'cc_receipt' => '', + 'bcc_receipt' => '', + 'receipt_text' => '', + 'is_active' => '1', + 'footer_text' => '', + 'amount_block_is_active' => '', + 'start_date' => '', + 'end_date' => '', + 'created_id' => '', + 'created_date' => '', + 'currency' => 'NZD', + 'campaign_id' => '', + 'is_share' => '', + 'is_billing_required' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionPage and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionPage +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionPage/Delete.php b/api/v3/examples/ContributionPage/Delete.php index 24ddce6520..08d3f01aeb 100644 --- a/api/v3/examples/ContributionPage/Delete.php +++ b/api/v3/examples/ContributionPage/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('contribution_page', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_page delete API. + * + * + * @return array + * API result array + */ +function contribution_page_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('contribution_page', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_page_delete_expectedresult(){ +function contribution_page_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteContributionPage and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteContributionPage +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionPage/Get.php b/api/v3/examples/ContributionPage/Get.php index 55dbd5ad5d..64e6641df7 100644 --- a/api/v3/examples/ContributionPage/Get.php +++ b/api/v3/examples/ContributionPage/Get.php @@ -1,73 +1,89 @@ '34567', - 'currency' => 'NZD', - 'financial_type_id' => 1, -); -try{ - $result = civicrm_api3('contribution_page', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_page get API. + * + * + * @return array + * API result array + */ +function contribution_page_get_example() { + $params = array( + 'amount' => '34567', + 'currency' => 'NZD', + 'financial_type_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('contribution_page', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_page_get_expectedresult(){ +function contribution_page_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'title' => 'Test Contribution Page', - 'financial_type_id' => '1', - 'is_credit_card_only' => 0, - 'is_monetary' => '1', - 'is_recur' => 0, - 'is_confirm_enabled' => '1', - 'is_recur_interval' => 0, - 'is_recur_installments' => 0, - 'is_pay_later' => '1', - 'is_partial_payment' => 0, - 'is_allow_other_amount' => 0, - 'goal_amount' => '34567.00', - 'is_for_organization' => 0, - 'is_email_receipt' => 0, - 'is_active' => '1', - 'amount_block_is_active' => '1', - 'currency' => 'NZD', - 'is_share' => '1', - 'is_billing_required' => 0, - ), + 'id' => '1', + 'title' => 'Test Contribution Page', + 'financial_type_id' => '1', + 'is_credit_card_only' => 0, + 'is_monetary' => '1', + 'is_recur' => 0, + 'is_confirm_enabled' => '1', + 'is_recur_interval' => 0, + 'is_recur_installments' => 0, + 'is_pay_later' => '1', + 'is_partial_payment' => 0, + 'is_allow_other_amount' => 0, + 'goal_amount' => '34567.00', + 'is_for_organization' => 0, + 'is_email_receipt' => 0, + 'is_active' => '1', + 'amount_block_is_active' => '1', + 'currency' => 'NZD', + 'is_share' => '1', + 'is_billing_required' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetContributionPageByAmount and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetContributionPageByAmount +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionPage/Submit.php b/api/v3/examples/ContributionPage/Submit.php index 6c0cefb0de..e380559ee4 100644 --- a/api/v3/examples/ContributionPage/Submit.php +++ b/api/v3/examples/ContributionPage/Submit.php @@ -1,67 +1,84 @@ '', - 'id' => 1, - 'amount' => 10, - 'billing_first_name' => 'Billy', - 'billing_middle_name' => 'Goat', - 'billing_last_name' => 'Gruff', - 'email' => 'billy@goat.gruff', - 'selectMembership' => array( + +/** + * Test Generated example of using contribution_page Submit API. + * + * submit contribution page + * + * @return array + * API result array + */ +function contribution_page_submit_example() { + $params = array( + 'price_3' => '', + 'id' => 1, + 'amount' => 10, + 'billing_first_name' => 'Billy', + 'billing_middle_name' => 'Goat', + 'billing_last_name' => 'Gruff', + 'email' => 'billy@goat.gruff', + 'selectMembership' => array( '0' => 1, ), - 'payment_processor' => 1, - 'credit_card_number' => '4111111111111111', - 'credit_card_type' => 'Visa', - 'credit_card_exp_date' => array( + 'payment_processor' => 1, + 'credit_card_number' => '4111111111111111', + 'credit_card_type' => 'Visa', + 'credit_card_exp_date' => array( 'M' => 9, 'Y' => 2040, ), - 'cvv2' => 123, - 'is_recur' => 1, - 'frequency_interval' => 1, - 'frequency_unit' => 'month', -); + 'cvv2' => 123, + 'is_recur' => 1, + 'frequency_interval' => 1, + 'frequency_unit' => 'month', + ); -try{ - $result = civicrm_api3('contribution_page', 'Submit', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('contribution_page', 'Submit', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_page_submit_expectedresult(){ +function contribution_page_submit_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 0, - 'values' => '', -); + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => '', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testSubmitMembershipPriceSetPaymentPaymentProcessorRecurDelayed and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testSubmitMembershipPriceSetPaymentPaymentProcessorRecurDelayed +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionRecur/Create.php b/api/v3/examples/ContributionRecur/Create.php index 4fcb5e025c..2ea2c9bf67 100644 --- a/api/v3/examples/ContributionRecur/Create.php +++ b/api/v3/examples/ContributionRecur/Create.php @@ -1,85 +1,101 @@ 3, - 'installments' => '12', - 'frequency_interval' => '1', - 'amount' => '500', - 'contribution_status_id' => 1, - 'start_date' => '2012-01-01 00:00:00', - 'currency' => 'USD', - 'frequency_unit' => 'day', -); -try{ - $result = civicrm_api3('contribution_recur', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_recur create API. + * + * + * @return array + * API result array + */ +function contribution_recur_create_example() { + $params = array( + 'contact_id' => 3, + 'installments' => '12', + 'frequency_interval' => '1', + 'amount' => '500', + 'contribution_status_id' => 1, + 'start_date' => '2012-01-01 00:00:00', + 'currency' => 'USD', + 'frequency_unit' => 'day', + ); -return $result; + try{ + $result = civicrm_api3('contribution_recur', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_recur_create_expectedresult(){ +function contribution_recur_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '3', - 'amount' => '500', - 'currency' => 'USD', - 'frequency_unit' => 'day', - 'frequency_interval' => '1', - 'installments' => '12', - 'start_date' => '2013-07-29 00:00:00', - 'create_date' => '20120130621222105', - 'modified_date' => '', - 'cancel_date' => '', - 'end_date' => '', - 'processor_id' => '', - 'trxn_id' => '', - 'invoice_id' => '', - 'contribution_status_id' => '1', - 'is_test' => '', - 'cycle_day' => '', - 'next_sched_contribution_date' => '', - 'failure_count' => '', - 'failure_retry_date' => '', - 'auto_renew' => '', - 'payment_processor_id' => '', - 'financial_type_id' => '', - 'payment_instrument_id' => '', - 'campaign_id' => '', - 'is_email_receipt' => '', - ), + 'id' => '1', + 'contact_id' => '3', + 'amount' => '500', + 'currency' => 'USD', + 'frequency_unit' => 'day', + 'frequency_interval' => '1', + 'installments' => '12', + 'start_date' => '2013-07-29 00:00:00', + 'create_date' => '20120130621222105', + 'modified_date' => '', + 'cancel_date' => '', + 'end_date' => '', + 'processor_id' => '', + 'trxn_id' => '', + 'invoice_id' => '', + 'contribution_status_id' => '1', + 'is_test' => '', + 'cycle_day' => '', + 'next_sched_contribution_date' => '', + 'failure_count' => '', + 'failure_retry_date' => '', + 'auto_renew' => '', + 'payment_processor_id' => '', + 'financial_type_id' => '', + 'payment_instrument_id' => '', + 'campaign_id' => '', + 'is_email_receipt' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionRecur and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionRecur +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionRecur/Delete.php b/api/v3/examples/ContributionRecur/Delete.php index b104226df9..d1a1ca0741 100644 --- a/api/v3/examples/ContributionRecur/Delete.php +++ b/api/v3/examples/ContributionRecur/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('contribution_recur', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_recur delete API. + * + * + * @return array + * API result array + */ +function contribution_recur_delete_example() { + $params = array( + 'id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('contribution_recur', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_recur_delete_expectedresult(){ +function contribution_recur_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteContributionRecur and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteContributionRecur +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionRecur/Get.php b/api/v3/examples/ContributionRecur/Get.php index d9ae74745f..4a938ac26b 100644 --- a/api/v3/examples/ContributionRecur/Get.php +++ b/api/v3/examples/ContributionRecur/Get.php @@ -1,66 +1,82 @@ '500', -); -try{ - $result = civicrm_api3('contribution_recur', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_recur get API. + * + * + * @return array + * API result array + */ +function contribution_recur_get_example() { + $params = array( + 'amount' => '500', + ); -return $result; + try{ + $result = civicrm_api3('contribution_recur', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_recur_get_expectedresult(){ +function contribution_recur_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'contact_id' => '4', - 'amount' => '500.00', - 'currency' => 'USD', - 'frequency_unit' => 'day', - 'frequency_interval' => '1', - 'installments' => '12', - 'start_date' => '2013-07-29 00:00:00', - 'create_date' => '20120130621222105', - 'contribution_status_id' => '1', - 'is_test' => 0, - 'cycle_day' => '1', - 'failure_count' => 0, - 'auto_renew' => 0, - 'is_email_receipt' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'contact_id' => '4', + 'amount' => '500.00', + 'currency' => 'USD', + 'frequency_unit' => 'day', + 'frequency_interval' => '1', + 'installments' => '12', + 'start_date' => '2013-07-29 00:00:00', + 'create_date' => '20120130621222105', + 'contribution_status_id' => '1', + 'is_test' => 0, + 'cycle_day' => '1', + 'failure_count' => 0, + 'auto_renew' => 0, + 'is_email_receipt' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetContributionRecur and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetContributionRecur +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionSoft/Create.php b/api/v3/examples/ContributionSoft/Create.php index ff9f747718..00e20b2b07 100644 --- a/api/v3/examples/ContributionSoft/Create.php +++ b/api/v3/examples/ContributionSoft/Create.php @@ -1,65 +1,81 @@ 1, - 'contact_id' => 2, - 'amount' => '10', - 'currency' => 'USD', - 'soft_credit_type_id' => 5, -); -try{ - $result = civicrm_api3('contribution_soft', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_soft create API. + * + * + * @return array + * API result array + */ +function contribution_soft_create_example() { + $params = array( + 'contribution_id' => 6, + 'contact_id' => 19, + 'amount' => '10', + 'currency' => 'USD', + 'soft_credit_type_id' => 5, + ); -return $result; + try{ + $result = civicrm_api3('contribution_soft', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_soft_create_expectedresult(){ +function contribution_soft_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'contribution_id' => '1', - 'contact_id' => '2', - 'amount' => '10', - 'currency' => 'USD', - 'pcp_id' => '', - 'pcp_display_in_roll' => '', - 'pcp_roll_nickname' => '', - 'pcp_personal_note' => '', - 'soft_credit_type_id' => '5', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 5, + 'values' => array( + '5' => array( + 'id' => '5', + 'contribution_id' => '6', + 'contact_id' => '19', + 'amount' => '10', + 'currency' => 'USD', + 'pcp_id' => '', + 'pcp_display_in_roll' => '', + 'pcp_roll_nickname' => '', + 'pcp_personal_note' => '', + 'soft_credit_type_id' => '5', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateContributionSoft and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionSoft +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionSoft/Delete.php b/api/v3/examples/ContributionSoft/Delete.php index c8c6f6e6d9..c2e2f09e9a 100644 --- a/api/v3/examples/ContributionSoft/Delete.php +++ b/api/v3/examples/ContributionSoft/Delete.php @@ -1,42 +1,58 @@ 1, -); -try{ - $result = civicrm_api3('contribution_soft', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_soft delete API. + * + * + * @return array + * API result array + */ +function contribution_soft_delete_example() { + $params = array( + 'id' => 7, + ); -return $result; + try{ + $result = civicrm_api3('contribution_soft', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_soft_delete_expectedresult(){ +function contribution_soft_delete_expectedresult() { $expectedResult = ''; return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteContributionSoft and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteContributionSoft +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ContributionSoft/Get.php b/api/v3/examples/ContributionSoft/Get.php index efad77eef3..24281a6d0a 100644 --- a/api/v3/examples/ContributionSoft/Get.php +++ b/api/v3/examples/ContributionSoft/Get.php @@ -1,58 +1,74 @@ 1, -); -try{ - $result = civicrm_api3('contribution_soft', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using contribution_soft get API. + * + * + * @return array + * API result array + */ +function contribution_soft_get_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('contribution_soft', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function contribution_soft_get_expectedresult(){ +function contribution_soft_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contribution_id' => '1', - 'contact_id' => '4', - 'amount' => '10.00', - 'currency' => 'USD', - 'pcp_display_in_roll' => 0, - 'soft_credit_type_id' => '4', - ), + 'id' => '1', + 'contribution_id' => '1', + 'contact_id' => '4', + 'amount' => '10.00', + 'currency' => 'USD', + 'pcp_display_in_roll' => 0, + 'soft_credit_type_id' => '4', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetContributionSoft and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetContributionSoft +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Country/Create.php b/api/v3/examples/Country/Create.php index 7789a17ac0..6d8c3775f3 100644 --- a/api/v3/examples/Country/Create.php +++ b/api/v3/examples/Country/Create.php @@ -1,62 +1,78 @@ 'Made Up Land', - 'iso_code' => 'ML', - 'region_id' => 1, -); -try{ - $result = civicrm_api3('country', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using country create API. + * + * + * @return array + * API result array + */ +function country_create_example() { + $params = array( + 'name' => 'Made Up Land', + 'iso_code' => 'ZZ', + 'region_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('country', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function country_create_expectedresult(){ +function country_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'name' => 'Made Up Land', - 'iso_code' => 'ML', - 'country_code' => '', - 'address_format_id' => '', - 'idd_prefix' => '', - 'ndd_prefix' => '', - 'region_id' => '1', - 'is_province_abbreviated' => '', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1252, + 'values' => array( + '1252' => array( + 'id' => '1252', + 'name' => 'Made Up Land', + 'iso_code' => 'ZZ', + 'country_code' => '', + 'address_format_id' => '', + 'idd_prefix' => '', + 'ndd_prefix' => '', + 'region_id' => '1', + 'is_province_abbreviated' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateCountry and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateCountry +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Country/Delete.php b/api/v3/examples/Country/Delete.php index 6080fa0f69..7c6df427df 100644 --- a/api/v3/examples/Country/Delete.php +++ b/api/v3/examples/Country/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('country', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using country delete API. + * + * + * @return array + * API result array + */ +function country_delete_example() { + $params = array( + 'id' => 1253, + ); -return $result; + try{ + $result = civicrm_api3('country', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function country_delete_expectedresult(){ +function country_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteCountry and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteCountry +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Country/Get.php b/api/v3/examples/Country/Get.php index ea03ca4ee6..e96dec6cf5 100644 --- a/api/v3/examples/Country/Get.php +++ b/api/v3/examples/Country/Get.php @@ -1,56 +1,72 @@ 'ML', -); -try{ - $result = civicrm_api3('country', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using country get API. + * + * + * @return array + * API result array + */ +function country_get_example() { + $params = array( + 'iso_code' => 'ZZ', + ); -return $result; + try{ + $result = civicrm_api3('country', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function country_get_expectedresult(){ +function country_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'name' => 'Made Up Land', - 'iso_code' => 'ML', - 'region_id' => '1', - 'is_province_abbreviated' => 0, - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1254, + 'values' => array( + '1254' => array( + 'id' => '1254', + 'name' => 'Made Up Land', + 'iso_code' => 'ZZ', + 'region_id' => '1', + 'is_province_abbreviated' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/CustomField/Create.php b/api/v3/examples/CustomField/Create.php index 4a1b802475..83b8352b4c 100644 --- a/api/v3/examples/CustomField/Create.php +++ b/api/v3/examples/CustomField/Create.php @@ -1,90 +1,106 @@ 1, - 'name' => 'test_textfield2', - 'label' => 'Name1', - 'html_type' => 'Text', - 'data_type' => 'String', - 'default_value' => 'abc', - 'weight' => 4, - 'is_required' => 1, - 'is_searchable' => 0, - 'is_active' => 1, -); -try{ - $result = civicrm_api3('custom_field', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using custom_field create API. + * + * + * @return array + * API result array + */ +function custom_field_create_example() { + $params = array( + 'custom_group_id' => 1, + 'name' => 'test_textfield2', + 'label' => 'Name1', + 'html_type' => 'Text', + 'data_type' => 'String', + 'default_value' => 'abc', + 'weight' => 4, + 'is_required' => 1, + 'is_searchable' => 0, + 'is_active' => 1, + ); -return $result; + try{ + $result = civicrm_api3('custom_field', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function custom_field_create_expectedresult(){ +function custom_field_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'custom_group_id' => '1', - 'name' => 'test_textfield2', - 'label' => 'Name1', - 'data_type' => 'String', - 'html_type' => 'Text', - 'default_value' => 'abc', - 'is_required' => '1', - 'is_searchable' => 0, - 'is_search_range' => 0, - 'weight' => '4', - 'help_pre' => '', - 'help_post' => '', - 'mask' => '', - 'attributes' => '', - 'javascript' => '', - 'is_active' => '1', - 'is_view' => 0, - 'options_per_line' => '', - 'text_length' => '', - 'start_date_years' => '', - 'end_date_years' => '', - 'date_format' => '', - 'time_format' => '', - 'note_columns' => '', - 'note_rows' => '', - 'column_name' => 'name1_1', - 'option_group_id' => '', - 'filter' => '', - 'in_selector' => 0, - ), + 'id' => '1', + 'custom_group_id' => '1', + 'name' => 'test_textfield2', + 'label' => 'Name1', + 'data_type' => 'String', + 'html_type' => 'Text', + 'default_value' => 'abc', + 'is_required' => '1', + 'is_searchable' => 0, + 'is_search_range' => 0, + 'weight' => '4', + 'help_pre' => '', + 'help_post' => '', + 'mask' => '', + 'attributes' => '', + 'javascript' => '', + 'is_active' => '1', + 'is_view' => 0, + 'options_per_line' => '', + 'text_length' => '', + 'start_date_years' => '', + 'end_date_years' => '', + 'date_format' => '', + 'time_format' => '', + 'note_columns' => '', + 'note_rows' => '', + 'column_name' => 'name1_1', + 'option_group_id' => '', + 'filter' => '', + 'in_selector' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCustomFieldCreateWithEdit and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCustomFieldCreateWithEdit +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/CustomField/Delete.php b/api/v3/examples/CustomField/Delete.php index f8ae1d5f47..3c0c46a0e4 100644 --- a/api/v3/examples/CustomField/Delete.php +++ b/api/v3/examples/CustomField/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('custom_field', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using custom_field delete API. + * + * + * @return array + * API result array + */ +function custom_field_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('custom_field', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function custom_field_delete_expectedresult(){ +function custom_field_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCustomFieldDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCustomFieldDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/CustomGroup/Create.php b/api/v3/examples/CustomGroup/Create.php index a78eb124cc..859b44c11a 100644 --- a/api/v3/examples/CustomGroup/Create.php +++ b/api/v3/examples/CustomGroup/Create.php @@ -1,81 +1,97 @@ 'Test_Group_1', - 'name' => 'test_group_1', - 'extends' => array( + +/** + * Test Generated example of using custom_group create API. + * + * + * @return array + * API result array + */ +function custom_group_create_example() { + $params = array( + 'title' => 'Test_Group_1', + 'name' => 'test_group_1', + 'extends' => array( '0' => 'Individual', ), - 'weight' => 4, - 'collapse_display' => 1, - 'style' => 'Inline', - 'help_pre' => 'This is Pre Help For Test Group 1', - 'help_post' => 'This is Post Help For Test Group 1', - 'is_active' => 1, -); + 'weight' => 4, + 'collapse_display' => 1, + 'style' => 'Inline', + 'help_pre' => 'This is Pre Help For Test Group 1', + 'help_post' => 'This is Post Help For Test Group 1', + 'is_active' => 1, + ); -try{ - $result = civicrm_api3('custom_group', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('custom_group', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function custom_group_create_expectedresult(){ +function custom_group_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'name' => 'test_group_1', - 'title' => 'Test_Group_1', - 'extends' => 'Individual', - 'extends_entity_column_id' => '', - 'extends_entity_column_value' => '', - 'style' => 'Inline', - 'collapse_display' => '1', - 'help_pre' => 'This is Pre Help For Test Group 1', - 'help_post' => 'This is Post Help For Test Group 1', - 'weight' => '2', - 'is_active' => '1', - 'table_name' => 'civicrm_value_test_group_1_1', - 'is_multiple' => '', - 'min_multiple' => '', - 'max_multiple' => '', - 'collapse_adv_display' => '', - 'created_id' => '', - 'created_date' => '', - 'is_reserved' => '', - ), + 'id' => '1', + 'name' => 'test_group_1', + 'title' => 'Test_Group_1', + 'extends' => 'Individual', + 'extends_entity_column_id' => '', + 'extends_entity_column_value' => '', + 'style' => 'Inline', + 'collapse_display' => '1', + 'help_pre' => 'This is Pre Help For Test Group 1', + 'help_post' => 'This is Post Help For Test Group 1', + 'weight' => '2', + 'is_active' => '1', + 'table_name' => 'civicrm_value_test_group_1_1', + 'is_multiple' => '', + 'min_multiple' => '', + 'max_multiple' => '', + 'collapse_adv_display' => '', + 'created_id' => '', + 'created_date' => '', + 'is_reserved' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCustomGroupCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCustomGroupCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/CustomGroup/Delete.php b/api/v3/examples/CustomGroup/Delete.php index e2ff22aaa7..3cbc73a6f9 100644 --- a/api/v3/examples/CustomGroup/Delete.php +++ b/api/v3/examples/CustomGroup/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('custom_group', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using custom_group delete API. + * + * + * @return array + * API result array + */ +function custom_group_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('custom_group', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function custom_group_delete_expectedresult(){ +function custom_group_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCustomGroupDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCustomGroupDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/CustomGroup/Get.php b/api/v3/examples/CustomGroup/Get.php index 417295207d..da5c935d2a 100644 --- a/api/v3/examples/CustomGroup/Get.php +++ b/api/v3/examples/CustomGroup/Get.php @@ -1,63 +1,79 @@ getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using custom_group get API. + * + * + * @return array + * API result array + */ +function custom_group_get_example() { + $params = array(); -return $result; + try{ + $result = civicrm_api3('custom_group', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function custom_group_get_expectedresult(){ +function custom_group_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'name' => 'test_group_1', - 'title' => 'Test_Group_1', - 'extends' => 'Individual', - 'style' => 'Inline', - 'collapse_display' => '1', - 'help_pre' => 'This is Pre Help For Test Group 1', - 'help_post' => 'This is Post Help For Test Group 1', - 'weight' => '2', - 'is_active' => '1', - 'table_name' => 'civicrm_value_test_group_1_1', - 'is_multiple' => 0, - 'collapse_adv_display' => 0, - 'is_reserved' => 0, - ), + 'id' => '1', + 'name' => 'test_group_1', + 'title' => 'Test_Group_1', + 'extends' => 'Individual', + 'style' => 'Inline', + 'collapse_display' => '1', + 'help_pre' => 'This is Pre Help For Test Group 1', + 'help_post' => 'This is Post Help For Test Group 1', + 'weight' => '2', + 'is_active' => '1', + 'table_name' => 'civicrm_value_test_group_1_1', + 'is_multiple' => 0, + 'collapse_adv_display' => 0, + 'is_reserved' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetCustomGroupSuccess and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetCustomGroupSuccess +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/CustomValue/Create.php b/api/v3/examples/CustomValue/Create.php index 18d85519c9..b46846b502 100644 --- a/api/v3/examples/CustomValue/Create.php +++ b/api/v3/examples/CustomValue/Create.php @@ -1,48 +1,64 @@ 'customString', - 'entity_id' => 3, -); -try{ - $result = civicrm_api3('custom_value', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using custom_value create API. + * + * + * @return array + * API result array + */ +function custom_value_create_example() { + $params = array( + 'custom_1' => 'customString', + 'entity_id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('custom_value', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function custom_value_create_expectedresult(){ +function custom_value_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateCustomValue and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateCustomValue +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomValueTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/CustomValue/Get.php b/api/v3/examples/CustomValue/Get.php index 2cc9c048ab..4bd831388b 100644 --- a/api/v3/examples/CustomValue/Get.php +++ b/api/v3/examples/CustomValue/Get.php @@ -1,96 +1,113 @@ 2, - 'entity_id' => 2, -); -try{ - $result = civicrm_api3('custom_value', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using custom_value get API. + * + * /*this demonstrates the use of CustomValue get + * + * @return array + * API result array + */ +function custom_value_get_example() { + $params = array( + 'id' => 2, + 'entity_id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('custom_value', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function custom_value_get_expectedresult(){ +function custom_value_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 7, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 7, + 'values' => array( '1' => array( - 'entity_id' => '2', - 'latest' => 'value 1', - 'id' => '1', - ), + 'entity_id' => '2', + 'latest' => 'value 1', + 'id' => '1', + ), '2' => array( - 'entity_id' => '2', - 'latest' => 'value 3', - 'id' => '2', - '1' => 'value 2', - '2' => 'value 3', - ), + 'entity_id' => '2', + 'latest' => 'value 3', + 'id' => '2', + '1' => 'value 2', + '2' => 'value 3', + ), '3' => array( - 'entity_id' => '2', - 'latest' => '', - 'id' => '3', - '1' => 'warm beer', - '2' => '', - ), + 'entity_id' => '2', + 'latest' => '', + 'id' => '3', + '1' => 'warm beer', + '2' => '', + ), '4' => array( - 'entity_id' => '2', - 'latest' => '', - 'id' => '4', - '1' => 'fl* w*', - '2' => '', - ), + 'entity_id' => '2', + 'latest' => '', + 'id' => '4', + '1' => 'fl* w*', + '2' => '', + ), '5' => array( - 'entity_id' => '2', - 'latest' => 'coffee', - 'id' => '5', - '1' => 'defaultValue', - '2' => 'coffee', - ), + 'entity_id' => '2', + 'latest' => 'coffee', + 'id' => '5', + '1' => 'defaultValue', + '2' => 'coffee', + ), '6' => array( - 'entity_id' => '2', - 'latest' => 'value 4', - 'id' => '6', - '1' => '', - '2' => 'value 4', - ), + 'entity_id' => '2', + 'latest' => 'value 4', + 'id' => '6', + '1' => '', + '2' => 'value 4', + ), '7' => array( - 'entity_id' => '2', - 'latest' => '', - 'id' => '7', - '1' => 'vegemite', - '2' => '', - ), + 'entity_id' => '2', + 'latest' => '', + 'id' => '7', + '1' => 'vegemite', + '2' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetMultipleCustomValues and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetMultipleCustomValues +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomValueTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/CustomValue/formatFieldName.php b/api/v3/examples/CustomValue/formatFieldName.php index 82e6f157de..e1238e6ebd 100644 --- a/api/v3/examples/CustomValue/formatFieldName.php +++ b/api/v3/examples/CustomValue/formatFieldName.php @@ -1,97 +1,114 @@ 2, - 'entity_id' => 2, - 'format.field_names' => 1, -); -try{ - $result = civicrm_api3('custom_value', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using custom_value get API. + * + * utilises field names + * + * @return array + * API result array + */ +function custom_value_get_example() { + $params = array( + 'id' => 2, + 'entity_id' => 2, + 'format.field_names' => 1, + ); -return $result; + try{ + $result = civicrm_api3('custom_value', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function custom_value_get_expectedresult(){ +function custom_value_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 7, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 7, + 'values' => array( 'mySingleField' => array( - 'entity_id' => '2', - 'latest' => 'value 1', - 'id' => 'mySingleField', - ), + 'entity_id' => '2', + 'latest' => 'value 1', + 'id' => 'mySingleField', + ), 'field_12' => array( - 'entity_id' => '2', - 'latest' => 'value 3', - 'id' => 'field_12', - '1' => 'value 2', - '2' => 'value 3', - ), + 'entity_id' => '2', + 'latest' => 'value 3', + 'id' => 'field_12', + '1' => 'value 2', + '2' => 'value 3', + ), 'field_22' => array( - 'entity_id' => '2', - 'latest' => '', - 'id' => 'field_22', - '1' => 'warm beer', - '2' => '', - ), + 'entity_id' => '2', + 'latest' => '', + 'id' => 'field_22', + '1' => 'warm beer', + '2' => '', + ), 'field_32' => array( - 'entity_id' => '2', - 'latest' => '', - 'id' => 'field_32', - '1' => 'fl* w*', - '2' => '', - ), + 'entity_id' => '2', + 'latest' => '', + 'id' => 'field_32', + '1' => 'fl* w*', + '2' => '', + ), 'field_13' => array( - 'entity_id' => '2', - 'latest' => 'coffee', - 'id' => 'field_13', - '1' => 'defaultValue', - '2' => 'coffee', - ), + 'entity_id' => '2', + 'latest' => 'coffee', + 'id' => 'field_13', + '1' => 'defaultValue', + '2' => 'coffee', + ), 'field_23' => array( - 'entity_id' => '2', - 'latest' => 'value 4', - 'id' => 'field_23', - '1' => '', - '2' => 'value 4', - ), + 'entity_id' => '2', + 'latest' => 'value 4', + 'id' => 'field_23', + '1' => '', + '2' => 'value 4', + ), 'field_33' => array( - 'entity_id' => '2', - 'latest' => '', - 'id' => 'field_33', - '1' => 'vegemite', - '2' => '', - ), + 'entity_id' => '2', + 'latest' => '', + 'id' => 'field_33', + '1' => 'vegemite', + '2' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetMultipleCustomValues and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetMultipleCustomValues +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomValueTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Domain/Create.php b/api/v3/examples/Domain/Create.php index d0265f65f4..8a27360bb7 100644 --- a/api/v3/examples/Domain/Create.php +++ b/api/v3/examples/Domain/Create.php @@ -1,62 +1,78 @@ 'A-team domain', - 'description' => 'domain of chaos', - 'domain_version' => '4.2', - 'contact_id' => 6, -); -try{ - $result = civicrm_api3('domain', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using domain create API. + * + * + * @return array + * API result array + */ +function domain_create_example() { + $params = array( + 'name' => 'A-team domain', + 'description' => 'domain of chaos', + 'domain_version' => '4.2', + 'contact_id' => 6, + ); -return $result; + try{ + $result = civicrm_api3('domain', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function domain_create_expectedresult(){ +function domain_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( '3' => array( - 'id' => '3', - 'name' => 'A-team domain', - 'description' => 'domain of chaos', - 'config_backend' => '', - 'version' => '4.2', - 'contact_id' => '6', - 'locales' => '', - 'locale_custom_strings' => '', - ), + 'id' => '3', + 'name' => 'A-team domain', + 'description' => 'domain of chaos', + 'config_backend' => '', + 'version' => '4.2', + 'contact_id' => '6', + 'locales' => '', + 'locale_custom_strings' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Domain/Get.php b/api/v3/examples/Domain/Get.php index e81e455be0..d88fe16379 100644 --- a/api/v3/examples/Domain/Get.php +++ b/api/v3/examples/Domain/Get.php @@ -1,99 +1,115 @@ 1, -); -try{ - $result = civicrm_api3('domain', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using domain get API. + * + * + * @return array + * API result array + */ +function domain_get_example() { + $params = array( + 'sequential' => 1, + ); + + try{ + $result = civicrm_api3('domain', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function domain_get_expectedresult(){ +function domain_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '0' => array( - 'id' => '1', - 'name' => 'Default Domain Name', - 'config_backend' => 'a:83:{s:18:\"fatalErrorTemplate\";s:20:\"CRM/common/fatal.tpl\";s:15:\"civiRelativeURL\";s:13:\"/index.php?q=\";s:11:\"civiVersion\";s:9:\"4.5.beta9\";s:11:\"empoweredBy\";b:1;s:10:\"userSystem\";O:26:\"CRM_Utils_System_UnitTests\":5:{s:19:\"supports_UF_Logging\";b:1;s:9:\"is_drupal\";b:0;s:9:\"is_joomla\";b:0;s:12:\"is_wordpress\";b:0;s:24:\"supports_form_extensions\";b:0;}s:11:\"initialized\";i:0;s:15:\"DAOFactoryClass\";s:23:\"CRM_Contact_DAO_Factory\";s:17:\"componentRegistry\";O:18:\"CRM_Core_Component\":0:{}s:9:\"inCiviCRM\";b:0;s:18:\"recaptchaPublicKey\";N;s:5:\"debug\";i:0;s:9:\"backtrace\";i:0;s:12:\"resourceBase\";N;s:13:\"extensionsURL\";N;s:12:\"countryLimit\";a:1:{i:0;s:4:\"1228\";}s:27:\"defaultContactStateProvince\";N;s:13:\"provinceLimit\";a:1:{i:0;s:4:\"1228\";}s:21:\"defaultContactCountry\";s:4:\"1228\";s:15:\"defaultCurrency\";s:3:\"USD\";s:10:\"lcMessages\";s:5:\"en_US\";s:18:\"dateformatDatetime\";s:20:\"%B %E%f, %Y %l:%M %P\";s:14:\"dateformatFull\";s:11:\"%B %E%f, %Y\";s:17:\"dateformatPartial\";s:5:\"%B %Y\";s:14:\"dateformatYear\";s:2:\"%Y\";s:14:\"dateformatTime\";s:8:\"%l:%M %P\";s:15:\"timeInputFormat\";i:1;s:15:\"dateInputFormat\";s:8:\"mm/dd/yy\";s:15:\"fiscalYearStart\";a:2:{s:1:\"M\";i:1;s:1:\"d\";i:1;}s:11:\"moneyformat\";s:5:\"%c %a\";s:16:\"moneyvalueformat\";s:3:\"%!i\";s:15:\"currencySymbols\";s:0:\"\";s:21:\"defaultCurrencySymbol\";s:1:\"$\";s:20:\"monetaryDecimalPoint\";s:1:\".\";s:25:\"monetaryThousandSeparator\";s:1:\",\";s:14:\"gettextCodeset\";s:5:\"utf-8\";s:13:\"gettextDomain\";s:7:\"civicrm\";s:27:\"userFrameworkUsersTableName\";s:5:\"users\";s:21:\"userFrameworkFrontend\";b:0;s:20:\"userFrameworkLogging\";b:0;s:17:\"maxImportFileSize\";i:2097152;s:11:\"maxFileSize\";i:2;s:11:\"mapProvider\";N;s:9:\"mapAPIKey\";N;s:11:\"geoProvider\";N;s:9:\"geoAPIKey\";N;s:13:\"geocodeMethod\";s:0:\"\";s:12:\"mapGeoCoding\";i:1;s:7:\"logging\";b:0;s:12:\"versionCheck\";b:1;s:16:\"enableComponents\";a:6:{i:0;s:14:\"CiviContribute\";i:1;s:10:\"CiviPledge\";i:2;s:10:\"CiviMember\";i:3;s:9:\"CiviEvent\";i:4;s:8:\"CiviMail\";i:5;s:10:\"CiviReport\";}s:18:\"enableComponentIDs\";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:\"enableSSL\";b:0;s:17:\"fatalErrorHandler\";N;s:14:\"legacyEncoding\";s:12:\"Windows-1252\";s:14:\"fieldSeparator\";s:1:\",\";s:17:\"maxLocationBlocks\";i:2;s:15:\"captchaFontPath\";s:25:\"/usr/X11R6/lib/X11/fonts/\";s:11:\"captchaFont\";s:17:\"HelveticaBold.ttf\";s:21:\"includeWildCardInName\";i:1;s:18:\"includeEmailInName\";i:1;s:21:\"includeNickNameInName\";i:0;s:22:\"smartGroupCacheTimeout\";i:5;s:22:\"defaultSearchProfileID\";N;s:21:\"dashboardCacheTimeout\";i:1440;s:15:\"doNotResetCache\";i:0;s:24:\"includeAlphabeticalPager\";i:1;s:20:\"includeOrderByClause\";i:1;s:13:\"oldInputStyle\";i:1;s:14:\"formKeyDisable\";b:0;s:21:\"doNotAttachPDFReceipt\";b:0;s:15:\"wkhtmltopdfPath\";b:0;s:23:\"secondDegRelPermissions\";b:0;s:10:\"wpBasePage\";N;s:9:\"groupTree\";b:0;s:11:\"revampPages\";a:0:{}s:13:\"verpSeparator\";s:1:\".\";s:12:\"mailerPeriod\";i:180;s:16:\"mailerSpoolLimit\";i:0;s:16:\"mailerBatchLimit\";i:0;s:13:\"mailerJobSize\";i:0;s:13:\"mailerJobsMax\";i:0;s:16:\"mailThrottleTime\";i:0;s:12:\"customCSSURL\";N;}', - 'version' => '3', - 'contact_id' => '3', - 'locale_custom_strings' => 'a:1:{s:5:\"en_US\";a:0:{}}', - 'domain_email' => 'my@email.com', - 'domain_phone' => array( - 'phone_type' => 'Phone', - 'phone' => '456-456', - ), - 'domain_address' => array( - 'street_address' => '45 Penny Lane', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'state_province_id' => '', - 'postal_code' => '', - 'country_id' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - ), - 'from_email' => 'info@EXAMPLE.ORG', - 'from_name' => 'FIXME', + 'id' => '1', + 'name' => 'Default Domain Name', + 'config_backend' => 'a:82:{s:18:\"fatalErrorTemplate\";s:20:\"CRM/common/fatal.tpl\";s:15:\"civiRelativeURL\";s:13:\"/index.php?q=\";s:11:\"civiVersion\";s:10:\"4.6.alpha1\";s:11:\"empoweredBy\";b:1;s:10:\"userSystem\";O:26:\"CRM_Utils_System_UnitTests\":5:{s:19:\"supports_UF_Logging\";b:1;s:9:\"is_drupal\";b:0;s:9:\"is_joomla\";b:0;s:12:\"is_wordpress\";b:0;s:24:\"supports_form_extensions\";b:0;}s:11:\"initialized\";i:0;s:15:\"DAOFactoryClass\";s:23:\"CRM_Contact_DAO_Factory\";s:17:\"componentRegistry\";O:18:\"CRM_Core_Component\":0:{}s:9:\"inCiviCRM\";b:0;s:18:\"recaptchaPublicKey\";N;s:5:\"debug\";i:0;s:9:\"backtrace\";i:0;s:12:\"resourceBase\";N;s:13:\"extensionsURL\";N;s:12:\"countryLimit\";a:1:{i:0;s:4:\"1228\";}s:27:\"defaultContactStateProvince\";N;s:13:\"provinceLimit\";a:1:{i:0;s:4:\"1228\";}s:21:\"defaultContactCountry\";s:4:\"1228\";s:15:\"defaultCurrency\";s:3:\"USD\";s:10:\"lcMessages\";s:5:\"en_US\";s:18:\"dateformatDatetime\";s:20:\"%B %E%f, %Y %l:%M %P\";s:14:\"dateformatFull\";s:11:\"%B %E%f, %Y\";s:17:\"dateformatPartial\";s:5:\"%B %Y\";s:14:\"dateformatYear\";s:2:\"%Y\";s:14:\"dateformatTime\";s:8:\"%l:%M %P\";s:15:\"timeInputFormat\";i:1;s:15:\"dateInputFormat\";s:8:\"mm/dd/yy\";s:15:\"fiscalYearStart\";a:2:{s:1:\"M\";i:1;s:1:\"d\";i:1;}s:11:\"moneyformat\";s:5:\"%c %a\";s:16:\"moneyvalueformat\";s:3:\"%!i\";s:15:\"currencySymbols\";s:0:\"\";s:21:\"defaultCurrencySymbol\";s:1:\"$\";s:20:\"monetaryDecimalPoint\";s:1:\".\";s:25:\"monetaryThousandSeparator\";s:1:\",\";s:14:\"gettextCodeset\";s:5:\"utf-8\";s:13:\"gettextDomain\";s:7:\"civicrm\";s:27:\"userFrameworkUsersTableName\";s:5:\"users\";s:21:\"userFrameworkFrontend\";b:0;s:20:\"userFrameworkLogging\";b:0;s:17:\"maxImportFileSize\";i:2097152;s:11:\"maxFileSize\";i:2;s:11:\"mapProvider\";N;s:9:\"mapAPIKey\";N;s:11:\"geoProvider\";N;s:9:\"geoAPIKey\";N;s:13:\"geocodeMethod\";s:0:\"\";s:12:\"mapGeoCoding\";i:1;s:7:\"logging\";b:0;s:16:\"enableComponents\";a:6:{i:0;s:14:\"CiviContribute\";i:1;s:10:\"CiviPledge\";i:2;s:10:\"CiviMember\";i:3;s:9:\"CiviEvent\";i:4;s:8:\"CiviMail\";i:5;s:10:\"CiviReport\";}s:18:\"enableComponentIDs\";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:\"enableSSL\";b:0;s:17:\"fatalErrorHandler\";N;s:14:\"legacyEncoding\";s:12:\"Windows-1252\";s:14:\"fieldSeparator\";s:1:\",\";s:17:\"maxLocationBlocks\";i:2;s:15:\"captchaFontPath\";s:25:\"/usr/X11R6/lib/X11/fonts/\";s:11:\"captchaFont\";s:17:\"HelveticaBold.ttf\";s:21:\"includeWildCardInName\";i:1;s:18:\"includeEmailInName\";i:1;s:21:\"includeNickNameInName\";i:0;s:22:\"smartGroupCacheTimeout\";i:5;s:22:\"defaultSearchProfileID\";N;s:21:\"dashboardCacheTimeout\";i:1440;s:15:\"doNotResetCache\";i:0;s:24:\"includeAlphabeticalPager\";i:1;s:20:\"includeOrderByClause\";i:1;s:13:\"oldInputStyle\";i:1;s:14:\"formKeyDisable\";b:0;s:21:\"doNotAttachPDFReceipt\";b:0;s:15:\"wkhtmltopdfPath\";b:0;s:23:\"secondDegRelPermissions\";b:0;s:10:\"wpBasePage\";N;s:9:\"groupTree\";b:0;s:11:\"revampPages\";a:0:{}s:13:\"verpSeparator\";s:1:\".\";s:12:\"mailerPeriod\";i:180;s:16:\"mailerSpoolLimit\";i:0;s:16:\"mailerBatchLimit\";i:0;s:13:\"mailerJobSize\";i:0;s:13:\"mailerJobsMax\";i:0;s:16:\"mailThrottleTime\";i:0;s:12:\"customCSSURL\";N;}', + 'version' => '3', + 'contact_id' => '3', + 'locale_custom_strings' => 'a:1:{s:5:\"en_US\";a:0:{}}', + 'domain_email' => 'my@email.com', + 'domain_phone' => array( + 'phone_type' => 'Phone', + 'phone' => '456-456', ), + 'domain_address' => array( + 'street_address' => '45 Penny Lane', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'state_province_id' => '', + 'postal_code' => '', + 'country_id' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + ), + 'from_email' => 'info@EXAMPLE.ORG', + 'from_name' => 'FIXME', + ), '1' => array( - 'id' => '2', - 'name' => 'Second Domain', - 'config_backend' => 'a:83:{s:18:\"fatalErrorTemplate\";s:20:\"CRM/common/fatal.tpl\";s:15:\"civiRelativeURL\";s:13:\"/index.php?q=\";s:11:\"civiVersion\";s:9:\"4.5.beta9\";s:11:\"empoweredBy\";b:1;s:10:\"userSystem\";O:26:\"CRM_Utils_System_UnitTests\":5:{s:19:\"supports_UF_Logging\";b:1;s:9:\"is_drupal\";b:0;s:9:\"is_joomla\";b:0;s:12:\"is_wordpress\";b:0;s:24:\"supports_form_extensions\";b:0;}s:11:\"initialized\";i:0;s:15:\"DAOFactoryClass\";s:23:\"CRM_Contact_DAO_Factory\";s:17:\"componentRegistry\";O:18:\"CRM_Core_Component\":0:{}s:9:\"inCiviCRM\";b:0;s:18:\"recaptchaPublicKey\";N;s:5:\"debug\";i:0;s:9:\"backtrace\";i:0;s:12:\"resourceBase\";N;s:13:\"extensionsURL\";N;s:12:\"countryLimit\";a:1:{i:0;s:4:\"1228\";}s:27:\"defaultContactStateProvince\";N;s:13:\"provinceLimit\";a:1:{i:0;s:4:\"1228\";}s:21:\"defaultContactCountry\";s:4:\"1228\";s:15:\"defaultCurrency\";s:3:\"USD\";s:10:\"lcMessages\";s:5:\"en_US\";s:18:\"dateformatDatetime\";s:20:\"%B %E%f, %Y %l:%M %P\";s:14:\"dateformatFull\";s:11:\"%B %E%f, %Y\";s:17:\"dateformatPartial\";s:5:\"%B %Y\";s:14:\"dateformatYear\";s:2:\"%Y\";s:14:\"dateformatTime\";s:8:\"%l:%M %P\";s:15:\"timeInputFormat\";i:1;s:15:\"dateInputFormat\";s:8:\"mm/dd/yy\";s:15:\"fiscalYearStart\";a:2:{s:1:\"M\";i:1;s:1:\"d\";i:1;}s:11:\"moneyformat\";s:5:\"%c %a\";s:16:\"moneyvalueformat\";s:3:\"%!i\";s:15:\"currencySymbols\";s:0:\"\";s:21:\"defaultCurrencySymbol\";s:1:\"$\";s:20:\"monetaryDecimalPoint\";s:1:\".\";s:25:\"monetaryThousandSeparator\";s:1:\",\";s:14:\"gettextCodeset\";s:5:\"utf-8\";s:13:\"gettextDomain\";s:7:\"civicrm\";s:27:\"userFrameworkUsersTableName\";s:5:\"users\";s:21:\"userFrameworkFrontend\";b:0;s:20:\"userFrameworkLogging\";b:0;s:17:\"maxImportFileSize\";i:2097152;s:11:\"maxFileSize\";i:2;s:11:\"mapProvider\";N;s:9:\"mapAPIKey\";N;s:11:\"geoProvider\";N;s:9:\"geoAPIKey\";N;s:13:\"geocodeMethod\";s:0:\"\";s:12:\"mapGeoCoding\";i:1;s:7:\"logging\";b:0;s:12:\"versionCheck\";b:1;s:16:\"enableComponents\";a:6:{i:0;s:14:\"CiviContribute\";i:1;s:10:\"CiviPledge\";i:2;s:10:\"CiviMember\";i:3;s:9:\"CiviEvent\";i:4;s:8:\"CiviMail\";i:5;s:10:\"CiviReport\";}s:18:\"enableComponentIDs\";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:\"enableSSL\";b:0;s:17:\"fatalErrorHandler\";N;s:14:\"legacyEncoding\";s:12:\"Windows-1252\";s:14:\"fieldSeparator\";s:1:\",\";s:17:\"maxLocationBlocks\";i:2;s:15:\"captchaFontPath\";s:25:\"/usr/X11R6/lib/X11/fonts/\";s:11:\"captchaFont\";s:17:\"HelveticaBold.ttf\";s:21:\"includeWildCardInName\";i:1;s:18:\"includeEmailInName\";i:1;s:21:\"includeNickNameInName\";i:0;s:22:\"smartGroupCacheTimeout\";i:5;s:22:\"defaultSearchProfileID\";N;s:21:\"dashboardCacheTimeout\";i:1440;s:15:\"doNotResetCache\";i:0;s:24:\"includeAlphabeticalPager\";i:1;s:20:\"includeOrderByClause\";i:1;s:13:\"oldInputStyle\";i:1;s:14:\"formKeyDisable\";b:0;s:21:\"doNotAttachPDFReceipt\";b:0;s:15:\"wkhtmltopdfPath\";b:0;s:23:\"secondDegRelPermissions\";b:0;s:10:\"wpBasePage\";N;s:9:\"groupTree\";b:0;s:11:\"revampPages\";a:0:{}s:13:\"verpSeparator\";s:1:\".\";s:12:\"mailerPeriod\";i:180;s:16:\"mailerSpoolLimit\";i:0;s:16:\"mailerBatchLimit\";i:0;s:13:\"mailerJobSize\";i:0;s:13:\"mailerJobsMax\";i:0;s:16:\"mailThrottleTime\";i:0;s:12:\"customCSSURL\";N;}', - 'version' => '4.6.alpha1', - 'contact_id' => '2', - 'domain_email' => '\"Domain Email\" ', - 'domain_phone' => array( - 'phone_type' => 'Phone', - 'phone' => '204 555-1001', - ), - 'domain_address' => array( - 'street_address' => '15 Main St', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => 'Collinsville', - 'state_province_id' => '1006', - 'postal_code' => '6022', - 'country_id' => '1228', - 'geo_code_1' => '41.8328', - 'geo_code_2' => '-72.9253', - ), - 'from_email' => 'info@EXAMPLE.ORG', - 'from_name' => 'FIXME', + 'id' => '2', + 'name' => 'Second Domain', + 'config_backend' => 'a:82:{s:18:\"fatalErrorTemplate\";s:20:\"CRM/common/fatal.tpl\";s:15:\"civiRelativeURL\";s:13:\"/index.php?q=\";s:11:\"civiVersion\";s:10:\"4.6.alpha1\";s:11:\"empoweredBy\";b:1;s:10:\"userSystem\";O:26:\"CRM_Utils_System_UnitTests\":5:{s:19:\"supports_UF_Logging\";b:1;s:9:\"is_drupal\";b:0;s:9:\"is_joomla\";b:0;s:12:\"is_wordpress\";b:0;s:24:\"supports_form_extensions\";b:0;}s:11:\"initialized\";i:0;s:15:\"DAOFactoryClass\";s:23:\"CRM_Contact_DAO_Factory\";s:17:\"componentRegistry\";O:18:\"CRM_Core_Component\":0:{}s:9:\"inCiviCRM\";b:0;s:18:\"recaptchaPublicKey\";N;s:5:\"debug\";i:0;s:9:\"backtrace\";i:0;s:12:\"resourceBase\";N;s:13:\"extensionsURL\";N;s:12:\"countryLimit\";a:1:{i:0;s:4:\"1228\";}s:27:\"defaultContactStateProvince\";N;s:13:\"provinceLimit\";a:1:{i:0;s:4:\"1228\";}s:21:\"defaultContactCountry\";s:4:\"1228\";s:15:\"defaultCurrency\";s:3:\"USD\";s:10:\"lcMessages\";s:5:\"en_US\";s:18:\"dateformatDatetime\";s:20:\"%B %E%f, %Y %l:%M %P\";s:14:\"dateformatFull\";s:11:\"%B %E%f, %Y\";s:17:\"dateformatPartial\";s:5:\"%B %Y\";s:14:\"dateformatYear\";s:2:\"%Y\";s:14:\"dateformatTime\";s:8:\"%l:%M %P\";s:15:\"timeInputFormat\";i:1;s:15:\"dateInputFormat\";s:8:\"mm/dd/yy\";s:15:\"fiscalYearStart\";a:2:{s:1:\"M\";i:1;s:1:\"d\";i:1;}s:11:\"moneyformat\";s:5:\"%c %a\";s:16:\"moneyvalueformat\";s:3:\"%!i\";s:15:\"currencySymbols\";s:0:\"\";s:21:\"defaultCurrencySymbol\";s:1:\"$\";s:20:\"monetaryDecimalPoint\";s:1:\".\";s:25:\"monetaryThousandSeparator\";s:1:\",\";s:14:\"gettextCodeset\";s:5:\"utf-8\";s:13:\"gettextDomain\";s:7:\"civicrm\";s:27:\"userFrameworkUsersTableName\";s:5:\"users\";s:21:\"userFrameworkFrontend\";b:0;s:20:\"userFrameworkLogging\";b:0;s:17:\"maxImportFileSize\";i:2097152;s:11:\"maxFileSize\";i:2;s:11:\"mapProvider\";N;s:9:\"mapAPIKey\";N;s:11:\"geoProvider\";N;s:9:\"geoAPIKey\";N;s:13:\"geocodeMethod\";s:0:\"\";s:12:\"mapGeoCoding\";i:1;s:7:\"logging\";b:0;s:16:\"enableComponents\";a:6:{i:0;s:14:\"CiviContribute\";i:1;s:10:\"CiviPledge\";i:2;s:10:\"CiviMember\";i:3;s:9:\"CiviEvent\";i:4;s:8:\"CiviMail\";i:5;s:10:\"CiviReport\";}s:18:\"enableComponentIDs\";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:\"enableSSL\";b:0;s:17:\"fatalErrorHandler\";N;s:14:\"legacyEncoding\";s:12:\"Windows-1252\";s:14:\"fieldSeparator\";s:1:\",\";s:17:\"maxLocationBlocks\";i:2;s:15:\"captchaFontPath\";s:25:\"/usr/X11R6/lib/X11/fonts/\";s:11:\"captchaFont\";s:17:\"HelveticaBold.ttf\";s:21:\"includeWildCardInName\";i:1;s:18:\"includeEmailInName\";i:1;s:21:\"includeNickNameInName\";i:0;s:22:\"smartGroupCacheTimeout\";i:5;s:22:\"defaultSearchProfileID\";N;s:21:\"dashboardCacheTimeout\";i:1440;s:15:\"doNotResetCache\";i:0;s:24:\"includeAlphabeticalPager\";i:1;s:20:\"includeOrderByClause\";i:1;s:13:\"oldInputStyle\";i:1;s:14:\"formKeyDisable\";b:0;s:21:\"doNotAttachPDFReceipt\";b:0;s:15:\"wkhtmltopdfPath\";b:0;s:23:\"secondDegRelPermissions\";b:0;s:10:\"wpBasePage\";N;s:9:\"groupTree\";b:0;s:11:\"revampPages\";a:0:{}s:13:\"verpSeparator\";s:1:\".\";s:12:\"mailerPeriod\";i:180;s:16:\"mailerSpoolLimit\";i:0;s:16:\"mailerBatchLimit\";i:0;s:13:\"mailerJobSize\";i:0;s:13:\"mailerJobsMax\";i:0;s:16:\"mailThrottleTime\";i:0;s:12:\"customCSSURL\";N;}', + 'version' => '4.6.alpha1', + 'contact_id' => '2', + 'domain_email' => '\"Domain Email\" ', + 'domain_phone' => array( + 'phone_type' => 'Phone', + 'phone' => '204 555-1001', + ), + 'domain_address' => array( + 'street_address' => '15 Main St', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => 'Collinsville', + 'state_province_id' => '1006', + 'postal_code' => '6022', + 'country_id' => '1228', + 'geo_code_1' => '41.8328', + 'geo_code_2' => '-72.9253', ), + 'from_email' => 'info@EXAMPLE.ORG', + 'from_name' => 'FIXME', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Email/Create.php b/api/v3/examples/Email/Create.php index 62f85de66f..951036bfb5 100644 --- a/api/v3/examples/Email/Create.php +++ b/api/v3/examples/Email/Create.php @@ -1,66 +1,82 @@ 3, - 'location_type_id' => 6, - 'email' => 'api@a-team.com', - 'is_primary' => 1, -); -try{ - $result = civicrm_api3('email', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using email create API. + * + * + * @return array + * API result array + */ +function email_create_example() { + $params = array( + 'contact_id' => 3, + 'location_type_id' => 6, + 'email' => 'api@a-team.com', + 'is_primary' => 1, + ); -return $result; + try{ + $result = civicrm_api3('email', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function email_create_expectedresult(){ +function email_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( '3' => array( - 'id' => '3', - 'contact_id' => '3', - 'location_type_id' => '6', - 'email' => 'api@a-team.com', - 'is_primary' => '1', - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), + 'id' => '3', + 'contact_id' => '3', + 'location_type_id' => '6', + 'email' => 'api@a-team.com', + 'is_primary' => '1', + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateEmail and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateEmail +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Email/Delete.php b/api/v3/examples/Email/Delete.php index c76f539ad8..54ef848a51 100644 --- a/api/v3/examples/Email/Delete.php +++ b/api/v3/examples/Email/Delete.php @@ -1,47 +1,63 @@ 11, -); -try{ - $result = civicrm_api3('email', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using email delete API. + * + * + * @return array + * API result array + */ +function email_delete_example() { + $params = array( + 'id' => 11, + ); -return $result; + try{ + $result = civicrm_api3('email', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function email_delete_expectedresult(){ +function email_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteEmail and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteEmail +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Email/NestedReplaceEmail.php b/api/v3/examples/Email/NestedReplaceEmail.php index 0c5299d411..2da60eb9d3 100644 --- a/api/v3/examples/Email/NestedReplaceEmail.php +++ b/api/v3/examples/Email/NestedReplaceEmail.php @@ -1,223 +1,240 @@ 10, - 'api.email.replace' => array( + +/** + * Test Generated example of using email replace API. + * + * example demonstrates use of Replace in a nested API call + * + * @return array + * API result array + */ +function email_replace_example() { + $params = array( + 'id' => 10, + 'api.email.replace' => array( 'values' => array( - '0' => array( - 'location_type_id' => 20, + '0' => array( + 'location_type_id' => 20, + 'email' => '1-1@example.com', + 'is_primary' => 1, + ), + '1' => array( + 'location_type_id' => 20, + 'email' => '1-2@example.com', + 'is_primary' => 0, + ), + '2' => array( + 'location_type_id' => 20, + 'email' => '1-3@example.com', + 'is_primary' => 0, + ), + '3' => array( + 'location_type_id' => 21, + 'email' => '2-1@example.com', + 'is_primary' => 0, + ), + '4' => array( + 'location_type_id' => 21, + 'email' => '2-2@example.com', + 'is_primary' => 0, + ), + ), + ), + ); + + try{ + $result = civicrm_api3('email', 'replace', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function email_replace_expectedresult() { + + $expectedResult = array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 10, + 'values' => array( + '10' => array( + 'contact_id' => '10', + 'contact_type' => 'Organization', + 'contact_sub_type' => '', + 'sort_name' => 'Unit Test Organization', + 'display_name' => 'Unit Test Organization', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'first_name' => '', + 'middle_name' => '', + 'last_name' => '', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'organization_name' => 'Unit Test Organization', + 'sic_code' => '', + 'contact_is_deleted' => 0, + 'current_employer' => '', + 'address_id' => '', + 'street_address' => '', + 'supplemental_address_1' => '', + 'supplemental_address_2' => '', + 'city' => '', + 'postal_code_suffix' => '', + 'postal_code' => '', + 'geo_code_1' => '', + 'geo_code_2' => '', + 'state_province_id' => '', + 'country_id' => '', + 'phone_id' => '', + 'phone_type_id' => '', + 'phone' => '', + 'email_id' => '', + 'email' => '', + 'on_hold' => '', + 'im_id' => '', + 'provider_id' => '', + 'im' => '', + 'worldregion_id' => '', + 'world_region' => '', + 'individual_prefix' => '', + 'individual_suffix' => '', + 'communication_style' => '', + 'gender' => '', + 'state_province_name' => '', + 'state_province' => '', + 'country' => '', + 'id' => '10', + 'api.email.replace' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 5, + 'values' => array( + '0' => array( + 'id' => '18', + 'contact_id' => '10', + 'location_type_id' => '20', 'email' => '1-1@example.com', - 'is_primary' => 1, + 'is_primary' => '1', + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', ), - '1' => array( - 'location_type_id' => 20, + '1' => array( + 'id' => '19', + 'contact_id' => '10', + 'location_type_id' => '20', 'email' => '1-2@example.com', 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', ), - '2' => array( - 'location_type_id' => 20, + '2' => array( + 'id' => '20', + 'contact_id' => '10', + 'location_type_id' => '20', 'email' => '1-3@example.com', 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', ), - '3' => array( - 'location_type_id' => 21, + '3' => array( + 'id' => '21', + 'contact_id' => '10', + 'location_type_id' => '21', 'email' => '2-1@example.com', 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', ), - '4' => array( - 'location_type_id' => 21, + '4' => array( + 'id' => '22', + 'contact_id' => '10', + 'location_type_id' => '21', 'email' => '2-2@example.com', 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', ), + ), ), + ), ), -); - -try{ - $result = civicrm_api3('email', 'replace', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} - -return $result; -} - -/** - * Function returns array of result expected from previous function - */ -function email_replace_expectedresult(){ - - $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 10, - 'values' => array( - '10' => array( - 'contact_id' => '10', - 'contact_type' => 'Organization', - 'contact_sub_type' => '', - 'sort_name' => 'Unit Test Organization', - 'display_name' => 'Unit Test Organization', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'first_name' => '', - 'middle_name' => '', - 'last_name' => '', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'organization_name' => 'Unit Test Organization', - 'sic_code' => '', - 'contact_is_deleted' => 0, - 'current_employer' => '', - 'address_id' => '', - 'street_address' => '', - 'supplemental_address_1' => '', - 'supplemental_address_2' => '', - 'city' => '', - 'postal_code_suffix' => '', - 'postal_code' => '', - 'geo_code_1' => '', - 'geo_code_2' => '', - 'state_province_id' => '', - 'country_id' => '', - 'phone_id' => '', - 'phone_type_id' => '', - 'phone' => '', - 'email_id' => '', - 'email' => '', - 'on_hold' => '', - 'im_id' => '', - 'provider_id' => '', - 'im' => '', - 'worldregion_id' => '', - 'world_region' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', - 'gender' => '', - 'state_province_name' => '', - 'state_province' => '', - 'country' => '', - 'id' => '10', - 'api.email.replace' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 5, - 'values' => array( - '0' => array( - 'id' => '18', - 'contact_id' => '10', - 'location_type_id' => '20', - 'email' => '1-1@example.com', - 'is_primary' => '1', - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), - '1' => array( - 'id' => '19', - 'contact_id' => '10', - 'location_type_id' => '20', - 'email' => '1-2@example.com', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), - '2' => array( - 'id' => '20', - 'contact_id' => '10', - 'location_type_id' => '20', - 'email' => '1-3@example.com', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), - '3' => array( - 'id' => '21', - 'contact_id' => '10', - 'location_type_id' => '21', - 'email' => '2-1@example.com', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), - '4' => array( - 'id' => '22', - 'contact_id' => '10', - 'location_type_id' => '21', - 'email' => '2-2@example.com', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), - ), - ), - ), - ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testReplaceEmailsInChain and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testReplaceEmailsInChain +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Email/Replace.php b/api/v3/examples/Email/Replace.php index f6b95fb553..213b82a9e3 100644 --- a/api/v3/examples/Email/Replace.php +++ b/api/v3/examples/Email/Replace.php @@ -1,145 +1,161 @@ 9, - 'values' => array( + +/** + * Test Generated example of using email replace API. + * + * + * @return array + * API result array + */ +function email_replace_example() { + $params = array( + 'contact_id' => 9, + 'values' => array( '0' => array( - 'location_type_id' => 18, - 'email' => '1-1@example.com', - 'is_primary' => 1, - ), + 'location_type_id' => 18, + 'email' => '1-1@example.com', + 'is_primary' => 1, + ), '1' => array( - 'location_type_id' => 18, - 'email' => '1-2@example.com', - 'is_primary' => 0, - ), + 'location_type_id' => 18, + 'email' => '1-2@example.com', + 'is_primary' => 0, + ), '2' => array( - 'location_type_id' => 18, - 'email' => '1-3@example.com', - 'is_primary' => 0, - ), + 'location_type_id' => 18, + 'email' => '1-3@example.com', + 'is_primary' => 0, + ), '3' => array( - 'location_type_id' => 19, - 'email' => '2-1@example.com', - 'is_primary' => 0, - ), + 'location_type_id' => 19, + 'email' => '2-1@example.com', + 'is_primary' => 0, + ), '4' => array( - 'location_type_id' => 19, - 'email' => '2-2@example.com', - 'is_primary' => 0, - ), + 'location_type_id' => 19, + 'email' => '2-2@example.com', + 'is_primary' => 0, + ), ), -); + ); -try{ - $result = civicrm_api3('email', 'replace', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('email', 'replace', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function email_replace_expectedresult(){ +function email_replace_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 5, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 5, + 'values' => array( '12' => array( - 'id' => '12', - 'contact_id' => '9', - 'location_type_id' => '18', - 'email' => '1-1@example.com', - 'is_primary' => '1', - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), + 'id' => '12', + 'contact_id' => '9', + 'location_type_id' => '18', + 'email' => '1-1@example.com', + 'is_primary' => '1', + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', + ), '13' => array( - 'id' => '13', - 'contact_id' => '9', - 'location_type_id' => '18', - 'email' => '1-2@example.com', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), + 'id' => '13', + 'contact_id' => '9', + 'location_type_id' => '18', + 'email' => '1-2@example.com', + 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', + ), '14' => array( - 'id' => '14', - 'contact_id' => '9', - 'location_type_id' => '18', - 'email' => '1-3@example.com', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), + 'id' => '14', + 'contact_id' => '9', + 'location_type_id' => '18', + 'email' => '1-3@example.com', + 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', + ), '15' => array( - 'id' => '15', - 'contact_id' => '9', - 'location_type_id' => '19', - 'email' => '2-1@example.com', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), + 'id' => '15', + 'contact_id' => '9', + 'location_type_id' => '19', + 'email' => '2-1@example.com', + 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', + ), '16' => array( - 'id' => '16', - 'contact_id' => '9', - 'location_type_id' => '19', - 'email' => '2-2@example.com', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), + 'id' => '16', + 'contact_id' => '9', + 'location_type_id' => '19', + 'email' => '2-2@example.com', + 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testReplaceEmail and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testReplaceEmail +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/EntityTag/Create.php b/api/v3/examples/EntityTag/Create.php index bce9448343..b08bd1cb4a 100644 --- a/api/v3/examples/EntityTag/Create.php +++ b/api/v3/examples/EntityTag/Create.php @@ -1,48 +1,64 @@ 12, - 'tag_id' => '1', -); -try{ - $result = civicrm_api3('entity_tag', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using entity_tag create API. + * + * + * @return array + * API result array + */ +function entity_tag_create_example() { + $params = array( + 'contact_id' => 12, + 'tag_id' => '9', + ); -return $result; + try{ + $result = civicrm_api3('entity_tag', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function entity_tag_create_expectedresult(){ +function entity_tag_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'not_added' => 0, - 'added' => 1, - 'total_count' => 1, -); + 'is_error' => 0, + 'not_added' => 0, + 'added' => 1, + 'total_count' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testContactEntityTagCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testContactEntityTagCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/EntityTag/Delete.php b/api/v3/examples/EntityTag/Delete.php index 908982a737..e5bbe53ecf 100644 --- a/api/v3/examples/EntityTag/Delete.php +++ b/api/v3/examples/EntityTag/Delete.php @@ -1,48 +1,64 @@ 37, - 'tag_id' => '1', -); -try{ - $result = civicrm_api3('entity_tag', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using entity_tag delete API. + * + * + * @return array + * API result array + */ +function entity_tag_delete_example() { + $params = array( + 'contact_id_h' => 37, + 'tag_id' => '17', + ); -return $result; + try{ + $result = civicrm_api3('entity_tag', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function entity_tag_delete_expectedresult(){ +function entity_tag_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'not_removed' => 0, - 'removed' => 1, - 'total_count' => 1, -); + 'is_error' => 0, + 'not_removed' => 0, + 'removed' => 1, + 'total_count' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testEntityTagDeleteHH and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testEntityTagDeleteHH +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/EntityTag/Get.php b/api/v3/examples/EntityTag/Get.php index 9124d42310..2f4f2d8b40 100644 --- a/api/v3/examples/EntityTag/Get.php +++ b/api/v3/examples/EntityTag/Get.php @@ -1,48 +1,64 @@ 21, - 'tag_id' => '1', -); -try{ - $result = civicrm_api3('entity_tag', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using entity_tag get API. + * + * + * @return array + * API result array + */ +function entity_tag_get_example() { + $params = array( + 'contact_id' => 21, + 'tag_id' => '12', + ); -return $result; + try{ + $result = civicrm_api3('entity_tag', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function entity_tag_get_expectedresult(){ +function entity_tag_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'not_added' => 0, - 'added' => 1, - 'total_count' => 1, -); + 'is_error' => 0, + 'not_added' => 0, + 'added' => 1, + 'total_count' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testIndividualEntityTagGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testIndividualEntityTagGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Event/Create.php b/api/v3/examples/Event/Create.php index fb15e40699..98a7025d91 100644 --- a/api/v3/examples/Event/Create.php +++ b/api/v3/examples/Event/Create.php @@ -1,130 +1,147 @@ 'Annual CiviCRM meet', - 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', - 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', - 'event_type_id' => 1, - 'is_public' => 1, - 'start_date' => 20081021, - 'end_date' => 20081023, - 'is_online_registration' => 1, - 'registration_start_date' => 20080601, - 'registration_end_date' => '2008-10-15', - 'max_participants' => 100, - 'event_full_text' => 'Sorry! We are already full', - 'is_monetary' => 0, - 'is_active' => 1, - 'is_show_location' => 0, -); -try{ - $result = civicrm_api3('event', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using event create API. + * + * + * @return array + * API result array + */ +function event_create_example() { + $params = array( + 'title' => 'Annual CiviCRM meet', + 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', + 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', + 'event_type_id' => 1, + 'is_public' => 1, + 'start_date' => 20081021, + 'end_date' => 20081023, + 'is_online_registration' => 1, + 'registration_start_date' => 20080601, + 'registration_end_date' => '2008-10-15', + 'max_participants' => 100, + 'event_full_text' => 'Sorry! We are already full', + 'is_monetary' => 0, + 'is_active' => 1, + 'is_show_location' => 0, + ); -return $result; + try{ + $result = civicrm_api3('event', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function event_create_expectedresult(){ +function event_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( '3' => array( - 'id' => '3', - 'title' => 'Annual CiviCRM meet', - 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', - 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', - 'event_type_id' => '1', - 'participant_listing_id' => '', - 'is_public' => '1', - 'start_date' => '2013-07-29 00:00:00', - 'end_date' => '2013-08-04 00:00:00', - 'is_online_registration' => '1', - 'registration_link_text' => '', - 'registration_start_date' => '20080601000000', - 'registration_end_date' => '20081015000000', - 'max_participants' => '100', - 'event_full_text' => 'Sorry! We are already full', - 'is_monetary' => 0, - 'financial_type_id' => '', - 'payment_processor' => '', - 'is_map' => '', - 'is_active' => '1', - 'fee_label' => '', - 'is_show_location' => 0, - 'loc_block_id' => '', - 'default_role_id' => '', - 'intro_text' => '', - 'footer_text' => '', - 'confirm_title' => '', - 'confirm_text' => '', - 'confirm_footer_text' => '', - 'is_email_confirm' => '', - 'confirm_email_text' => '', - 'confirm_from_name' => '', - 'confirm_from_email' => '', - 'cc_confirm' => '', - 'bcc_confirm' => '', - 'default_fee_id' => '', - 'default_discount_fee_id' => '', - 'thankyou_title' => '', - 'thankyou_text' => '', - 'thankyou_footer_text' => '', - 'is_pay_later' => '', - 'pay_later_text' => '', - 'pay_later_receipt' => '', - 'is_partial_payment' => '', - 'initial_amount_label' => '', - 'initial_amount_help_text' => '', - 'min_initial_amount' => '', - 'is_multiple_registrations' => '', - 'allow_same_participant_emails' => '', - 'has_waitlist' => '', - 'requires_approval' => '', - 'expiration_time' => '', - 'waitlist_text' => '', - 'approval_req_text' => '', - 'is_template' => 0, - 'template_title' => '', - 'created_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'currency' => '', - 'campaign_id' => '', - 'is_share' => '', - 'is_confirm_enabled' => '', - 'parent_event_id' => '', - 'slot_label_id' => '', - 'dedupe_rule_group_id' => '', - ), + 'id' => '3', + 'title' => 'Annual CiviCRM meet', + 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', + 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', + 'event_type_id' => '1', + 'participant_listing_id' => '', + 'is_public' => '1', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'is_online_registration' => '1', + 'registration_link_text' => '', + 'registration_start_date' => '20080601000000', + 'registration_end_date' => '20081015000000', + 'max_participants' => '100', + 'event_full_text' => 'Sorry! We are already full', + 'is_monetary' => 0, + 'financial_type_id' => '', + 'payment_processor' => '', + 'is_map' => '', + 'is_active' => '1', + 'fee_label' => '', + 'is_show_location' => 0, + 'loc_block_id' => '', + 'default_role_id' => '', + 'intro_text' => '', + 'footer_text' => '', + 'confirm_title' => '', + 'confirm_text' => '', + 'confirm_footer_text' => '', + 'is_email_confirm' => '', + 'confirm_email_text' => '', + 'confirm_from_name' => '', + 'confirm_from_email' => '', + 'cc_confirm' => '', + 'bcc_confirm' => '', + 'default_fee_id' => '', + 'default_discount_fee_id' => '', + 'thankyou_title' => '', + 'thankyou_text' => '', + 'thankyou_footer_text' => '', + 'is_pay_later' => '', + 'pay_later_text' => '', + 'pay_later_receipt' => '', + 'is_partial_payment' => '', + 'initial_amount_label' => '', + 'initial_amount_help_text' => '', + 'min_initial_amount' => '', + 'is_multiple_registrations' => '', + 'allow_same_participant_emails' => '', + 'has_waitlist' => '', + 'requires_approval' => '', + 'expiration_time' => '', + 'waitlist_text' => '', + 'approval_req_text' => '', + 'is_template' => 0, + 'template_title' => '', + 'created_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'currency' => '', + 'campaign_id' => '', + 'is_share' => '', + 'is_confirm_enabled' => '', + 'parent_event_id' => '', + 'slot_label_id' => '', + 'dedupe_rule_group_id' => '', + 'is_billing_required' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateEventSuccess and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateEventSuccess +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Event/Delete.php b/api/v3/examples/Event/Delete.php index 72b1b8f59e..8a9bcbf8ed 100644 --- a/api/v3/examples/Event/Delete.php +++ b/api/v3/examples/Event/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('event', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using event delete API. + * + * + * @return array + * API result array + */ +function event_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('event', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function event_delete_expectedresult(){ +function event_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Event/Get.php b/api/v3/examples/Event/Get.php index a8aa0eb99f..cf68137c7a 100644 --- a/api/v3/examples/Event/Get.php +++ b/api/v3/examples/Event/Get.php @@ -1,75 +1,92 @@ 'Annual CiviCRM meet', - 'sequential' => true, -); -try{ - $result = civicrm_api3('event', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using event get API. + * + * + * @return array + * API result array + */ +function event_get_example() { + $params = array( + 'event_title' => 'Annual CiviCRM meet', + 'sequential' => TRUE, + ); -return $result; + try{ + $result = civicrm_api3('event', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function event_get_expectedresult(){ +function event_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '0' => array( - 'id' => '1', - 'title' => 'Annual CiviCRM meet', - 'event_title' => 'Annual CiviCRM meet', - 'event_type_id' => '1', - 'participant_listing_id' => 0, - 'is_public' => '1', - 'start_date' => '2013-07-29 00:00:00', - 'event_start_date' => '2013-07-29 00:00:00', - 'is_online_registration' => 0, - 'is_monetary' => 0, - 'is_map' => 0, - 'is_active' => '1', - 'is_show_location' => '1', - 'default_role_id' => '1', - 'is_email_confirm' => 0, - 'is_pay_later' => 0, - 'is_partial_payment' => 0, - 'is_multiple_registrations' => 0, - 'allow_same_participant_emails' => 0, - 'is_template' => 0, - 'created_date' => '2013-07-28 08:49:19', - 'is_share' => '1', - 'is_confirm_enabled' => '1', - ), + 'id' => '1', + 'title' => 'Annual CiviCRM meet', + 'event_title' => 'Annual CiviCRM meet', + 'event_type_id' => '1', + 'participant_listing_id' => 0, + 'is_public' => '1', + 'start_date' => '2013-07-29 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'is_online_registration' => 0, + 'is_monetary' => 0, + 'is_map' => 0, + 'is_active' => '1', + 'is_show_location' => '1', + 'default_role_id' => '1', + 'is_email_confirm' => 0, + 'is_pay_later' => 0, + 'is_partial_payment' => 0, + 'is_multiple_registrations' => 0, + 'allow_same_participant_emails' => 0, + 'is_template' => 0, + 'created_date' => '2013-07-28 08:49:19', + 'is_share' => '1', + 'is_confirm_enabled' => '1', + 'is_billing_required' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetEventByEventTitle and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetEventByEventTitle +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Event/IsCurrentOption.php b/api/v3/examples/Event/IsCurrentOption.php index b1f3a15598..41c990a1f3 100644 --- a/api/v3/examples/Event/IsCurrentOption.php +++ b/api/v3/examples/Event/IsCurrentOption.php @@ -1,83 +1,101 @@ 1, -); -try{ - $result = civicrm_api3('event', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using event get API. + * + * demonstrates use of is.Current option + * + * @return array + * API result array + */ +function event_get_example() { + $params = array( + 'isCurrent' => 1, + ); -return $result; + try{ + $result = civicrm_api3('event', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function event_get_expectedresult(){ +function event_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( '3' => array( - 'id' => '3', - 'title' => 'Annual CiviCRM meet 2', - 'event_title' => 'Annual CiviCRM meet 2', - 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', - 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', - 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', - 'event_type_id' => '1', - 'participant_listing_id' => 0, - 'is_public' => '1', - 'start_date' => '2013-07-29 00:00:00', - 'event_start_date' => '2013-07-29 00:00:00', - 'end_date' => '2013-08-04 00:00:00', - 'event_end_date' => '2013-08-04 00:00:00', - 'is_online_registration' => '1', - 'registration_start_date' => '2010-06-01 00:00:00', - 'registration_end_date' => '2010-10-15 00:00:00', - 'max_participants' => '100', - 'event_full_text' => 'Sorry! We are already full', - 'is_monetary' => 0, - 'is_map' => 0, - 'is_active' => '1', - 'is_show_location' => 0, - 'default_role_id' => '1', - 'is_email_confirm' => 0, - 'is_pay_later' => 0, - 'is_partial_payment' => 0, - 'is_multiple_registrations' => 0, - 'allow_same_participant_emails' => 0, - 'is_template' => 0, - 'created_date' => '2013-07-28 08:49:19', - 'is_share' => '1', - 'is_confirm_enabled' => '1', - ), + 'id' => '3', + 'title' => 'Annual CiviCRM meet 2', + 'event_title' => 'Annual CiviCRM meet 2', + 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now', + 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', + 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', + 'event_type_id' => '1', + 'participant_listing_id' => 0, + 'is_public' => '1', + 'start_date' => '2013-07-29 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', + 'is_online_registration' => '1', + 'registration_start_date' => '2010-06-01 00:00:00', + 'registration_end_date' => '2010-10-15 00:00:00', + 'max_participants' => '100', + 'event_full_text' => 'Sorry! We are already full', + 'is_monetary' => 0, + 'is_map' => 0, + 'is_active' => '1', + 'is_show_location' => 0, + 'default_role_id' => '1', + 'is_email_confirm' => 0, + 'is_pay_later' => 0, + 'is_partial_payment' => 0, + 'is_multiple_registrations' => 0, + 'allow_same_participant_emails' => 0, + 'is_template' => 0, + 'created_date' => '2013-07-28 08:49:19', + 'is_share' => '1', + 'is_confirm_enabled' => '1', + 'is_billing_required' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetIsCurrent and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetIsCurrent +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Event/IsFullOption.php b/api/v3/examples/Event/IsFullOption.php index bfa1cd0f7d..872c86ad15 100644 --- a/api/v3/examples/Event/IsFullOption.php +++ b/api/v3/examples/Event/IsFullOption.php @@ -1,70 +1,88 @@ 1, - 'return.is_full' => 1, -); -try{ - $result = civicrm_api3('event', 'getsingle', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using event getsingle API. + * + * demonstrates use of return is_full + * + * @return array + * API result array + */ +function event_getsingle_example() { + $params = array( + 'id' => 1, + 'return.is_full' => 1, + ); -return $result; + try{ + $result = civicrm_api3('event', 'getsingle', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function event_getsingle_expectedresult(){ +function event_getsingle_expectedresult() { $expectedResult = array( - 'id' => '1', - 'title' => 'Annual CiviCRM meet', - 'event_title' => 'Annual CiviCRM meet', - 'event_type_id' => '1', - 'participant_listing_id' => 0, - 'is_public' => '1', - 'start_date' => '2008-10-21 00:00:00', - 'event_start_date' => '2008-10-21 00:00:00', - 'is_online_registration' => 0, - 'max_participants' => '1', - 'is_monetary' => 0, - 'is_map' => 0, - 'is_active' => '1', - 'is_show_location' => '1', - 'default_role_id' => '1', - 'is_email_confirm' => 0, - 'is_pay_later' => 0, - 'is_partial_payment' => 0, - 'is_multiple_registrations' => 0, - 'allow_same_participant_emails' => 0, - 'is_template' => 0, - 'created_date' => '2014-09-28 23:20:52', - 'is_share' => '1', - 'is_confirm_enabled' => '1', - 'available_places' => 0, - 'is_full' => '1', -); + 'id' => '1', + 'title' => 'Annual CiviCRM meet', + 'event_title' => 'Annual CiviCRM meet', + 'event_type_id' => '1', + 'participant_listing_id' => 0, + 'is_public' => '1', + 'start_date' => '2008-10-21 00:00:00', + 'event_start_date' => '2008-10-21 00:00:00', + 'is_online_registration' => 0, + 'max_participants' => '1', + 'is_monetary' => 0, + 'is_map' => 0, + 'is_active' => '1', + 'is_show_location' => '1', + 'default_role_id' => '1', + 'is_email_confirm' => 0, + 'is_pay_later' => 0, + 'is_partial_payment' => 0, + 'is_multiple_registrations' => 0, + 'allow_same_participant_emails' => 0, + 'is_template' => 0, + 'created_date' => '2015-01-15 02:10:12', + 'is_share' => '1', + 'is_confirm_enabled' => '1', + 'is_billing_required' => 0, + 'available_places' => 0, + 'is_full' => '1', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetSingleReturnIsFull and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetSingleReturnIsFull +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Grant/Create.php b/api/v3/examples/Grant/Create.php index 9c118cbb20..478cd1398b 100644 --- a/api/v3/examples/Grant/Create.php +++ b/api/v3/examples/Grant/Create.php @@ -1,73 +1,89 @@ 3, - 'application_received_date' => 'now', - 'decision_date' => 'next Monday', - 'amount_total' => '500', - 'status_id' => 1, - 'rationale' => 'Just Because', - 'currency' => 'USD', - 'grant_type_id' => 1, -); -try{ - $result = civicrm_api3('grant', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using grant create API. + * + * + * @return array + * API result array + */ +function grant_create_example() { + $params = array( + 'contact_id' => 3, + 'application_received_date' => 'now', + 'decision_date' => 'next Monday', + 'amount_total' => '500', + 'status_id' => 1, + 'rationale' => 'Just Because', + 'currency' => 'USD', + 'grant_type_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('grant', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function grant_create_expectedresult(){ +function grant_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '3', - 'application_received_date' => '20130728084957', - 'decision_date' => '20130805000000', - 'money_transfer_date' => '', - 'grant_due_date' => '', - 'grant_report_received' => '', - 'grant_type_id' => '1', - 'amount_total' => '500', - 'amount_requested' => '', - 'amount_granted' => '', - 'currency' => 'USD', - 'rationale' => 'Just Because', - 'status_id' => '1', - 'financial_type_id' => '', - ), + 'id' => '1', + 'contact_id' => '3', + 'application_received_date' => '20130728084957', + 'decision_date' => '20130805000000', + 'money_transfer_date' => '', + 'grant_due_date' => '', + 'grant_report_received' => '', + 'grant_type_id' => '1', + 'amount_total' => '500', + 'amount_requested' => '', + 'amount_granted' => '', + 'currency' => 'USD', + 'rationale' => 'Just Because', + 'status_id' => '1', + 'financial_type_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateGrant and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateGrant +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Grant/Delete.php b/api/v3/examples/Grant/Delete.php index 7719a922f0..ab4a452c1a 100644 --- a/api/v3/examples/Grant/Delete.php +++ b/api/v3/examples/Grant/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('grant', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using grant delete API. + * + * + * @return array + * API result array + */ +function grant_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('grant', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function grant_delete_expectedresult(){ +function grant_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteGrant and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteGrant +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Grant/Get.php b/api/v3/examples/Grant/Get.php index 15fbbf2bd0..33b4e65ec4 100644 --- a/api/v3/examples/Grant/Get.php +++ b/api/v3/examples/Grant/Get.php @@ -1,60 +1,76 @@ 'Just Because', -); -try{ - $result = civicrm_api3('grant', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using grant get API. + * + * + * @return array + * API result array + */ +function grant_get_example() { + $params = array( + 'rationale' => 'Just Because', + ); -return $result; + try{ + $result = civicrm_api3('grant', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function grant_get_expectedresult(){ +function grant_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '5', - 'application_received_date' => '20130728084957', - 'decision_date' => '20130805000000', - 'grant_type_id' => '1', - 'amount_total' => '500.00', - 'currency' => 'USD', - 'rationale' => 'Just Because', - 'status_id' => '1', - ), + 'id' => '1', + 'contact_id' => '5', + 'application_received_date' => '20130728084957', + 'decision_date' => '20130805000000', + 'grant_type_id' => '1', + 'amount_total' => '500.00', + 'currency' => 'USD', + 'rationale' => 'Just Because', + 'status_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetGrant and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetGrant +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Group/Get.php b/api/v3/examples/Group/Get.php index b164e7311d..710c469141 100644 --- a/api/v3/examples/Group/Get.php +++ b/api/v3/examples/Group/Get.php @@ -1,66 +1,82 @@ 'Test Group 1', -); -try{ - $result = civicrm_api3('group', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group get API. + * + * + * @return array + * API result array + */ +function group_get_example() { + $params = array( + 'name' => 'Test Group 1', + ); -return $result; + try{ + $result = civicrm_api3('group', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_get_expectedresult(){ +function group_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 4, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 4, + 'values' => array( '4' => array( - 'id' => '4', - 'name' => 'Test Group 1', - 'title' => 'New Test Group Created', - 'description' => 'New Test Group Created', - 'is_active' => '1', - 'visibility' => 'Public Pages', - 'where_clause' => ' ( `civicrm_group_contact-4`.group_id IN ( 4 ) AND `civicrm_group_contact-4`.status IN (\"Added\") ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON ( contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.group_id IN ( 4 ) )\";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON ( contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.group_id IN ( 4 ) )\";}', - 'group_type' => array( - '0' => '1', - '1' => '2', - ), - 'is_hidden' => 0, - 'is_reserved' => 0, + 'id' => '4', + 'name' => 'Test Group 1', + 'title' => 'New Test Group Created', + 'description' => 'New Test Group Created', + 'is_active' => '1', + 'visibility' => 'Public Pages', + 'where_clause' => ' ( `civicrm_group_contact-4`.group_id IN ( 4 ) AND `civicrm_group_contact-4`.status IN (\"Added\") ) ', + 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON ( contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.group_id IN ( 4 ) )\";}', + 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON ( contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.group_id IN ( 4 ) )\";}', + 'group_type' => array( + '0' => '1', + '1' => '2', ), + 'is_hidden' => 0, + 'is_reserved' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetGroupParamsWithGroupName and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetGroupParamsWithGroupName +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Group/getfields.php b/api/v3/examples/Group/getfields.php index 3dd054b100..4e5330bc70 100644 --- a/api/v3/examples/Group/getfields.php +++ b/api/v3/examples/Group/getfields.php @@ -1,179 +1,199 @@ 'create', -); -try{ - $result = civicrm_api3('group', 'getfields', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group getfields API. + * + * demonstrate use of getfields to interrogate api + * + * @return array + * API result array + */ +function group_getfields_example() { + $params = array( + 'action' => 'create', + ); -return $result; + try{ + $result = civicrm_api3('group', 'getfields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_getfields_expectedresult(){ +function group_getfields_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 20, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 20, + 'values' => array( 'id' => array( - 'name' => 'id', - 'type' => 1, - 'title' => 'Group ID', - 'required' => true, - 'api.aliases' => array( - '0' => 'group_id', - ), - ), + 'name' => 'id', + 'type' => 1, + 'title' => 'Group ID', + 'required' => TRUE, + 'api.aliases' => array( + '0' => 'group_id', + ), + ), 'name' => array( - 'name' => 'name', - 'type' => 2, - 'title' => 'Group Name', - 'maxlength' => 64, - 'size' => 30, - ), + 'name' => 'name', + 'type' => 2, + 'title' => 'Group Name', + 'maxlength' => 64, + 'size' => 30, + ), 'title' => array( - 'name' => 'title', - 'type' => 2, - 'title' => 'Group Title', - 'maxlength' => 64, - 'size' => 30, - 'api.required' => 1, - ), + 'name' => 'title', + 'type' => 2, + 'title' => 'Group Title', + 'maxlength' => 64, + 'size' => 30, + 'api.required' => 1, + ), 'description' => array( - 'name' => 'description', - 'type' => 32, - 'title' => 'Group Description', - 'rows' => 2, - 'cols' => 60, - 'html' => array( - 'type' => 'TextArea', - ), - ), + 'name' => 'description', + 'type' => 32, + 'title' => 'Group Description', + 'rows' => 2, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ), + ), 'source' => array( - 'name' => 'source', - 'type' => 2, - 'title' => 'Group Source', - 'maxlength' => 64, - 'size' => 30, - ), + 'name' => 'source', + 'type' => 2, + 'title' => 'Group Source', + 'maxlength' => 64, + 'size' => 30, + ), 'saved_search_id' => array( - 'name' => 'saved_search_id', - 'type' => 1, - 'title' => 'Saved Search ID', - 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', - ), + 'name' => 'saved_search_id', + 'type' => 1, + 'title' => 'Saved Search ID', + 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', + 'FKApiName' => 'SavedSearch', + ), 'is_active' => array( - 'name' => 'is_active', - 'type' => 16, - 'title' => 'Group Enabled', - 'api.default' => 1, - ), + 'name' => 'is_active', + 'type' => 16, + 'title' => 'Group Enabled', + 'api.default' => 1, + ), 'visibility' => array( - 'name' => 'visibility', - 'type' => 2, - 'title' => 'Group Visibility Setting', - 'maxlength' => 24, - 'size' => 20, - 'default' => 'User and User Admin Only', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'callback' => 'CRM_Core_SelectValues::groupVisibility', - ), - ), + 'name' => 'visibility', + 'type' => 2, + 'title' => 'Group Visibility Setting', + 'maxlength' => 24, + 'size' => 20, + 'default' => 'User and User Admin Only', + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::groupVisibility', + ), + ), 'where_clause' => array( - 'name' => 'where_clause', - 'type' => 32, - 'title' => 'Group Where Clause', - ), + 'name' => 'where_clause', + 'type' => 32, + 'title' => 'Group Where Clause', + ), 'select_tables' => array( - 'name' => 'select_tables', - 'type' => 32, - 'title' => 'Tables For Select Clause', - ), + 'name' => 'select_tables', + 'type' => 32, + 'title' => 'Tables For Select Clause', + ), 'where_tables' => array( - 'name' => 'where_tables', - 'type' => 32, - 'title' => 'Tables For Where Clause', - ), + 'name' => 'where_tables', + 'type' => 32, + 'title' => 'Tables For Where Clause', + ), 'group_type' => array( - 'name' => 'group_type', - 'type' => 2, - 'title' => 'Group Type', - 'maxlength' => 128, - 'size' => 45, - ), + 'name' => 'group_type', + 'type' => 2, + 'title' => 'Group Type', + 'maxlength' => 128, + 'size' => 45, + ), 'cache_date' => array( - 'name' => 'cache_date', - 'type' => 12, - 'title' => 'Group Cache Date', - ), + 'name' => 'cache_date', + 'type' => 12, + 'title' => 'Group Cache Date', + ), 'refresh_date' => array( - 'name' => 'refresh_date', - 'type' => 12, - 'title' => 'Next Group Refresh Time', - ), + 'name' => 'refresh_date', + 'type' => 12, + 'title' => 'Next Group Refresh Time', + ), 'parents' => array( - 'name' => 'parents', - 'type' => 32, - 'title' => 'Group Parents', - ), + 'name' => 'parents', + 'type' => 32, + 'title' => 'Group Parents', + ), 'children' => array( - 'name' => 'children', - 'type' => 32, - 'title' => 'Group Children', - ), + 'name' => 'children', + 'type' => 32, + 'title' => 'Group Children', + ), 'is_hidden' => array( - 'name' => 'is_hidden', - 'type' => 16, - 'title' => 'Group is Hidden', - ), + 'name' => 'is_hidden', + 'type' => 16, + 'title' => 'Group is Hidden', + ), 'is_reserved' => array( - 'name' => 'is_reserved', - 'type' => 16, - 'title' => 'Group is Reserved', - ), + 'name' => 'is_reserved', + 'type' => 16, + 'title' => 'Group is Reserved', + ), 'created_id' => array( - 'name' => 'created_id', - 'type' => 1, - 'title' => 'Group Created By', - 'FKClassName' => 'CRM_Contact_DAO_Contact', - ), + 'name' => 'created_id', + 'type' => 1, + 'title' => 'Group Created By', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'FKApiName' => 'Contact', + ), 'modified_id' => array( - 'name' => 'modified_id', - 'type' => 1, - 'title' => 'Group Modified By', - 'FKClassName' => 'CRM_Contact_DAO_Contact', - ), + 'name' => 'modified_id', + 'type' => 1, + 'title' => 'Group Modified By', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'FKApiName' => 'Contact', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testgetfields and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testgetfields +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupContact/Create.php b/api/v3/examples/GroupContact/Create.php index 0e3ad3b7d7..930139a5ee 100644 --- a/api/v3/examples/GroupContact/Create.php +++ b/api/v3/examples/GroupContact/Create.php @@ -1,52 +1,68 @@ 1, - 'contact_id.2' => 2, - 'group_id' => 1, -); -try{ - $result = civicrm_api3('group_contact', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_contact create API. + * + * + * @return array + * API result array + */ +function group_contact_create_example() { + $params = array( + 'contact_id' => 8, + 'contact_id.2' => 9, + 'group_id' => 11, + ); -return $result; + try{ + $result = civicrm_api3('group_contact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_contact_create_expectedresult(){ +function group_contact_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, - 'total_count' => 2, - 'added' => 1, - 'not_added' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + 'total_count' => 2, + 'added' => 1, + 'not_added' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupContact/Delete.php b/api/v3/examples/GroupContact/Delete.php index c61c1a74e7..1a3829a969 100644 --- a/api/v3/examples/GroupContact/Delete.php +++ b/api/v3/examples/GroupContact/Delete.php @@ -1,51 +1,67 @@ 4, - 'skip_undelete' => true, -); -try{ - $result = civicrm_api3('group_contact', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_contact delete API. + * + * + * @return array + * API result array + */ +function group_contact_delete_example() { + $params = array( + 'id' => 9, + 'skip_undelete' => TRUE, + ); -return $result; + try{ + $result = civicrm_api3('group_contact', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_contact_delete_expectedresult(){ +function group_contact_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, - 'total_count' => 1, - 'removed' => 0, - 'not_removed' => 0, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + 'total_count' => 1, + 'removed' => 0, + 'not_removed' => 0, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeletePermanent and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeletePermanent +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupContact/Get.php b/api/v3/examples/GroupContact/Get.php index 4cf76d0935..d78b1df66b 100644 --- a/api/v3/examples/GroupContact/Get.php +++ b/api/v3/examples/GroupContact/Get.php @@ -1,58 +1,74 @@ 3, -); -try{ - $result = civicrm_api3('group_contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_contact get API. + * + * + * @return array + * API result array + */ +function group_contact_get_example() { + $params = array( + 'contact_id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('group_contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_contact_get_expectedresult(){ +function group_contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'group_id' => '1', - 'title' => 'New Test Group Created', - 'visibility' => 'Public Pages', - 'is_hidden' => 0, - 'in_date' => '2013-07-28 08:50:19', - 'in_method' => 'API', - ), + 'id' => '1', + 'group_id' => '1', + 'title' => 'New Test Group Created', + 'visibility' => 'Public Pages', + 'is_hidden' => 0, + 'in_date' => '2013-07-28 08:50:19', + 'in_method' => 'API', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupContact/GetWithGroupID.php b/api/v3/examples/GroupContact/GetWithGroupID.php index 62a9b3d115..bf4d830233 100644 --- a/api/v3/examples/GroupContact/GetWithGroupID.php +++ b/api/v3/examples/GroupContact/GetWithGroupID.php @@ -1,112 +1,99 @@ 1, - 'api.group.get' => 1, - 'sequential' => 1, -); -try{ - $result = civicrm_api3('group_contact', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_contact get API. + * + * Get all from group and display contacts + * + * @return array + * API result array + */ +function group_contact_get_example() { + $params = array( + 'group_id' => 3, + 'api.group.get' => 1, + 'sequential' => 1, + ); + + try{ + $result = civicrm_api3('group_contact', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_contact_get_expectedresult(){ +function group_contact_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '0' => array( - 'id' => '1', - 'group_id' => '1', - 'contact_id' => '3', - 'status' => 'Added', - 'api.group.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'name' => 'Test Group 1', - 'title' => 'New Test Group Created', - 'description' => 'New Test Group Created', - 'is_active' => '1', - 'visibility' => 'Public Pages', - 'where_clause' => ' ( `civicrm_group_contact-1`.group_id IN ( 1 ) AND `civicrm_group_contact-1`.status IN (\"Added\") ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-1`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON ( contact_a.id = `civicrm_group_contact-1`.contact_id AND `civicrm_group_contact-1`.group_id IN ( 1 ) )\";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-1`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON ( contact_a.id = `civicrm_group_contact-1`.contact_id AND `civicrm_group_contact-1`.group_id IN ( 1 ) )\";}', - 'group_type' => array( - '0' => '1', - '1' => '2', - ), - 'is_hidden' => 0, - 'is_reserved' => 0, - ), - ), - ), - ), - '1' => array( - 'id' => '2', - 'group_id' => '1', - 'contact_id' => '1', - 'status' => 'Added', - 'api.group.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'name' => 'Test Group 1', - 'title' => 'New Test Group Created', - 'description' => 'New Test Group Created', - 'is_active' => '1', - 'visibility' => 'Public Pages', - 'where_clause' => ' ( `civicrm_group_contact-1`.group_id IN ( 1 ) AND `civicrm_group_contact-1`.status IN (\"Added\") ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-1`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON ( contact_a.id = `civicrm_group_contact-1`.contact_id AND `civicrm_group_contact-1`.group_id IN ( 1 ) )\";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-1`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-1` ON ( contact_a.id = `civicrm_group_contact-1`.contact_id AND `civicrm_group_contact-1`.group_id IN ( 1 ) )\";}', - 'group_type' => array( - '0' => '1', - '1' => '2', - ), - 'is_hidden' => 0, - 'is_reserved' => 0, - ), - ), + 'id' => '2', + 'group_id' => '3', + 'contact_id' => '4', + 'status' => 'Added', + 'api.group.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( + '0' => array( + 'id' => '3', + 'name' => 'Test Group 1', + 'title' => 'New Test Group Created', + 'description' => 'New Test Group Created', + 'is_active' => '1', + 'visibility' => 'Public Pages', + 'where_clause' => ' ( `civicrm_group_contact-3`.group_id IN ( 3 ) AND `civicrm_group_contact-3`.status IN (\"Added\") ) ', + 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON ( contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.group_id IN ( 3 ) )\";}', + 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON ( contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.group_id IN ( 3 ) )\";}', + 'group_type' => array( + '0' => '1', + '1' => '2', + ), + 'is_hidden' => 0, + 'is_reserved' => 0, ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetGroupID and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetGroupID +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupNesting/Create.php b/api/v3/examples/GroupNesting/Create.php index 6f8c63421f..d53c24b7e8 100644 --- a/api/v3/examples/GroupNesting/Create.php +++ b/api/v3/examples/GroupNesting/Create.php @@ -1,51 +1,67 @@ 1, - 'child_group_id' => 3, -); -try{ - $result = civicrm_api3('group_nesting', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_nesting create API. + * + * + * @return array + * API result array + */ +function group_nesting_create_example() { + $params = array( + 'parent_group_id' => 1, + 'child_group_id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('group_nesting', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_nesting_create_expectedresult(){ +function group_nesting_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 'is_error', - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 'is_error', + 'values' => array( 'is_error' => 0, ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupNesting/Delete.php b/api/v3/examples/GroupNesting/Delete.php index e5562e1751..c88f00527c 100644 --- a/api/v3/examples/GroupNesting/Delete.php +++ b/api/v3/examples/GroupNesting/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('group_nesting', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_nesting delete API. + * + * + * @return array + * API result array + */ +function group_nesting_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('group_nesting', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_nesting_delete_expectedresult(){ +function group_nesting_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupNesting/Get.php b/api/v3/examples/GroupNesting/Get.php index 3aa9aaa4a0..d054477c2a 100644 --- a/api/v3/examples/GroupNesting/Get.php +++ b/api/v3/examples/GroupNesting/Get.php @@ -1,55 +1,71 @@ 1, - 'child_group_id' => 2, -); -try{ - $result = civicrm_api3('group_nesting', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_nesting get API. + * + * + * @return array + * API result array + */ +function group_nesting_get_example() { + $params = array( + 'parent_group_id' => 1, + 'child_group_id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('group_nesting', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_nesting_get_expectedresult(){ +function group_nesting_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'child_group_id' => '2', - 'parent_group_id' => '1', - ), + 'id' => '1', + 'child_group_id' => '2', + 'parent_group_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupOrganization/Create.php b/api/v3/examples/GroupOrganization/Create.php index 6df4b1ee46..7e23bff87d 100644 --- a/api/v3/examples/GroupOrganization/Create.php +++ b/api/v3/examples/GroupOrganization/Create.php @@ -1,53 +1,69 @@ 1, - 'group_id' => 1, -); -try{ - $result = civicrm_api3('group_organization', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_organization create API. + * + * + * @return array + * API result array + */ +function group_organization_create_example() { + $params = array( + 'organization_id' => 8, + 'group_id' => 6, + ); -return $result; + try{ + $result = civicrm_api3('group_organization', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_organization_create_expectedresult(){ +function group_organization_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 3, - 'id' => 1, - 'values' => array( - 'id' => '1', - 'group_id' => '1', - 'organization_id' => '1', + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'id' => 3, + 'values' => array( + 'id' => '3', + 'group_id' => '6', + 'organization_id' => '8', ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGroupOrganizationCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGroupOrganizationCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupOrganization/Delete.php b/api/v3/examples/GroupOrganization/Delete.php index 51ab52d0b5..381bc73e72 100644 --- a/api/v3/examples/GroupOrganization/Delete.php +++ b/api/v3/examples/GroupOrganization/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('group_organization', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_organization delete API. + * + * + * @return array + * API result array + */ +function group_organization_delete_example() { + $params = array( + 'id' => 5, + ); -return $result; + try{ + $result = civicrm_api3('group_organization', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_organization_delete_expectedresult(){ +function group_organization_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 'Deleted Group Organization successfully', -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 'Deleted Group Organization successfully', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGroupOrganizationDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGroupOrganizationDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/GroupOrganization/Get.php b/api/v3/examples/GroupOrganization/Get.php index f6ef40f7ed..ad8616bedc 100644 --- a/api/v3/examples/GroupOrganization/Get.php +++ b/api/v3/examples/GroupOrganization/Get.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('group_organization', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using group_organization get API. + * + * + * @return array + * API result array + */ +function group_organization_get_example() { + $params = array( + 'organization_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('group_organization', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function group_organization_get_expectedresult(){ +function group_organization_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 0, - 'values' => array(), -); + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => array(), + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGroupOrganizationGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGroupOrganizationGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Im/Create.php b/api/v3/examples/Im/Create.php index 905e87dafd..04e0377a1d 100644 --- a/api/v3/examples/Im/Create.php +++ b/api/v3/examples/Im/Create.php @@ -1,61 +1,77 @@ 3, - 'name' => 'My Yahoo IM Handle', - 'location_type_id' => 1, - 'provider_id' => 1, -); -try{ - $result = civicrm_api3('im', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using im create API. + * + * + * @return array + * API result array + */ +function im_create_example() { + $params = array( + 'contact_id' => 3, + 'name' => 'My Yahoo IM Handle', + 'location_type_id' => 1, + 'provider_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('im', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function im_create_expectedresult(){ +function im_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '3', - 'location_type_id' => '1', - 'name' => 'My Yahoo IM Handle', - 'provider_id' => '1', - 'is_primary' => '', - 'is_billing' => '', - ), + 'id' => '1', + 'contact_id' => '3', + 'location_type_id' => '1', + 'name' => 'My Yahoo IM Handle', + 'provider_id' => '1', + 'is_primary' => '', + 'is_billing' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateIm and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateIm +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Im/Delete.php b/api/v3/examples/Im/Delete.php index 980311040a..8eaf1435dd 100644 --- a/api/v3/examples/Im/Delete.php +++ b/api/v3/examples/Im/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('im', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using im delete API. + * + * + * @return array + * API result array + */ +function im_delete_example() { + $params = array( + 'id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('im', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function im_delete_expectedresult(){ +function im_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteIm and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteIm +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Im/Get.php b/api/v3/examples/Im/Get.php index 0269a1b0a2..d9351b1779 100644 --- a/api/v3/examples/Im/Get.php +++ b/api/v3/examples/Im/Get.php @@ -1,61 +1,77 @@ 1, - 'name' => 'My Yahoo IM Handle', - 'location_type_id' => 1, - 'provider_id' => 1, -); -try{ - $result = civicrm_api3('im', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using im get API. + * + * + * @return array + * API result array + */ +function im_get_example() { + $params = array( + 'contact_id' => 4, + 'name' => 'My Yahoo IM Handle', + 'location_type_id' => 1, + 'provider_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('im', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function im_get_expectedresult(){ +function im_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'contact_id' => '1', - 'location_type_id' => '1', - 'name' => 'My Yahoo IM Handle', - 'provider_id' => '1', - 'is_primary' => 0, - 'is_billing' => 0, - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'contact_id' => '4', + 'location_type_id' => '1', + 'name' => 'My Yahoo IM Handle', + 'provider_id' => '1', + 'is_primary' => 0, + 'is_billing' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetIm and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetIm +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Job/Create.php b/api/v3/examples/Job/Create.php index e8a6d8e746..5b2e81460b 100644 --- a/api/v3/examples/Job/Create.php +++ b/api/v3/examples/Job/Create.php @@ -1,68 +1,84 @@ 1, - 'name' => 'API_Test_Job', - 'description' => 'A long description written by hand in cursive', - 'run_frequency' => 'Daily', - 'api_entity' => 'ApiTestEntity', - 'api_action' => 'apitestaction', - 'parameters' => 'Semi-formal explanation of runtime job parameters', - 'is_active' => 1, -); -try{ - $result = civicrm_api3('job', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using job create API. + * + * + * @return array + * API result array + */ +function job_create_example() { + $params = array( + 'sequential' => 1, + 'name' => 'API_Test_Job', + 'description' => 'A long description written by hand in cursive', + 'run_frequency' => 'Daily', + 'api_entity' => 'ApiTestEntity', + 'api_action' => 'apitestaction', + 'parameters' => 'Semi-formal explanation of runtime job parameters', + 'is_active' => 1, + ); -return $result; + try{ + $result = civicrm_api3('job', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function job_create_expectedresult(){ +function job_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 29, + 'values' => array( '0' => array( - 'id' => '1', - 'domain_id' => '1', - 'run_frequency' => 'Daily', - 'last_run' => '', - 'name' => 'API_Test_Job', - 'description' => 'A long description written by hand in cursive', - 'api_entity' => 'ApiTestEntity', - 'api_action' => 'apitestaction', - 'parameters' => 'Semi-formal explanation of runtime job parameters', - 'is_active' => '1', - ), + 'id' => '29', + 'domain_id' => '1', + 'run_frequency' => 'Daily', + 'last_run' => '', + 'name' => 'API_Test_Job', + 'description' => 'A long description written by hand in cursive', + 'api_entity' => 'ApiTestEntity', + 'api_action' => 'apitestaction', + 'parameters' => 'Semi-formal explanation of runtime job parameters', + 'is_active' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Job/Delete.php b/api/v3/examples/Job/Delete.php index 759d3d36e9..9b063df98d 100644 --- a/api/v3/examples/Job/Delete.php +++ b/api/v3/examples/Job/Delete.php @@ -1,42 +1,58 @@ 1, -); -try{ - $result = civicrm_api3('job', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using job delete API. + * + * + * @return array + * API result array + */ +function job_delete_example() { + $params = array( + 'id' => 30, + ); -return $result; + try{ + $result = civicrm_api3('job', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function job_delete_expectedresult(){ +function job_delete_expectedresult() { $expectedResult = ''; return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/LineItem/Create.php b/api/v3/examples/LineItem/Create.php index 520a7601b0..1f4931164c 100644 --- a/api/v3/examples/LineItem/Create.php +++ b/api/v3/examples/LineItem/Create.php @@ -1,71 +1,88 @@ 1, - 'price_field_id' => 1, - 'entity_table' => 'civicrm_contribution', - 'entity_id' => 1, - 'qty' => 1, - 'unit_price' => 50, - 'line_total' => 50, - 'debug' => 1, -); -try{ - $result = civicrm_api3('line_item', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using line_item create API. + * + * + * @return array + * API result array + */ +function line_item_create_example() { + $params = array( + 'price_field_value_id' => 1, + 'price_field_id' => 1, + 'entity_table' => 'civicrm_contribution', + 'entity_id' => 1, + 'qty' => 1, + 'unit_price' => 50, + 'line_total' => 50, + 'debug' => 1, + ); -return $result; + try{ + $result = civicrm_api3('line_item', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function line_item_create_expectedresult(){ +function line_item_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'entity_table' => 'civicrm_contribution', - 'entity_id' => '1', - 'contribution_id' => '', - 'price_field_id' => '1', - 'label' => 'line item', - 'qty' => '1', - 'unit_price' => '50', - 'line_total' => '50', - 'participant_count' => '', - 'price_field_value_id' => '1', - 'financial_type_id' => '', - 'deductible_amount' => '', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'entity_table' => 'civicrm_contribution', + 'entity_id' => '1', + 'contribution_id' => '', + 'price_field_id' => '1', + 'label' => 'line item', + 'qty' => '1', + 'unit_price' => '50', + 'line_total' => '50', + 'participant_count' => '', + 'price_field_value_id' => '1', + 'financial_type_id' => '', + 'deductible_amount' => '', + 'tax_amount' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateLineItem and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateLineItem +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/LineItem/Delete.php b/api/v3/examples/LineItem/Delete.php index 125969e4c7..181d9b22e7 100644 --- a/api/v3/examples/LineItem/Delete.php +++ b/api/v3/examples/LineItem/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('line_item', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using line_item delete API. + * + * + * @return array + * API result array + */ +function line_item_delete_example() { + $params = array( + 'id' => 4, + ); -return $result; + try{ + $result = civicrm_api3('line_item', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function line_item_delete_expectedresult(){ +function line_item_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteLineItem and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteLineItem +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/LineItem/Get.php b/api/v3/examples/LineItem/Get.php index feeb147c23..3c01833fe4 100644 --- a/api/v3/examples/LineItem/Get.php +++ b/api/v3/examples/LineItem/Get.php @@ -1,63 +1,79 @@ 'civicrm_contribution', -); -try{ - $result = civicrm_api3('line_item', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using line_item get API. + * + * + * @return array + * API result array + */ +function line_item_get_example() { + $params = array( + 'entity_table' => 'civicrm_contribution', + ); -return $result; + try{ + $result = civicrm_api3('line_item', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function line_item_get_expectedresult(){ +function line_item_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'entity_table' => 'civicrm_contribution', - 'entity_id' => '1', - 'contribution_id' => '1', - 'price_field_id' => '1', - 'label' => 'Contribution Amount', - 'qty' => '1', - 'unit_price' => '100.00', - 'line_total' => '100.00', - 'price_field_value_id' => '1', - 'financial_type_id' => '1', - 'deductible_amount' => '0.00', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( + '3' => array( + 'id' => '3', + 'entity_table' => 'civicrm_contribution', + 'entity_id' => '2', + 'contribution_id' => '2', + 'price_field_id' => '1', + 'label' => 'Contribution Amount', + 'qty' => '1', + 'unit_price' => '100.00', + 'line_total' => '100.00', + 'price_field_value_id' => '1', + 'financial_type_id' => '1', + 'deductible_amount' => '0.00', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetBasicLineItem and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetBasicLineItem +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/LocBlock/createEntities.php b/api/v3/examples/LocBlock/createEntities.php index a10c0e2a01..0932d1bb12 100644 --- a/api/v3/examples/LocBlock/createEntities.php +++ b/api/v3/examples/LocBlock/createEntities.php @@ -1,121 +1,138 @@ array( + +/** + * Test Generated example of using loc_block create API. + * + * Create entities and locBlock in 1 api call + * + * @return array + * API result array + */ +function loc_block_create_example() { + $params = array( + 'email' => array( 'location_type_id' => 1, 'email' => 'test2@loc.block', ), - 'phone' => array( + 'phone' => array( 'location_type_id' => 1, 'phone' => '987654321', ), - 'phone_2' => array( + 'phone_2' => array( 'location_type_id' => 1, 'phone' => '456-7890', ), - 'address' => array( + 'address' => array( 'location_type_id' => 1, 'street_address' => '987654321', ), -); + ); -try{ - $result = civicrm_api3('loc_block', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('loc_block', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function loc_block_create_expectedresult(){ +function loc_block_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( '3' => array( - 'address' => array( - 'id' => '3', - 'location_type_id' => '1', - 'is_primary' => 0, - 'is_billing' => 0, - 'street_address' => '987654321', - 'manual_geo_code' => 0, - ), - 'email' => array( - 'id' => '33', - 'contact_id' => '', - 'location_type_id' => '1', - 'email' => 'test2@loc.block', - 'is_primary' => 0, - 'is_billing' => '', - 'on_hold' => '', - 'is_bulkmail' => '', - 'hold_date' => '', - 'reset_date' => '', - 'signature_text' => '', - 'signature_html' => '', - ), - 'phone' => array( - 'id' => '3', - 'contact_id' => '', - 'location_type_id' => '1', - 'is_primary' => 0, - 'is_billing' => '', - 'mobile_provider_id' => '', - 'phone' => '987654321', - 'phone_ext' => '', - 'phone_numeric' => '', - 'phone_type_id' => '', - ), - 'phone_2' => array( - 'id' => '4', - 'contact_id' => '', - 'location_type_id' => '1', - 'is_primary' => 0, - 'is_billing' => '', - 'mobile_provider_id' => '', - 'phone' => '456-7890', - 'phone_ext' => '', - 'phone_numeric' => '', - 'phone_type_id' => '', - ), + 'address' => array( + 'id' => '3', + 'location_type_id' => '1', + 'is_primary' => 0, + 'is_billing' => 0, + 'street_address' => '987654321', + 'manual_geo_code' => 0, + ), + 'email' => array( + 'id' => '4', + 'contact_id' => '', + 'location_type_id' => '1', + 'email' => 'test2@loc.block', + 'is_primary' => 0, + 'is_billing' => '', + 'on_hold' => '', + 'is_bulkmail' => '', + 'hold_date' => '', + 'reset_date' => '', + 'signature_text' => '', + 'signature_html' => '', + ), + 'phone' => array( 'id' => '3', - 'address_id' => '3', - 'email_id' => '33', - 'phone_id' => '3', - 'im_id' => '', - 'address_2_id' => '', - 'email_2_id' => '', - 'phone_2_id' => '4', - 'im_2_id' => '', + 'contact_id' => '', + 'location_type_id' => '1', + 'is_primary' => 0, + 'is_billing' => '', + 'mobile_provider_id' => '', + 'phone' => '987654321', + 'phone_ext' => '', + 'phone_numeric' => '', + 'phone_type_id' => '', + ), + 'phone_2' => array( + 'id' => '4', + 'contact_id' => '', + 'location_type_id' => '1', + 'is_primary' => 0, + 'is_billing' => '', + 'mobile_provider_id' => '', + 'phone' => '456-7890', + 'phone_ext' => '', + 'phone_numeric' => '', + 'phone_type_id' => '', ), + 'id' => '3', + 'address_id' => '3', + 'email_id' => '4', + 'phone_id' => '3', + 'im_id' => '', + 'address_2_id' => '', + 'email_2_id' => '', + 'phone_2_id' => '4', + 'im_2_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateLocBlockEntities and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateLocBlockEntities +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/LocBlock/getEntities.php b/api/v3/examples/LocBlock/getEntities.php index a79cd0bc1d..e8d6339934 100644 --- a/api/v3/examples/LocBlock/getEntities.php +++ b/api/v3/examples/LocBlock/getEntities.php @@ -1,90 +1,107 @@ 3, - 'return' => 'all', -); -try{ - $result = civicrm_api3('loc_block', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using loc_block get API. + * + * Get entities and location block in 1 api call + * + * @return array + * API result array + */ +function loc_block_get_example() { + $params = array( + 'id' => 3, + 'return' => 'all', + ); + + try{ + $result = civicrm_api3('loc_block', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function loc_block_get_expectedresult(){ +function loc_block_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( '3' => array( + 'id' => '3', + 'address_id' => '3', + 'email_id' => '4', + 'phone_id' => '3', + 'phone_2_id' => '4', + 'address' => array( + 'id' => '3', + 'location_type_id' => '1', + 'is_primary' => 0, + 'is_billing' => 0, + 'street_address' => '987654321', + 'manual_geo_code' => 0, + ), + 'email' => array( + 'id' => '4', + 'location_type_id' => '1', + 'email' => 'test2@loc.block', + 'is_primary' => 0, + 'is_billing' => 0, + 'on_hold' => 0, + 'is_bulkmail' => 0, + ), + 'phone' => array( 'id' => '3', - 'address_id' => '3', - 'email_id' => '33', - 'phone_id' => '3', - 'phone_2_id' => '4', - 'address' => array( - 'id' => '3', - 'location_type_id' => '1', - 'is_primary' => 0, - 'is_billing' => 0, - 'street_address' => '987654321', - 'manual_geo_code' => 0, - ), - 'email' => array( - 'id' => '33', - 'location_type_id' => '1', - 'email' => 'test2@loc.block', - 'is_primary' => 0, - 'is_billing' => 0, - 'on_hold' => 0, - 'is_bulkmail' => 0, - ), - 'phone' => array( - 'id' => '3', - 'location_type_id' => '1', - 'is_primary' => 0, - 'is_billing' => 0, - 'phone' => '987654321', - 'phone_numeric' => '987654321', - ), - 'phone_2' => array( - 'id' => '4', - 'location_type_id' => '1', - 'is_primary' => 0, - 'is_billing' => 0, - 'phone' => '456-7890', - 'phone_numeric' => '4567890', - ), + 'location_type_id' => '1', + 'is_primary' => 0, + 'is_billing' => 0, + 'phone' => '987654321', + 'phone_numeric' => '987654321', + ), + 'phone_2' => array( + 'id' => '4', + 'location_type_id' => '1', + 'is_primary' => 0, + 'is_billing' => 0, + 'phone' => '456-7890', + 'phone_numeric' => '4567890', ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateLocBlockEntities and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateLocBlockEntities +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/LocBlock/simpleCreate.php b/api/v3/examples/LocBlock/simpleCreate.php index 5bc9adb710..7cd8d4d37b 100644 --- a/api/v3/examples/LocBlock/simpleCreate.php +++ b/api/v3/examples/LocBlock/simpleCreate.php @@ -1,62 +1,79 @@ 2, - 'phone_id' => 2, - 'email_id' => 32, -); -try{ - $result = civicrm_api3('loc_block', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using loc_block create API. + * + * Create locBlock with existing entities + * + * @return array + * API result array + */ +function loc_block_create_example() { + $params = array( + 'address_id' => 2, + 'phone_id' => 2, + 'email_id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('loc_block', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function loc_block_create_expectedresult(){ +function loc_block_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'address_id' => '2', - 'email_id' => '32', - 'phone_id' => '2', - 'im_id' => '', - 'address_2_id' => '', - 'email_2_id' => '', - 'phone_2_id' => '', - 'im_2_id' => '', - ), + 'id' => '2', + 'address_id' => '2', + 'email_id' => '3', + 'phone_id' => '2', + 'im_id' => '', + 'address_2_id' => '', + 'email_2_id' => '', + 'phone_2_id' => '', + 'im_2_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateLocBlock and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateLocBlock +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MailSettings/ChainedGetDelete.php b/api/v3/examples/MailSettings/ChainedGetDelete.php index 4f4c520998..fabcab76c9 100644 --- a/api/v3/examples/MailSettings/ChainedGetDelete.php +++ b/api/v3/examples/MailSettings/ChainedGetDelete.php @@ -1,79 +1,96 @@ 'MailSettings title', - 'api.MailSettings.delete' => 1, -); -try{ - $result = civicrm_api3('mail_settings', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using mail_settings get API. + * + * demonstrates get + delete in the same call + * + * @return array + * API result array + */ +function mail_settings_get_example() { + $params = array( + 'title' => 'MailSettings title', + 'api.MailSettings.delete' => 1, + ); -return $result; + try{ + $result = civicrm_api3('mail_settings', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function mail_settings_get_expectedresult(){ +function mail_settings_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '1' => array( - 'id' => '1', - 'domain_id' => '1', - 'name' => 'default', - 'is_default' => 0, - 'domain' => 'EXAMPLE.ORG', - 'api.MailSettings.delete' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, - ), + 'id' => '1', + 'domain_id' => '1', + 'name' => 'default', + 'is_default' => 0, + 'domain' => 'EXAMPLE.ORG', + 'api.MailSettings.delete' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, ), + ), '6' => array( - 'id' => '6', - 'domain_id' => '1', - 'name' => 'my mail setting', - 'is_default' => '1', - 'domain' => 'setting.com', - 'server' => 'localhost', - 'username' => 'sue', - 'password' => 'pass', - 'is_ssl' => 0, - 'api.MailSettings.delete' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, - ), + 'id' => '6', + 'domain_id' => '1', + 'name' => 'my mail setting', + 'is_default' => '1', + 'domain' => 'setting.com', + 'server' => 'localhost', + 'username' => 'sue', + 'password' => 'pass', + 'is_ssl' => 0, + 'api.MailSettings.delete' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetMailSettingsChainDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetMailSettingsChainDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MailSettings/Create.php b/api/v3/examples/MailSettings/Create.php index f465c2942b..2dd6c621f4 100644 --- a/api/v3/examples/MailSettings/Create.php +++ b/api/v3/examples/MailSettings/Create.php @@ -1,72 +1,88 @@ 1, - 'name' => 'my mail setting', - 'domain' => 'setting.com', - 'local_part' => 'civicrm+', - 'server' => 'localhost', - 'username' => 'sue', - 'password' => 'pass', - 'is_default' => 1, -); -try{ - $result = civicrm_api3('mail_settings', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using mail_settings create API. + * + * + * @return array + * API result array + */ +function mail_settings_create_example() { + $params = array( + 'domain_id' => 1, + 'name' => 'my mail setting', + 'domain' => 'setting.com', + 'local_part' => 'civicrm+', + 'server' => 'localhost', + 'username' => 'sue', + 'password' => 'pass', + 'is_default' => 1, + ); -return $result; + try{ + $result = civicrm_api3('mail_settings', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function mail_settings_create_expectedresult(){ +function mail_settings_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'domain_id' => '1', - 'name' => 'my mail setting', - 'is_default' => '1', - 'domain' => 'setting.com', - 'localpart' => '', - 'return_path' => '', - 'protocol' => '', - 'server' => 'localhost', - 'port' => '', - 'username' => 'sue', - 'password' => 'pass', - 'is_ssl' => '', - 'source' => '', - ), + 'id' => '2', + 'domain_id' => '1', + 'name' => 'my mail setting', + 'is_default' => '1', + 'domain' => 'setting.com', + 'localpart' => '', + 'return_path' => '', + 'protocol' => '', + 'server' => 'localhost', + 'port' => '', + 'username' => 'sue', + 'password' => 'pass', + 'is_ssl' => '', + 'source' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateMailSettings and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateMailSettings +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MailSettings/Delete.php b/api/v3/examples/MailSettings/Delete.php index 482d9c3396..80f9d8149d 100644 --- a/api/v3/examples/MailSettings/Delete.php +++ b/api/v3/examples/MailSettings/Delete.php @@ -1,47 +1,63 @@ 5, -); -try{ - $result = civicrm_api3('mail_settings', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using mail_settings delete API. + * + * + * @return array + * API result array + */ +function mail_settings_delete_example() { + $params = array( + 'id' => 5, + ); -return $result; + try{ + $result = civicrm_api3('mail_settings', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function mail_settings_delete_expectedresult(){ +function mail_settings_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteMailSettings and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteMailSettings +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MailSettings/Get.php b/api/v3/examples/MailSettings/Get.php index 0083f7008e..8e2c97a3a3 100644 --- a/api/v3/examples/MailSettings/Get.php +++ b/api/v3/examples/MailSettings/Get.php @@ -1,67 +1,83 @@ 1, - 'name' => 'my mail setting', - 'domain' => 'setting.com', - 'local_part' => 'civicrm+', - 'server' => 'localhost', - 'username' => 'sue', - 'password' => 'pass', - 'is_default' => 1, -); -try{ - $result = civicrm_api3('mail_settings', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using mail_settings get API. + * + * + * @return array + * API result array + */ +function mail_settings_get_example() { + $params = array( + 'domain_id' => 1, + 'name' => 'my mail setting', + 'domain' => 'setting.com', + 'local_part' => 'civicrm+', + 'server' => 'localhost', + 'username' => 'sue', + 'password' => 'pass', + 'is_default' => 1, + ); -return $result; + try{ + $result = civicrm_api3('mail_settings', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function mail_settings_get_expectedresult(){ +function mail_settings_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 4, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 4, + 'values' => array( '4' => array( - 'id' => '4', - 'domain_id' => '1', - 'name' => 'my mail setting', - 'is_default' => '1', - 'domain' => 'setting.com', - 'server' => 'localhost', - 'username' => 'sue', - 'password' => 'pass', - 'is_ssl' => 0, - ), + 'id' => '4', + 'domain_id' => '1', + 'name' => 'my mail setting', + 'is_default' => '1', + 'domain' => 'setting.com', + 'server' => 'localhost', + 'username' => 'sue', + 'password' => 'pass', + 'is_ssl' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetMailSettings and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetMailSettings +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Mailing/Create.php b/api/v3/examples/Mailing/Create.php index fed0c7dd8f..8e49d23e31 100644 --- a/api/v3/examples/Mailing/Create.php +++ b/api/v3/examples/Mailing/Create.php @@ -1,111 +1,130 @@ 'maild', - 'body_text' => 'bdkfhdskfhduew', - 'name' => 'mailing name', - 'created_id' => 1, -); -try{ - $result = civicrm_api3('mailing', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using mailing create API. + * + * + * @return array + * API result array + */ +function mailing_create_example() { + $params = array( + 'subject' => 'Hello {contact.display_name}', + 'body_text' => 'This is {contact.display_name}', + 'body_html' => '

This is {contact.display_name}

', + 'name' => 'mailing name', + 'created_id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('mailing', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function mailing_create_expectedresult(){ +function mailing_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'domain_id' => '1', - 'header_id' => '', - 'footer_id' => '', - 'reply_id' => '', - 'unsubscribe_id' => '', - 'resubscribe_id' => '', - 'optout_id' => '', - 'name' => 'mailing name', - 'from_name' => 'FIXME', - 'from_email' => 'info@EXAMPLE.ORG', - 'replyto_email' => 'info@EXAMPLE.ORG', - 'subject' => 'maild', - 'body_text' => 'bdkfhdskfhduew', - 'body_html' => '', - 'url_tracking' => '1', - 'forward_replies' => '', - 'auto_responder' => 0, - 'open_tracking' => '1', - 'is_completed' => '', - 'msg_template_id' => '', - 'override_verp' => '1', - 'created_id' => '1', - 'created_date' => '2013-07-28 08:49:19', - 'scheduled_id' => '', - 'scheduled_date' => '', - 'approver_id' => '', - 'approval_date' => '', - 'approval_status_id' => '', - 'approval_note' => '', - 'is_archived' => '', - 'visibility' => 'Public Pages', - 'campaign_id' => '', - 'dedupe_email' => '', - 'sms_provider_id' => '', - 'hash' => '', - 'api.mailing_job.create' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'mailing_id' => '1', - 'scheduled_date' => '20130728085413', - 'start_date' => '', - 'end_date' => '', - 'status' => 'Scheduled', - 'is_test' => 0, - 'job_type' => '', - 'parent_id' => '', - 'job_offset' => '', - 'job_limit' => '', - ), - ), + 'id' => '1', + 'domain_id' => '1', + 'header_id' => '', + 'footer_id' => '', + 'reply_id' => '', + 'unsubscribe_id' => '', + 'resubscribe_id' => '', + 'optout_id' => '', + 'name' => 'mailing name', + 'from_name' => 'FIXME', + 'from_email' => 'info@EXAMPLE.ORG', + 'replyto_email' => 'info@EXAMPLE.ORG', + 'subject' => 'Hello {contact.display_name}', + 'body_text' => 'This is {contact.display_name}', + 'body_html' => '

This is {contact.display_name}

', + 'url_tracking' => '1', + 'forward_replies' => '', + 'auto_responder' => 0, + 'open_tracking' => '1', + 'is_completed' => '', + 'msg_template_id' => '', + 'override_verp' => '1', + 'created_id' => '3', + 'created_date' => '2013-07-28 08:49:19', + 'scheduled_id' => '', + 'scheduled_date' => '', + 'approver_id' => '', + 'approval_date' => '', + 'approval_status_id' => '', + 'approval_note' => '', + 'is_archived' => '', + 'visibility' => 'Public Pages', + 'campaign_id' => '', + 'dedupe_email' => '', + 'sms_provider_id' => '', + 'hash' => '', + 'location_type_id' => '', + 'email_selection_method' => '', + 'api.mailing_job.create' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'mailing_id' => '1', + 'scheduled_date' => '20130728085413', + 'start_date' => '', + 'end_date' => '', + 'status' => 'Scheduled', + 'is_test' => 0, + 'job_type' => '', + 'parent_id' => '', + 'job_offset' => '', + 'job_limit' => '', ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testMailerCreateSuccess and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testMailerCreateSuccess +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Mailing/Delete.php b/api/v3/examples/Mailing/Delete.php index 3112bbf070..d387079297 100644 --- a/api/v3/examples/Mailing/Delete.php +++ b/api/v3/examples/Mailing/Delete.php @@ -1,47 +1,63 @@ 2, -); -try{ - $result = civicrm_api3('mailing', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using mailing delete API. + * + * + * @return array + * API result array + */ +function mailing_delete_example() { + $params = array( + 'id' => 12, + ); -return $result; + try{ + $result = civicrm_api3('mailing', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function mailing_delete_expectedresult(){ +function mailing_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testMailerDeleteSuccess and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testMailerDeleteSuccess +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Mailing/Submit.php b/api/v3/examples/Mailing/Submit.php new file mode 100644 index 0000000000..33ab8c791f --- /dev/null +++ b/api/v3/examples/Mailing/Submit.php @@ -0,0 +1,120 @@ + '2014-12-13 10:00:00', + 'id' => 9, + ); + + try{ + $result = civicrm_api3('mailing', 'submit', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function mailing_submit_expectedresult() { + + $expectedResult = array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 9, + 'values' => array( + '9' => array( + 'id' => '9', + 'domain_id' => '1', + 'header_id' => '', + 'footer_id' => '', + 'reply_id' => '', + 'unsubscribe_id' => '', + 'resubscribe_id' => '', + 'optout_id' => '', + 'name' => 'mailing name', + 'from_name' => 'FIXME', + 'from_email' => 'info@EXAMPLE.ORG', + 'replyto_email' => 'info@EXAMPLE.ORG', + 'subject' => 'Hello {contact.display_name}', + 'body_text' => 'This is {contact.display_name}', + 'body_html' => '

This is {contact.display_name}

', + 'url_tracking' => '1', + 'forward_replies' => 0, + 'auto_responder' => 0, + 'open_tracking' => '1', + 'is_completed' => '', + 'msg_template_id' => '', + 'override_verp' => '1', + 'created_id' => '22', + 'created_date' => '2013-07-28 08:49:19', + 'scheduled_id' => '22', + 'scheduled_date' => '20130728085413', + 'approver_id' => '', + 'approval_date' => '', + 'approval_status_id' => '', + 'approval_note' => '', + 'is_archived' => 0, + 'visibility' => 'Public Pages', + 'campaign_id' => '', + 'dedupe_email' => 0, + 'sms_provider_id' => '', + 'hash' => '67eac7789eaee00', + 'location_type_id' => '', + 'email_selection_method' => '', + ), + ), + ); + + return $expectedResult; +} + +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testMailerSubmit +* and can be found in +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-master-git/ +* +* To Learn about the API read +* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* +* Browse the api on your own site with the api explorer +* http://MYSITE.ORG/path/to/civicrm/api/explorer +* +* Read more about testing here +* http://wiki.civicrm.org/confluence/display/CRM/Testing +* +* API Standards documentation: +* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +*/ diff --git a/api/v3/examples/MailingGroup/Subscribe.php b/api/v3/examples/MailingGroup/Subscribe.php index 0b9d99b237..47c7b46e75 100644 --- a/api/v3/examples/MailingGroup/Subscribe.php +++ b/api/v3/examples/MailingGroup/Subscribe.php @@ -1,58 +1,74 @@ 'test@test.test', - 'group_id' => 2, - 'contact_id' => 3, - 'hash' => 'b15de8b64e2cec34', - 'time_stamp' => '20101212121212', -); -try{ - $result = civicrm_api3('mailing_group', 'subscribe', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using mailing_group subscribe API. + * + * + * @return array + * API result array + */ +function mailing_group_subscribe_example() { + $params = array( + 'email' => 'test@test.test', + 'group_id' => 2, + 'contact_id' => 3, + 'hash' => 'b15de8b64e2cec34', + 'time_stamp' => '20101212121212', + ); -return $result; + try{ + $result = civicrm_api3('mailing_group', 'subscribe', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function mailing_group_subscribe_expectedresult(){ +function mailing_group_subscribe_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '3', - 'subscribe_id' => '1', - 'hash' => '67eac7789eaee00', - ), + 'contact_id' => '3', + 'subscribe_id' => '1', + 'hash' => '67eac7789eaee00', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testMailerGroupSubscribeGivenContactId and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testMailerGroupSubscribeGivenContactId +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Membership/Create.php b/api/v3/examples/Membership/Create.php index 7e8a297817..20da77c503 100644 --- a/api/v3/examples/Membership/Create.php +++ b/api/v3/examples/Membership/Create.php @@ -1,74 +1,90 @@ 88, - 'membership_type_id' => 53, - 'join_date' => '2009-01-21', - 'start_date' => '2009-01-21', - 'end_date' => '2009-12-21', - 'source' => 'Payment', - 'is_override' => 1, - 'status_id' => 33, - 'custom_1' => 'custom string', -); -try{ - $result = civicrm_api3('membership', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership create API. + * + * + * @return array + * API result array + */ +function membership_create_example() { + $params = array( + 'contact_id' => 88, + 'membership_type_id' => 53, + 'join_date' => '2009-01-21', + 'start_date' => '2009-01-21', + 'end_date' => '2009-12-21', + 'source' => 'Payment', + 'is_override' => 1, + 'status_id' => 33, + 'custom_1' => 'custom string', + ); -return $result; + try{ + $result = civicrm_api3('membership', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_create_expectedresult(){ +function membership_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '88', - 'membership_type_id' => '53', - 'join_date' => '20090121000000', - 'start_date' => '2013-07-29 00:00:00', - 'end_date' => '2013-08-04 00:00:00', - 'source' => 'Payment', - 'status_id' => '33', - 'is_override' => '1', - 'owner_membership_id' => '', - 'max_related' => '', - 'is_test' => 0, - 'is_pay_later' => '', - 'contribution_recur_id' => '', - 'campaign_id' => '', - ), + 'id' => '1', + 'contact_id' => '88', + 'membership_type_id' => '53', + 'join_date' => '20090121000000', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'source' => 'Payment', + 'status_id' => '33', + 'is_override' => '1', + 'owner_membership_id' => '', + 'max_related' => '', + 'is_test' => 0, + 'is_pay_later' => '', + 'contribution_recur_id' => '', + 'campaign_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateWithCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateWithCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Membership/Delete.php b/api/v3/examples/Membership/Delete.php index 47d84cf41e..668d14178d 100644 --- a/api/v3/examples/Membership/Delete.php +++ b/api/v3/examples/Membership/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('membership', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership delete API. + * + * + * @return array + * API result array + */ +function membership_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('membership', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_delete_expectedresult(){ +function membership_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testMembershipDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testMembershipDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Membership/Get.php b/api/v3/examples/Membership/Get.php index e59994618e..5cfe6d21b5 100644 --- a/api/v3/examples/Membership/Get.php +++ b/api/v3/examples/Membership/Get.php @@ -1,66 +1,82 @@ 21, -); -try{ - $result = civicrm_api3('membership', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership get API. + * + * + * @return array + * API result array + */ +function membership_get_example() { + $params = array( + 'membership_type_id' => 21, + ); -return $result; + try{ + $result = civicrm_api3('membership', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_get_expectedresult(){ +function membership_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '35', - 'membership_type_id' => '21', - 'join_date' => '2009-01-21', - 'start_date' => '2013-07-29 00:00:00', - 'end_date' => '2013-08-04 00:00:00', - 'source' => 'Payment', - 'status_id' => '18', - 'is_override' => '1', - 'is_test' => 0, - 'is_pay_later' => 0, - 'membership_name' => 'General', - 'relationship_name' => 'Child of', - 'custom_1' => 'custom string', - 'custom_1_1' => 'custom string', - ), + 'id' => '1', + 'contact_id' => '35', + 'membership_type_id' => '21', + 'join_date' => '2009-01-21', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'source' => 'Payment', + 'status_id' => '18', + 'is_override' => '1', + 'is_test' => 0, + 'is_pay_later' => 0, + 'membership_name' => 'General', + 'relationship_name' => 'Child of', + 'custom_1' => 'custom string', + 'custom_1_1' => 'custom string', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetWithParamsMemberShipIdAndCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetWithParamsMemberShipIdAndCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Membership/Update.php b/api/v3/examples/Membership/Update.php index 8fa367659b..005bf7071a 100644 --- a/api/v3/examples/Membership/Update.php +++ b/api/v3/examples/Membership/Update.php @@ -1,74 +1,90 @@ 106, - 'membership_type_id' => 65, - 'join_date' => '2009-01-21', - 'start_date' => '2009-01-21', - 'end_date' => '2009-12-21', - 'source' => 'Payment', - 'is_override' => 1, - 'status_id' => 39, - 'custom_1' => 'custom string', -); -try{ - $result = civicrm_api3('membership', 'update', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership update API. + * + * + * @return array + * API result array + */ +function membership_update_example() { + $params = array( + 'contact_id' => 106, + 'membership_type_id' => 65, + 'join_date' => '2009-01-21', + 'start_date' => '2009-01-21', + 'end_date' => '2009-12-21', + 'source' => 'Payment', + 'is_override' => 1, + 'status_id' => 39, + 'custom_1' => 'custom string', + ); -return $result; + try{ + $result = civicrm_api3('membership', 'update', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_update_expectedresult(){ +function membership_update_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '106', - 'membership_type_id' => '65', - 'join_date' => '20090121000000', - 'start_date' => '2013-07-29 00:00:00', - 'end_date' => '2013-08-04 00:00:00', - 'source' => 'Payment', - 'status_id' => '39', - 'is_override' => '1', - 'owner_membership_id' => '', - 'max_related' => '', - 'is_test' => 0, - 'is_pay_later' => '', - 'contribution_recur_id' => '', - 'campaign_id' => '', - ), + 'id' => '1', + 'contact_id' => '106', + 'membership_type_id' => '65', + 'join_date' => '20090121000000', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'source' => 'Payment', + 'status_id' => '39', + 'is_override' => '1', + 'owner_membership_id' => '', + 'max_related' => '', + 'is_test' => 0, + 'is_pay_later' => '', + 'contribution_recur_id' => '', + 'campaign_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testUpdateWithCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testUpdateWithCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Membership/filterIsCurrent.php b/api/v3/examples/Membership/filterIsCurrent.php index 65aa8ded80..41c412920e 100644 --- a/api/v3/examples/Membership/filterIsCurrent.php +++ b/api/v3/examples/Membership/filterIsCurrent.php @@ -1,67 +1,84 @@ 44, - 'filters' => array( + +/** + * Test Generated example of using membership get API. + * + * Demonstrates use of 'filter' active_only' param + * + * @return array + * API result array + */ +function membership_get_example() { + $params = array( + 'contact_id' => 44, + 'filters' => array( 'is_current' => 1, ), -); + ); -try{ - $result = civicrm_api3('membership', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('membership', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_get_expectedresult(){ +function membership_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '44', - 'membership_type_id' => '27', - 'join_date' => '2009-01-21', - 'start_date' => '2013-07-29 00:00:00', - 'end_date' => '2013-08-04 00:00:00', - 'source' => 'Payment', - 'status_id' => '21', - 'is_override' => '1', - 'is_test' => 0, - 'is_pay_later' => 0, - 'membership_name' => 'General', - 'relationship_name' => 'Child of', - ), + 'id' => '1', + 'contact_id' => '44', + 'membership_type_id' => '27', + 'join_date' => '2009-01-21', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'source' => 'Payment', + 'status_id' => '21', + 'is_override' => '1', + 'is_test' => 0, + 'is_pay_later' => 0, + 'membership_name' => 'General', + 'relationship_name' => 'Child of', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetOnlyActive and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetOnlyActive +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MembershipPayment/Create.php b/api/v3/examples/MembershipPayment/Create.php index 61e1f78b77..165f7a1383 100644 --- a/api/v3/examples/MembershipPayment/Create.php +++ b/api/v3/examples/MembershipPayment/Create.php @@ -1,55 +1,71 @@ 1, - 'membership_id' => 1, -); -try{ - $result = civicrm_api3('membership_payment', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership_payment create API. + * + * + * @return array + * API result array + */ +function membership_payment_create_example() { + $params = array( + 'contribution_id' => 2, + 'membership_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('membership_payment', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_payment_create_expectedresult(){ +function membership_payment_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'membership_id' => '1', - 'contribution_id' => '1', - ), + 'id' => '1', + 'membership_id' => '1', + 'contribution_id' => '2', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipPaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MembershipPayment/Get.php b/api/v3/examples/MembershipPayment/Get.php index d2b76b18fe..15b111ef1e 100644 --- a/api/v3/examples/MembershipPayment/Get.php +++ b/api/v3/examples/MembershipPayment/Get.php @@ -1,55 +1,71 @@ 1, - 'membership_id' => 1, -); -try{ - $result = civicrm_api3('membership_payment', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership_payment get API. + * + * + * @return array + * API result array + */ +function membership_payment_get_example() { + $params = array( + 'contribution_id' => 4, + 'membership_id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('membership_payment', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_payment_get_expectedresult(){ +function membership_payment_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'membership_id' => '1', - 'contribution_id' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'membership_id' => '2', + 'contribution_id' => '4', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipPaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MembershipStatus/Create.php b/api/v3/examples/MembershipStatus/Create.php index 2887176e4e..07e1af9570 100644 --- a/api/v3/examples/MembershipStatus/Create.php +++ b/api/v3/examples/MembershipStatus/Create.php @@ -1,66 +1,82 @@ 'test membership status', -); -try{ - $result = civicrm_api3('membership_status', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership_status create API. + * + * + * @return array + * API result array + */ +function membership_status_create_example() { + $params = array( + 'name' => 'test membership status', + ); -return $result; + try{ + $result = civicrm_api3('membership_status', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_status_create_expectedresult(){ +function membership_status_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 15, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 15, + 'values' => array( '15' => array( - 'id' => '15', - 'name' => 'test membership status', - 'label' => 'test membership status', - 'start_event' => '', - 'start_event_adjust_unit' => '', - 'start_event_adjust_interval' => '', - 'end_event' => '', - 'end_event_adjust_unit' => '', - 'end_event_adjust_interval' => '', - 'is_current_member' => '', - 'is_admin' => '', - 'weight' => '', - 'is_default' => '', - 'is_active' => '', - 'is_reserved' => '', - ), + 'id' => '15', + 'name' => 'test membership status', + 'label' => 'test membership status', + 'start_event' => '', + 'start_event_adjust_unit' => '', + 'start_event_adjust_interval' => '', + 'end_event' => '', + 'end_event_adjust_unit' => '', + 'end_event_adjust_interval' => '', + 'is_current_member' => '', + 'is_admin' => '', + 'weight' => '', + 'is_default' => '', + 'is_active' => '', + 'is_reserved' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipStatusTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MembershipStatus/Get.php b/api/v3/examples/MembershipStatus/Get.php index ec82d0db0a..1c86b6deab 100644 --- a/api/v3/examples/MembershipStatus/Get.php +++ b/api/v3/examples/MembershipStatus/Get.php @@ -1,61 +1,77 @@ 'test status', -); -try{ - $result = civicrm_api3('membership_status', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership_status get API. + * + * + * @return array + * API result array + */ +function membership_status_get_example() { + $params = array( + 'name' => 'test status', + ); -return $result; + try{ + $result = civicrm_api3('membership_status', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_status_get_expectedresult(){ +function membership_status_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 9, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 9, + 'values' => array( '9' => array( - 'id' => '9', - 'name' => 'test status', - 'label' => 'test status', - 'start_event' => 'start_date', - 'end_event' => 'end_date', - 'is_current_member' => '1', - 'is_admin' => 0, - 'is_default' => 0, - 'is_active' => '1', - 'is_reserved' => 0, - ), + 'id' => '9', + 'name' => 'test status', + 'label' => 'test status', + 'start_event' => 'start_date', + 'end_event' => 'end_date', + 'is_current_member' => '1', + 'is_admin' => 0, + 'is_default' => 0, + 'is_active' => '1', + 'is_reserved' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipStatusTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MembershipType/Create.php b/api/v3/examples/MembershipType/Create.php index 9217360662..1af9055fb7 100644 --- a/api/v3/examples/MembershipType/Create.php +++ b/api/v3/examples/MembershipType/Create.php @@ -1,82 +1,98 @@ '40+ Membership', - 'description' => 'people above 40 are given health instructions', - 'member_of_contact_id' => 1, - 'financial_type_id' => 1, - 'domain_id' => '1', - 'minimum_fee' => '200', - 'duration_unit' => 'month', - 'duration_interval' => '10', - 'period_type' => 'rolling', - 'visibility' => 'public', -); -try{ - $result = civicrm_api3('membership_type', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership_type create API. + * + * + * @return array + * API result array + */ +function membership_type_create_example() { + $params = array( + 'name' => '40+ Membership', + 'description' => 'people above 40 are given health instructions', + 'member_of_contact_id' => 13, + 'financial_type_id' => 1, + 'domain_id' => '1', + 'minimum_fee' => '200', + 'duration_unit' => 'month', + 'duration_interval' => '10', + 'period_type' => 'rolling', + 'visibility' => 'public', + ); -return $result; + try{ + $result = civicrm_api3('membership_type', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_type_create_expectedresult(){ +function membership_type_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'domain_id' => '1', - 'name' => '40+ Membership', - 'description' => 'people above 40 are given health instructions', - 'member_of_contact_id' => '1', - 'financial_type_id' => '1', - 'minimum_fee' => '200', - 'duration_unit' => 'month', - 'duration_interval' => '10', - 'period_type' => 'rolling', - 'fixed_period_start_day' => '', - 'fixed_period_rollover_day' => '', - 'relationship_type_id' => '', - 'relationship_direction' => '', - 'max_related' => '', - 'visibility' => 'Public', - 'weight' => '', - 'receipt_text_signup' => '', - 'receipt_text_renewal' => '', - 'auto_renew' => '', - 'is_active' => '', - 'contribution_type_id' => '1', - ), + 'id' => '2', + 'domain_id' => '1', + 'name' => '40+ Membership', + 'description' => 'people above 40 are given health instructions', + 'member_of_contact_id' => '13', + 'financial_type_id' => '1', + 'minimum_fee' => '200', + 'duration_unit' => 'month', + 'duration_interval' => '10', + 'period_type' => 'rolling', + 'fixed_period_start_day' => '', + 'fixed_period_rollover_day' => '', + 'relationship_type_id' => '', + 'relationship_direction' => '', + 'max_related' => '', + 'visibility' => 'Public', + 'weight' => '', + 'receipt_text_signup' => '', + 'receipt_text_renewal' => '', + 'auto_renew' => '', + 'is_active' => '', + 'contribution_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MembershipType/Delete.php b/api/v3/examples/MembershipType/Delete.php index 19ffb1bf87..6f3355ffb1 100644 --- a/api/v3/examples/MembershipType/Delete.php +++ b/api/v3/examples/MembershipType/Delete.php @@ -1,47 +1,63 @@ 4, -); -try{ - $result = civicrm_api3('membership_type', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership_type delete API. + * + * + * @return array + * API result array + */ +function membership_type_delete_example() { + $params = array( + 'id' => 4, + ); -return $result; + try{ + $result = civicrm_api3('membership_type', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_type_delete_expectedresult(){ +function membership_type_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MembershipType/Get.php b/api/v3/examples/MembershipType/Get.php index 120de5de12..376c772a92 100644 --- a/api/v3/examples/MembershipType/Get.php +++ b/api/v3/examples/MembershipType/Get.php @@ -1,63 +1,79 @@ 1, -); -try{ - $result = civicrm_api3('membership_type', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using membership_type get API. + * + * + * @return array + * API result array + */ +function membership_type_get_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('membership_type', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function membership_type_get_expectedresult(){ +function membership_type_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'domain_id' => '1', - 'name' => 'General', - 'member_of_contact_id' => '1', - 'financial_type_id' => '1', - 'minimum_fee' => '0.00', - 'duration_unit' => 'year', - 'duration_interval' => '1', - 'period_type' => 'rolling', - 'visibility' => 'Public', - 'auto_renew' => 0, - 'is_active' => '1', - ), + 'id' => '1', + 'domain_id' => '1', + 'name' => 'General', + 'member_of_contact_id' => '4', + 'financial_type_id' => '1', + 'minimum_fee' => '0.00', + 'duration_unit' => 'year', + 'duration_interval' => '1', + 'period_type' => 'rolling', + 'visibility' => 'Public', + 'auto_renew' => 0, + 'is_active' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MessageTemplate/Create.php b/api/v3/examples/MessageTemplate/Create.php index 7d499bbdff..a9e1a33525 100644 --- a/api/v3/examples/MessageTemplate/Create.php +++ b/api/v3/examples/MessageTemplate/Create.php @@ -1,67 +1,84 @@ 'msg_title_131', - 'msg_subject' => 'msg_subject_131', - 'msg_text' => 'msg_text_131', - 'msg_html' => 'msg_html_131', - 'workflow_id' => 131, - 'is_default' => '1', - 'is_reserved' => 1, -); -try{ - $result = civicrm_api3('message_template', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using message_template create API. + * + * + * @return array + * API result array + */ +function message_template_create_example() { + $params = array( + 'msg_title' => 'msg_title_165', + 'msg_subject' => 'msg_subject_165', + 'msg_text' => 'msg_text_165', + 'msg_html' => 'msg_html_165', + 'workflow_id' => 165, + 'is_default' => '1', + 'is_reserved' => 1, + ); -return $result; + try{ + $result = civicrm_api3('message_template', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function message_template_create_expectedresult(){ +function message_template_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( - '2' => array( - 'id' => '2', - 'msg_title' => 'msg_title_131', - 'msg_subject' => 'msg_subject_131', - 'msg_text' => 'msg_text_131', - 'msg_html' => 'msg_html_131', - 'is_active' => '1', - 'workflow_id' => '131', - 'is_default' => '1', - 'is_reserved' => '1', - 'pdf_format_id' => '', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 65, + 'values' => array( + '65' => array( + 'id' => '65', + 'msg_title' => 'msg_title_165', + 'msg_subject' => 'msg_subject_165', + 'msg_text' => 'msg_text_165', + 'msg_html' => 'msg_html_165', + 'is_active' => '1', + 'workflow_id' => '165', + 'is_default' => '1', + 'is_reserved' => '1', + 'is_sms' => '', + 'pdf_format_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MessageTemplate/Delete.php b/api/v3/examples/MessageTemplate/Delete.php index 1c574f1d9b..b3cc861b95 100644 --- a/api/v3/examples/MessageTemplate/Delete.php +++ b/api/v3/examples/MessageTemplate/Delete.php @@ -1,47 +1,63 @@ 2, -); -try{ - $result = civicrm_api3('message_template', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using message_template delete API. + * + * + * @return array + * API result array + */ +function message_template_delete_example() { + $params = array( + 'id' => 68, + ); -return $result; + try{ + $result = civicrm_api3('message_template', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function message_template_delete_expectedresult(){ +function message_template_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/MessageTemplate/Get.php b/api/v3/examples/MessageTemplate/Get.php index 56eaecc772..4109f12f4f 100644 --- a/api/v3/examples/MessageTemplate/Get.php +++ b/api/v3/examples/MessageTemplate/Get.php @@ -1,67 +1,84 @@ 'msg_title_132', - 'msg_subject' => 'msg_subject_132', - 'msg_text' => 'msg_text_132', - 'msg_html' => 'msg_html_132', - 'workflow_id' => 132, - 'is_default' => '1', - 'is_reserved' => 1, -); -try{ - $result = civicrm_api3('message_template', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using message_template get API. + * + * + * @return array + * API result array + */ +function message_template_get_example() { + $params = array( + 'msg_title' => 'msg_title_166', + 'msg_subject' => 'msg_subject_166', + 'msg_text' => 'msg_text_166', + 'msg_html' => 'msg_html_166', + 'workflow_id' => 166, + 'is_default' => '1', + 'is_reserved' => 1, + ); -return $result; + try{ + $result = civicrm_api3('message_template', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function message_template_get_expectedresult(){ +function message_template_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'msg_title' => 'msg_title_132', - 'msg_subject' => 'msg_subject_132', - 'msg_text' => 'msg_text_132', - 'msg_html' => 'msg_html_132', - 'is_active' => '1', - 'workflow_id' => '132', - 'is_default' => '1', - 'is_reserved' => '1', - 'pdf_format_id' => '132', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 66, + 'values' => array( + '66' => array( + 'id' => '66', + 'msg_title' => 'msg_title_166', + 'msg_subject' => 'msg_subject_166', + 'msg_text' => 'msg_text_166', + 'msg_html' => 'msg_html_166', + 'is_active' => '1', + 'workflow_id' => '166', + 'is_default' => '1', + 'is_reserved' => '1', + 'is_sms' => '1', + 'pdf_format_id' => '166', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Note/Create.php b/api/v3/examples/Note/Create.php index bf11336252..2a6c930c4d 100644 --- a/api/v3/examples/Note/Create.php +++ b/api/v3/examples/Note/Create.php @@ -1,64 +1,80 @@ 'civicrm_contact', - 'entity_id' => 1, - 'note' => 'Hello!!! m testing Note', - 'contact_id' => 1, - 'modified_date' => '2011-01-31', - 'subject' => 'Test Note', -); -try{ - $result = civicrm_api3('note', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using note create API. + * + * + * @return array + * API result array + */ +function note_create_example() { + $params = array( + 'entity_table' => 'civicrm_contact', + 'entity_id' => 9, + 'note' => 'Hello!!! m testing Note', + 'contact_id' => 9, + 'modified_date' => '2011-01-31', + 'subject' => 'Test Note', + ); -return $result; + try{ + $result = civicrm_api3('note', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function note_create_expectedresult(){ +function note_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( - '2' => array( - 'id' => '2', - 'entity_table' => 'civicrm_contact', - 'entity_id' => '1', - 'note' => 'Hello!!! m testing Note', - 'contact_id' => '1', - 'modified_date' => '2012-11-14 16:02:35', - 'subject' => 'Test Note', - 'privacy' => 0, - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 8, + 'values' => array( + '8' => array( + 'id' => '8', + 'entity_table' => 'civicrm_contact', + 'entity_id' => '9', + 'note' => 'Hello!!! m testing Note', + 'contact_id' => '9', + 'modified_date' => '2012-11-14 16:02:35', + 'subject' => 'Test Note', + 'privacy' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Note/Delete.php b/api/v3/examples/Note/Delete.php index cf0ac6eb83..6595aa1502 100644 --- a/api/v3/examples/Note/Delete.php +++ b/api/v3/examples/Note/Delete.php @@ -1,47 +1,63 @@ 2, -); -try{ - $result = civicrm_api3('note', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using note delete API. + * + * + * @return array + * API result array + */ +function note_delete_example() { + $params = array( + 'id' => 19, + ); -return $result; + try{ + $result = civicrm_api3('note', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function note_delete_expectedresult(){ +function note_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Note/Get.php b/api/v3/examples/Note/Get.php index a0fb55c362..66b85868e6 100644 --- a/api/v3/examples/Note/Get.php +++ b/api/v3/examples/Note/Get.php @@ -1,60 +1,64 @@ 'civicrm_contact', - 'entity_id' => 1, -); -try{ - $result = civicrm_api3('note', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using note get API. + * + * + * @return array + * API result array + */ +function note_get_example() { + $params = array( + 'entity_table' => 'civicrm_contact', + 'entity_id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('note', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function note_get_expectedresult(){ +function note_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'entity_table' => 'civicrm_contact', - 'entity_id' => '1', - 'note' => 'hello I am testing Note', - 'contact_id' => '1', - 'modified_date' => '2012-11-14 16:02:35', - 'subject' => 'Test Note', - 'privacy' => 0, - ), - ), -); + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => array(), + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/OptionGroup/Create.php b/api/v3/examples/OptionGroup/Create.php index 8f799d1f20..cf8152692d 100644 --- a/api/v3/examples/OptionGroup/Create.php +++ b/api/v3/examples/OptionGroup/Create.php @@ -1,69 +1,85 @@ 1, - 'name' => 'civicrm_event.amount.560', - 'is_reserved' => 1, - 'is_active' => 1, - 'api.OptionValue.create' => array( + +/** + * Test Generated example of using option_group create API. + * + * + * @return array + * API result array + */ +function option_group_create_example() { + $params = array( + 'sequential' => 1, + 'name' => 'civicrm_event.amount.560', + 'is_reserved' => 1, + 'is_active' => 1, + 'api.OptionValue.create' => array( 'label' => 'workshop', 'value' => 35, 'is_default' => 1, 'is_active' => 1, 'format.only_id' => 1, ), -); + ); -try{ - $result = civicrm_api3('option_group', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('option_group', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function option_group_create_expectedresult(){ +function option_group_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 89, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 92, + 'values' => array( '0' => array( - 'id' => '89', - 'name' => 'civicrm_event.amount.560', - 'title' => '', - 'description' => '', - 'is_reserved' => '1', - 'is_active' => '1', - 'is_locked' => '', - 'api.OptionValue.create' => 764, - ), + 'id' => '92', + 'name' => 'civicrm_event.amount.560', + 'title' => '', + 'description' => '', + 'is_reserved' => '1', + 'is_active' => '1', + 'is_locked' => '', + 'api.OptionValue.create' => 780, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetOptionCreateSuccess and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetOptionCreateSuccess +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/OptionGroup/Delete.php b/api/v3/examples/OptionGroup/Delete.php index b75a2f0287..8cefe8d4fa 100644 --- a/api/v3/examples/OptionGroup/Delete.php +++ b/api/v3/examples/OptionGroup/Delete.php @@ -1,47 +1,63 @@ 94, -); -try{ - $result = civicrm_api3('option_group', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using option_group delete API. + * + * + * @return array + * API result array + */ +function option_group_delete_example() { + $params = array( + 'id' => 97, + ); -return $result; + try{ + $result = civicrm_api3('option_group', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function option_group_delete_expectedresult(){ +function option_group_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteOptionGroup and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteOptionGroup +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/OptionGroup/Get.php b/api/v3/examples/OptionGroup/Get.php index 779bc24172..4f786c220a 100644 --- a/api/v3/examples/OptionGroup/Get.php +++ b/api/v3/examples/OptionGroup/Get.php @@ -1,57 +1,73 @@ 'preferred_communication_method', -); -try{ - $result = civicrm_api3('option_group', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using option_group get API. + * + * + * @return array + * API result array + */ +function option_group_get_example() { + $params = array( + 'name' => 'preferred_communication_method', + ); -return $result; + try{ + $result = civicrm_api3('option_group', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function option_group_get_expectedresult(){ +function option_group_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'name' => 'preferred_communication_method', - 'title' => 'Preferred Communication Method', - 'is_reserved' => '1', - 'is_active' => '1', - 'is_locked' => 0, - ), + 'id' => '1', + 'name' => 'preferred_communication_method', + 'title' => 'Preferred Communication Method', + 'is_reserved' => '1', + 'is_active' => '1', + 'is_locked' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetOptionGroupByName and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetOptionGroupByName +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/OptionValue/Get.php b/api/v3/examples/OptionValue/Get.php index 0cf8674b6b..9f8a43f795 100644 --- a/api/v3/examples/OptionValue/Get.php +++ b/api/v3/examples/OptionValue/Get.php @@ -1,103 +1,119 @@ 1, -); -try{ - $result = civicrm_api3('option_value', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using option_value get API. + * + * + * @return array + * API result array + */ +function option_value_get_example() { + $params = array( + 'option_group_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('option_value', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function option_value_get_expectedresult(){ +function option_value_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 5, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 5, + 'values' => array( '1' => array( - 'id' => '1', - 'option_group_id' => '1', - 'label' => 'Phone', - 'value' => '1', - 'filter' => 0, - 'weight' => '1', - 'is_optgroup' => 0, - 'is_reserved' => 0, - 'is_active' => '1', - ), + 'id' => '1', + 'option_group_id' => '1', + 'label' => 'Phone', + 'value' => '1', + 'filter' => 0, + 'weight' => '1', + 'is_optgroup' => 0, + 'is_reserved' => 0, + 'is_active' => '1', + ), '2' => array( - 'id' => '2', - 'option_group_id' => '1', - 'label' => 'Email', - 'value' => '2', - 'filter' => 0, - 'weight' => '2', - 'is_optgroup' => 0, - 'is_reserved' => 0, - 'is_active' => '1', - ), + 'id' => '2', + 'option_group_id' => '1', + 'label' => 'Email', + 'value' => '2', + 'filter' => 0, + 'weight' => '2', + 'is_optgroup' => 0, + 'is_reserved' => 0, + 'is_active' => '1', + ), '3' => array( - 'id' => '3', - 'option_group_id' => '1', - 'label' => 'Postal Mail', - 'value' => '3', - 'filter' => 0, - 'weight' => '3', - 'is_optgroup' => 0, - 'is_reserved' => 0, - 'is_active' => '1', - ), + 'id' => '3', + 'option_group_id' => '1', + 'label' => 'Postal Mail', + 'value' => '3', + 'filter' => 0, + 'weight' => '3', + 'is_optgroup' => 0, + 'is_reserved' => 0, + 'is_active' => '1', + ), '4' => array( - 'id' => '4', - 'option_group_id' => '1', - 'label' => 'SMS', - 'value' => '4', - 'filter' => 0, - 'weight' => '4', - 'is_optgroup' => 0, - 'is_reserved' => 0, - 'is_active' => '1', - ), + 'id' => '4', + 'option_group_id' => '1', + 'label' => 'SMS', + 'value' => '4', + 'filter' => 0, + 'weight' => '4', + 'is_optgroup' => 0, + 'is_reserved' => 0, + 'is_active' => '1', + ), '5' => array( - 'id' => '5', - 'option_group_id' => '1', - 'label' => 'Fax', - 'value' => '5', - 'filter' => 0, - 'weight' => '5', - 'is_optgroup' => 0, - 'is_reserved' => 0, - 'is_active' => '1', - ), + 'id' => '5', + 'option_group_id' => '1', + 'label' => 'Fax', + 'value' => '5', + 'filter' => 0, + 'weight' => '5', + 'is_optgroup' => 0, + 'is_reserved' => 0, + 'is_active' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetOptionGroup and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetOptionGroup +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionValueTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/OptionValue/SortOption.php b/api/v3/examples/OptionValue/SortOption.php index 49fb663faa..d33da0b494 100644 --- a/api/v3/examples/OptionValue/SortOption.php +++ b/api/v3/examples/OptionValue/SortOption.php @@ -1,56 +1,73 @@ 1, - 'options' => array( + +/** + * Test Generated example of using option_value getsingle API. + * + * demonstrates use of Sort param (available in many api functions). Also, getsingle + * + * @return array + * API result array + */ +function option_value_getsingle_example() { + $params = array( + 'option_group_id' => 1, + 'options' => array( 'sort' => 'label DESC', 'limit' => 1, ), -); + ); -try{ - $result = civicrm_api3('option_value', 'getsingle', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('option_value', 'getsingle', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function option_value_getsingle_expectedresult(){ +function option_value_getsingle_expectedresult() { $expectedResult = array( - 'id' => '4', - 'option_group_id' => '1', - 'label' => 'SMS', - 'value' => '4', - 'filter' => 0, - 'weight' => '4', - 'is_optgroup' => 0, - 'is_reserved' => 0, - 'is_active' => '1', -); + 'id' => '4', + 'option_group_id' => '1', + 'label' => 'SMS', + 'value' => '4', + 'filter' => 0, + 'weight' => '4', + 'is_optgroup' => 0, + 'is_reserved' => 0, + 'is_active' => '1', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetSingleValueOptionValueSort and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetSingleValueOptionValueSort +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionValueTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Participant/Create.php b/api/v3/examples/Participant/Create.php index 6beb53c113..c74231c39e 100644 --- a/api/v3/examples/Participant/Create.php +++ b/api/v3/examples/Participant/Create.php @@ -1,75 +1,91 @@ 4, - 'event_id' => 1, - 'status_id' => 1, - 'role_id' => 1, - 'register_date' => '2007-07-21 00:00:00', - 'source' => 'Online Event Registration: API Testing', - 'custom_1' => 'custom string', -); -try{ - $result = civicrm_api3('participant', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant create API. + * + * + * @return array + * API result array + */ +function participant_create_example() { + $params = array( + 'contact_id' => 4, + 'event_id' => 1, + 'status_id' => 1, + 'role_id' => 1, + 'register_date' => '2007-07-21 00:00:00', + 'source' => 'Online Event Registration: API Testing', + 'custom_1' => 'custom string', + ); -return $result; + try{ + $result = civicrm_api3('participant', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_create_expectedresult(){ +function participant_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 4, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 4, + 'values' => array( '4' => array( - 'id' => '4', - 'contact_id' => '4', - 'event_id' => '1', - 'status_id' => '1', - 'role_id' => '1', - 'register_date' => '20070721000000', - 'source' => 'Online Event Registration: API Testing', - 'fee_level' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'fee_amount' => '', - 'registered_by_id' => '', - 'discount_id' => '', - 'fee_currency' => '', - 'campaign_id' => '', - 'discount_amount' => '', - 'cart_id' => '', - 'must_wait' => '', - ), + 'id' => '4', + 'contact_id' => '4', + 'event_id' => '1', + 'status_id' => '1', + 'role_id' => '1', + 'register_date' => '20070721000000', + 'source' => 'Online Event Registration: API Testing', + 'fee_level' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'fee_amount' => '', + 'registered_by_id' => '', + 'discount_id' => '', + 'fee_currency' => '', + 'campaign_id' => '', + 'discount_amount' => '', + 'cart_id' => '', + 'must_wait' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateWithCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateWithCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Participant/CreateParticipantPayment.php b/api/v3/examples/Participant/CreateParticipantPayment.php index 1f70d8f36e..8d9eb63121 100644 --- a/api/v3/examples/Participant/CreateParticipantPayment.php +++ b/api/v3/examples/Participant/CreateParticipantPayment.php @@ -1,132 +1,149 @@ 'Individual', - 'display_name' => 'dlobo', - 'api.participant' => array( +function participant_create_example() { + $params = array( + 'contact_type' => 'Individual', + 'display_name' => 'dlobo', + 'api.participant' => array( 'event_id' => 40, 'status_id' => 1, 'role_id' => 1, 'format.only_id' => 1, ), - 'api.contribution.create' => array( + 'api.contribution.create' => array( 'financial_type_id' => 1, 'total_amount' => 100, 'format.only_id' => 1, ), - 'api.participant_payment.create' => array( + 'api.participant_payment.create' => array( 'contribution_id' => '$value.api.contribution.create', 'participant_id' => '$value.api.participant', ), -); + ); -try{ - $result = civicrm_api3('participant', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('participant', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_create_expectedresult(){ +function participant_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 5, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 5, + 'values' => array( '5' => array( - 'id' => '5', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'sort_name' => '', - 'display_name' => 'dlobo', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'hash' => '67eac7789eaee00', - 'api_key' => '', - 'first_name' => '', - 'middle_name' => '', - 'last_name' => '', - 'prefix_id' => '', - 'suffix_id' => '', - 'formal_title' => '', - 'communication_style_id' => '', - 'email_greeting_id' => '1', - 'email_greeting_custom' => '', - 'email_greeting_display' => '', - 'postal_greeting_id' => '1', - 'postal_greeting_custom' => '', - 'postal_greeting_display' => '', - 'addressee_id' => '1', - 'addressee_custom' => '', - 'addressee_display' => '', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'primary_contact_id' => '', - 'organization_name' => '', - 'sic_code' => '', - 'user_unique_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'modified_date' => '2012-11-14 16:02:35', - 'api.participant' => 4, - 'api.contribution.create' => 1, - 'api.participant_payment.create' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '0' => array( - 'id' => '1', - 'participant_id' => '4', - 'contribution_id' => '1', - ), - ), + 'id' => '5', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'sort_name' => '', + 'display_name' => 'dlobo', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'hash' => '67eac7789eaee00', + 'api_key' => '', + 'first_name' => '', + 'middle_name' => '', + 'last_name' => '', + 'prefix_id' => '', + 'suffix_id' => '', + 'formal_title' => '', + 'communication_style_id' => '', + 'email_greeting_id' => '1', + 'email_greeting_custom' => '', + 'email_greeting_display' => '', + 'postal_greeting_id' => '1', + 'postal_greeting_custom' => '', + 'postal_greeting_display' => '', + 'addressee_id' => '1', + 'addressee_custom' => '', + 'addressee_display' => '', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'primary_contact_id' => '', + 'organization_name' => '', + 'sic_code' => '', + 'user_unique_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', + 'api.participant' => 4, + 'api.contribution.create' => 1, + 'api.participant_payment.create' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'participant_id' => '4', + 'contribution_id' => '1', ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateParticipantWithPayment and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateParticipantWithPayment +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Participant/Get.php b/api/v3/examples/Participant/Get.php index 7aa04d0e21..082f2cb762 100644 --- a/api/v3/examples/Participant/Get.php +++ b/api/v3/examples/Participant/Get.php @@ -1,78 +1,94 @@ 1, -); -try{ - $result = civicrm_api3('participant', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant get API. + * + * + * @return array + * API result array + */ +function participant_get_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('participant', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_get_expectedresult(){ +function participant_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '2', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'Anderson, Anthony', - 'display_name' => 'Mr. Anthony Anderson II', - 'event_id' => '5', - 'event_title' => 'Annual CiviCRM meet', - 'event_start_date' => '2013-07-29 00:00:00', - 'event_end_date' => '2013-08-04 00:00:00', - 'participant_id' => '1', - 'participant_fee_level' => '', - 'participant_fee_amount' => '', - 'participant_fee_currency' => '', - 'event_type' => 'Conference', - 'participant_status_id' => '2', - 'participant_status' => 'Attended', - 'participant_role' => 'Attendee', - 'participant_role_id' => '1', - 'participant_register_date' => '2007-02-19 00:00:00', - 'participant_source' => 'Wimbeldon', - 'participant_note' => '', - 'participant_is_pay_later' => 0, - 'participant_is_test' => 0, - 'participant_registered_by_id' => '', - 'participant_discount_name' => '', - 'participant_campaign_id' => '', - 'id' => '1', - ), + 'contact_id' => '2', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'event_id' => '5', + 'event_title' => 'Annual CiviCRM meet', + 'event_start_date' => '2013-07-29 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', + 'participant_id' => '1', + 'participant_fee_level' => '', + 'participant_fee_amount' => '', + 'participant_fee_currency' => '', + 'event_type' => 'Conference', + 'participant_status_id' => '2', + 'participant_status' => 'Attended', + 'participant_role' => 'Attendee', + 'participant_role_id' => '1', + 'participant_register_date' => '2007-02-19 00:00:00', + 'participant_source' => 'Wimbeldon', + 'participant_note' => '', + 'participant_is_pay_later' => 0, + 'participant_is_test' => 0, + 'participant_registered_by_id' => '', + 'participant_discount_name' => '', + 'participant_campaign_id' => '', + 'id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetParamsAsIdOnly and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetParamsAsIdOnly +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Participant/NestedDelete.php b/api/v3/examples/Participant/NestedDelete.php index 788f2b98f7..b06f437a8a 100644 --- a/api/v3/examples/Participant/NestedDelete.php +++ b/api/v3/examples/Participant/NestedDelete.php @@ -1,119 +1,136 @@ 4, - 'api.participant.delete' => 1, -); -try{ - $result = civicrm_api3('participant', 'Get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant Get API. + * + * Criteria delete by nesting a GET & a DELETE + * + * @return array + * API result array + */ +function participant_get_example() { + $params = array( + 'contact_id' => 4, + 'api.participant.delete' => 1, + ); -return $result; + try{ + $result = civicrm_api3('participant', 'Get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_get_expectedresult(){ +function participant_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '2' => array( - 'contact_id' => '4', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'Anderson, Anthony', - 'display_name' => 'Mr. Anthony Anderson II', - 'event_id' => '39', - 'event_title' => 'Annual CiviCRM meet', - 'event_start_date' => '2013-07-29 00:00:00', - 'event_end_date' => '2013-08-04 00:00:00', - 'participant_id' => '2', - 'participant_fee_level' => '', - 'participant_fee_amount' => '', - 'participant_fee_currency' => '', - 'event_type' => 'Conference', - 'participant_status_id' => '2', - 'participant_status' => 'Attended', - 'participant_role' => 'Attendee', - 'participant_role_id' => '1', - 'participant_register_date' => '2007-02-19 00:00:00', - 'participant_source' => 'Wimbeldon', - 'participant_note' => '', - 'participant_is_pay_later' => 0, - 'participant_is_test' => 0, - 'participant_registered_by_id' => '', - 'participant_discount_name' => '', - 'participant_campaign_id' => '', - 'id' => '2', - 'api.participant.delete' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, - ), + 'contact_id' => '4', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'event_id' => '39', + 'event_title' => 'Annual CiviCRM meet', + 'event_start_date' => '2013-07-29 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', + 'participant_id' => '2', + 'participant_fee_level' => '', + 'participant_fee_amount' => '', + 'participant_fee_currency' => '', + 'event_type' => 'Conference', + 'participant_status_id' => '2', + 'participant_status' => 'Attended', + 'participant_role' => 'Attendee', + 'participant_role_id' => '1', + 'participant_register_date' => '2007-02-19 00:00:00', + 'participant_source' => 'Wimbeldon', + 'participant_note' => '', + 'participant_is_pay_later' => 0, + 'participant_is_test' => 0, + 'participant_registered_by_id' => '', + 'participant_discount_name' => '', + 'participant_campaign_id' => '', + 'id' => '2', + 'api.participant.delete' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, ), + ), '3' => array( - 'contact_id' => '4', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'Anderson, Anthony', - 'display_name' => 'Mr. Anthony Anderson II', - 'event_id' => '39', - 'event_title' => 'Annual CiviCRM meet', - 'event_start_date' => '2013-07-29 00:00:00', - 'event_end_date' => '2013-08-04 00:00:00', - 'participant_id' => '3', - 'participant_fee_level' => '', - 'participant_fee_amount' => '', - 'participant_fee_currency' => '', - 'event_type' => 'Conference', - 'participant_status_id' => '2', - 'participant_status' => 'Attended', - 'participant_role' => 'Attendee', - 'participant_role_id' => '1', - 'participant_register_date' => '2007-02-19 00:00:00', - 'participant_source' => 'Wimbeldon', - 'participant_note' => '', - 'participant_is_pay_later' => 0, - 'participant_is_test' => 0, - 'participant_registered_by_id' => '', - 'participant_discount_name' => '', - 'participant_campaign_id' => '', - 'id' => '3', - 'api.participant.delete' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, - ), + 'contact_id' => '4', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'event_id' => '39', + 'event_title' => 'Annual CiviCRM meet', + 'event_start_date' => '2013-07-29 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', + 'participant_id' => '3', + 'participant_fee_level' => '', + 'participant_fee_amount' => '', + 'participant_fee_currency' => '', + 'event_type' => 'Conference', + 'participant_status_id' => '2', + 'participant_status' => 'Attended', + 'participant_role' => 'Attendee', + 'participant_role_id' => '1', + 'participant_register_date' => '2007-02-19 00:00:00', + 'participant_source' => 'Wimbeldon', + 'participant_note' => '', + 'participant_is_pay_later' => 0, + 'participant_is_test' => 0, + 'participant_registered_by_id' => '', + 'participant_discount_name' => '', + 'participant_campaign_id' => '', + 'id' => '3', + 'api.participant.delete' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testNestedDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testNestedDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Participant/NestedEventGet.php b/api/v3/examples/Participant/NestedEventGet.php index 397a255596..98d30be336 100644 --- a/api/v3/examples/Participant/NestedEventGet.php +++ b/api/v3/examples/Participant/NestedEventGet.php @@ -1,121 +1,139 @@ 1, - 'api.event.get' => 1, -); -try{ - $result = civicrm_api3('participant', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant get API. + * + * use nested get to get an event + * + * @return array + * API result array + */ +function participant_get_example() { + $params = array( + 'id' => 1, + 'api.event.get' => 1, + ); -return $result; + try{ + $result = civicrm_api3('participant', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_get_expectedresult(){ +function participant_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '2', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'Anderson, Anthony', - 'display_name' => 'Mr. Anthony Anderson II', - 'event_id' => '6', - 'event_title' => 'Annual CiviCRM meet', - 'event_start_date' => '2013-07-29 00:00:00', - 'event_end_date' => '2013-08-04 00:00:00', - 'participant_id' => '1', - 'participant_fee_level' => '', - 'participant_fee_amount' => '', - 'participant_fee_currency' => '', - 'event_type' => 'Conference', - 'participant_status_id' => '2', - 'participant_status' => 'Attended', - 'participant_role' => 'Attendee', - 'participant_role_id' => '1', - 'participant_register_date' => '2007-02-19 00:00:00', - 'participant_source' => 'Wimbeldon', - 'participant_note' => '', - 'participant_is_pay_later' => 0, - 'participant_is_test' => 0, - 'participant_registered_by_id' => '', - 'participant_discount_name' => '', - 'participant_campaign_id' => '', - 'id' => '1', - 'api.event.get' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 6, - 'values' => array( - '0' => array( - 'id' => '6', - 'title' => 'Annual CiviCRM meet', - 'event_title' => 'Annual CiviCRM meet', - 'summary' => 'If you have any CiviCRM related issues or want to track where CiviCRM is heading, Sign up now', - 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', - 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', - 'event_type_id' => '1', - 'participant_listing_id' => 0, - 'is_public' => '1', - 'start_date' => '2013-07-29 00:00:00', - 'event_start_date' => '2013-07-29 00:00:00', - 'end_date' => '2013-08-04 00:00:00', - 'event_end_date' => '2013-08-04 00:00:00', - 'is_online_registration' => '1', - 'registration_start_date' => '2008-06-01 00:00:00', - 'registration_end_date' => '2008-10-15 00:00:00', - 'max_participants' => '100', - 'event_full_text' => 'Sorry! We are already full', - 'is_monetary' => 0, - 'is_map' => 0, - 'is_active' => '1', - 'is_show_location' => 0, - 'default_role_id' => '1', - 'is_email_confirm' => 0, - 'is_pay_later' => 0, - 'is_partial_payment' => 0, - 'is_multiple_registrations' => 0, - 'allow_same_participant_emails' => 0, - 'is_template' => 0, - 'created_date' => '2013-07-28 08:49:19', - 'is_share' => '1', - 'is_confirm_enabled' => '1', - ), - ), + 'contact_id' => '2', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'event_id' => '6', + 'event_title' => 'Annual CiviCRM meet', + 'event_start_date' => '2013-07-29 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', + 'participant_id' => '1', + 'participant_fee_level' => '', + 'participant_fee_amount' => '', + 'participant_fee_currency' => '', + 'event_type' => 'Conference', + 'participant_status_id' => '2', + 'participant_status' => 'Attended', + 'participant_role' => 'Attendee', + 'participant_role_id' => '1', + 'participant_register_date' => '2007-02-19 00:00:00', + 'participant_source' => 'Wimbeldon', + 'participant_note' => '', + 'participant_is_pay_later' => 0, + 'participant_is_test' => 0, + 'participant_registered_by_id' => '', + 'participant_discount_name' => '', + 'participant_campaign_id' => '', + 'id' => '1', + 'api.event.get' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 6, + 'values' => array( + '0' => array( + 'id' => '6', + 'title' => 'Annual CiviCRM meet', + 'event_title' => 'Annual CiviCRM meet', + 'summary' => 'If you have any CiviCRM related issues or want to track where CiviCRM is heading, Sign up now', + 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', + 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', + 'event_type_id' => '1', + 'participant_listing_id' => 0, + 'is_public' => '1', + 'start_date' => '2013-07-29 00:00:00', + 'event_start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'event_end_date' => '2013-08-04 00:00:00', + 'is_online_registration' => '1', + 'registration_start_date' => '2008-06-01 00:00:00', + 'registration_end_date' => '2008-10-15 00:00:00', + 'max_participants' => '100', + 'event_full_text' => 'Sorry! We are already full', + 'is_monetary' => 0, + 'is_map' => 0, + 'is_active' => '1', + 'is_show_location' => 0, + 'default_role_id' => '1', + 'is_email_confirm' => 0, + 'is_pay_later' => 0, + 'is_partial_payment' => 0, + 'is_multiple_registrations' => 0, + 'allow_same_participant_emails' => 0, + 'is_template' => 0, + 'created_date' => '2013-07-28 08:49:19', + 'is_share' => '1', + 'is_confirm_enabled' => '1', + 'is_billing_required' => 0, ), + ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetNestedEventGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetNestedEventGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ParticipantPayment/Create.php b/api/v3/examples/ParticipantPayment/Create.php index e45c9a737a..569864723c 100644 --- a/api/v3/examples/ParticipantPayment/Create.php +++ b/api/v3/examples/ParticipantPayment/Create.php @@ -1,55 +1,71 @@ 1, - 'contribution_id' => 1, -); -try{ - $result = civicrm_api3('participant_payment', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant_payment create API. + * + * + * @return array + * API result array + */ +function participant_payment_create_example() { + $params = array( + 'participant_id' => 13, + 'contribution_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('participant_payment', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_payment_create_expectedresult(){ +function participant_payment_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'participant_id' => '1', - 'contribution_id' => '1', - ), + 'id' => '1', + 'participant_id' => '13', + 'contribution_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testPaymentCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testPaymentCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ParticipantPayment/Delete.php b/api/v3/examples/ParticipantPayment/Delete.php index c194956c6a..bf8a2edbca 100644 --- a/api/v3/examples/ParticipantPayment/Delete.php +++ b/api/v3/examples/ParticipantPayment/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('participant_payment', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant_payment delete API. + * + * + * @return array + * API result array + */ +function participant_payment_delete_example() { + $params = array( + 'id' => 5, + ); -return $result; + try{ + $result = civicrm_api3('participant_payment', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_payment_delete_expectedresult(){ +function participant_payment_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testPaymentDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testPaymentDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ParticipantPayment/Get.php b/api/v3/examples/ParticipantPayment/Get.php index 87e45e8037..00498b9ec6 100644 --- a/api/v3/examples/ParticipantPayment/Get.php +++ b/api/v3/examples/ParticipantPayment/Get.php @@ -1,55 +1,71 @@ 4, - 'contribution_id' => 1, -); -try{ - $result = civicrm_api3('participant_payment', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant_payment get API. + * + * + * @return array + * API result array + */ +function participant_payment_get_example() { + $params = array( + 'participant_id' => 64, + 'contribution_id' => 6, + ); -return $result; + try{ + $result = civicrm_api3('participant_payment', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_payment_get_expectedresult(){ +function participant_payment_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'participant_id' => '4', - 'contribution_id' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 6, + 'values' => array( + '6' => array( + 'id' => '6', + 'participant_id' => '64', + 'contribution_id' => '6', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ParticipantStatusType/Create.php b/api/v3/examples/ParticipantStatusType/Create.php index 0a61f26347..b4793cfe9f 100644 --- a/api/v3/examples/ParticipantStatusType/Create.php +++ b/api/v3/examples/ParticipantStatusType/Create.php @@ -1,67 +1,83 @@ 'test status', - 'label' => 'I am a test', - 'class' => 'Positive', - 'is_reserved' => 0, - 'is_active' => 1, - 'is_counted' => 1, - 'visibility_id' => 1, - 'weight' => 10, -); -try{ - $result = civicrm_api3('participant_status_type', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant_status_type create API. + * + * + * @return array + * API result array + */ +function participant_status_type_create_example() { + $params = array( + 'name' => 'test status', + 'label' => 'I am a test', + 'class' => 'Positive', + 'is_reserved' => 0, + 'is_active' => 1, + 'is_counted' => 1, + 'visibility_id' => 1, + 'weight' => 10, + ); -return $result; + try{ + $result = civicrm_api3('participant_status_type', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_status_type_create_expectedresult(){ +function participant_status_type_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 16, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 16, + 'values' => array( '16' => array( - 'id' => '16', - 'name' => 'test status', - 'label' => 'I am a test', - 'class' => '14', - 'is_reserved' => 0, - 'is_active' => '1', - 'is_counted' => '1', - 'weight' => '10', - 'visibility_id' => '1', - ), + 'id' => '16', + 'name' => 'test status', + 'label' => 'I am a test', + 'class' => '14', + 'is_reserved' => 0, + 'is_active' => '1', + 'is_counted' => '1', + 'weight' => '10', + 'visibility_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateParticipantStatusType and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateParticipantStatusType +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ParticipantStatusType/Delete.php b/api/v3/examples/ParticipantStatusType/Delete.php index 74a74ec498..d5114cf345 100644 --- a/api/v3/examples/ParticipantStatusType/Delete.php +++ b/api/v3/examples/ParticipantStatusType/Delete.php @@ -1,47 +1,63 @@ 17, -); -try{ - $result = civicrm_api3('participant_status_type', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant_status_type delete API. + * + * + * @return array + * API result array + */ +function participant_status_type_delete_example() { + $params = array( + 'id' => 18, + ); -return $result; + try{ + $result = civicrm_api3('participant_status_type', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_status_type_delete_expectedresult(){ +function participant_status_type_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteParticipantStatusType and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteParticipantStatusType +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ParticipantStatusType/Get.php b/api/v3/examples/ParticipantStatusType/Get.php index 0a5c0ed836..8f868c9a93 100644 --- a/api/v3/examples/ParticipantStatusType/Get.php +++ b/api/v3/examples/ParticipantStatusType/Get.php @@ -1,67 +1,83 @@ 'test status', - 'label' => 'I am a test', - 'class' => 'Positive', - 'is_reserved' => 0, - 'is_active' => 1, - 'is_counted' => 1, - 'visibility_id' => 1, - 'weight' => 10, -); -try{ - $result = civicrm_api3('participant_status_type', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using participant_status_type get API. + * + * + * @return array + * API result array + */ +function participant_status_type_get_example() { + $params = array( + 'name' => 'test status', + 'label' => 'I am a test', + 'class' => 'Positive', + 'is_reserved' => 0, + 'is_active' => 1, + 'is_counted' => 1, + 'visibility_id' => 1, + 'weight' => 10, + ); -return $result; + try{ + $result = civicrm_api3('participant_status_type', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function participant_status_type_get_expectedresult(){ +function participant_status_type_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 16, - 'values' => array( - '16' => array( - 'id' => '16', - 'name' => 'test status', - 'label' => 'I am a test', - 'class' => '14', - 'is_reserved' => 0, - 'is_active' => '1', - 'is_counted' => '1', - 'weight' => '10', - 'visibility_id' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 17, + 'values' => array( + '17' => array( + 'id' => '17', + 'name' => 'test status', + 'label' => 'I am a test', + 'class' => '14', + 'is_reserved' => 0, + 'is_active' => '1', + 'is_counted' => '1', + 'weight' => '10', + 'visibility_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetParticipantStatusType and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetParticipantStatusType +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PaymentProcessor/Create.php b/api/v3/examples/PaymentProcessor/Create.php index 6891f7f03d..1b65044923 100644 --- a/api/v3/examples/PaymentProcessor/Create.php +++ b/api/v3/examples/PaymentProcessor/Create.php @@ -1,75 +1,91 @@ 'API Test PP', - 'payment_processor_type_id' => 1, - 'class_name' => 'CRM_Core_Payment_APITest', - 'is_recur' => 0, - 'domain_id' => 1, -); -try{ - $result = civicrm_api3('payment_processor', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using payment_processor create API. + * + * + * @return array + * API result array + */ +function payment_processor_create_example() { + $params = array( + 'name' => 'API Test PP', + 'payment_processor_type_id' => 18, + 'class_name' => 'CRM_Core_Payment_APITest', + 'is_recur' => 0, + 'domain_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('payment_processor', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function payment_processor_create_expectedresult(){ +function payment_processor_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'domain_id' => '1', - 'name' => 'API Test PP', - 'description' => '', - 'payment_processor_type_id' => '1', - 'is_active' => '', - 'is_default' => 0, - 'is_test' => 0, - 'user_name' => '', - 'password' => '', - 'signature' => '', - 'url_site' => '', - 'url_api' => '', - 'url_recur' => '', - 'url_button' => '', - 'subject' => '', - 'class_name' => 'CRM_Core_Payment_APITest', - 'billing_mode' => '1', - 'is_recur' => 0, - 'payment_type' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'domain_id' => '1', + 'name' => 'API Test PP', + 'description' => '', + 'payment_processor_type_id' => '18', + 'is_active' => '', + 'is_default' => 0, + 'is_test' => 0, + 'user_name' => '', + 'password' => '', + 'signature' => '', + 'url_site' => '', + 'url_api' => '', + 'url_recur' => '', + 'url_button' => '', + 'subject' => '', + 'class_name' => 'CRM_Core_Payment_APITest', + 'billing_mode' => '1', + 'is_recur' => 0, + 'payment_type' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testPaymentProcessorCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testPaymentProcessorCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PaymentProcessor/Delete.php b/api/v3/examples/PaymentProcessor/Delete.php index 966f5842bd..347a451e35 100644 --- a/api/v3/examples/PaymentProcessor/Delete.php +++ b/api/v3/examples/PaymentProcessor/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('payment_processor', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using payment_processor delete API. + * + * + * @return array + * API result array + */ +function payment_processor_delete_example() { + $params = array( + 'id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('payment_processor', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function payment_processor_delete_expectedresult(){ +function payment_processor_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testPaymentProcessorDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testPaymentProcessorDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PaymentProcessorType/Create.php b/api/v3/examples/PaymentProcessorType/Create.php index 1c7ba72fb4..1db856a050 100644 --- a/api/v3/examples/PaymentProcessorType/Create.php +++ b/api/v3/examples/PaymentProcessorType/Create.php @@ -1,78 +1,94 @@ 1, - 'name' => 'API_Test_PP', - 'title' => 'API Test Payment Processor', - 'class_name' => 'CRM_Core_Payment_APITest', - 'billing_mode' => 'form', - 'is_recur' => 0, -); -try{ - $result = civicrm_api3('payment_processor_type', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using payment_processor_type create API. + * + * + * @return array + * API result array + */ +function payment_processor_type_create_example() { + $params = array( + 'sequential' => 1, + 'name' => 'API_Test_PP', + 'title' => 'API Test Payment Processor', + 'class_name' => 'CRM_Core_Payment_APITest', + 'billing_mode' => 'form', + 'is_recur' => 0, + ); -return $result; + try{ + $result = civicrm_api3('payment_processor_type', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function payment_processor_type_create_expectedresult(){ +function payment_processor_type_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 15, + 'values' => array( '0' => array( - 'id' => '1', - 'name' => 'API_Test_PP', - 'title' => 'API Test Payment Processor', - 'description' => '', - 'is_active' => '1', - 'is_default' => '', - 'user_name_label' => '', - 'password_label' => '', - 'signature_label' => '', - 'subject_label' => '', - 'class_name' => 'CRM_Core_Payment_APITest', - 'url_site_default' => '', - 'url_api_default' => '', - 'url_recur_default' => '', - 'url_button_default' => '', - 'url_site_test_default' => '', - 'url_api_test_default' => '', - 'url_recur_test_default' => '', - 'url_button_test_default' => '', - 'billing_mode' => '1', - 'is_recur' => 0, - 'payment_type' => '', - ), + 'id' => '15', + 'name' => 'API_Test_PP', + 'title' => 'API Test Payment Processor', + 'description' => '', + 'is_active' => '1', + 'is_default' => '', + 'user_name_label' => '', + 'password_label' => '', + 'signature_label' => '', + 'subject_label' => '', + 'class_name' => 'CRM_Core_Payment_APITest', + 'url_site_default' => '', + 'url_api_default' => '', + 'url_recur_default' => '', + 'url_button_default' => '', + 'url_site_test_default' => '', + 'url_api_test_default' => '', + 'url_recur_test_default' => '', + 'url_button_test_default' => '', + 'billing_mode' => '1', + 'is_recur' => 0, + 'payment_type' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testPaymentProcessorTypeCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testPaymentProcessorTypeCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PaymentProcessorType/Delete.php b/api/v3/examples/PaymentProcessorType/Delete.php index 323c678dd7..dddb23984f 100644 --- a/api/v3/examples/PaymentProcessorType/Delete.php +++ b/api/v3/examples/PaymentProcessorType/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('payment_processor_type', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using payment_processor_type delete API. + * + * + * @return array + * API result array + */ +function payment_processor_type_delete_example() { + $params = array( + 'id' => 17, + ); -return $result; + try{ + $result = civicrm_api3('payment_processor_type', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function payment_processor_type_delete_expectedresult(){ +function payment_processor_type_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testPaymentProcessorTypeDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testPaymentProcessorTypeDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Phone/Create.php b/api/v3/examples/Phone/Create.php index 3e5d8f0f11..538506958b 100644 --- a/api/v3/examples/Phone/Create.php +++ b/api/v3/examples/Phone/Create.php @@ -1,65 +1,81 @@ 3, - 'location_type_id' => 6, - 'phone' => '(123) 456-7890', - 'is_primary' => 1, - 'phone_type_id' => 1, -); -try{ - $result = civicrm_api3('phone', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using phone create API. + * + * + * @return array + * API result array + */ +function phone_create_example() { + $params = array( + 'contact_id' => 3, + 'location_type_id' => 6, + 'phone' => '(123) 456-7890', + 'is_primary' => 1, + 'phone_type_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('phone', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function phone_create_expectedresult(){ +function phone_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'contact_id' => '3', - 'location_type_id' => '6', - 'is_primary' => '1', - 'is_billing' => '', - 'mobile_provider_id' => '', - 'phone' => '(123) 456-7890', - 'phone_ext' => '', - 'phone_numeric' => '', - 'phone_type_id' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'contact_id' => '3', + 'location_type_id' => '6', + 'is_primary' => '1', + 'is_billing' => '', + 'mobile_provider_id' => '', + 'phone' => '(123) 456-7890', + 'phone_ext' => '', + 'phone_numeric' => '', + 'phone_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreatePhone and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreatePhone +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Phone/Delete.php b/api/v3/examples/Phone/Delete.php index a7a49076cb..93fd8553af 100644 --- a/api/v3/examples/Phone/Delete.php +++ b/api/v3/examples/Phone/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('phone', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using phone delete API. + * + * + * @return array + * API result array + */ +function phone_delete_example() { + $params = array( + 'id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('phone', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function phone_delete_expectedresult(){ +function phone_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeletePhone and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeletePhone +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Phone/Get.php b/api/v3/examples/Phone/Get.php index df460cf980..f4ea4f1b4a 100644 --- a/api/v3/examples/Phone/Get.php +++ b/api/v3/examples/Phone/Get.php @@ -1,60 +1,76 @@ 7, - 'phone' => '(123) 456-7890', -); -try{ - $result = civicrm_api3('phone', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using phone get API. + * + * + * @return array + * API result array + */ +function phone_get_example() { + $params = array( + 'contact_id' => 7, + 'phone' => '(123) 456-7890', + ); -return $result; + try{ + $result = civicrm_api3('phone', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function phone_get_expectedresult(){ +function phone_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'contact_id' => '7', - 'location_type_id' => '10', - 'is_primary' => '1', - 'is_billing' => 0, - 'phone' => '(123) 456-7890', - 'phone_numeric' => '1234567890', - 'phone_type_id' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 4, + 'values' => array( + '4' => array( + 'id' => '4', + 'contact_id' => '7', + 'location_type_id' => '10', + 'is_primary' => '1', + 'is_billing' => 0, + 'phone' => '(123) 456-7890', + 'phone_numeric' => '1234567890', + 'phone_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Pledge/Create.php b/api/v3/examples/Pledge/Create.php index 82d61298e4..6b15b70540 100644 --- a/api/v3/examples/Pledge/Create.php +++ b/api/v3/examples/Pledge/Create.php @@ -1,86 +1,102 @@ 11, - 'pledge_create_date' => '20140928', - 'start_date' => '20140928', - 'scheduled_date' => '20140930', - 'amount' => '100', - 'pledge_status_id' => '2', - 'pledge_financial_type_id' => '1', - 'pledge_original_installment_amount' => 20, - 'frequency_interval' => 5, - 'frequency_unit' => 'year', - 'frequency_day' => 15, - 'installments' => 5, - 'sequential' => 1, -); -try{ - $result = civicrm_api3('pledge', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using pledge create API. + * + * + * @return array + * API result array + */ +function pledge_create_example() { + $params = array( + 'contact_id' => 11, + 'pledge_create_date' => '20150115', + 'start_date' => '20150115', + 'scheduled_date' => '20150117', + 'amount' => '100', + 'pledge_status_id' => '2', + 'pledge_financial_type_id' => '1', + 'pledge_original_installment_amount' => 20, + 'frequency_interval' => 5, + 'frequency_unit' => 'year', + 'frequency_day' => 15, + 'installments' => 5, + 'sequential' => 1, + ); -return $result; + try{ + $result = civicrm_api3('pledge', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function pledge_create_expectedresult(){ +function pledge_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '0' => array( - 'id' => '1', - 'contact_id' => '11', - 'financial_type_id' => '1', - 'contribution_page_id' => '', - 'amount' => '100', - 'original_installment_amount' => '20', - 'currency' => 'USD', - 'frequency_unit' => 'year', - 'frequency_interval' => '5', - 'frequency_day' => '15', - 'installments' => '5', - 'start_date' => '2013-07-29 00:00:00', - 'create_date' => '20120130621222105', - 'acknowledge_date' => '', - 'modified_date' => '', - 'cancel_date' => '', - 'end_date' => '', - 'max_reminders' => '', - 'initial_reminder_day' => '', - 'additional_reminder_day' => '', - 'status_id' => '2', - 'is_test' => '', - 'campaign_id' => '', - ), + 'id' => '1', + 'contact_id' => '11', + 'financial_type_id' => '1', + 'contribution_page_id' => '', + 'amount' => '100', + 'original_installment_amount' => '20', + 'currency' => 'USD', + 'frequency_unit' => 'year', + 'frequency_interval' => '5', + 'frequency_day' => '15', + 'installments' => '5', + 'start_date' => '2013-07-29 00:00:00', + 'create_date' => '20120130621222105', + 'acknowledge_date' => '', + 'modified_date' => '', + 'cancel_date' => '', + 'end_date' => '', + 'max_reminders' => '', + 'initial_reminder_day' => '', + 'additional_reminder_day' => '', + 'status_id' => '2', + 'is_test' => '', + 'campaign_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreatePledge and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreatePledge +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Pledge/Delete.php b/api/v3/examples/Pledge/Delete.php index 8fa7bab93b..827ac42f05 100644 --- a/api/v3/examples/Pledge/Delete.php +++ b/api/v3/examples/Pledge/Delete.php @@ -1,50 +1,66 @@ 1, -); -try{ - $result = civicrm_api3('pledge', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using pledge delete API. + * + * + * @return array + * API result array + */ +function pledge_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('pledge', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function pledge_delete_expectedresult(){ +function pledge_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 'id', - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 'id', + 'values' => array( 'id' => 1, ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeletePledgeUseID and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeletePledgeUseID +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Pledge/Get.php b/api/v3/examples/Pledge/Get.php index 460ebabdba..62fbb4ec39 100644 --- a/api/v3/examples/Pledge/Get.php +++ b/api/v3/examples/Pledge/Get.php @@ -1,72 +1,88 @@ 1, -); -try{ - $result = civicrm_api3('pledge', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using pledge get API. + * + * + * @return array + * API result array + */ +function pledge_get_example() { + $params = array( + 'pledge_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('pledge', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function pledge_get_expectedresult(){ +function pledge_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'contact_id' => '5', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'Anderson, Anthony', - 'display_name' => 'Mr. Anthony Anderson II', - 'pledge_id' => '1', - 'pledge_amount' => '100.00', - 'pledge_create_date' => '2014-09-28 00:00:00', - 'pledge_status' => 'Pending', - 'pledge_total_paid' => '', - 'pledge_next_pay_date' => '2014-09-30 00:00:00', - 'pledge_next_pay_amount' => '20.00', - 'pledge_outstanding_amount' => '', - 'pledge_financial_type' => 'Donation', - 'pledge_contribution_page_id' => '', - 'pledge_frequency_interval' => '5', - 'pledge_frequency_unit' => 'year', - 'pledge_is_test' => 0, - 'pledge_campaign_id' => '', - 'pledge_currency' => 'USD', - 'id' => '1', - ), + 'contact_id' => '5', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'pledge_id' => '1', + 'pledge_amount' => '100.00', + 'pledge_create_date' => '2015-01-15 00:00:00', + 'pledge_status' => 'Pending', + 'pledge_total_paid' => '', + 'pledge_next_pay_date' => '2015-01-17 00:00:00', + 'pledge_next_pay_amount' => '20.00', + 'pledge_outstanding_amount' => '', + 'pledge_financial_type' => 'Donation', + 'pledge_contribution_page_id' => '', + 'pledge_frequency_interval' => '5', + 'pledge_frequency_unit' => 'year', + 'pledge_is_test' => 0, + 'pledge_campaign_id' => '', + 'pledge_currency' => 'USD', + 'id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetPledge and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetPledge +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Pledge/GetFilterHighDate.php b/api/v3/examples/Pledge/GetFilterHighDate.php index 2539d81ab6..cd07fae578 100644 --- a/api/v3/examples/Pledge/GetFilterHighDate.php +++ b/api/v3/examples/Pledge/GetFilterHighDate.php @@ -1,72 +1,89 @@ '20140926232809', -); -try{ - $result = civicrm_api3('pledge', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using pledge get API. + * + * demonstrates high date filter + * + * @return array + * API result array + */ +function pledge_get_example() { + $params = array( + 'pledge_start_date_high' => '20150113034845', + ); -return $result; + try{ + $result = civicrm_api3('pledge', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function pledge_get_expectedresult(){ +function pledge_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'contact_id' => '8', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'sort_name' => 'Anderson, Anthony', - 'display_name' => 'Mr. Anthony Anderson II', - 'pledge_id' => '2', - 'pledge_amount' => '100.00', - 'pledge_create_date' => '2014-09-28 00:00:00', - 'pledge_status' => 'Overdue', - 'pledge_total_paid' => '', - 'pledge_next_pay_date' => '2013-03-01 00:00:00', - 'pledge_next_pay_amount' => '20.00', - 'pledge_outstanding_amount' => '20.00', - 'pledge_financial_type' => 'Donation', - 'pledge_contribution_page_id' => '', - 'pledge_frequency_interval' => '5', - 'pledge_frequency_unit' => 'year', - 'pledge_is_test' => 0, - 'pledge_campaign_id' => '', - 'pledge_currency' => 'USD', - 'id' => '2', - ), + 'contact_id' => '8', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'pledge_id' => '2', + 'pledge_amount' => '100.00', + 'pledge_create_date' => '2015-01-15 00:00:00', + 'pledge_status' => 'Overdue', + 'pledge_total_paid' => '', + 'pledge_next_pay_date' => '2014-03-07 00:00:00', + 'pledge_next_pay_amount' => '20.00', + 'pledge_outstanding_amount' => '20.00', + 'pledge_financial_type' => 'Donation', + 'pledge_contribution_page_id' => '', + 'pledge_frequency_interval' => '5', + 'pledge_frequency_unit' => 'year', + 'pledge_is_test' => 0, + 'pledge_campaign_id' => '', + 'pledge_currency' => 'USD', + 'id' => '2', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testPledgeGetReturnFilters and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testPledgeGetReturnFilters +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PledgePayment/Create.php b/api/v3/examples/PledgePayment/Create.php index 0e02f75250..cbe35a0ea2 100644 --- a/api/v3/examples/PledgePayment/Create.php +++ b/api/v3/examples/PledgePayment/Create.php @@ -1,65 +1,81 @@ 1, - 'pledge_id' => 1, - 'contribution_id' => 1, - 'status_id' => 1, - 'actual_amount' => 20, -); -try{ - $result = civicrm_api3('pledge_payment', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using pledge_payment create API. + * + * + * @return array + * API result array + */ +function pledge_payment_create_example() { + $params = array( + 'contact_id' => 1, + 'pledge_id' => 1, + 'contribution_id' => 1, + 'status_id' => 1, + 'actual_amount' => 20, + ); -return $result; + try{ + $result = civicrm_api3('pledge_payment', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function pledge_payment_create_expectedresult(){ +function pledge_payment_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'pledge_id' => '1', - 'contribution_id' => '1', - 'scheduled_amount' => '', - 'actual_amount' => '20', - 'currency' => 'USD', - 'scheduled_date' => '', - 'reminder_date' => '', - 'reminder_count' => '', - 'status_id' => '1', - ), + 'id' => '1', + 'pledge_id' => '1', + 'contribution_id' => '1', + 'scheduled_amount' => '', + 'actual_amount' => '20', + 'currency' => 'USD', + 'scheduled_date' => '', + 'reminder_date' => '', + 'reminder_count' => '', + 'status_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreatePledgePayment and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreatePledgePayment +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PledgePayment/Delete.php b/api/v3/examples/PledgePayment/Delete.php index bc0e010034..28801b9610 100644 --- a/api/v3/examples/PledgePayment/Delete.php +++ b/api/v3/examples/PledgePayment/Delete.php @@ -1,50 +1,66 @@ 1, -); -try{ - $result = civicrm_api3('pledge_payment', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using pledge_payment delete API. + * + * + * @return array + * API result array + */ +function pledge_payment_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('pledge_payment', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function pledge_payment_delete_expectedresult(){ +function pledge_payment_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 'id', - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 'id', + 'values' => array( 'id' => 1, ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeletePledgePayment and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeletePledgePayment +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PledgePayment/Get.php b/api/v3/examples/PledgePayment/Get.php index e1e6120eb3..a526b9c3b7 100644 --- a/api/v3/examples/PledgePayment/Get.php +++ b/api/v3/examples/PledgePayment/Get.php @@ -1,91 +1,107 @@ getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using pledge_payment get API. + * + * + * @return array + * API result array + */ +function pledge_payment_get_example() { + $params = array(); -return $result; + try{ + $result = civicrm_api3('pledge_payment', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function pledge_payment_get_expectedresult(){ +function pledge_payment_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 5, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 5, + 'values' => array( '1' => array( - 'id' => '1', - 'pledge_id' => '1', - 'scheduled_amount' => '20.00', - 'currency' => 'USD', - 'scheduled_date' => '20130728085413', - 'reminder_count' => 0, - 'status_id' => '2', - ), + 'id' => '1', + 'pledge_id' => '1', + 'scheduled_amount' => '20.00', + 'currency' => 'USD', + 'scheduled_date' => '20130728085413', + 'reminder_count' => 0, + 'status_id' => '2', + ), '2' => array( - 'id' => '2', - 'pledge_id' => '1', - 'scheduled_amount' => '20.00', - 'currency' => 'USD', - 'scheduled_date' => '20130728085413', - 'reminder_count' => 0, - 'status_id' => '2', - ), + 'id' => '2', + 'pledge_id' => '1', + 'scheduled_amount' => '20.00', + 'currency' => 'USD', + 'scheduled_date' => '20130728085413', + 'reminder_count' => 0, + 'status_id' => '2', + ), '3' => array( - 'id' => '3', - 'pledge_id' => '1', - 'scheduled_amount' => '20.00', - 'currency' => 'USD', - 'scheduled_date' => '20130728085413', - 'reminder_count' => 0, - 'status_id' => '2', - ), + 'id' => '3', + 'pledge_id' => '1', + 'scheduled_amount' => '20.00', + 'currency' => 'USD', + 'scheduled_date' => '20130728085413', + 'reminder_count' => 0, + 'status_id' => '2', + ), '4' => array( - 'id' => '4', - 'pledge_id' => '1', - 'scheduled_amount' => '20.00', - 'currency' => 'USD', - 'scheduled_date' => '20130728085413', - 'reminder_count' => 0, - 'status_id' => '2', - ), + 'id' => '4', + 'pledge_id' => '1', + 'scheduled_amount' => '20.00', + 'currency' => 'USD', + 'scheduled_date' => '20130728085413', + 'reminder_count' => 0, + 'status_id' => '2', + ), '5' => array( - 'id' => '5', - 'pledge_id' => '1', - 'scheduled_amount' => '20.00', - 'currency' => 'USD', - 'scheduled_date' => '20130728085413', - 'reminder_count' => 0, - 'status_id' => '2', - ), + 'id' => '5', + 'pledge_id' => '1', + 'scheduled_amount' => '20.00', + 'currency' => 'USD', + 'scheduled_date' => '20130728085413', + 'reminder_count' => 0, + 'status_id' => '2', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetPledgePayment and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetPledgePayment +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PledgePayment/Update.php b/api/v3/examples/PledgePayment/Update.php index fe32d3cad8..07615b674a 100644 --- a/api/v3/examples/PledgePayment/Update.php +++ b/api/v3/examples/PledgePayment/Update.php @@ -1,62 +1,78 @@ 1, - 'status_id' => 1, -); -try{ - $result = civicrm_api3('pledge_payment', 'update', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using pledge_payment update API. + * + * + * @return array + * API result array + */ +function pledge_payment_update_example() { + $params = array( + 'id' => 1, + 'status_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('pledge_payment', 'update', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function pledge_payment_update_expectedresult(){ +function pledge_payment_update_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'pledge_id' => '1', - 'contribution_id' => '1', - 'scheduled_amount' => '20.00', - 'actual_amount' => '20.00', - 'currency' => 'USD', - 'scheduled_date' => '20130728085413', - 'reminder_date' => '', - 'reminder_count' => 0, - 'status_id' => '1', - ), + 'id' => '1', + 'pledge_id' => '1', + 'contribution_id' => '1', + 'scheduled_amount' => '20.00', + 'actual_amount' => '20.00', + 'currency' => 'USD', + 'scheduled_date' => '20130728085413', + 'reminder_date' => '', + 'reminder_count' => 0, + 'status_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testUpdatePledgePayment and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testUpdatePledgePayment +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceField/Create.php b/api/v3/examples/PriceField/Create.php index 0e795d380a..2141638b4c 100644 --- a/api/v3/examples/PriceField/Create.php +++ b/api/v3/examples/PriceField/Create.php @@ -1,73 +1,89 @@ 3, - 'name' => 'grassvariety', - 'label' => 'Grass Variety', - 'html_type' => 'Text', - 'is_enter_qty' => 1, - 'is_active' => 1, -); -try{ - $result = civicrm_api3('price_field', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_field create API. + * + * + * @return array + * API result array + */ +function price_field_create_example() { + $params = array( + 'price_set_id' => 3, + 'name' => 'grassvariety', + 'label' => 'Grass Variety', + 'html_type' => 'Text', + 'is_enter_qty' => 1, + 'is_active' => 1, + ); -return $result; + try{ + $result = civicrm_api3('price_field', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_field_create_expectedresult(){ +function price_field_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'price_set_id' => '3', - 'name' => 'grassvariety', - 'label' => 'Grass Variety', - 'html_type' => 'Text', - 'is_enter_qty' => '1', - 'help_pre' => '', - 'help_post' => '', - 'weight' => '', - 'is_display_amounts' => '', - 'options_per_line' => '', - 'is_active' => '1', - 'is_required' => '', - 'active_on' => '', - 'expire_on' => '', - 'javascript' => '', - 'visibility_id' => '', - ), + 'id' => '2', + 'price_set_id' => '3', + 'name' => 'grassvariety', + 'label' => 'Grass Variety', + 'html_type' => 'Text', + 'is_enter_qty' => '1', + 'help_pre' => '', + 'help_post' => '', + 'weight' => '', + 'is_display_amounts' => '', + 'options_per_line' => '', + 'is_active' => '1', + 'is_required' => '', + 'active_on' => '', + 'expire_on' => '', + 'javascript' => '', + 'visibility_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreatePriceField and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreatePriceField +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceField/Delete.php b/api/v3/examples/PriceField/Delete.php index 81bf7ded9c..3f77f4f0be 100644 --- a/api/v3/examples/PriceField/Delete.php +++ b/api/v3/examples/PriceField/Delete.php @@ -1,47 +1,63 @@ 4, -); -try{ - $result = civicrm_api3('price_field', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_field delete API. + * + * + * @return array + * API result array + */ +function price_field_delete_example() { + $params = array( + 'id' => 4, + ); -return $result; + try{ + $result = civicrm_api3('price_field', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_field_delete_expectedresult(){ +function price_field_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeletePriceField and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeletePriceField +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceField/Get.php b/api/v3/examples/PriceField/Get.php index 45a6729bd7..9d72dc87c7 100644 --- a/api/v3/examples/PriceField/Get.php +++ b/api/v3/examples/PriceField/Get.php @@ -1,63 +1,79 @@ 'contribution_amount', -); -try{ - $result = civicrm_api3('price_field', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_field get API. + * + * + * @return array + * API result array + */ +function price_field_get_example() { + $params = array( + 'name' => 'contribution_amount', + ); -return $result; + try{ + $result = civicrm_api3('price_field', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_field_get_expectedresult(){ +function price_field_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'price_set_id' => '1', - 'name' => 'contribution_amount', - 'label' => 'Contribution Amount', - 'html_type' => 'Text', - 'is_enter_qty' => 0, - 'weight' => '1', - 'is_display_amounts' => '1', - 'options_per_line' => '1', - 'is_active' => '1', - 'is_required' => '1', - 'visibility_id' => '1', - ), + 'id' => '1', + 'price_set_id' => '1', + 'name' => 'contribution_amount', + 'label' => 'Contribution Amount', + 'html_type' => 'Text', + 'is_enter_qty' => 0, + 'weight' => '1', + 'is_display_amounts' => '1', + 'options_per_line' => '1', + 'is_active' => '1', + 'is_required' => '1', + 'visibility_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetBasicPriceField and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetBasicPriceField +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceFieldValue/Create.php b/api/v3/examples/PriceFieldValue/Create.php index 7745993d5a..5ba3272b58 100644 --- a/api/v3/examples/PriceFieldValue/Create.php +++ b/api/v3/examples/PriceFieldValue/Create.php @@ -1,74 +1,90 @@ 13, - 'membership_type_id' => 5, - 'name' => 'memType1', - 'label' => 'memType1', - 'amount' => 90, - 'membership_num_terms' => 2, - 'is_active' => 1, - 'financial_type_id' => 2, -); -try{ - $result = civicrm_api3('price_field_value', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_field_value create API. + * + * + * @return array + * API result array + */ +function price_field_value_create_example() { + $params = array( + 'price_field_id' => 13, + 'membership_type_id' => 5, + 'name' => 'memType1', + 'label' => 'memType1', + 'amount' => 90, + 'membership_num_terms' => 2, + 'is_active' => 1, + 'financial_type_id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('price_field_value', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_field_value_create_expectedresult(){ +function price_field_value_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 10, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 10, + 'values' => array( '10' => array( - 'id' => '10', - 'price_field_id' => '13', - 'name' => 'memType1', - 'label' => 'memType1', - 'description' => '', - 'amount' => '90', - 'count' => '', - 'max_value' => '', - 'weight' => '1', - 'membership_type_id' => '5', - 'membership_num_terms' => '2', - 'is_default' => '', - 'is_active' => '1', - 'financial_type_id' => '2', - 'deductible_amount' => '', - 'contribution_type_id' => '2', - ), + 'id' => '10', + 'price_field_id' => '13', + 'name' => 'memType1', + 'label' => 'memType1', + 'description' => '', + 'amount' => '90', + 'count' => '', + 'max_value' => '', + 'weight' => '1', + 'membership_type_id' => '5', + 'membership_num_terms' => '2', + 'is_default' => '', + 'is_active' => '1', + 'financial_type_id' => '2', + 'deductible_amount' => '', + 'contribution_type_id' => '2', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreatePriceFieldValuewithMultipleTerms and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreatePriceFieldValuewithMultipleTerms +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceFieldValue/Delete.php b/api/v3/examples/PriceFieldValue/Delete.php index 3db7479593..cbe7bda4f3 100644 --- a/api/v3/examples/PriceFieldValue/Delete.php +++ b/api/v3/examples/PriceFieldValue/Delete.php @@ -1,47 +1,63 @@ 7, -); -try{ - $result = civicrm_api3('price_field_value', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_field_value delete API. + * + * + * @return array + * API result array + */ +function price_field_value_delete_example() { + $params = array( + 'id' => 7, + ); -return $result; + try{ + $result = civicrm_api3('price_field_value', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_field_value_delete_expectedresult(){ +function price_field_value_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeletePriceFieldValue and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeletePriceFieldValue +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceFieldValue/Get.php b/api/v3/examples/PriceFieldValue/Get.php index 743f7abd2a..da75f61bc6 100644 --- a/api/v3/examples/PriceFieldValue/Get.php +++ b/api/v3/examples/PriceFieldValue/Get.php @@ -1,61 +1,77 @@ 'contribution_amount', -); -try{ - $result = civicrm_api3('price_field_value', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_field_value get API. + * + * + * @return array + * API result array + */ +function price_field_value_get_example() { + $params = array( + 'name' => 'contribution_amount', + ); -return $result; + try{ + $result = civicrm_api3('price_field_value', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_field_value_get_expectedresult(){ +function price_field_value_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'price_field_id' => '1', - 'name' => 'contribution_amount', - 'label' => 'Contribution Amount', - 'amount' => '1', - 'weight' => '1', - 'is_default' => 0, - 'is_active' => '1', - 'financial_type_id' => '1', - 'deductible_amount' => '0.00', - ), + 'id' => '1', + 'price_field_id' => '1', + 'name' => 'contribution_amount', + 'label' => 'Contribution Amount', + 'amount' => '1', + 'weight' => '1', + 'is_default' => 0, + 'is_active' => '1', + 'financial_type_id' => '1', + 'deductible_amount' => '0.00', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetBasicPriceFieldValue and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetBasicPriceFieldValue +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceSet/Create.php b/api/v3/examples/PriceSet/Create.php index 41257e8f3c..806c3ee2eb 100644 --- a/api/v3/examples/PriceSet/Create.php +++ b/api/v3/examples/PriceSet/Create.php @@ -1,71 +1,89 @@ 'default_goat_priceset', - 'title' => 'Goat accessories', - 'is_active' => 1, - 'help_pre' => 'Please describe your goat in detail', - 'help_post' => 'thank you for your time', - 'extends' => 2, - 'financial_type_id' => 1, - 'is_quick_config' => 1, - 'is_reserved' => 1, -); -try{ - $result = civicrm_api3('price_set', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_set create API. + * + * + * @return array + * API result array + */ +function price_set_create_example() { + $params = array( + 'name' => 'some_price_set', + 'title' => 'Some Price Set', + 'is_active' => 1, + 'financial_type_id' => 1, + 'extends' => array( + '0' => 1, + '1' => 2, + ), + ); -return $result; + try{ + $result = civicrm_api3('price_set', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_set_create_expectedresult(){ +function price_set_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 15, - 'values' => array( - '15' => array( - 'id' => '15', - 'domain_id' => '', - 'name' => 'default_goat_priceset', - 'title' => 'Goat accessories', - 'is_active' => '1', - 'help_pre' => 'Please describe your goat in detail', - 'help_post' => 'thank you for your time', - 'javascript' => '', - 'extends' => '2', - 'financial_type_id' => '1', - 'is_quick_config' => '1', - 'is_reserved' => '1', + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 16, + 'values' => array( + '16' => array( + 'id' => '16', + 'domain_id' => '', + 'name' => 'some_price_set', + 'title' => 'Some Price Set', + 'is_active' => '1', + 'help_pre' => '', + 'help_post' => '', + 'javascript' => '', + 'extends' => array( + '0' => '1', + '1' => '2', ), + 'financial_type_id' => '1', + 'is_quick_config' => '', + 'is_reserved' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreatePriceSet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreatePriceSetForEventAndContribution +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceSet/Delete.php b/api/v3/examples/PriceSet/Delete.php index 71bdf5e5c4..f45fad6aba 100644 --- a/api/v3/examples/PriceSet/Delete.php +++ b/api/v3/examples/PriceSet/Delete.php @@ -1,47 +1,63 @@ 18, -); -try{ - $result = civicrm_api3('price_set', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_set delete API. + * + * + * @return array + * API result array + */ +function price_set_delete_example() { + $params = array( + 'id' => 19, + ); -return $result; + try{ + $result = civicrm_api3('price_set', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_set_delete_expectedresult(){ +function price_set_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeletePriceSet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeletePriceSet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/PriceSet/Get.php b/api/v3/examples/PriceSet/Get.php index 713f077cf4..19d5b04108 100644 --- a/api/v3/examples/PriceSet/Get.php +++ b/api/v3/examples/PriceSet/Get.php @@ -1,59 +1,75 @@ 'default_contribution_amount', -); -try{ - $result = civicrm_api3('price_set', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using price_set get API. + * + * + * @return array + * API result array + */ +function price_set_get_example() { + $params = array( + 'name' => 'default_contribution_amount', + ); -return $result; + try{ + $result = civicrm_api3('price_set', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function price_set_get_expectedresult(){ +function price_set_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'name' => 'default_contribution_amount', - 'title' => 'Contribution Amount', - 'is_active' => '1', - 'extends' => '2', - 'is_quick_config' => '1', - 'is_reserved' => '1', - 'entity' => array(), - ), + 'id' => '1', + 'name' => 'default_contribution_amount', + 'title' => 'Contribution Amount', + 'is_active' => '1', + 'extends' => '2', + 'is_quick_config' => '1', + 'is_reserved' => '1', + 'entity' => array(), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetBasicPriceSet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetBasicPriceSet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Profile/Apply.php b/api/v3/examples/Profile/Apply.php index 41c8abfe2d..a650ea8fea 100644 --- a/api/v3/examples/Profile/Apply.php +++ b/api/v3/examples/Profile/Apply.php @@ -1,44 +1,60 @@ 31, - 'contact_id' => 3, - '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', -); -try{ - $result = civicrm_api3('profile', 'apply', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using profile apply API. + * + * + * @return array + * API result array + */ +function profile_apply_example() { + $params = array( + 'profile_id' => 31, + 'contact_id' => 3, + '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', + ); -return $result; + try{ + $result = civicrm_api3('profile', 'apply', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function profile_apply_expectedresult(){ +function profile_apply_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 11, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 11, + 'values' => array( 'contact_type' => 'Individual', 'contact_sub_type' => '', 'contact_id' => 3, @@ -48,39 +64,39 @@ function profile_apply_expectedresult(){ 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email' => array( - '1' => array( - 'location_type_id' => '1', - 'is_primary' => 1, - 'email' => 'abc2.xyz2@gmail.com', - ), + '1' => array( + 'location_type_id' => '1', + 'is_primary' => 1, + 'email' => 'abc2.xyz2@gmail.com', ), + ), 'phone' => array( - '2' => array( - 'location_type_id' => '1', - 'is_primary' => 1, - 'phone_type_id' => '1', - 'phone' => '022 321 826', - ), + '2' => array( + 'location_type_id' => '1', + 'is_primary' => 1, + 'phone_type_id' => '1', + 'phone' => '022 321 826', ), + ), 'address' => array( - '1' => array( - 'location_type_id' => '1', - 'is_primary' => 1, - 'country_id' => '1013', - 'state_province_id' => '1000', - ), + '1' => array( + 'location_type_id' => '1', + 'is_primary' => 1, + 'country_id' => '1013', + 'state_province_id' => '1000', ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testProfileApply and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testProfileApply +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Profile/Get.php b/api/v3/examples/Profile/Get.php index 1e229acffa..6e22136fb0 100644 --- a/api/v3/examples/Profile/Get.php +++ b/api/v3/examples/Profile/Get.php @@ -1,84 +1,100 @@ array( + +/** + * Test Generated example of using profile get API. + * + * + * @return array + * API result array + */ +function profile_get_example() { + $params = array( + 'profile_id' => array( '0' => 15, '1' => 1, '2' => 'Billing', ), - 'contact_id' => 3, -); + 'contact_id' => 3, + ); -try{ - $result = civicrm_api3('profile', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('profile', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function profile_get_expectedresult(){ +function profile_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => array( '15' => array( - 'postal_code-1' => '90210', - 'state_province-1' => '1021', - 'country-1' => '1228', - 'phone-1-1' => '021 512 755', - 'email-Primary' => 'abc1.xyz1@yahoo.com', - 'last_name' => 'xyz1', - 'first_name' => 'abc1', - 'email-primary' => 'abc1.xyz1@yahoo.com', - ), + 'postal_code-1' => '90210', + 'state_province-1' => '1021', + 'country-1' => '1228', + 'phone-1-1' => '021 512 755', + 'email-Primary' => 'abc1.xyz1@yahoo.com', + 'last_name' => 'xyz1', + 'first_name' => 'abc1', + 'email-primary' => 'abc1.xyz1@yahoo.com', + ), '1' => array( - 'first_name' => 'abc1', - 'last_name' => 'xyz1', - 'street_address-1' => '5 Saint Helier St', - 'city-1' => 'Gotham City', - 'postal_code-1' => '90210', - 'country-1' => '1228', - 'state_province-1' => '1021', - ), + 'first_name' => 'abc1', + 'last_name' => 'xyz1', + 'street_address-1' => '5 Saint Helier St', + 'city-1' => 'Gotham City', + 'postal_code-1' => '90210', + 'country-1' => '1228', + 'state_province-1' => '1021', + ), 'Billing' => array( - 'billing_first_name' => 'abc1', - 'billing_middle_name' => 'J.', - 'billing_last_name' => 'xyz1', - 'billing_street_address-5' => '5 Saint Helier St', - 'billing_city-5' => 'Gotham City', - 'billing_state_province_id-5' => '1021', - 'billing_country_id-5' => '1228', - 'billing_postal_code-5' => '90210', - 'billing-email-5' => 'abc1.xyz1@yahoo.com', - 'email-5' => 'abc1.xyz1@yahoo.com', - ), + 'billing_first_name' => 'abc1', + 'billing_middle_name' => 'J.', + 'billing_last_name' => 'xyz1', + 'billing_street_address-5' => '5 Saint Helier St', + 'billing_city-5' => 'Gotham City', + 'billing_state_province_id-5' => '1021', + 'billing_country_id-5' => '1228', + 'billing_postal_code-5' => '90210', + 'billing-email-5' => 'abc1.xyz1@yahoo.com', + 'email-5' => 'abc1.xyz1@yahoo.com', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testProfileGetMultiple and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testProfileGetMultiple +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Profile/GetFields.php b/api/v3/examples/Profile/GetFields.php index 37f5a5890d..35564b56f3 100644 --- a/api/v3/examples/Profile/GetFields.php +++ b/api/v3/examples/Profile/GetFields.php @@ -1,225 +1,244 @@ 'submit', - 'profile_id' => 27, -); -try{ - $result = civicrm_api3('profile', 'getfields', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using profile getfields API. + * + * demonstrates retrieving profile fields passing in an id + * + * @return array + * API result array + */ +function profile_getfields_example() { + $params = array( + 'action' => 'submit', + 'profile_id' => 27, + ); -return $result; + try{ + $result = civicrm_api3('profile', 'getfields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function profile_getfields_expectedresult(){ +function profile_getfields_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 9, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 9, + 'values' => array( 'custom_1' => array( - 'label' => '_addCustomFieldToProfile', - 'groupTitle' => '_addCustomFie', - 'data_type' => 'String', - 'html_type' => 'Text', - 'default_value' => 'defaultValue', - 'text_length' => '', - 'options_per_line' => '', - 'custom_group_id' => '1', - 'extends' => 'Contact', - 'is_search_range' => 0, - 'extends_entity_column_value' => '', - 'extends_entity_column_id' => '', - 'is_view' => 0, - 'is_multiple' => 0, - 'option_group_id' => '', - 'date_format' => '', - 'time_format' => '', - 'is_required' => 0, - 'name' => 'custom_1', - 'title' => 'first_name', - 'type' => 2, - 'api.required' => '1', - 'help_pre' => '', - 'help_post' => '', - 'entity' => 'contact', - 'weight' => '1', - 'api.aliases' => array(), - ), + 'label' => '_addCustomFieldToProfile', + 'groupTitle' => '_addCustomFie', + 'data_type' => 'String', + 'html_type' => 'Text', + 'default_value' => 'defaultValue', + 'text_length' => '', + 'options_per_line' => '', + 'custom_group_id' => '1', + 'extends' => 'Contact', + 'is_search_range' => 0, + 'extends_entity_column_value' => '', + 'extends_entity_column_id' => '', + 'is_view' => 0, + 'is_multiple' => 0, + 'option_group_id' => '', + 'date_format' => '', + 'time_format' => '', + 'is_required' => 0, + 'name' => 'custom_1', + 'title' => 'first_name', + 'type' => 2, + 'api.required' => '1', + 'help_pre' => '', + 'help_post' => '', + 'entity' => 'contact', + 'weight' => '1', + 'api.aliases' => array(), + ), 'postal_code-1' => array( - 'name' => 'postal_code', - 'type' => 2, - 'title' => 'State Province', - 'maxlength' => 12, - 'size' => 12, - 'import' => true, - 'where' => 'civicrm_address.postal_code', - 'headerPattern' => '/postal|zip/i', - 'dataPattern' => '/\\d?\\d{4}(-\\d{4})?/', - 'export' => true, - 'api.required' => 0, - 'help_pre' => '', - 'help_post' => '', - 'entity' => 'address', - 'weight' => '2', - 'api.aliases' => array(), - ), + 'name' => 'postal_code', + 'type' => 2, + 'title' => 'State Province', + 'maxlength' => 12, + 'size' => 12, + 'import' => TRUE, + 'where' => 'civicrm_address.postal_code', + 'headerPattern' => '/postal|zip/i', + 'dataPattern' => '/\\d?\\d{4}(-\\d{4})?/', + 'export' => TRUE, + 'api.required' => 0, + 'help_pre' => '', + 'help_post' => '', + 'entity' => 'address', + 'weight' => '2', + 'api.aliases' => array(), + ), 'state_province-1' => array( - 'name' => 'state_province_id', - 'type' => 1, - 'title' => 'State Province', - 'FKClassName' => 'CRM_Core_DAO_StateProvince', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'table' => 'civicrm_state_province', - 'keyColumn' => 'id', - 'labelColumn' => 'name', - ), - 'api.required' => '1', - 'help_pre' => '', - 'help_post' => '', - 'entity' => 'address', - 'weight' => '3', - 'api.aliases' => array(), + 'name' => 'state_province_id', + 'type' => 1, + 'title' => 'State Province', + 'FKClassName' => 'CRM_Core_DAO_StateProvince', + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'table' => 'civicrm_state_province', + 'keyColumn' => 'id', + 'labelColumn' => 'name', ), + 'FKApiName' => 'StateProvince', + 'api.required' => '1', + 'help_pre' => '', + 'help_post' => '', + 'entity' => 'address', + 'weight' => '3', + 'api.aliases' => array(), + ), 'country-1' => array( - 'name' => 'country_id', - 'type' => 1, - 'title' => 'Country', - 'FKClassName' => 'CRM_Core_DAO_Country', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'table' => 'civicrm_country', - 'keyColumn' => 'id', - 'labelColumn' => 'name', - 'nameColumn' => 'iso_code', - ), - 'api.required' => '1', - 'help_pre' => '', - 'help_post' => '', - 'entity' => 'address', - 'weight' => '4', - 'api.aliases' => array(), + 'name' => 'country_id', + 'type' => 1, + 'title' => 'Country', + 'FKClassName' => 'CRM_Core_DAO_Country', + 'html' => array( + 'type' => 'Select', ), - 'phone-1-1' => array( - 'name' => 'phone', - 'type' => 2, - 'title' => 'Phone', - 'maxlength' => 32, - 'size' => 20, - 'import' => true, - 'where' => 'civicrm_phone.phone', - 'headerPattern' => '/phone/i', - 'dataPattern' => '/^[\\d\\(\\)\\-\\.\\s]+$/', - 'export' => true, - 'api.required' => '1', - 'help_pre' => '', - 'help_post' => '', - 'entity' => 'phone', - 'weight' => '5', - 'api.aliases' => array(), + 'pseudoconstant' => array( + 'table' => 'civicrm_country', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + 'nameColumn' => 'iso_code', ), + 'FKApiName' => 'Country', + 'api.required' => '1', + 'help_pre' => '', + 'help_post' => '', + 'entity' => 'address', + 'weight' => '4', + 'api.aliases' => array(), + ), + 'phone-1-1' => array( + 'name' => 'phone', + 'type' => 2, + 'title' => 'Phone', + 'maxlength' => 32, + 'size' => 20, + 'import' => TRUE, + 'where' => 'civicrm_phone.phone', + 'headerPattern' => '/phone/i', + 'dataPattern' => '/^[\\d\\(\\)\\-\\.\\s]+$/', + 'export' => TRUE, + 'api.required' => '1', + 'help_pre' => '', + 'help_post' => '', + 'entity' => 'phone', + 'weight' => '5', + 'api.aliases' => array(), + ), 'email-primary' => array( - 'name' => 'email', - 'type' => 2, - 'title' => 'Email', - 'maxlength' => 254, - 'size' => 20, - 'import' => true, - 'where' => 'civicrm_email.email', - 'headerPattern' => '/e.?mail/i', - 'dataPattern' => '/^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$/', - 'export' => true, - 'rule' => 'email', - 'html' => array( - 'type' => 'Text', - ), - 'api.required' => '1', - 'help_pre' => '', - 'help_post' => '', - 'entity' => 'email', - 'weight' => '6', - 'api.aliases' => array( - '0' => 'email-Primary', - ), + 'name' => 'email', + 'type' => 2, + 'title' => 'Email', + 'maxlength' => 254, + 'size' => 20, + 'import' => TRUE, + 'where' => 'civicrm_email.email', + 'headerPattern' => '/e.?mail/i', + 'dataPattern' => '/^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$/', + 'export' => TRUE, + 'rule' => 'email', + 'html' => array( + 'type' => 'Text', ), + 'api.required' => '1', + 'help_pre' => '', + 'help_post' => '', + 'entity' => 'email', + 'weight' => '6', + 'api.aliases' => array( + '0' => 'email-Primary', + ), + ), 'last_name' => array( - 'name' => 'last_name', - 'type' => 2, - 'title' => 'Last Name', - 'maxlength' => 64, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.last_name', - 'headerPattern' => '/^last|(l(ast\\s)?name)$/i', - 'dataPattern' => '/^\\w+(\\s\\w+)?+$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - 'api.required' => '1', - 'help_pre' => '', - 'help_post' => '', - 'entity' => 'contact', - 'weight' => '7', - 'api.aliases' => array(), + 'name' => 'last_name', + 'type' => 2, + 'title' => 'Last Name', + 'maxlength' => 64, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.last_name', + 'headerPattern' => '/^last|(l(ast\\s)?name)$/i', + 'dataPattern' => '/^\\w+(\\s\\w+)?+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', ), + 'api.required' => '1', + 'help_pre' => '', + 'help_post' => '', + 'entity' => 'contact', + 'weight' => '7', + 'api.aliases' => array(), + ), 'first_name' => array( - 'name' => 'first_name', - 'type' => 2, - 'title' => 'First Name', - 'maxlength' => 64, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_contact.first_name', - 'headerPattern' => '/^first|(f(irst\\s)?name)$/i', - 'dataPattern' => '/^\\w+$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), - 'api.required' => '1', - 'help_pre' => '', - 'help_post' => '', - 'entity' => 'contact', - 'weight' => '8', - 'api.aliases' => array(), + 'name' => 'first_name', + 'type' => 2, + 'title' => 'First Name', + 'maxlength' => 64, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_contact.first_name', + 'headerPattern' => '/^first|(f(irst\\s)?name)$/i', + 'dataPattern' => '/^\\w+$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', ), + 'api.required' => '1', + 'help_pre' => '', + 'help_post' => '', + 'entity' => 'contact', + 'weight' => '8', + 'api.aliases' => array(), + ), 'profile_id' => array( - 'api.required' => true, - 'title' => 'Profile ID', - ), + 'api.required' => TRUE, + 'title' => 'Profile ID', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetFields and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetFields +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Profile/Submit.php b/api/v3/examples/Profile/Submit.php index 564522bd8b..3edde79896 100644 --- a/api/v3/examples/Profile/Submit.php +++ b/api/v3/examples/Profile/Submit.php @@ -1,107 +1,123 @@ 29, - 'contact_id' => 3, - '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', -); -try{ - $result = civicrm_api3('profile', 'submit', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using profile submit API. + * + * + * @return array + * API result array + */ +function profile_submit_example() { + $params = array( + 'profile_id' => 29, + 'contact_id' => 3, + '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', + ); -return $result; + try{ + $result = civicrm_api3('profile', 'submit', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function profile_submit_expectedresult(){ +function profile_submit_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => array( '3' => array( - 'id' => '3', - 'contact_type' => 'Individual', - 'contact_sub_type' => '', - 'do_not_email' => 0, - 'do_not_phone' => 0, - 'do_not_mail' => 0, - 'do_not_sms' => 0, - 'do_not_trade' => 0, - 'is_opt_out' => 0, - 'legal_identifier' => '', - 'external_identifier' => '', - 'sort_name' => 'xyz2, abc2', - 'display_name' => 'Mr. abc2 xyz2 II', - 'nick_name' => '', - 'legal_name' => '', - 'image_URL' => '', - 'preferred_communication_method' => '', - 'preferred_language' => 'en_US', - 'preferred_mail_format' => 'Both', - 'hash' => '67eac7789eaee00', - 'api_key' => '', - 'first_name' => 'abc2', - 'middle_name' => 'J.', - 'last_name' => 'xyz2', - 'prefix_id' => '3', - 'suffix_id' => '3', - 'formal_title' => '', - 'communication_style_id' => '', - 'email_greeting_id' => '1', - 'email_greeting_custom' => '', - 'email_greeting_display' => 'Dear abc1', - 'postal_greeting_id' => '1', - 'postal_greeting_custom' => '', - 'postal_greeting_display' => 'Dear abc1', - 'addressee_id' => '1', - 'addressee_custom' => '', - 'addressee_display' => 'Mr. abc1 J. xyz1 II', - 'job_title' => '', - 'gender_id' => '', - 'birth_date' => '', - 'is_deceased' => 0, - 'deceased_date' => '', - 'household_name' => '', - 'primary_contact_id' => '', - 'organization_name' => '', - 'sic_code' => '', - 'user_unique_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'modified_date' => '2012-11-14 16:02:35', - ), + 'id' => '3', + 'contact_type' => 'Individual', + 'contact_sub_type' => '', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_identifier' => '', + 'external_identifier' => '', + 'sort_name' => 'xyz2, abc2', + 'display_name' => 'Mr. abc2 xyz2 II', + 'nick_name' => '', + 'legal_name' => '', + 'image_URL' => '', + 'preferred_communication_method' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', + 'hash' => '67eac7789eaee00', + 'api_key' => '', + 'first_name' => 'abc2', + 'middle_name' => 'J.', + 'last_name' => 'xyz2', + 'prefix_id' => '3', + 'suffix_id' => '3', + 'formal_title' => '', + 'communication_style_id' => '', + 'email_greeting_id' => '1', + 'email_greeting_custom' => '', + 'email_greeting_display' => 'Dear abc1', + 'postal_greeting_id' => '1', + 'postal_greeting_custom' => '', + 'postal_greeting_display' => 'Dear abc1', + 'addressee_id' => '1', + 'addressee_custom' => '', + 'addressee_display' => 'Mr. abc1 J. xyz1 II', + 'job_title' => '', + 'gender_id' => '', + 'birth_date' => '', + 'is_deceased' => 0, + 'deceased_date' => '', + 'household_name' => '', + 'primary_contact_id' => '', + 'organization_name' => '', + 'sic_code' => '', + 'user_unique_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testProfileSubmit and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testProfileSubmit +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Relationship/BetweenRelationshipType.php b/api/v3/examples/Relationship/BetweenRelationshipType.php index 5b89a61fda..91ba982591 100644 --- a/api/v3/examples/Relationship/BetweenRelationshipType.php +++ b/api/v3/examples/Relationship/BetweenRelationshipType.php @@ -1,86 +1,103 @@ array( + +/** + * Test Generated example of using relationship get API. + * + * demonstrates use of BETWEEN filter + * + * @return array + * API result array + */ +function relationship_get_example() { + $params = array( + 'relationship_type_id' => array( 'BETWEEN' => array( - '0' => 33, - '1' => 35, - ), + '0' => 33, + '1' => 35, + ), ), -); + ); -try{ - $result = civicrm_api3('relationship', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('relationship', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_get_expectedresult(){ +function relationship_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => array( '2' => array( - 'id' => '2', - 'contact_id_a' => '87', - 'contact_id_b' => '89', - 'relationship_type_id' => '33', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '2', + 'contact_id_a' => '87', + 'contact_id_b' => '89', + 'relationship_type_id' => '33', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), '3' => array( - 'id' => '3', - 'contact_id_a' => '87', - 'contact_id_b' => '89', - 'relationship_type_id' => '34', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '3', + 'contact_id_a' => '87', + 'contact_id_b' => '89', + 'relationship_type_id' => '34', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), '4' => array( - 'id' => '4', - 'contact_id_a' => '87', - 'contact_id_b' => '89', - 'relationship_type_id' => '35', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '4', + 'contact_id_a' => '87', + 'contact_id_b' => '89', + 'relationship_type_id' => '35', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetTypeOperators and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetTypeOperators +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Relationship/Create.php b/api/v3/examples/Relationship/Create.php index 936f8b8412..9205979cd3 100644 --- a/api/v3/examples/Relationship/Create.php +++ b/api/v3/examples/Relationship/Create.php @@ -1,68 +1,84 @@ 31, - 'contact_id_b' => 33, - 'relationship_type_id' => 18, - 'start_date' => '2010-10-30', - 'end_date' => '2010-12-30', - 'is_active' => 1, - 'note' => 'note', -); -try{ - $result = civicrm_api3('relationship', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using relationship create API. + * + * + * @return array + * API result array + */ +function relationship_create_example() { + $params = array( + 'contact_id_a' => 31, + 'contact_id_b' => 33, + 'relationship_type_id' => 18, + 'start_date' => '2010-10-30', + 'end_date' => '2010-12-30', + 'is_active' => 1, + 'note' => 'note', + ); -return $result; + try{ + $result = civicrm_api3('relationship', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_create_expectedresult(){ +function relationship_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id_a' => '31', - 'contact_id_b' => '33', - 'relationship_type_id' => '18', - 'start_date' => '2013-07-29 00:00:00', - 'end_date' => '2013-08-04 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - 'case_id' => '', - ), + 'id' => '1', + 'contact_id_a' => '31', + 'contact_id_b' => '33', + 'relationship_type_id' => '18', + 'start_date' => '2013-07-29 00:00:00', + 'end_date' => '2013-08-04 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + 'case_id' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testRelationshipCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testRelationshipCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Relationship/Delete.php b/api/v3/examples/Relationship/Delete.php index 21495601ac..a5e70535fe 100644 --- a/api/v3/examples/Relationship/Delete.php +++ b/api/v3/examples/Relationship/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('relationship', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using relationship delete API. + * + * + * @return array + * API result array + */ +function relationship_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('relationship', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_delete_expectedresult(){ +function relationship_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 'Deleted relationship successfully', -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 'Deleted relationship successfully', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testRelationshipDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testRelationshipDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Relationship/Get.php b/api/v3/examples/Relationship/Get.php index 0802c5a1f0..9165b6a33c 100644 --- a/api/v3/examples/Relationship/Get.php +++ b/api/v3/examples/Relationship/Get.php @@ -1,62 +1,78 @@ 1, -); -try{ - $result = civicrm_api3('relationship', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using relationship get API. + * + * + * @return array + * API result array + */ +function relationship_get_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('relationship', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_get_expectedresult(){ +function relationship_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id_a' => '47', - 'contact_id_b' => '49', - 'relationship_type_id' => '22', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - 'custom_1' => 'custom string', - 'custom_1_1' => 'custom string', - ), + 'id' => '1', + 'contact_id_a' => '47', + 'contact_id_b' => '49', + 'relationship_type_id' => '22', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + 'custom_1' => 'custom string', + 'custom_1_1' => 'custom string', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetWithCustom and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetWithCustom +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Relationship/INRelationshipType.php b/api/v3/examples/Relationship/INRelationshipType.php index ab995846e2..db712b5779 100644 --- a/api/v3/examples/Relationship/INRelationshipType.php +++ b/api/v3/examples/Relationship/INRelationshipType.php @@ -1,75 +1,92 @@ array( + +/** + * Test Generated example of using relationship get API. + * + * demonstrates use of IN filter + * + * @return array + * API result array + */ +function relationship_get_example() { + $params = array( + 'relationship_type_id' => array( 'IN' => array( - '0' => 33, - '1' => 34, - ), + '0' => 33, + '1' => 34, + ), ), -); + ); -try{ - $result = civicrm_api3('relationship', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('relationship', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_get_expectedresult(){ +function relationship_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'contact_id_a' => '87', - 'contact_id_b' => '89', - 'relationship_type_id' => '33', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '2', + 'contact_id_a' => '87', + 'contact_id_b' => '89', + 'relationship_type_id' => '33', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), '3' => array( - 'id' => '3', - 'contact_id_a' => '87', - 'contact_id_b' => '89', - 'relationship_type_id' => '34', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '3', + 'contact_id_a' => '87', + 'contact_id_b' => '89', + 'relationship_type_id' => '34', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetTypeOperators and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetTypeOperators +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Relationship/NotBetweenRelationshipType.php b/api/v3/examples/Relationship/NotBetweenRelationshipType.php index 2ac80828ed..fb837467aa 100644 --- a/api/v3/examples/Relationship/NotBetweenRelationshipType.php +++ b/api/v3/examples/Relationship/NotBetweenRelationshipType.php @@ -1,65 +1,82 @@ array( + +/** + * Test Generated example of using relationship get API. + * + * demonstrates use of Not BETWEEN filter + * + * @return array + * API result array + */ +function relationship_get_example() { + $params = array( + 'relationship_type_id' => array( 'NOT BETWEEN' => array( - '0' => 33, - '1' => 35, - ), + '0' => 33, + '1' => 35, + ), ), -); + ); -try{ - $result = civicrm_api3('relationship', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('relationship', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_get_expectedresult(){ +function relationship_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id_a' => '87', - 'contact_id_b' => '89', - 'relationship_type_id' => '32', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '1', + 'contact_id_a' => '87', + 'contact_id_b' => '89', + 'relationship_type_id' => '32', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetTypeOperators and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetTypeOperators +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Relationship/NotInRelationshipType.php b/api/v3/examples/Relationship/NotInRelationshipType.php index 716e6068ad..99e3ae461c 100644 --- a/api/v3/examples/Relationship/NotInRelationshipType.php +++ b/api/v3/examples/Relationship/NotInRelationshipType.php @@ -1,75 +1,92 @@ array( + +/** + * Test Generated example of using relationship get API. + * + * demonstrates use of NOT IN filter + * + * @return array + * API result array + */ +function relationship_get_example() { + $params = array( + 'relationship_type_id' => array( 'NOT IN' => array( - '0' => 33, - '1' => 34, - ), + '0' => 33, + '1' => 34, + ), ), -); + ); -try{ - $result = civicrm_api3('relationship', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('relationship', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_get_expectedresult(){ +function relationship_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id_a' => '87', - 'contact_id_b' => '89', - 'relationship_type_id' => '32', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '1', + 'contact_id_a' => '87', + 'contact_id_b' => '89', + 'relationship_type_id' => '32', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), '4' => array( - 'id' => '4', - 'contact_id_a' => '87', - 'contact_id_b' => '89', - 'relationship_type_id' => '35', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '4', + 'contact_id_a' => '87', + 'contact_id_b' => '89', + 'relationship_type_id' => '35', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetTypeOperators and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetTypeOperators +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Relationship/filterIsCurrent.php b/api/v3/examples/Relationship/filterIsCurrent.php index 7ba21e6575..8ee1ec860a 100644 --- a/api/v3/examples/Relationship/filterIsCurrent.php +++ b/api/v3/examples/Relationship/filterIsCurrent.php @@ -1,62 +1,79 @@ array( + +/** + * Test Generated example of using relationship get API. + * + * demonstrates is_current filter + * + * @return array + * API result array + */ +function relationship_get_example() { + $params = array( + 'filters' => array( 'is_current' => 1, ), -); + ); -try{ - $result = civicrm_api3('relationship', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('relationship', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_get_expectedresult(){ +function relationship_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'contact_id_a' => '83', - 'contact_id_b' => '85', - 'relationship_type_id' => '31', - 'start_date' => '2013-07-29 00:00:00', - 'is_active' => '1', - 'description' => '', - 'is_permission_a_b' => 0, - 'is_permission_b_a' => 0, - ), + 'id' => '2', + 'contact_id_a' => '83', + 'contact_id_b' => '85', + 'relationship_type_id' => '31', + 'start_date' => '2013-07-29 00:00:00', + 'is_active' => '1', + 'description' => '', + 'is_permission_a_b' => 0, + 'is_permission_b_a' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetIsCurrent and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetIsCurrent +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/RelationshipType/Create.php b/api/v3/examples/RelationshipType/Create.php index 5756dd46c6..b6ba39501d 100644 --- a/api/v3/examples/RelationshipType/Create.php +++ b/api/v3/examples/RelationshipType/Create.php @@ -1,69 +1,85 @@ 'Relation 1 for relationship type create', - 'name_b_a' => 'Relation 2 for relationship type create', - 'contact_type_a' => 'Individual', - 'contact_type_b' => 'Organization', - 'is_reserved' => 1, - 'is_active' => 1, - 'sequential' => 1, -); -try{ - $result = civicrm_api3('relationship_type', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using relationship_type create API. + * + * + * @return array + * API result array + */ +function relationship_type_create_example() { + $params = array( + 'name_a_b' => 'Relation 1 for relationship type create', + 'name_b_a' => 'Relation 2 for relationship type create', + 'contact_type_a' => 'Individual', + 'contact_type_b' => 'Organization', + 'is_reserved' => 1, + 'is_active' => 1, + 'sequential' => 1, + ); -return $result; + try{ + $result = civicrm_api3('relationship_type', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_type_create_expectedresult(){ +function relationship_type_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '0' => array( - 'id' => '1', - 'name_a_b' => 'Relation 1 for relationship type create', - 'label_a_b' => 'Relation 1 for relationship type create', - 'name_b_a' => 'Relation 2 for relationship type create', - 'label_b_a' => 'Relation 2 for relationship type create', - 'description' => '', - 'contact_type_a' => 'Individual', - 'contact_type_b' => 'Organization', - 'contact_sub_type_a' => '', - 'contact_sub_type_b' => '', - 'is_reserved' => '1', - 'is_active' => '1', - ), + 'id' => '1', + 'name_a_b' => 'Relation 1 for relationship type create', + 'label_a_b' => 'Relation 1 for relationship type create', + 'name_b_a' => 'Relation 2 for relationship type create', + 'label_b_a' => 'Relation 2 for relationship type create', + 'description' => '', + 'contact_type_a' => 'Individual', + 'contact_type_b' => 'Organization', + 'contact_sub_type_a' => '', + 'contact_sub_type_b' => '', + 'is_reserved' => '1', + 'is_active' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testRelationshipTypeCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testRelationshipTypeCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/RelationshipType/Delete.php b/api/v3/examples/RelationshipType/Delete.php index dd81f5cc01..609b87740c 100644 --- a/api/v3/examples/RelationshipType/Delete.php +++ b/api/v3/examples/RelationshipType/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('relationship_type', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using relationship_type delete API. + * + * + * @return array + * API result array + */ +function relationship_type_delete_example() { + $params = array( + 'id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('relationship_type', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function relationship_type_delete_expectedresult(){ +function relationship_type_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testRelationshipTypeDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testRelationshipTypeDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ReportTemplate/Getrows.php b/api/v3/examples/ReportTemplate/Getrows.php index b75584b9d6..f46d10c63e 100644 --- a/api/v3/examples/ReportTemplate/Getrows.php +++ b/api/v3/examples/ReportTemplate/Getrows.php @@ -1,69 +1,86 @@ 'contact/summary', - 'options' => array( + +/** + * Test Generated example of using report_template getrows API. + * + * Retrieve rows from a report template (optionally providing the instance_id) + * + * @return array + * API result array + */ +function report_template_getrows_example() { + $params = array( + 'report_id' => 'contact/summary', + 'options' => array( 'metadata' => array( - '0' => 'labels', - '1' => 'title', - ), + '0' => 'labels', + '1' => 'title', + ), ), -); + ); -try{ - $result = civicrm_api3('report_template', 'getrows', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('report_template', 'getrows', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function report_template_getrows_expectedresult(){ +function report_template_getrows_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '0' => array( - 'civicrm_contact_sort_name' => 'Default Organization', - 'civicrm_contact_id' => '1', - ), + 'civicrm_contact_sort_name' => 'Default Organization', + 'civicrm_contact_id' => '1', + ), '1' => array( - 'civicrm_contact_sort_name' => 'Second Domain', - 'civicrm_contact_id' => '2', - ), + 'civicrm_contact_sort_name' => 'Second Domain', + 'civicrm_contact_id' => '2', + ), ), - 'metadata' => array( + 'metadata' => array( 'title' => 'ERROR: Title is not Set', 'labels' => array( - 'civicrm_contact_sort_name' => 'Contact Name', - 'civicrm_contact_id' => 'Internal Contact ID', - ), + 'civicrm_contact_sort_name' => 'Contact Name', + 'civicrm_contact_id' => 'Internal Contact ID', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testReportTemplateGetRowsContactSummary and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testReportTemplateGetRowsContactSummary +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ReportTemplateTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/ReportTemplate/Getstatistics.php b/api/v3/examples/ReportTemplate/Getstatistics.php index 55f412f9a7..14ac786007 100644 --- a/api/v3/examples/ReportTemplate/Getstatistics.php +++ b/api/v3/examples/ReportTemplate/Getstatistics.php @@ -1,65 +1,72 @@ 'member/contributionDetail', -); -try{ - $result = civicrm_api3('report_template', 'getstatistics', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using report_template getstatistics API. + * + * Get Statistics from a report (note there isn't much data to get in the test DB :-( + * + * @return array + * API result array + */ +function report_template_getstatistics_example() { + $params = array( + 'report_id' => 'contribute/recur', + ); -return $result; + try{ + $result = civicrm_api3('report_template', 'getstatistics', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function report_template_getstatistics_expectedresult(){ +function report_template_getstatistics_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( 'counts' => array( - 'rowCount' => array( - 'title' => 'Row(s) Listed', - 'value' => 0, - ), - 'amount' => array( - 'title' => 'Total Amount', - 'value' => '', - 'type' => 2, - ), - 'avg' => array( - 'title' => 'Average', - 'value' => '', - 'type' => 2, - ), + 'rowCount' => array( + 'title' => 'Row(s) Listed', + 'value' => 0, ), + ), 'filters' => array(), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testReportTemplateGetStatisticsAllReports and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testReportTemplateGetStatisticsAllReports +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ReportTemplateTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/Create.php b/api/v3/examples/Setting/Create.php index 7c4c742e4e..c069f335da 100644 --- a/api/v3/examples/Setting/Create.php +++ b/api/v3/examples/Setting/Create.php @@ -1,53 +1,69 @@ 2, - 'uniq_email_per_site' => 1, -); -try{ - $result = civicrm_api3('setting', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting create API. + * + * + * @return array + * API result array + */ +function setting_create_example() { + $params = array( + 'domain_id' => 2, + 'uniq_email_per_site' => 1, + ); -return $result; + try{ + $result = civicrm_api3('setting', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_create_expectedresult(){ +function setting_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateSetting and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateSetting +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/CreateAllDomains.php b/api/v3/examples/Setting/CreateAllDomains.php index e1e3df2134..11c26b53e6 100644 --- a/api/v3/examples/Setting/CreateAllDomains.php +++ b/api/v3/examples/Setting/CreateAllDomains.php @@ -1,58 +1,75 @@ 'all', - 'uniq_email_per_site' => 1, -); -try{ - $result = civicrm_api3('setting', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting create API. + * + * shows setting a variable for all domains + * + * @return array + * API result array + */ +function setting_create_example() { + $params = array( + 'domain_id' => 'all', + 'uniq_email_per_site' => 1, + ); -return $result; + try{ + $result = civicrm_api3('setting', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_create_expectedresult(){ +function setting_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => array( '1' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), '2' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), '3' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateSettingMultipleDomains and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateSettingMultipleDomains +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/CreateSettingCurrentDomain.php b/api/v3/examples/Setting/CreateSettingCurrentDomain.php index 50771cf43f..47121bf6f4 100644 --- a/api/v3/examples/Setting/CreateSettingCurrentDomain.php +++ b/api/v3/examples/Setting/CreateSettingCurrentDomain.php @@ -1,52 +1,69 @@ 1, -); -try{ - $result = civicrm_api3('setting', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting create API. + * + * shows setting a variable for a current domain + * + * @return array + * API result array + */ +function setting_create_example() { + $params = array( + 'uniq_email_per_site' => 1, + ); -return $result; + try{ + $result = civicrm_api3('setting', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_create_expectedresult(){ +function setting_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateSetting and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateSetting +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/CreateSpecifiedDomains.php b/api/v3/examples/Setting/CreateSpecifiedDomains.php index cf69d0bd3e..d0c3c40128 100644 --- a/api/v3/examples/Setting/CreateSpecifiedDomains.php +++ b/api/v3/examples/Setting/CreateSpecifiedDomains.php @@ -1,58 +1,75 @@ array( + +/** + * Test Generated example of using setting create API. + * + * shows setting a variable for specified domains + * + * @return array + * API result array + */ +function setting_create_example() { + $params = array( + 'domain_id' => array( '0' => 1, '1' => 3, ), - 'uniq_email_per_site' => 0, -); + 'uniq_email_per_site' => 0, + ); -try{ - $result = civicrm_api3('setting', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('setting', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_create_expectedresult(){ +function setting_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '1' => array( - 'uniq_email_per_site' => 0, - ), + 'uniq_email_per_site' => 0, + ), '3' => array( - 'uniq_email_per_site' => 0, - ), + 'uniq_email_per_site' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateSettingMultipleDomains and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateSettingMultipleDomains +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/Get.php b/api/v3/examples/Setting/Get.php index 3a20440161..812b9c71e0 100644 --- a/api/v3/examples/Setting/Get.php +++ b/api/v3/examples/Setting/Get.php @@ -1,53 +1,69 @@ 2, - 'return' => 'uniq_email_per_site', -); -try{ - $result = civicrm_api3('setting', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting get API. + * + * + * @return array + * API result array + */ +function setting_get_example() { + $params = array( + 'domain_id' => 2, + 'return' => 'uniq_email_per_site', + ); -return $result; + try{ + $result = civicrm_api3('setting', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_get_expectedresult(){ +function setting_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetSetting and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetSetting +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/GetAllDomains.php b/api/v3/examples/Setting/GetAllDomains.php index 0a62bf56ed..311f2b42a8 100644 --- a/api/v3/examples/Setting/GetAllDomains.php +++ b/api/v3/examples/Setting/GetAllDomains.php @@ -1,58 +1,75 @@ 'all', - 'return' => 'uniq_email_per_site', -); -try{ - $result = civicrm_api3('setting', 'Get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting Get API. + * + * shows getting a variable for all domains + * + * @return array + * API result array + */ +function setting_get_example() { + $params = array( + 'domain_id' => 'all', + 'return' => 'uniq_email_per_site', + ); -return $result; + try{ + $result = civicrm_api3('setting', 'Get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_get_expectedresult(){ +function setting_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => array( '1' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), '2' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), '3' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateSettingMultipleDomains and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateSettingMultipleDomains +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/GetDefaults.php b/api/v3/examples/Setting/GetDefaults.php index 75c11cf9ea..689ff05e03 100644 --- a/api/v3/examples/Setting/GetDefaults.php +++ b/api/v3/examples/Setting/GetDefaults.php @@ -1,57 +1,74 @@ 'address_format', -); -try{ - $result = civicrm_api3('setting', 'getdefaults', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting getdefaults API. + * + * gets defaults setting a variable for a given domain - if no domain is set current is assumed + * + * @return array + * API result array + */ +function setting_getdefaults_example() { + $params = array( + 'name' => 'address_format', + ); -return $result; + try{ + $result = civicrm_api3('setting', 'getdefaults', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_getdefaults_expectedresult(){ +function setting_getdefaults_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'address_format' => '{contact.address_name} + 'address_format' => '{contact.address_name} {contact.street_address} {contact.supplemental_address_1} {contact.supplemental_address_2} {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', - ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetDefaults and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetDefaults +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/GetFields.php b/api/v3/examples/Setting/GetFields.php index c8d637a766..ab680d810f 100644 --- a/api/v3/examples/Setting/GetFields.php +++ b/api/v3/examples/Setting/GetFields.php @@ -1,1586 +1,1645 @@ getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting getfields API. + * + * Demonstrate return from getfields - see subfolder for variants + * + * @return array + * API result array + */ +function setting_getfields_example() { + $params = array(); -return $result; + try{ + $result = civicrm_api3('setting', 'getfields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_getfields_expectedresult(){ +function setting_getfields_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 89, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 91, + 'values' => array( 'address_standardization_provider' => array( - 'group_name' => 'Address Preferences', - 'group' => 'address', - 'name' => 'address_standardization_provider', - 'type' => 'String', - 'html_type' => 'Select', - 'default' => '', - 'add' => '4.1', - 'title' => 'Address Standardization Provider.', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => 'CiviCRM includes an optional plugin for interfacing with the United States Postal Services (USPS) Address Standardization web service. You must register to use the USPS service at https://www.usps.com/business/web-tools-apis/address-information.htm. If you are approved, they will provide you with a User ID and the URL for the service. Plugins for other address standardization services may be available from 3rd party developers. If installed, they will be included in the drop-down below. ', - ), + 'group_name' => 'Address Preferences', + 'group' => 'address', + 'name' => 'address_standardization_provider', + 'type' => 'String', + 'html_type' => 'Select', + 'default' => '', + 'add' => '4.1', + 'title' => 'Address Standardization Provider.', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => 'CiviCRM includes an optional plugin for interfacing with the United States Postal Services (USPS) Address Standardization web service. You must register to use the USPS service at https://www.usps.com/business/web-tools-apis/address-information.htm. If you are approved, they will provide you with a User ID and the URL for the service. Plugins for other address standardization services may be available from 3rd party developers. If installed, they will be included in the drop-down below. ', + ), 'address_standardization_userid' => array( - 'group_name' => 'Address Preferences', - 'group' => 'address', - 'name' => 'address_standardization_userid', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'title' => 'Web service user ID', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Address Preferences', + 'group' => 'address', + 'name' => 'address_standardization_userid', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'title' => 'Web service user ID', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'address_standardization_url' => array( - 'group_name' => 'Address Preferences', - 'group' => 'address', - 'name' => 'address_standardization_url', - 'type' => 'Text', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'title' => 'Web Service URL', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => 'Web Service URL', - 'validate_callback' => 'CRM_Utils_Rule::url', - ), + 'group_name' => 'Address Preferences', + 'group' => 'address', + 'name' => 'address_standardization_url', + 'type' => 'Text', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'title' => 'Web Service URL', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => 'Web Service URL', + 'validate_callback' => 'CRM_Utils_Rule::url', + ), 'tag_unconfirmed' => array( - 'group_name' => 'Campaign Preferences', - 'group' => 'campaign', - 'name' => 'tag_unconfirmed', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => 'Unconfirmed', - 'add' => '4.1', - 'title' => 'Tag for Unconfirmed Petition Signers', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', - ), + 'group_name' => 'Campaign Preferences', + 'group' => 'campaign', + 'name' => 'tag_unconfirmed', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => 'Unconfirmed', + 'add' => '4.1', + 'title' => 'Tag for Unconfirmed Petition Signers', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + ), 'petition_contacts' => array( - 'group_name' => 'Campaign Preferences', - 'group' => 'campaign', - 'name' => 'petition_contacts', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => 'Petition Contacts', - 'add' => '4.1', - 'title' => 'Petition Signers Group', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', - ), + 'group_name' => 'Campaign Preferences', + 'group' => 'campaign', + 'name' => 'petition_contacts', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => 'Petition Contacts', + 'add' => '4.1', + 'title' => 'Petition Signers Group', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + ), 'cvv_backoffice_required' => array( - 'group_name' => 'Contribute Preferences', - 'group' => 'contribute', - 'name' => 'cvv_backoffice_required', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => '1', - 'add' => '4.1', - 'title' => 'CVV required for backoffice?', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Is the CVV code required for back office credit card transactions', - 'help_text' => 'If set it back-office credit card transactions will required a cvv code. Leave as required unless you have a very strong reason to change', - ), + 'group_name' => 'Contribute Preferences', + 'group' => 'contribute', + 'name' => 'cvv_backoffice_required', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => '1', + 'add' => '4.1', + 'title' => 'CVV required for backoffice?', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Is the CVV code required for back office credit card transactions', + 'help_text' => 'If set it back-office credit card transactions will required a cvv code. Leave as required unless you have a very strong reason to change', + ), 'contact_view_options' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'contact_view_options', - 'type' => 'String', - 'html_type' => 'checkboxes', - 'pseudoconstant' => array( - 'optionGroupName' => 'contact_view_options', - ), - 'default' => array( - '0' => '1', - '1' => '2', - '2' => '3', - '3' => '4', - '4' => '5', - '5' => '6', - '6' => '7', - '7' => '8', - '8' => '9', - '9' => '10', - '10' => '11', - '11' => '13', - ), - 'add' => '4.1', - 'title' => 'Viewing Contacts', - 'is_domain' => '1', - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'contact_view_options', + 'type' => 'String', + 'html_type' => 'checkboxes', + 'pseudoconstant' => array( + 'optionGroupName' => 'contact_view_options', + ), + 'default' => array( + '0' => '1', + '1' => '2', + '2' => '3', + '3' => '4', + '4' => '5', + '5' => '6', + '6' => '7', + '7' => '8', + '8' => '9', + '9' => '10', + '10' => '11', + '11' => '13', + ), + 'add' => '4.1', + 'title' => 'Viewing Contacts', + 'is_domain' => '1', + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'contact_edit_options' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'contact_edit_options', - 'type' => 'String', - 'html_type' => 'checkboxes', - 'pseudoconstant' => array( - 'optionGroupName' => 'contact_edit_options', - ), - 'default' => array( - '0' => '1', - '1' => '2', - '2' => '3', - '3' => '4', - '4' => '5', - '5' => '6', - '6' => '7', - '7' => '8', - '8' => '9', - '9' => '10', - '10' => '11', - ), - 'add' => '4.1', - 'title' => 'Editing Contacts', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'contact_edit_options', + 'type' => 'String', + 'html_type' => 'checkboxes', + 'pseudoconstant' => array( + 'optionGroupName' => 'contact_edit_options', + ), + 'default' => array( + '0' => '1', + '1' => '2', + '2' => '3', + '3' => '4', + '4' => '5', + '5' => '6', + '6' => '7', + '7' => '8', + '8' => '9', + '9' => '10', + '10' => '11', + ), + 'add' => '4.1', + 'title' => 'Editing Contacts', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'advanced_search_options' => array( - 'group_name' => 'CiviCRM Preferences', - 'name' => 'advanced_search_options', - 'type' => 'String', - 'html_type' => 'checkboxes', - 'pseudoconstant' => array( - 'optionGroupName' => 'advanced_search_options', - ), - 'default' => array( - '0' => '1', - '1' => '2', - '2' => '3', - '3' => '4', - '4' => '5', - '5' => '6', - '6' => '7', - '7' => '8', - '8' => '9', - '9' => '10', - '10' => '12', - '11' => '13', - '12' => '15', - '13' => '16', - '14' => '17', - '15' => '18', - '16' => '19', - ), - 'add' => '4.1', - 'title' => 'Contact Search', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'name' => 'advanced_search_options', + 'type' => 'String', + 'html_type' => 'checkboxes', + 'pseudoconstant' => array( + 'optionGroupName' => 'advanced_search_options', + ), + 'default' => array( + '0' => '1', + '1' => '2', + '2' => '3', + '3' => '4', + '4' => '5', + '5' => '6', + '6' => '7', + '7' => '8', + '8' => '9', + '9' => '10', + '10' => '12', + '11' => '13', + '12' => '15', + '13' => '16', + '14' => '17', + '15' => '18', + '16' => '19', + ), + 'add' => '4.1', + 'title' => 'Contact Search', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'user_dashboard_options' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'user_dashboard_options', - 'type' => 'String', - 'html_type' => 'checkboxes', - 'pseudoconstant' => array( - 'optionGroupName' => 'user_dashboard_options', - ), - 'default' => array( - '0' => '1', - '1' => '2', - '2' => '3', - '3' => '4', - '4' => '5', - '5' => '7', - '6' => '8', - '7' => '9', - ), - 'add' => '4.1', - 'title' => 'Contact Dashboard', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'user_dashboard_options', + 'type' => 'String', + 'html_type' => 'checkboxes', + 'pseudoconstant' => array( + 'optionGroupName' => 'user_dashboard_options', + ), + 'default' => array( + '0' => '1', + '1' => '2', + '2' => '3', + '3' => '4', + '4' => '5', + '5' => '7', + '6' => '8', + '7' => '9', + ), + 'add' => '4.1', + 'title' => 'Contact Dashboard', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'address_options' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'address_options', - 'type' => 'String', - 'html_type' => 'Text', - 'pseudoconstant' => array( - 'optionGroupName' => 'address_options', - ), - 'default' => array( - '0' => '1', - '1' => '2', - '2' => '4', - '3' => '5', - '4' => '8', - '5' => '9', - '6' => '10', - '7' => '11', - ), - 'add' => '4.1', - 'title' => 'Addressing Options', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'address_options', + 'type' => 'String', + 'html_type' => 'Text', + 'pseudoconstant' => array( + 'optionGroupName' => 'address_options', + ), + 'default' => array( + '0' => '1', + '1' => '2', + '2' => '4', + '3' => '5', + '4' => '8', + '5' => '9', + '6' => '10', + '7' => '11', + ), + 'add' => '4.1', + 'title' => 'Addressing Options', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'address_format' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'address_format', - 'type' => 'String', - 'html_type' => 'TextArea', - 'default' => '{contact.address_name} + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'address_format', + 'type' => 'String', + 'html_type' => 'TextArea', + 'default' => '{contact.address_name} {contact.street_address} {contact.supplemental_address_1} {contact.supplemental_address_2} {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', - 'add' => '4.1', - 'title' => 'Address Format', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'add' => '4.1', + 'title' => 'Address Format', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'mailing_format' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'mailing_format', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => '{contact.addressee} + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'mailing_format', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => '{contact.addressee} {contact.street_address} {contact.supplemental_address_1} {contact.supplemental_address_2} {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', - 'add' => '4.1', - 'title' => 'Mailing Format', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'add' => '4.1', + 'title' => 'Mailing Format', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'display_name_format' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'display_name_format', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => '{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}', - 'add' => '4.1', - 'title' => 'Display Name Format', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'display_name_format', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => '{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}', + 'add' => '4.1', + 'title' => 'Display Name Format', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'sort_name_format' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'sort_name_format', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => '{contact.last_name}{, }{contact.first_name}', - 'add' => '4.1', - 'title' => 'Sort Name Format', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'sort_name_format', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => '{contact.last_name}{, }{contact.first_name}', + 'add' => '4.1', + 'title' => 'Sort Name Format', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'editor_id' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'editor_id', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'title' => 'Wysiwig Editor', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'editor_id', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'title' => 'Wysiwig Editor', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'contact_ajax_check_similar' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'contact_ajax_check_similar', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'title' => 'Ajax Check Similar', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'contact_ajax_check_similar', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'title' => 'Ajax Check Similar', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'ajaxPopupsEnabled' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'ajaxPopupsEnabled', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.5', - 'title' => 'Ajax Popups Enabled', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'ajaxPopupsEnabled', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'add' => '4.5', + 'title' => 'Ajax Popups Enabled', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'activity_assignee_notification' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'activity_assignee_notification', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'title' => 'Notify Activity Assignees', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'activity_assignee_notification', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'title' => 'Notify Activity Assignees', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'activity_assignee_notification_ics' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'activity_assignee_notification_ics', - 'type' => 'String', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.3', - 'title' => 'Include ICal Invite to Activity Assignees', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'activity_assignee_notification_ics', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.3', + 'title' => 'Include ICal Invite to Activity Assignees', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'contact_autocomplete_options' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'contact_autocomplete_options', - 'type' => 'String', - 'html_type' => 'checkboxes', - 'pseudoconstant' => array( - 'optionGroupName' => 'contact_autocomplete_options', - ), - 'default' => array( - '0' => '1', - '1' => '2', - '2' => '3', - '3' => '4', - '4' => '5', - '5' => '6', - '6' => '7', - ), - 'add' => '4.1', - 'title' => 'Contact Reference Autocomplete Options', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'contact_autocomplete_options', + 'type' => 'String', + 'html_type' => 'checkboxes', + 'pseudoconstant' => array( + 'optionGroupName' => 'contact_autocomplete_options', + ), + 'default' => array( + '0' => '1', + '1' => '2', + '2' => '3', + '3' => '4', + '4' => '5', + '5' => '6', + '6' => '7', + ), + 'add' => '4.1', + 'title' => 'Contact Reference Autocomplete Options', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'contact_reference_options' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'contact_reference_options', - 'type' => 'String', - 'html_type' => 'checkboxes', - 'pseudoconstant' => array( - 'optionGroupName' => 'contact_reference_options', - ), - 'default' => array( - '0' => '1', - '1' => '2', - '2' => '3', - '3' => '4', - '4' => '5', - '5' => '6', - '6' => '7', - ), - 'add' => '4.1', - 'title' => 'Contact Reference Options', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'contact_reference_options', + 'type' => 'String', + 'html_type' => 'checkboxes', + 'pseudoconstant' => array( + 'optionGroupName' => 'contact_reference_options', + ), + 'default' => array( + '0' => '1', + '1' => '2', + '2' => '3', + '3' => '4', + '4' => '5', + '5' => '6', + '6' => '7', + ), + 'add' => '4.1', + 'title' => 'Contact Reference Options', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'max_attachments' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'max_attachments', - 'legacy_key' => 'maxAttachments', - 'prefetch' => 0, - 'type' => 'Integer', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array( - 'size' => 2, - 'maxlength' => 8, - ), - 'default' => 3, - 'add' => '4.3', - 'title' => 'Maximum Attachments', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Maximum number of files (documents, images, etc.) which can attached to emails or activities.', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'max_attachments', + 'legacy_key' => 'maxAttachments', + 'prefetch' => 0, + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 2, + 'maxlength' => 8, + ), + 'default' => 3, + 'add' => '4.3', + 'title' => 'Maximum Attachments', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Maximum number of files (documents, images, etc.) which can attached to emails or activities.', + 'help_text' => '', + ), 'maxFileSize' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'maxFileSize', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'Integer', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array( - 'size' => 2, - 'maxlength' => 8, - ), - 'default' => 3, - 'add' => '4.3', - 'title' => 'Maximum File Size (in MB)', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Maximum Size of file (documents, images, etc.) which can attached to emails or activities.
Note: php.ini should support this file size.', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'maxFileSize', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 2, + 'maxlength' => 8, + ), + 'default' => 3, + 'add' => '4.3', + 'title' => 'Maximum File Size (in MB)', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Maximum Size of file (documents, images, etc.) which can attached to emails or activities.
Note: php.ini should support this file size.', + 'help_text' => '', + ), 'contact_undelete' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'contact_undelete', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.3', - 'title' => 'Contact Trash and Undelete', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If enabled, deleted contacts will be moved to trash (instead of being destroyed). Users with the proper permission are able to search for the deleted contacts and restore them (or delete permanently).', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'contact_undelete', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'add' => '4.3', + 'title' => 'Contact Trash and Undelete', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If enabled, deleted contacts will be moved to trash (instead of being destroyed). Users with the proper permission are able to search for the deleted contacts and restore them (or delete permanently).', + 'help_text' => '', + ), 'allowPermDeleteFinancial' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'allowPermDeleteFinancial', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => '', - 'add' => '4.3', - 'title' => 'Contact Permanent Delete', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Allow Permanent Delete for contacts who are linked to live financial transactions', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'allowPermDeleteFinancial', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => '', + 'add' => '4.3', + 'title' => 'Contact Permanent Delete', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Allow Permanent Delete for contacts who are linked to live financial transactions', + 'help_text' => '', + ), 'versionAlert' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'versionAlert', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.3', - 'title' => 'New Version Alerts', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Displays an on-screen alert to users with \"Administer CiviCRM\" permissions when a new version of CiviCRM is available. This setting will only work if the \"Version Check & Statistics Reporting\" setting is enabled.', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'versionAlert', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'select', + 'option_values' => array( + '0' => 'Disabled', + '1' => 'Display In Page Footer', + '2' => 'Display As Popup Alert', + '3' => 'Page Footer + Popup Alert', + ), + 'default' => 1, + 'add' => '4.3', + 'title' => 'New Version Alerts', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), + 'securityUpdateAlert' => array( + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'securityUpdateAlert', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'select', + 'option_values' => array( + '0' => 'Disabled', + '1' => 'Display In Page Footer', + '2' => 'Display As Popup Alert', + '3' => 'Page Footer + Popup Alert', + ), + 'default' => 3, + 'add' => '4.6', + 'title' => 'Security Update Alerts', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'versionCheck' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'versionCheck', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.3', - 'title' => 'Version Check & Statistics Reporting', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If enabled, CiviCRM automatically checks availablity of a newer version of the software. New version alerts will be displayed on the main CiviCRM Administration page. -When enabled, statistics about your CiviCRM installation are reported anonymously to the CiviCRM team to assist in prioritizing ongoing development efforts. The following information is gathered: CiviCRM version, versions of PHP, MySQL and framework (Drupal/Joomla/standalone), and default language. Counts (but no actual data) of the following record types are reported: contacts, activities, cases, relationships, contributions, contribution pages, contribution products, contribution widgets, discounts, price sets, profiles, events, participants, tell-a-friend pages, grants, mailings, memberships, membership blocks, pledges, pledge blocks and active payment processor types.', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'versionCheck', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'add' => '4.3', + 'title' => 'Automatically Check for Updates', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), + 'versionCheckIgnoreDate' => array( + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'versionCheckIgnoreDate', + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'placeholder' => 'YYYY-MM-DD', + ), + 'default' => '', + 'add' => '4.6', + 'title' => 'Ignore Updates Prior to', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'securityAlert' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'versionCheck', - 'prefetch' => 0, - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.4', - 'title' => 'Security Alerts', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If enabled, CiviCRM will automatically run checks for significant mis-configurations such as ineffective file protections.', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'securityAlert', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'add' => '4.4', + 'title' => 'Security Audits', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If enabled, CiviCRM will automatically run checks for significant mis-configurations such as ineffective file protections.', + 'help_text' => '', + ), 'doNotAttachPDFReceipt' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'doNotAttachPDFReceipt', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.3', - 'title' => 'Attach PDF copy to receipts', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If enabled, CiviCRM sends PDF receipt as an attachment during event signup or online contribution.', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'doNotAttachPDFReceipt', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'add' => '4.3', + 'title' => 'Attach PDF copy to receipts', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If enabled, CiviCRM sends PDF receipt as an attachment during event signup or online contribution.', + 'help_text' => '', + ), 'wkhtmltopdfPath' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'wkhtmltopdfPath', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 64, - 'maxlength' => 256, - ), - 'default' => '', - 'add' => '4.3', - 'title' => 'Path to wkhtmltopdf executable', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'wkhtmltopdfPath', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 64, + 'maxlength' => 256, + ), + 'default' => '', + 'add' => '4.3', + 'title' => 'Path to wkhtmltopdf executable', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'recaptchaPublicKey' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'recaptchaPublicKey', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 64, - 'maxlength' => 64, - ), - 'default' => '', - 'add' => '4.3', - 'title' => 'Recaptcha Public Key', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'recaptchaPublicKey', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 64, + 'maxlength' => 64, + ), + 'default' => '', + 'add' => '4.3', + 'title' => 'Recaptcha Public Key', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'recaptchaPrivateKey' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'recaptchaPrivateKey', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 64, - 'maxlength' => 64, - ), - 'default' => '', - 'add' => '4.3', - 'title' => 'Recaptcha Private Key', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'recaptchaPrivateKey', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 64, + 'maxlength' => 64, + ), + 'default' => '', + 'add' => '4.3', + 'title' => 'Recaptcha Private Key', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'dashboardCacheTimeout' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'dashboardCacheTimeout', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'Integer', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 3, - 'maxlength' => 5, - ), - 'default' => '', - 'add' => '4.3', - 'title' => 'Dashboard cache timeout', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'dashboardCacheTimeout', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 3, + 'maxlength' => 5, + ), + 'default' => '', + 'add' => '4.3', + 'title' => 'Dashboard cache timeout', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'checksumTimeout' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'checksumTimeout', - 'prefetch' => 1, - 'type' => 'Integer', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 2, - 'maxlength' => 8, - ), - 'default' => 7, - 'add' => '4.3', - 'title' => 'Checksum Lifespan', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'checksumTimeout', + 'prefetch' => 1, + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 2, + 'maxlength' => 8, + ), + 'default' => 7, + 'add' => '4.3', + 'title' => 'Checksum Lifespan', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'blogUrl' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'blogUrl', - 'prefetch' => 0, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 64, - 'maxlength' => 128, - ), - 'default' => '*default*', - 'add' => '4.3', - 'title' => 'Blog Feed URL', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Blog feed URL used by the blog dashlet', - 'help_text' => 'Use \"*default*\" for the system default or override with a custom URL', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'blogUrl', + 'prefetch' => 0, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 64, + 'maxlength' => 128, + ), + 'default' => '*default*', + 'add' => '4.3', + 'title' => 'Blog Feed URL', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Blog feed URL used by the blog dashlet', + 'help_text' => 'Use \"*default*\" for the system default or override with a custom URL', + ), 'communityMessagesUrl' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'communityMessagesUrl', - 'prefetch' => 0, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 64, - 'maxlength' => 128, - ), - 'default' => '*default*', - 'add' => '4.3', - 'title' => 'Community Messages URL', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Service providing CiviCRM community messages', - 'help_text' => 'Use \"*default*\" for the system default or override with a custom URL', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'communityMessagesUrl', + 'prefetch' => 0, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 64, + 'maxlength' => 128, + ), + 'default' => '*default*', + 'add' => '4.3', + 'title' => 'Community Messages URL', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Service providing CiviCRM community messages', + 'help_text' => 'Use \"*default*\" for the system default or override with a custom URL', + ), 'resCacheCode' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'resCacheCode', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 16, - 'maxlength' => 16, - ), - 'default' => '', - 'add' => '4.3', - 'title' => 'Resource Cache Code', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Code appended to resource URLs (JS/CSS) to coerce HTTP caching', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'resCacheCode', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 16, + 'maxlength' => 16, + ), + 'default' => '', + 'add' => '4.3', + 'title' => 'Resource Cache Code', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Code appended to resource URLs (JS/CSS) to coerce HTTP caching', + 'help_text' => '', + ), 'verifySSL' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'verifySSL', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.3', - 'title' => 'Verify SSL?', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If disabled, backend HTTPS services will allow unverified, insecure connections', - 'help_text' => 'Unless you are absolutely unable to configure your server to check the SSL certificate of the remote server you should leave this set to Yes', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'verifySSL', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'add' => '4.3', + 'title' => 'Verify SSL?', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If disabled, backend HTTPS services will allow unverified, insecure connections', + 'help_text' => 'Unless you are absolutely unable to configure your server to check the SSL certificate of the remote server you should leave this set to Yes', + ), 'wpBasePage' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'wpBasePage', - 'type' => 'String', - 'html_type' => 'text', - 'quick_form_type' => 'Element', - 'prefetch' => 1, - 'default' => '', - 'add' => '4.3', - 'title' => 'WordPress Base Page', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If set, CiviCRM will use this setting as the base url.', - 'help_text' => 'By default, CiviCRM will generate front-facing pages using the home page at http://wp/ as its base. If you want to use a different template for CiviCRM pages, set the path here.', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'wpBasePage', + 'type' => 'String', + 'html_type' => 'text', + 'quick_form_type' => 'Element', + 'prefetch' => 1, + 'default' => '', + 'add' => '4.3', + 'title' => 'WordPress Base Page', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If set, CiviCRM will use this setting as the base url.', + 'help_text' => 'By default, CiviCRM will generate front-facing pages using the home page at http://wp/ as its base. If you want to use a different template for CiviCRM pages, set the path here.', + ), 'secondDegRelPermissions' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'secondDegRelPermissions', - 'prefetch' => 1, - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 0, - 'add' => '4.3', - 'title' => 'Allow second-degree relationship permissions', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If enabled, contacts with the permission to edit a related contact will inherit that contact\'s permission to edit other related contacts', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'secondDegRelPermissions', + 'prefetch' => 1, + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.3', + 'title' => 'Allow second-degree relationship permissions', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If enabled, contacts with the permission to edit a related contact will inherit that contact\'s permission to edit other related contacts', + 'help_text' => '', + ), 'enable_components' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'enable_components', - 'type' => 'Array', - 'quick_form_type' => 'Element', - 'html_type' => 'advmultiselect', - 'html_attributes' => array( - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', - ), - 'default' => array( - '0' => 'CiviEvent', - '1' => 'CiviContribute', - '2' => 'CiviMember', - '3' => 'CiviMail', - '4' => 'CiviReport', - '5' => 'CiviPledge', - ), - 'add' => '4.4', - 'title' => 'Enable Components', - 'is_domain' => '1', - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - 'on_change' => array( - '0' => array( - '0' => 'CRM_Case_Info', - '1' => 'onToggleComponents', - ), - '1' => array( - '0' => 'CRM_Core_Component', - '1' => 'flushEnabledComponents', - ), - ), - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'enable_components', + 'type' => 'Array', + 'quick_form_type' => 'Element', + 'html_type' => 'advmultiselect', + 'html_attributes' => array( + 'size' => 5, + 'style' => 'width:150px', + 'class' => 'advmultiselect', + ), + 'default' => array( + '0' => 'CiviEvent', + '1' => 'CiviContribute', + '2' => 'CiviMember', + '3' => 'CiviMail', + '4' => 'CiviReport', + '5' => 'CiviPledge', + ), + 'add' => '4.4', + 'title' => 'Enable Components', + 'is_domain' => '1', + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + 'on_change' => array( + '0' => array( + '0' => 'CRM_Case_Info', + '1' => 'onToggleComponents', + ), + '1' => array( + '0' => 'CRM_Core_Component', + '1' => 'flushEnabledComponents', + ), + ), + ), 'disable_core_css' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'disable_core_css', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 0, - 'add' => '4.4', - 'title' => 'Disable CiviCRM css', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Prevent the stylesheet \"civicrm.css\" from being loaded.', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'disable_core_css', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.4', + 'title' => 'Disable CiviCRM css', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Prevent the stylesheet \"civicrm.css\" from being loaded.', + 'help_text' => '', + ), 'empoweredBy' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'empoweredBy', - 'prefetch' => 1, - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.5', - 'title' => 'Display \"empowered by CiviCRM\"', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'When enabled, \"empowered by CiviCRM\" is displayed at the bottom of public forms.', - 'help_text' => '', - ), + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'empoweredBy', + 'prefetch' => 1, + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'add' => '4.5', + 'title' => 'Display \"empowered by CiviCRM\"', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'When enabled, \"empowered by CiviCRM\" is displayed at the bottom of public forms.', + 'help_text' => '', + ), 'debug_enabled' => array( - 'group_name' => 'Developer Preferences', - 'group' => 'developer', - 'name' => 'debug_enabled', - 'config_key' => 'debug', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 0, - 'add' => '4.3', - 'title' => 'Enable Debugging', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Set this value to Yes if you want to use one of CiviCRM\'s debugging tools. This feature should NOT be enabled for production sites', - 'prefetch' => 1, - 'help_text' => 'Do not turn this on on production sites', - ), + 'group_name' => 'Developer Preferences', + 'group' => 'developer', + 'name' => 'debug_enabled', + 'config_key' => 'debug', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.3', + 'title' => 'Enable Debugging', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Set this value to Yes if you want to use one of CiviCRM\'s debugging tools. This feature should NOT be enabled for production sites', + 'prefetch' => 1, + 'help_text' => 'Do not turn this on on production sites', + ), 'userFrameworkLogging' => array( - 'group_name' => 'Developer Preferences', - 'group' => 'developer', - 'name' => 'userFrameworkLogging', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 0, - 'add' => '4.3', - 'title' => 'Enable Drupal Watchdog Logging', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Set this value to Yes if you want CiviCRM error/debugging messages to also appear in Drupal error logs', - 'prefetch' => 1, - 'help_text' => 'Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS\' error log. + 'group_name' => 'Developer Preferences', + 'group' => 'developer', + 'name' => 'userFrameworkLogging', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.3', + 'title' => 'Enable Drupal Watchdog Logging', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Set this value to Yes if you want CiviCRM error/debugging messages to also appear in Drupal error logs', + 'prefetch' => 1, + 'help_text' => 'Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS\' error log. In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal\'s watchdog enabled)', - ), + ), 'backtrace' => array( - 'group_name' => 'Developer Preferences', - 'group' => 'developer', - 'name' => 'backtrace', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 0, - 'add' => '4.3', - 'title' => 'Display Backtrace', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites', - 'prefetch' => 1, - ), + 'group_name' => 'Developer Preferences', + 'group' => 'developer', + 'name' => 'backtrace', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.3', + 'title' => 'Display Backtrace', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites', + 'prefetch' => 1, + ), 'fatalErrorTemplate' => array( - 'group_name' => 'Developer Preferences', - 'group' => 'developer', - 'name' => 'fatalErrorTemplate', - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'default' => 'CRM/common/fatal.tpl', - 'add' => '4.3', - 'title' => 'Fatal Error Template', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Enter the path and filename for a custom Smarty template if you want to define your own screen for displaying fatal errors.', - 'prefetch' => 1, - ), + 'group_name' => 'Developer Preferences', + 'group' => 'developer', + 'name' => 'fatalErrorTemplate', + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'default' => 'CRM/common/fatal.tpl', + 'add' => '4.3', + 'title' => 'Fatal Error Template', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Enter the path and filename for a custom Smarty template if you want to define your own screen for displaying fatal errors.', + 'prefetch' => 1, + ), 'fatalErrorHandler' => array( - 'group_name' => 'Developer Preferences', - 'group' => 'developer', - 'name' => 'fatalErrorHandler', - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'default' => '', - 'add' => '4.3', - 'title' => 'Fatal Error Handler', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Enter the path and class for a custom PHP error-handling function if you want to override built-in CiviCRM error handling for your site.', - 'prefetch' => 1, - ), + 'group_name' => 'Developer Preferences', + 'group' => 'developer', + 'name' => 'fatalErrorHandler', + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'default' => '', + 'add' => '4.3', + 'title' => 'Fatal Error Handler', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Enter the path and class for a custom PHP error-handling function if you want to override built-in CiviCRM error handling for your site.', + 'prefetch' => 1, + ), 'uploadDir' => array( - 'group_name' => 'Directory Preferences', - 'group' => 'directory', - 'name' => 'uploadDir', - 'type' => 'Url', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'title' => 'Upload Directory', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Directory Preferences', + 'group' => 'directory', + 'name' => 'uploadDir', + 'type' => 'Url', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'title' => 'Upload Directory', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'imageUploadDir' => array( - 'group_name' => 'Directory Preferences', - 'group' => 'directory', - 'name' => 'imageUploadDir', - 'type' => 'Url', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'title' => 'Image Directory', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Directory Preferences', + 'group' => 'directory', + 'name' => 'imageUploadDir', + 'type' => 'Url', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'title' => 'Image Directory', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'customFileUploadDir' => array( - 'group_name' => 'Directory Preferences', - 'group' => 'directory', - 'name' => 'customFileUploadDir', - 'type' => 'Url', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'title' => 'Custom Files Upload Directory', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Directory Preferences', + 'group' => 'directory', + 'name' => 'customFileUploadDir', + 'type' => 'Url', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'title' => 'Custom Files Upload Directory', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'customTemplateDir' => array( - 'group_name' => 'Directory Preferences', - 'group' => 'directory', - 'name' => 'customTemplateDir', - 'type' => 'Url', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'title' => 'Custom Template Directory', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Directory Preferences', + 'group' => 'directory', + 'name' => 'customTemplateDir', + 'type' => 'Url', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'title' => 'Custom Template Directory', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'customPHPPathDir' => array( - 'group_name' => 'Directory Preferences', - 'group' => 'directory', - 'name' => 'customPHPPathDir', - 'type' => 'Url', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'title' => 'Custom PHP Path', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Directory Preferences', + 'group' => 'directory', + 'name' => 'customPHPPathDir', + 'type' => 'Url', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'title' => 'Custom PHP Path', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'extensionsDir' => array( - 'group_name' => 'Directory Preferences', - 'group' => 'directory', - 'name' => 'extensionsDir', - 'type' => 'Url', - 'html_type' => 'Text', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'title' => 'Extensions Directory', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Directory Preferences', + 'group' => 'directory', + 'name' => 'extensionsDir', + 'type' => 'Url', + 'html_type' => 'Text', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'title' => 'Extensions Directory', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'event_enable_cart' => array( - 'name' => 'enable_cart', - 'group_name' => 'Event Preferences', - 'group' => 'event', - 'type' => 'String', - 'quick_form_type' => 'Element', - 'default' => 0, - 'add' => '4.1', - 'title' => 'Enable Event Cart', - 'is_domain' => 1, - 'is_contact' => 1, - 'description' => 'WRITE ME', - 'help_text' => 'WRITE ME', - ), + 'name' => 'enable_cart', + 'group_name' => 'Event Preferences', + 'group' => 'event', + 'type' => 'String', + 'quick_form_type' => 'Element', + 'default' => 0, + 'add' => '4.1', + 'title' => 'Enable Event Cart', + 'is_domain' => 1, + 'is_contact' => 1, + 'description' => 'WRITE ME', + 'help_text' => 'WRITE ME', + ), 'monetaryThousandSeparator' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'monetaryThousandSeparator', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array( - 'size' => 2, - ), - 'default' => ',', - 'add' => '4.3', - 'title' => 'Thousands Separator', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'monetaryThousandSeparator', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 2, + ), + 'default' => ',', + 'add' => '4.3', + 'title' => 'Thousands Separator', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'monetaryDecimalPoint' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'monetaryDecimalPoint', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array( - 'size' => 2, - ), - 'default' => '.', - 'add' => '4.3', - 'title' => 'Decimal Delimiter', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'monetaryDecimalPoint', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 2, + ), + 'default' => '.', + 'add' => '4.3', + 'title' => 'Decimal Delimiter', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'moneyformat' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'moneyformat', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'default' => '%c %a', - 'add' => '4.3', - 'title' => 'Monetary Amount Display', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'moneyformat', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'default' => '%c %a', + 'add' => '4.3', + 'title' => 'Monetary Amount Display', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'moneyvalueformat' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'moneyvalueformat', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'default' => '%!i', - 'add' => '4.3', - 'title' => 'Monetary Amount Display', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'moneyvalueformat', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'default' => '%!i', + 'add' => '4.3', + 'title' => 'Monetary Amount Display', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'defaultCurrency' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'defaultCurrency', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array( - 'size' => 2, - ), - 'default' => 'USD', - 'add' => '4.3', - 'title' => 'Default Currency', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Default currency assigned to contributions and other monetary transactions.', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'defaultCurrency', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 2, + ), + 'default' => 'USD', + 'add' => '4.3', + 'title' => 'Default Currency', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Default currency assigned to contributions and other monetary transactions.', + 'help_text' => '', + ), 'defaultContactCountry' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'defaultContactCountry', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array( - 'size' => 4, - ), - 'default' => '1228', - 'add' => '4.4', - 'title' => 'Default Country', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'This value is selected by default when adding a new contact address.', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'defaultContactCountry', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 4, + ), + 'default' => '1228', + 'add' => '4.4', + 'title' => 'Default Country', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'This value is selected by default when adding a new contact address.', + 'help_text' => '', + ), 'countryLimit' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'countryLimit', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'Array', - 'quick_form_type' => 'Element', - 'html_type' => 'advmultiselect', - 'html_attributes' => array( - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', - ), - 'default' => 'null', - 'add' => '4.3', - 'title' => 'Available Countries', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'countryLimit', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'Array', + 'quick_form_type' => 'Element', + 'html_type' => 'advmultiselect', + 'html_attributes' => array( + 'size' => 5, + 'style' => 'width:150px', + 'class' => 'advmultiselect', + ), + 'default' => 'null', + 'add' => '4.3', + 'title' => 'Available Countries', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'provinceLimit' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'provinceLimit', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'Array', - 'quick_form_type' => 'Element', - 'html_type' => 'advmultiselect', - 'html_attributes' => array( - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', - ), - 'default' => 'null', - 'add' => '4.3', - 'title' => 'Available States and Provinces', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'provinceLimit', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'Array', + 'quick_form_type' => 'Element', + 'html_type' => 'advmultiselect', + 'html_attributes' => array( + 'size' => 5, + 'style' => 'width:150px', + 'class' => 'advmultiselect', + ), + 'default' => 'null', + 'add' => '4.3', + 'title' => 'Available States and Provinces', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'inheritLocale' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'inheritLocale', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 0, - 'add' => '4.3', - 'title' => 'Inherit CMS Language', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'inheritLocale', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.3', + 'title' => 'Inherit CMS Language', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'dateformatDatetime' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'dateformatDatetime', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'default' => '%B %E%f, %Y %l:%M %P', - 'add' => '4.3', - 'title' => 'Complete Date and Time', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'dateformatDatetime', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'default' => '%B %E%f, %Y %l:%M %P', + 'add' => '4.3', + 'title' => 'Complete Date and Time', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'dateformatFull' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'dateformatFull', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'default' => '%B %E%f, %Y', - 'add' => '4.3', - 'title' => 'Complete Date', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'dateformatFull', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'default' => '%B %E%f, %Y', + 'add' => '4.3', + 'title' => 'Complete Date', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'dateformatPartial' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'dateformatPartial', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'default' => '%B %Y', - 'add' => '4.3', - 'title' => 'Month and Year', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'dateformatPartial', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'default' => '%B %Y', + 'add' => '4.3', + 'title' => 'Month and Year', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'lcMessages' => array( - 'group_name' => 'Localization Preferences', - 'group' => 'localization', - 'name' => 'lcMessages', - 'prefetch' => 1, - 'config_only' => 1, - 'type' => 'String', - 'default' => 'en_US', - 'add' => '4.3', - 'title' => 'Default Language', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'lcMessages', + 'prefetch' => 1, + 'config_only' => 1, + 'type' => 'String', + 'default' => 'en_US', + 'add' => '4.3', + 'title' => 'Default Language', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'profile_double_optin' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'profile_double_optin', - 'type' => 'Integer', - 'html_type' => 'checkbox', - 'default' => 0, - 'add' => '4.1', - 'title' => 'Enable Double Opt-in for Profile Group(s) field', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', - 'help_text' => '', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'profile_double_optin', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.1', + 'title' => 'Enable Double Opt-in for Profile Group(s) field', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'help_text' => '', + ), 'track_civimail_replies' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'track_civimail_replies', - 'type' => 'Integer', - 'html_type' => 'checkbox', - 'default' => 0, - 'add' => '4.1', - 'title' => 'Enable Double Opt-in for Profile Group(s) field', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', - 'help_text' => '', - 'validate_callback' => 'CRM_Core_BAO_Setting::validateBoolSetting', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'track_civimail_replies', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.1', + 'title' => 'Enable Double Opt-in for Profile Group(s) field', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'help_text' => '', + 'validate_callback' => 'CRM_Core_BAO_Setting::validateBoolSetting', + ), 'civimail_workflow' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'civimail_workflow', - 'type' => 'Integer', - 'html_type' => 'checkbox', - 'default' => 0, - 'add' => '4.1', - 'title' => 'Use CiviMail Workflow', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', - 'help_text' => '', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'civimail_workflow', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.1', + 'title' => 'Use CiviMail Workflow', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'help_text' => '', + ), 'civimail_server_wide_lock' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'civimail_server_wide_lock', - 'type' => 'Integer', - 'html_type' => 'checkbox', - 'default' => 0, - 'add' => '4.1', - 'title' => 'Lock Mails Server-Wide for Mail Sending', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'civimail_server_wide_lock', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.1', + 'title' => 'Lock Mails Server-Wide for Mail Sending', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'mailing_backend' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'mailing_backend', - 'type' => 'Array', - 'html_type' => 'checkbox', - 'default' => 0, - 'add' => '4.1', - 'title' => 'Mailing Backend', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'mailing_backend', + 'type' => 'Array', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.1', + 'title' => 'Mailing Backend', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'profile_add_to_group_double_optin' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'profile_add_to_group_double_optin', - 'type' => 'Integer', - 'html_type' => 'checkbox', - 'default' => 0, - 'add' => '4.1', - 'title' => 'Enable Double Opt-in for Profile Group(s) field', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', - 'help_text' => '', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'profile_add_to_group_double_optin', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.1', + 'title' => 'Enable Double Opt-in for Profile Group(s) field', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'help_text' => '', + ), 'disable_mandatory_tokens_check' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'disable_mandatory_tokens_check', - 'type' => 'Integer', - 'html_type' => 'checkbox', - 'default' => 0, - 'add' => '4.4', - 'title' => 'Disable check for mandatory tokens', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.', - 'help_text' => '', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'disable_mandatory_tokens_check', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.4', + 'title' => 'Disable check for mandatory tokens', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.', + 'help_text' => '', + ), 'dedupe_email_default' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'dedupe_email_default', - 'type' => 'Integer', - 'html_type' => 'checkbox', - 'default' => 1, - 'add' => '4.5', - 'title' => 'CiviMail dedupes e-mail addresses by default', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Set the \"dedupe e-mail\" option when sending a new mailing to \"true\" by default.', - 'help_text' => '', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'dedupe_email_default', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 1, + 'add' => '4.5', + 'title' => 'CiviMail dedupes e-mail addresses by default', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Set the \"dedupe e-mail\" option when sending a new mailing to \"true\" by default.', + 'help_text' => '', + ), 'hash_mailing_url' => array( - 'group_name' => 'Mailing Preferences', - 'group' => 'mailing', - 'name' => 'hash_mailing_url', - 'type' => 'Integer', - 'html_type' => 'checkbox', - 'default' => 0, - 'add' => '4.5', - 'title' => 'Hashed Mailing URL\'s', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If enabled, a randomized hash key will be used to reference the mailing URL in the mailing.viewUrl token, instead of the mailing ID', - 'help_text' => '', - ), + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'hash_mailing_url', + 'type' => 'Integer', + 'html_type' => 'checkbox', + 'default' => 0, + 'add' => '4.5', + 'title' => 'Hashed Mailing URL\'s', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If enabled, a randomized hash key will be used to reference the mailing URL in the mailing.viewUrl token, instead of the mailing ID', + 'help_text' => '', + ), 'default_renewal_contribution_page' => array( - 'group_name' => 'Member Preferences', - 'group' => 'member', - 'name' => 'default_renewal_contribution_page', - 'type' => 'Integer', - 'html_type' => 'Select', - 'default' => '', - 'pseudoconstant' => array( - 'name' => 'contributionPage', - ), - 'add' => '4.1', - 'title' => 'Default online membership renewal page', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'If you select a default online contribution page for self-service membership renewals, a \"renew\" link pointing to that page will be displayed on the Contact Dashboard for memberships which were entered offline. You will need to ensure that the membership block for the selected online contribution page includes any currently available memberships.', - 'help_text' => '', - ), + 'group_name' => 'Member Preferences', + 'group' => 'member', + 'name' => 'default_renewal_contribution_page', + 'type' => 'Integer', + 'html_type' => 'Select', + 'default' => '', + 'pseudoconstant' => array( + 'name' => 'contributionPage', + ), + 'add' => '4.1', + 'title' => 'Default online membership renewal page', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'If you select a default online contribution page for self-service membership renewals, a \"renew\" link pointing to that page will be displayed on the Contact Dashboard for memberships which were entered offline. You will need to ensure that the membership block for the selected online contribution page includes any currently available memberships.', + 'help_text' => '', + ), 'is_enabled' => array( - 'group_name' => 'Multi Site Preferences', - 'group' => 'multisite', - 'name' => 'is_enabled', - 'title' => 'Multisite Is enabled', - 'type' => 'Integer', - 'default' => '', - 'add' => '4.1', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Multisite is enabled', - 'help_text' => '', - ), + 'group_name' => 'Multi Site Preferences', + 'group' => 'multisite', + 'name' => 'is_enabled', + 'title' => 'Multisite Is enabled', + 'type' => 'Integer', + 'default' => '', + 'add' => '4.1', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Multisite is enabled', + 'help_text' => '', + ), 'domain_group_id' => array( - 'group_name' => 'Multi Site Preferences', - 'group' => 'multisite', - 'name' => 'domain_group_id', - 'title' => 'Multisite Domain Group', - 'type' => 'Integer', - 'default' => '', - 'add' => '4.1', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Multi Site Preferences', + 'group' => 'multisite', + 'name' => 'domain_group_id', + 'title' => 'Multisite Domain Group', + 'type' => 'Integer', + 'default' => '', + 'add' => '4.1', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'event_price_set_domain_id' => array( - 'group_name' => 'Multi Site Preferences', - 'group' => 'multisite', - 'name' => 'event_price_set_domain_id', - 'title' => 'Domain Event Price Set', - 'type' => 'Integer', - 'default' => '', - 'add' => '4.1', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Multi Site Preferences', + 'group' => 'multisite', + 'name' => 'event_price_set_domain_id', + 'title' => 'Domain Event Price Set', + 'type' => 'Integer', + 'default' => '', + 'add' => '4.1', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'uniq_email_per_site' => array( - 'group_name' => 'Multi Site Preferences', - 'group' => 'multisite', - 'name' => 'uniq_email_per_site', - 'type' => 'Integer', - 'title' => 'Unique Email per Domain?', - 'default' => '', - 'add' => '4.1', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Multi Site Preferences', + 'group' => 'multisite', + 'name' => 'uniq_email_per_site', + 'type' => 'Integer', + 'title' => 'Unique Email per Domain?', + 'default' => '', + 'add' => '4.1', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'search_autocomplete_count' => array( - 'group_name' => 'Search Preferences', - 'group' => 'Search Preferences', - 'name' => 'search_autocomplete_count', - 'prefetch' => 0, - 'type' => 'Integer', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array( - 'size' => 2, - 'maxlength' => 2, - ), - 'default' => 10, - 'add' => '4.3', - 'title' => 'Autocomplete Results', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'The maximum number of contacts to show at a time when typing in an autocomplete field.', - 'help_text' => '', - ), + 'group_name' => 'Search Preferences', + 'group' => 'Search Preferences', + 'name' => 'search_autocomplete_count', + 'prefetch' => 0, + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => 2, + 'maxlength' => 2, + ), + 'default' => 10, + 'add' => '4.3', + 'title' => 'Autocomplete Results', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'The maximum number of contacts to show at a time when typing in an autocomplete field.', + 'help_text' => '', + ), 'enable_innodb_fts' => array( - 'group_name' => 'Search Preferences', - 'group' => 'Search Preferences', - 'name' => 'enable_innodb_fts', - 'prefetch' => 0, - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 0, - 'add' => '4.4', - 'title' => 'InnoDB Full Text Search', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Enable InnoDB full-text search optimizations. (Requires MySQL 5.6+)', - 'help_text' => '', - 'on_change' => array( - '0' => array( - '0' => 'CRM_Core_InnoDBIndexer', - '1' => 'onToggleFts', - ), - ), - ), + 'group_name' => 'Search Preferences', + 'group' => 'Search Preferences', + 'name' => 'enable_innodb_fts', + 'prefetch' => 0, + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 0, + 'add' => '4.4', + 'title' => 'InnoDB Full Text Search', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Enable InnoDB full-text search optimizations. (Requires MySQL 5.6+)', + 'help_text' => '', + 'on_change' => array( + '0' => array( + '0' => 'CRM_Core_InnoDBIndexer', + '1' => 'onToggleFts', + ), + ), + ), 'fts_query_mode' => array( - 'group_name' => 'Search Preferences', - 'group' => 'Search Preferences', - 'name' => 'fts_query_mode', - 'prefetch' => 0, - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'Text', - 'html_attributes' => array( - 'size' => 64, - 'maxlength' => 64, - ), - 'default' => 'simple', - 'add' => '4.5', - 'title' => 'How to handle full-tet queries', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), + 'group_name' => 'Search Preferences', + 'group' => 'Search Preferences', + 'name' => 'fts_query_mode', + 'prefetch' => 0, + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'Text', + 'html_attributes' => array( + 'size' => 64, + 'maxlength' => 64, + ), + 'default' => 'simple', + 'add' => '4.5', + 'title' => 'How to handle full-tet queries', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => '', + ), 'userFrameworkResourceURL' => array( - 'group' => 'url', - 'group_name' => 'URL Preferences', - 'name' => 'userFrameworkResourceURL', - 'title' => 'Script and CSS Resources URL', - 'type' => 'String', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'CiviCRM Resource URL', - 'help_text' => '', - 'validate_callback' => 'CRM_Utils_Rule::url', - ), + 'group' => 'url', + 'group_name' => 'URL Preferences', + 'name' => 'userFrameworkResourceURL', + 'title' => 'Script and CSS Resources URL', + 'type' => 'String', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'CiviCRM Resource URL', + 'help_text' => '', + 'validate_callback' => 'CRM_Utils_Rule::url', + ), 'imageUploadURL' => array( - 'group' => 'url', - 'group_name' => 'URL Preferences', - 'title' => 'Image URL Prefix', - 'name' => 'imageUploadURL', - 'type' => 'String', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Image Upload URL', - 'help_text' => '', - 'validate_callback' => 'CRM_Utils_Rule::url', - ), + 'group' => 'url', + 'group_name' => 'URL Preferences', + 'title' => 'Image URL Prefix', + 'name' => 'imageUploadURL', + 'type' => 'String', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Image Upload URL', + 'help_text' => '', + 'validate_callback' => 'CRM_Utils_Rule::url', + ), 'customCSSURL' => array( - 'group' => 'url', - 'group_name' => 'URL Preferences', - 'name' => 'customCSSURL', - 'title' => 'Custom CSS', - 'type' => 'String', - 'default' => '', - 'add' => '4.1', - 'prefetch' => 1, - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => 'Custom CiviCRM CSS URL', - 'help_text' => '', - 'validate_callback' => 'CRM_Utils_Rule::url', - ), + 'group' => 'url', + 'group_name' => 'URL Preferences', + 'name' => 'customCSSURL', + 'title' => 'Custom CSS', + 'type' => 'String', + 'default' => '', + 'add' => '4.1', + 'prefetch' => 1, + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Custom CiviCRM CSS URL', + 'help_text' => '', + 'validate_callback' => 'CRM_Utils_Rule::url', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetFields and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetFields +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/GetSettingCurrentDomain.php b/api/v3/examples/Setting/GetSettingCurrentDomain.php index 20317b13b1..9761496877 100644 --- a/api/v3/examples/Setting/GetSettingCurrentDomain.php +++ b/api/v3/examples/Setting/GetSettingCurrentDomain.php @@ -1,52 +1,69 @@ 'uniq_email_per_site', -); -try{ - $result = civicrm_api3('setting', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting get API. + * + * shows getting a variable for a current domain + * + * @return array + * API result array + */ +function setting_get_example() { + $params = array( + 'return' => 'uniq_email_per_site', + ); -return $result; + try{ + $result = civicrm_api3('setting', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_get_expectedresult(){ +function setting_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'uniq_email_per_site' => 0, - ), + 'uniq_email_per_site' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetSetting and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetSetting +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/GetSpecifiedDomains.php b/api/v3/examples/Setting/GetSpecifiedDomains.php index b112c5bb88..b4120c781f 100644 --- a/api/v3/examples/Setting/GetSpecifiedDomains.php +++ b/api/v3/examples/Setting/GetSpecifiedDomains.php @@ -1,60 +1,77 @@ array( + +/** + * Test Generated example of using setting Get API. + * + * shows getting a variable for specified domains + * + * @return array + * API result array + */ +function setting_get_example() { + $params = array( + 'domain_id' => array( '0' => 1, '1' => 2, ), - 'return' => array( + 'return' => array( '0' => 'uniq_email_per_site', ), -); + ); -try{ - $result = civicrm_api3('setting', 'Get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('setting', 'Get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_get_expectedresult(){ +function setting_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => array( '1' => array( - 'uniq_email_per_site' => 0, - ), + 'uniq_email_per_site' => 0, + ), '2' => array( - 'uniq_email_per_site' => '1', - ), + 'uniq_email_per_site' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateSettingMultipleDomains and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateSettingMultipleDomains +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/GetValue.php b/api/v3/examples/Setting/GetValue.php index 03c06fe56f..7b1d4b8b49 100644 --- a/api/v3/examples/Setting/GetValue.php +++ b/api/v3/examples/Setting/GetValue.php @@ -1,43 +1,60 @@ 'petition_contacts', - 'group' => 'Campaign Preferences', -); -try{ - $result = civicrm_api3('setting', 'getvalue', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting getvalue API. + * + * Demonstrates getvalue action - intended for runtime use as better caching than get + * + * @return array + * API result array + */ +function setting_getvalue_example() { + $params = array( + 'name' => 'petition_contacts', + 'group' => 'Campaign Preferences', + ); -return $result; + try{ + $result = civicrm_api3('setting', 'getvalue', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_getvalue_expectedresult(){ +function setting_getvalue_expectedresult() { $expectedResult = 'Petition Contacts'; return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetValue and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetValue +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Setting/Revert.php b/api/v3/examples/Setting/Revert.php index 19e4bd7ff6..88e773843c 100644 --- a/api/v3/examples/Setting/Revert.php +++ b/api/v3/examples/Setting/Revert.php @@ -1,63 +1,80 @@ 'address_format', -); -try{ - $result = civicrm_api3('setting', 'revert', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using setting revert API. + * + * Demonstrates reverting a parameter to default value + * + * @return array + * API result array + */ +function setting_revert_example() { + $params = array( + 'name' => 'address_format', + ); -return $result; + try{ + $result = civicrm_api3('setting', 'revert', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function setting_revert_expectedresult(){ +function setting_revert_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 5, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 5, + 'id' => 1, + 'values' => array( 'is_error' => 0, 'version' => 3, 'count' => 1, 'id' => 1, 'values' => array( - '1' => array( - 'address_format' => '{contact.address_name} + '1' => array( + 'address_format' => '{contact.address_name} {contact.street_address} {contact.supplemental_address_1} {contact.supplemental_address_2} {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', - ), ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testRevert and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testRevert +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Survey/ChainedGetDelete.php b/api/v3/examples/Survey/ChainedGetDelete.php index 6ef6402f30..7bf2738db0 100644 --- a/api/v3/examples/Survey/ChainedGetDelete.php +++ b/api/v3/examples/Survey/ChainedGetDelete.php @@ -1,68 +1,85 @@ 'survey title', - 'api.survey.delete' => 1, -); -try{ - $result = civicrm_api3('survey', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using survey get API. + * + * demonstrates get + delete in the same call + * + * @return array + * API result array + */ +function survey_get_example() { + $params = array( + 'title' => 'survey title', + 'api.survey.delete' => 1, + ); -return $result; + try{ + $result = civicrm_api3('survey', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function survey_get_expectedresult(){ +function survey_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'title' => 'survey title', - 'activity_type_id' => '30', - 'instructions' => 'Call people, ask for money', - 'max_number_of_contacts' => '12', - 'is_active' => '1', - 'is_default' => 0, - 'created_date' => '2013-07-28 08:49:19', - 'bypass_confirm' => 0, - 'is_share' => '1', - 'api.survey.delete' => array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 4, + 'values' => array( + '4' => array( + 'id' => '4', + 'title' => 'survey title', + 'activity_type_id' => '30', + 'instructions' => 'Call people, ask for money', + 'max_number_of_contacts' => '12', + 'is_active' => '1', + 'is_default' => 0, + 'created_date' => '2013-07-28 08:49:19', + 'bypass_confirm' => 0, + 'is_share' => '1', + 'api.survey.delete' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetSurveyChainDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetSurveyChainDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Survey/Create.php b/api/v3/examples/Survey/Create.php index e0fc59ce8c..8d9911a860 100644 --- a/api/v3/examples/Survey/Create.php +++ b/api/v3/examples/Survey/Create.php @@ -1,74 +1,90 @@ 'survey title', - 'activity_type_id' => '30', - 'max_number_of_contacts' => 12, - 'instructions' => 'Call people, ask for money', -); -try{ - $result = civicrm_api3('survey', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using survey create API. + * + * + * @return array + * API result array + */ +function survey_create_example() { + $params = array( + 'title' => 'survey title', + 'activity_type_id' => '30', + 'max_number_of_contacts' => 12, + 'instructions' => 'Call people, ask for money', + ); -return $result; + try{ + $result = civicrm_api3('survey', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function survey_create_expectedresult(){ +function survey_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'title' => 'survey title', - 'campaign_id' => '', - 'activity_type_id' => '30', - 'recontact_interval' => '', - 'instructions' => 'Call people, ask for money', - 'release_frequency' => '', - 'max_number_of_contacts' => '12', - 'default_number_of_contacts' => '', - 'is_active' => '', - 'is_default' => '', - 'created_id' => '', - 'created_date' => '2013-07-28 08:49:19', - 'last_modified_id' => '', - 'last_modified_date' => '', - 'result_id' => '', - 'bypass_confirm' => '', - 'thankyou_title' => '', - 'thankyou_text' => '', - 'is_share' => '', - ), + 'id' => '1', + 'title' => 'survey title', + 'campaign_id' => '', + 'activity_type_id' => '30', + 'recontact_interval' => '', + 'instructions' => 'Call people, ask for money', + 'release_frequency' => '', + 'max_number_of_contacts' => '12', + 'default_number_of_contacts' => '', + 'is_active' => '', + 'is_default' => '', + 'created_id' => '', + 'created_date' => '2013-07-28 08:49:19', + 'last_modified_id' => '', + 'last_modified_date' => '', + 'result_id' => '', + 'bypass_confirm' => '', + 'thankyou_title' => '', + 'thankyou_text' => '', + 'is_share' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateSurvey and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateSurvey +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Survey/Delete.php b/api/v3/examples/Survey/Delete.php index 39e1fd2887..aad7c169c7 100644 --- a/api/v3/examples/Survey/Delete.php +++ b/api/v3/examples/Survey/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('survey', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using survey delete API. + * + * + * @return array + * API result array + */ +function survey_delete_example() { + $params = array( + 'id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('survey', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function survey_delete_expectedresult(){ +function survey_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteSurvey and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteSurvey +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Survey/Get.php b/api/v3/examples/Survey/Get.php index 40f79b4071..5805d2408a 100644 --- a/api/v3/examples/Survey/Get.php +++ b/api/v3/examples/Survey/Get.php @@ -1,64 +1,80 @@ 'survey title', - 'activity_type_id' => '30', - 'max_number_of_contacts' => 12, - 'instructions' => 'Call people, ask for money', -); -try{ - $result = civicrm_api3('survey', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using survey get API. + * + * + * @return array + * API result array + */ +function survey_get_example() { + $params = array( + 'title' => 'survey title', + 'activity_type_id' => '30', + 'max_number_of_contacts' => 12, + 'instructions' => 'Call people, ask for money', + ); -return $result; + try{ + $result = civicrm_api3('survey', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function survey_get_expectedresult(){ +function survey_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'title' => 'survey title', - 'activity_type_id' => '30', - 'instructions' => 'Call people, ask for money', - 'max_number_of_contacts' => '12', - 'is_active' => '1', - 'is_default' => 0, - 'created_date' => '2013-07-28 08:49:19', - 'bypass_confirm' => 0, - 'is_share' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'title' => 'survey title', + 'activity_type_id' => '30', + 'instructions' => 'Call people, ask for money', + 'max_number_of_contacts' => '12', + 'is_active' => '1', + 'is_default' => 0, + 'created_date' => '2013-07-28 08:49:19', + 'bypass_confirm' => 0, + 'is_share' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetSurvey and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetSurvey +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/SurveyRespondant/Get.php b/api/v3/examples/SurveyRespondant/Get.php index 8f0c63c0f8..a18541eebc 100644 --- a/api/v3/examples/SurveyRespondant/Get.php +++ b/api/v3/examples/SurveyRespondant/Get.php @@ -1,48 +1,64 @@ '1', - 'survey_id' => 1, -); -try{ - $result = civicrm_api3('survey_respondant', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using survey_respondant get API. + * + * + * @return array + * API result array + */ +function survey_respondant_get_example() { + $params = array( + 'sequential' => '1', + 'survey_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('survey_respondant', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function survey_respondant_get_expectedresult(){ +function survey_respondant_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 0, - 'values' => array(), -); + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => array(), + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetSurveyRespondants and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetSurveyRespondants +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyRespondantTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/System/Flush.php b/api/v3/examples/System/Flush.php index 4eb8a620a7..b29aa1c3ce 100644 --- a/api/v3/examples/System/Flush.php +++ b/api/v3/examples/System/Flush.php @@ -1,45 +1,62 @@ getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using system flush API. + * + * Flush all system caches + * + * @return array + * API result array + */ +function system_flush_example() { + $params = array(); -return $result; + try{ + $result = civicrm_api3('system', 'flush', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function system_flush_expectedresult(){ +function system_flush_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testFlush and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testFlush +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SystemTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Tag/Create.php b/api/v3/examples/Tag/Create.php index f1fa7b5341..a0feec3427 100644 --- a/api/v3/examples/Tag/Create.php +++ b/api/v3/examples/Tag/Create.php @@ -1,62 +1,78 @@ 'Super Heros', - 'description' => 'Outside undie-wearers', -); -try{ - $result = civicrm_api3('tag', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using tag create API. + * + * + * @return array + * API result array + */ +function tag_create_example() { + $params = array( + 'name' => 'Super Heros', + 'description' => 'Outside undie-wearers', + ); -return $result; + try{ + $result = civicrm_api3('tag', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function tag_create_expectedresult(){ +function tag_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 12, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 12, + 'values' => array( '12' => array( - 'id' => '12', - 'name' => 'Super Heros', - 'description' => 'Outside undie-wearers', - 'parent_id' => '', - 'is_selectable' => '', - 'is_reserved' => '', - 'is_tagset' => '', - 'used_for' => 'civicrm_contact', - 'created_id' => '', - 'created_date' => '2013-07-28 08:49:19', - ), + 'id' => '12', + 'name' => 'Super Heros', + 'description' => 'Outside undie-wearers', + 'parent_id' => '', + 'is_selectable' => '', + 'is_reserved' => '', + 'is_tagset' => '', + 'used_for' => 'civicrm_contact', + 'created_id' => '', + 'created_date' => '2013-07-28 08:49:19', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Tag/Delete.php b/api/v3/examples/Tag/Delete.php index 68914b444c..0b83a92fb9 100644 --- a/api/v3/examples/Tag/Delete.php +++ b/api/v3/examples/Tag/Delete.php @@ -1,47 +1,63 @@ '17', -); -try{ - $result = civicrm_api3('tag', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using tag delete API. + * + * + * @return array + * API result array + */ +function tag_delete_example() { + $params = array( + 'id' => '17', + ); -return $result; + try{ + $result = civicrm_api3('tag', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function tag_delete_expectedresult(){ +function tag_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testTagDeleteCorrectSyntax and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testTagDeleteCorrectSyntax +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Tag/Get.php b/api/v3/examples/Tag/Get.php index 2dafb49ee0..8d4dd1ebfe 100644 --- a/api/v3/examples/Tag/Get.php +++ b/api/v3/examples/Tag/Get.php @@ -1,60 +1,76 @@ '7', - 'name' => 'New Tag3', -); -try{ - $result = civicrm_api3('tag', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using tag get API. + * + * + * @return array + * API result array + */ +function tag_get_example() { + $params = array( + 'id' => '7', + 'name' => 'New Tag3', + ); -return $result; + try{ + $result = civicrm_api3('tag', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function tag_get_expectedresult(){ +function tag_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 7, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 7, + 'values' => array( '7' => array( - 'id' => '7', - 'name' => 'New Tag3', - 'description' => 'This is description for Our New Tag ', - 'is_selectable' => '1', - 'is_reserved' => 0, - 'is_tagset' => 0, - 'used_for' => 'civicrm_contact', - 'created_date' => '2013-07-28 08:49:19', - ), + 'id' => '7', + 'name' => 'New Tag3', + 'description' => 'This is description for Our New Tag ', + 'is_selectable' => '1', + 'is_reserved' => 0, + 'is_tagset' => 0, + 'used_for' => 'civicrm_contact', + 'created_date' => '2013-07-28 08:49:19', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Tag/GetList.php b/api/v3/examples/Tag/GetList.php index 7b645eb836..1ad846887a 100644 --- a/api/v3/examples/Tag/GetList.php +++ b/api/v3/examples/Tag/GetList.php @@ -1,64 +1,81 @@ 'New Tag3', - 'extra' => array( + +/** + * Test Generated example of using tag getlist API. + * + * Demonstrates use of api.getlist for autocomplete and quicksearch applications + * + * @return array + * API result array + */ +function tag_getlist_example() { + $params = array( + 'input' => 'New Tag3', + 'extra' => array( '0' => 'used_for', ), -); + ); -try{ - $result = civicrm_api3('tag', 'getlist', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('tag', 'getlist', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function tag_getlist_expectedresult(){ +function tag_getlist_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 0, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 0, + 'values' => array( '0' => array( - 'id' => '19', - 'label' => 'New Tag3', - 'description' => array( - '0' => 'This is description for Our New Tag ', - ), - 'extra' => array( - 'used_for' => 'civicrm_contact', - ), + 'id' => '19', + 'label' => 'New Tag3', + 'description' => array( + '0' => 'This is description for Our New Tag ', ), + 'extra' => array( + 'used_for' => 'civicrm_contact', + ), + ), ), - 'page_num' => 1, - 'more_results' => '', -); + 'page_num' => 1, + 'more_results' => '', + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testTagGetList and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testTagGetList +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Tag/Getfields.php b/api/v3/examples/Tag/Getfields.php index a329f22002..a8f0f58676 100644 --- a/api/v3/examples/Tag/Getfields.php +++ b/api/v3/examples/Tag/Getfields.php @@ -1,122 +1,141 @@ 'create', -); -try{ - $result = civicrm_api3('tag', 'getfields', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using tag getfields API. + * + * demonstrate use of getfields to interrogate api + * + * @return array + * API result array + */ +function tag_getfields_example() { + $params = array( + 'action' => 'create', + ); + + try{ + $result = civicrm_api3('tag', 'getfields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function tag_getfields_expectedresult(){ +function tag_getfields_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 10, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 10, + 'values' => array( 'id' => array( - 'name' => 'id', - 'type' => 1, - 'title' => 'Tag ID', - 'required' => true, - 'api.aliases' => array( - '0' => 'tag', - ), + 'name' => 'id', + 'type' => 1, + 'title' => 'Tag ID', + 'required' => TRUE, + 'api.aliases' => array( + '0' => 'tag', ), + ), 'name' => array( - 'name' => 'name', - 'type' => 2, - 'title' => 'Tag Name', - 'required' => true, - 'maxlength' => 64, - 'size' => 30, - 'api.required' => 1, - ), + 'name' => 'name', + 'type' => 2, + 'title' => 'Tag Name', + 'required' => TRUE, + 'maxlength' => 64, + 'size' => 30, + 'api.required' => 1, + ), 'description' => array( - 'name' => 'description', - 'type' => 2, - 'title' => 'Description', - 'maxlength' => 255, - 'size' => 45, - ), + 'name' => 'description', + 'type' => 2, + 'title' => 'Description', + 'maxlength' => 255, + 'size' => 45, + ), 'parent_id' => array( - 'name' => 'parent_id', - 'type' => 1, - 'title' => 'Parent Tag', - 'default' => 'NULL', - 'FKClassName' => 'CRM_Core_DAO_Tag', - ), + 'name' => 'parent_id', + 'type' => 1, + 'title' => 'Parent Tag', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Core_DAO_Tag', + 'FKApiName' => 'Tag', + ), 'is_selectable' => array( - 'name' => 'is_selectable', - 'type' => 16, - 'title' => 'Display Tag?', - 'default' => '1', - ), + 'name' => 'is_selectable', + 'type' => 16, + 'title' => 'Display Tag?', + 'default' => '1', + ), 'is_reserved' => array( - 'name' => 'is_reserved', - 'type' => 16, - 'title' => 'Reserved', - ), + 'name' => 'is_reserved', + 'type' => 16, + 'title' => 'Reserved', + ), 'is_tagset' => array( - 'name' => 'is_tagset', - 'type' => 16, - 'title' => 'Tagset', - ), + 'name' => 'is_tagset', + 'type' => 16, + 'title' => 'Tagset', + ), 'used_for' => array( - 'name' => 'used_for', - 'type' => 2, - 'title' => 'Used For', - 'maxlength' => 64, - 'size' => 30, - 'default' => 'NULL', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'tag_used_for', - ), - 'api.default' => 'civicrm_contact', + 'name' => 'used_for', + 'type' => 2, + 'title' => 'Used For', + 'maxlength' => 64, + 'size' => 30, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', ), - 'created_id' => array( - 'name' => 'created_id', - 'type' => 1, - 'title' => 'Tag Created By', - 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'pseudoconstant' => array( + 'optionGroupName' => 'tag_used_for', ), + 'api.default' => 'civicrm_contact', + ), + 'created_id' => array( + 'name' => 'created_id', + 'type' => 1, + 'title' => 'Tag Created By', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'FKApiName' => 'Contact', + ), 'created_date' => array( - 'name' => 'created_date', - 'type' => 12, - 'title' => 'Tag Created Date', - ), + 'name' => 'created_date', + 'type' => 12, + 'title' => 'Tag Created Date', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testTagGetfields and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testTagGetfields +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Tag/getReturnArray.php b/api/v3/examples/Tag/getReturnArray.php index f582388a43..7292413b0d 100644 --- a/api/v3/examples/Tag/getReturnArray.php +++ b/api/v3/examples/Tag/getReturnArray.php @@ -1,57 +1,74 @@ '8', - 'name' => 'New Tag3', - 'return' => array( + +/** + * Test Generated example of using tag get API. + * + * demonstrates use of Return as an array + * + * @return array + * API result array + */ +function tag_get_example() { + $params = array( + 'id' => '8', + 'name' => 'New Tag3', + 'return' => array( '0' => 'name', ), -); + ); -try{ - $result = civicrm_api3('tag', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('tag', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function tag_get_expectedresult(){ +function tag_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 8, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 8, + 'values' => array( '8' => array( - 'id' => '8', - 'name' => 'New Tag3', - ), + 'id' => '8', + 'name' => 'New Tag3', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetReturnArray and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetReturnArray +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/TaxContributionPage/Create.php b/api/v3/examples/TaxContributionPage/Create.php new file mode 100644 index 0000000000..8b8bb96eab --- /dev/null +++ b/api/v3/examples/TaxContributionPage/Create.php @@ -0,0 +1,118 @@ + 1, + 'receive_date' => '20120511', + 'total_amount' => '100', + 'financial_type_id' => 11, + 'contribution_page_id' => 1, + 'trxn_id' => 12345, + 'invoice_id' => 67890, + 'source' => 'SSF', + 'contribution_status_id' => 2, + ); + + try{ + $result = civicrm_api3('tax_contribution_page', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function tax_contribution_page_create_expectedresult() { + + $expectedResult = array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '1' => array( + 'id' => '1', + 'contact_id' => '1', + 'financial_type_id' => '11', + 'contribution_page_id' => '1', + 'payment_instrument_id' => '4', + 'receive_date' => '20120511000000', + 'non_deductible_amount' => '', + 'total_amount' => '120', + 'fee_amount' => 0, + 'net_amount' => '120', + 'trxn_id' => '12345', + 'invoice_id' => '67890', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '2', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '20', + 'contribution_type_id' => '11', + ), + ), + ); + + return $expectedResult; +} + +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionPendingOnline +* and can be found in +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TaxContributionPageTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-master-git/ +* +* To Learn about the API read +* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* +* Browse the api on your own site with the api explorer +* http://MYSITE.ORG/path/to/civicrm/api/explorer +* +* Read more about testing here +* http://wiki.civicrm.org/confluence/display/CRM/Testing +* +* API Standards documentation: +* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +*/ diff --git a/api/v3/examples/TaxContributionPage/CreateWithNestedLineItems.php b/api/v3/examples/TaxContributionPage/CreateWithNestedLineItems.php new file mode 100644 index 0000000000..6a2645e15a --- /dev/null +++ b/api/v3/examples/TaxContributionPage/CreateWithNestedLineItems.php @@ -0,0 +1,193 @@ + 1, + 'receive_date' => '20120511', + 'total_amount' => '400', + 'financial_type_id' => 7, + 'trxn_id' => 12345, + 'invoice_id' => 67890, + 'source' => 'SSF', + 'contribution_status_id' => 1, + 'skipLineItem' => 1, + 'api.line_item.create' => array( + '0' => array( + 'price_field_id' => array( + '0' => 3, + ), + 'qty' => 1, + 'line_total' => '100', + 'unit_price' => '100', + 'financial_type_id' => 7, + ), + '1' => array( + 'price_field_id' => array( + '0' => 3, + ), + 'qty' => 1, + 'line_total' => '300', + 'unit_price' => '300', + 'financial_type_id' => 8, + ), + ), + ); + + try{ + $result = civicrm_api3('tax_contribution_page', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function tax_contribution_page_create_expectedresult() { + + $expectedResult = array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '1' => array( + 'id' => '1', + 'contact_id' => '1', + 'financial_type_id' => '7', + 'contribution_page_id' => '', + 'payment_instrument_id' => '4', + 'receive_date' => '20120511000000', + 'non_deductible_amount' => '', + 'total_amount' => '435', + 'fee_amount' => 0, + 'net_amount' => '435', + 'trxn_id' => '12345', + 'invoice_id' => '67890', + 'currency' => 'USD', + 'cancel_date' => '', + 'cancel_reason' => '', + 'receipt_date' => '', + 'thankyou_date' => '', + 'source' => 'SSF', + 'amount_level' => '', + 'contribution_recur_id' => '', + 'is_test' => '', + 'is_pay_later' => '', + 'contribution_status_id' => '1', + 'address_id' => '', + 'check_number' => '', + 'campaign_id' => '', + 'creditnote_id' => '', + 'tax_amount' => '35', + 'contribution_type_id' => '7', + 'api.line_item.create' => array( + '0' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '0' => array( + 'id' => '1', + 'entity_table' => 'civicrm_contribution', + 'entity_id' => '1', + 'contribution_id' => '1', + 'price_field_id' => array( + '0' => '3', + ), + 'label' => 'line item', + 'qty' => '1', + 'unit_price' => '100', + 'line_total' => '100', + 'participant_count' => '', + 'price_field_value_id' => '', + 'financial_type_id' => '7', + 'deductible_amount' => '', + 'tax_amount' => '20', + ), + ), + ), + '1' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '0' => array( + 'id' => '2', + 'entity_table' => 'civicrm_contribution', + 'entity_id' => '1', + 'contribution_id' => '1', + 'price_field_id' => array( + '0' => '3', + ), + 'label' => 'line item', + 'qty' => '1', + 'unit_price' => '300', + 'line_total' => '300', + 'participant_count' => '', + 'price_field_value_id' => '', + 'financial_type_id' => '8', + 'deductible_amount' => '', + 'tax_amount' => '15', + ), + ), + ), + ), + ), + ), + ); + + return $expectedResult; +} + +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateContributionChainedLineItems +* and can be found in +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TaxContributionPageTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-master-git/ +* +* To Learn about the API read +* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* +* Browse the api on your own site with the api explorer +* http://MYSITE.ORG/path/to/civicrm/api/explorer +* +* Read more about testing here +* http://wiki.civicrm.org/confluence/display/CRM/Testing +* +* API Standards documentation: +* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +*/ diff --git a/api/v3/examples/TaxContributionPage/Delete.php b/api/v3/examples/TaxContributionPage/Delete.php new file mode 100644 index 0000000000..9aa32a0763 --- /dev/null +++ b/api/v3/examples/TaxContributionPage/Delete.php @@ -0,0 +1,80 @@ + 1, + ); + + try{ + $result = civicrm_api3('tax_contribution_page', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function tax_contribution_page_delete_expectedresult() { + + $expectedResult = array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( + '1' => 1, + ), + ); + + return $expectedResult; +} + +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteContribution +* and can be found in +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TaxContributionPageTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-master-git/ +* +* To Learn about the API read +* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* +* Browse the api on your own site with the api explorer +* http://MYSITE.ORG/path/to/civicrm/api/explorer +* +* Read more about testing here +* http://wiki.civicrm.org/confluence/display/CRM/Testing +* +* API Standards documentation: +* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +*/ diff --git a/api/v3/examples/UFField/Create.php b/api/v3/examples/UFField/Create.php index 701f005699..4574229cfe 100644 --- a/api/v3/examples/UFField/Create.php +++ b/api/v3/examples/UFField/Create.php @@ -1,79 +1,95 @@ 'phone', - 'field_type' => 'Contact', - 'visibility' => 'Public Pages and Listings', - 'weight' => 1, - 'label' => 'Test Phone', - 'is_searchable' => 1, - 'is_active' => 1, - 'location_type_id' => 1, - 'phone_type_id' => 1, - 'uf_group_id' => 11, -); -try{ - $result = civicrm_api3('uf_field', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_field create API. + * + * + * @return array + * API result array + */ +function uf_field_create_example() { + $params = array( + 'field_name' => 'phone', + 'field_type' => 'Contact', + 'visibility' => 'Public Pages and Listings', + 'weight' => 1, + 'label' => 'Test Phone', + 'is_searchable' => 1, + 'is_active' => 1, + 'location_type_id' => 1, + 'phone_type_id' => 1, + 'uf_group_id' => 11, + ); -return $result; + try{ + $result = civicrm_api3('uf_field', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_field_create_expectedresult(){ +function uf_field_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'uf_group_id' => '11', - 'field_name' => 'phone', - 'is_active' => '1', - 'is_view' => '', - 'is_required' => '', - 'weight' => '1', - 'help_post' => '', - 'help_pre' => '', - 'visibility' => 'Public Pages and Listings', - 'in_selector' => '', - 'is_searchable' => '1', - 'location_type_id' => '1', - 'phone_type_id' => '1', - 'website_type_id' => '', - 'label' => 'Test Phone', - 'field_type' => 'Contact', - 'is_reserved' => '', - 'is_multi_summary' => '', - ), + 'id' => '1', + 'uf_group_id' => '11', + 'field_name' => 'phone', + 'is_active' => '1', + 'is_view' => '', + 'is_required' => '', + 'weight' => '1', + 'help_post' => '', + 'help_pre' => '', + 'visibility' => 'Public Pages and Listings', + 'in_selector' => '', + 'is_searchable' => '1', + 'location_type_id' => '1', + 'phone_type_id' => '1', + 'website_type_id' => '', + 'label' => 'Test Phone', + 'field_type' => 'Contact', + 'is_reserved' => '', + 'is_multi_summary' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateUFField and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateUFField +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFField/Delete.php b/api/v3/examples/UFField/Delete.php index b93207b15c..5855bbf3a1 100644 --- a/api/v3/examples/UFField/Delete.php +++ b/api/v3/examples/UFField/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('uf_field', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_field delete API. + * + * + * @return array + * API result array + */ +function uf_field_delete_example() { + $params = array( + 'field_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('uf_field', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_field_delete_expectedresult(){ +function uf_field_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteUFField and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteUFField +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFField/Get.php b/api/v3/examples/UFField/Get.php index 2395dc93d1..b75acb0265 100644 --- a/api/v3/examples/UFField/Get.php +++ b/api/v3/examples/UFField/Get.php @@ -1,64 +1,80 @@ getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_field get API. + * + * + * @return array + * API result array + */ +function uf_field_get_example() { + $params = array(); -return $result; + try{ + $result = civicrm_api3('uf_field', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_field_get_expectedresult(){ +function uf_field_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'uf_group_id' => '11', - 'field_name' => 'phone', - 'is_active' => '1', - 'is_view' => 0, - 'is_required' => 0, - 'weight' => '1', - 'visibility' => 'Public Pages and Listings', - 'in_selector' => 0, - 'is_searchable' => '1', - 'location_type_id' => '1', - 'phone_type_id' => '1', - 'label' => 'Test Phone', - 'field_type' => 'Contact', - 'is_multi_summary' => 0, - ), + 'id' => '1', + 'uf_group_id' => '11', + 'field_name' => 'phone', + 'is_active' => '1', + 'is_view' => 0, + 'is_required' => 0, + 'weight' => '1', + 'visibility' => 'Public Pages and Listings', + 'in_selector' => 0, + 'is_searchable' => '1', + 'location_type_id' => '1', + 'phone_type_id' => '1', + 'label' => 'Test Phone', + 'field_type' => 'Contact', + 'is_multi_summary' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetUFFieldSuccess and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetUFFieldSuccess +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFField/Replace.php b/api/v3/examples/UFField/Replace.php index 0a162cc200..603db80207 100644 --- a/api/v3/examples/UFField/Replace.php +++ b/api/v3/examples/UFField/Replace.php @@ -1,144 +1,160 @@ 11, - 'option.autoweight' => '', - 'values' => array( + +/** + * Test Generated example of using uf_field replace API. + * + * + * @return array + * API result array + */ +function uf_field_replace_example() { + $params = array( + 'uf_group_id' => 11, + 'option.autoweight' => '', + 'values' => array( '0' => array( - 'field_name' => 'first_name', - 'field_type' => 'Contact', - 'visibility' => 'Public Pages and Listings', - 'weight' => 3, - 'label' => 'Test First Name', - 'is_searchable' => 1, - 'is_active' => 1, - ), + 'field_name' => 'first_name', + 'field_type' => 'Contact', + 'visibility' => 'Public Pages and Listings', + 'weight' => 3, + 'label' => 'Test First Name', + 'is_searchable' => 1, + 'is_active' => 1, + ), '1' => array( - 'field_name' => 'country', - 'field_type' => 'Contact', - 'visibility' => 'Public Pages and Listings', - 'weight' => 2, - 'label' => 'Test Country', - 'is_searchable' => 1, - 'is_active' => 1, - 'location_type_id' => 1, - ), + 'field_name' => 'country', + 'field_type' => 'Contact', + 'visibility' => 'Public Pages and Listings', + 'weight' => 2, + 'label' => 'Test Country', + 'is_searchable' => 1, + 'is_active' => 1, + 'location_type_id' => 1, + ), '2' => array( - 'field_name' => 'phone', - 'field_type' => 'Contact', - 'visibility' => 'Public Pages and Listings', - 'weight' => 1, - 'label' => 'Test Phone', - 'is_searchable' => 1, - 'is_active' => 1, - 'location_type_id' => 1, - 'phone_type_id' => 1, - ), + 'field_name' => 'phone', + 'field_type' => 'Contact', + 'visibility' => 'Public Pages and Listings', + 'weight' => 1, + 'label' => 'Test Phone', + 'is_searchable' => 1, + 'is_active' => 1, + 'location_type_id' => 1, + 'phone_type_id' => 1, + ), ), -); + ); -try{ - $result = civicrm_api3('uf_field', 'replace', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('uf_field', 'replace', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_field_replace_expectedresult(){ +function uf_field_replace_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 3, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => array( '1' => array( - 'id' => '1', - 'uf_group_id' => '11', - 'field_name' => 'first_name', - 'is_active' => '1', - 'is_view' => '', - 'is_required' => '', - 'weight' => '3', - 'help_post' => '', - 'help_pre' => '', - 'visibility' => 'Public Pages and Listings', - 'in_selector' => '', - 'is_searchable' => '1', - 'location_type_id' => '', - 'phone_type_id' => '', - 'website_type_id' => '', - 'label' => 'Test First Name', - 'field_type' => 'Contact', - 'is_reserved' => '', - 'is_multi_summary' => '', - ), + 'id' => '1', + 'uf_group_id' => '11', + 'field_name' => 'first_name', + 'is_active' => '1', + 'is_view' => '', + 'is_required' => '', + 'weight' => '3', + 'help_post' => '', + 'help_pre' => '', + 'visibility' => 'Public Pages and Listings', + 'in_selector' => '', + 'is_searchable' => '1', + 'location_type_id' => '', + 'phone_type_id' => '', + 'website_type_id' => '', + 'label' => 'Test First Name', + 'field_type' => 'Contact', + 'is_reserved' => '', + 'is_multi_summary' => '', + ), '2' => array( - 'id' => '2', - 'uf_group_id' => '11', - 'field_name' => 'country', - 'is_active' => '1', - 'is_view' => '', - 'is_required' => '', - 'weight' => '2', - 'help_post' => '', - 'help_pre' => '', - 'visibility' => 'Public Pages and Listings', - 'in_selector' => '', - 'is_searchable' => '1', - 'location_type_id' => '1', - 'phone_type_id' => '', - 'website_type_id' => '', - 'label' => 'Test Country', - 'field_type' => 'Contact', - 'is_reserved' => '', - 'is_multi_summary' => '', - ), + 'id' => '2', + 'uf_group_id' => '11', + 'field_name' => 'country', + 'is_active' => '1', + 'is_view' => '', + 'is_required' => '', + 'weight' => '2', + 'help_post' => '', + 'help_pre' => '', + 'visibility' => 'Public Pages and Listings', + 'in_selector' => '', + 'is_searchable' => '1', + 'location_type_id' => '1', + 'phone_type_id' => '', + 'website_type_id' => '', + 'label' => 'Test Country', + 'field_type' => 'Contact', + 'is_reserved' => '', + 'is_multi_summary' => '', + ), '3' => array( - 'id' => '3', - 'uf_group_id' => '11', - 'field_name' => 'phone', - 'is_active' => '1', - 'is_view' => '', - 'is_required' => '', - 'weight' => '1', - 'help_post' => '', - 'help_pre' => '', - 'visibility' => 'Public Pages and Listings', - 'in_selector' => '', - 'is_searchable' => '1', - 'location_type_id' => '1', - 'phone_type_id' => '1', - 'website_type_id' => '', - 'label' => 'Test Phone', - 'field_type' => 'Contact', - 'is_reserved' => '', - 'is_multi_summary' => '', - ), + 'id' => '3', + 'uf_group_id' => '11', + 'field_name' => 'phone', + 'is_active' => '1', + 'is_view' => '', + 'is_required' => '', + 'weight' => '1', + 'help_post' => '', + 'help_pre' => '', + 'visibility' => 'Public Pages and Listings', + 'in_selector' => '', + 'is_searchable' => '1', + 'location_type_id' => '1', + 'phone_type_id' => '1', + 'website_type_id' => '', + 'label' => 'Test Phone', + 'field_type' => 'Contact', + 'is_reserved' => '', + 'is_multi_summary' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testReplaceUFFields and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testReplaceUFFields +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFGroup/Create.php b/api/v3/examples/UFGroup/Create.php index 6458ffd03f..52d4675a5c 100644 --- a/api/v3/examples/UFGroup/Create.php +++ b/api/v3/examples/UFGroup/Create.php @@ -1,93 +1,109 @@ 1, - 'add_contact_to_group' => 1, - 'group' => 1, - 'cancel_URL' => 'http://example.org/cancel', - 'created_date' => '2009-06-27 00:00:00', - 'created_id' => 1, - 'group_type' => 'Individual,Contact', - 'help_post' => 'help post', - 'help_pre' => 'help pre', - 'is_active' => 0, - 'is_cms_user' => 1, - 'is_edit_link' => 1, - 'is_map' => 1, - 'is_reserved' => 1, - 'is_uf_link' => 1, - 'is_update_dupe' => 1, - 'name' => 'Test_Group', - 'notify' => 'admin@example.org', - 'post_URL' => 'http://example.org/post', - 'title' => 'Test Group', -); -try{ - $result = civicrm_api3('uf_group', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_group create API. + * + * + * @return array + * API result array + */ +function uf_group_create_example() { + $params = array( + 'add_captcha' => 1, + 'add_contact_to_group' => 1, + 'group' => 1, + 'cancel_URL' => 'http://example.org/cancel', + 'created_date' => '2009-06-27 00:00:00', + 'created_id' => 1, + 'group_type' => 'Individual,Contact', + 'help_post' => 'help post', + 'help_pre' => 'help pre', + 'is_active' => 0, + 'is_cms_user' => 1, + 'is_edit_link' => 1, + 'is_map' => 1, + 'is_reserved' => 1, + 'is_uf_link' => 1, + 'is_update_dupe' => 1, + 'name' => 'Test_Group', + 'notify' => 'admin@example.org', + 'post_URL' => 'http://example.org/post', + 'title' => 'Test Group', + ); -return $result; + try{ + $result = civicrm_api3('uf_group', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_group_create_expectedresult(){ +function uf_group_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'is_active' => 0, - 'group_type' => 'Individual,Contact', - 'title' => 'Test Group', - 'description' => '', - 'help_pre' => 'help pre', - 'help_post' => 'help post', - 'limit_listings_group_id' => '1', - 'post_URL' => 'http://example.org/post', - 'add_to_group_id' => '1', - 'add_captcha' => '1', - 'is_map' => '1', - 'is_edit_link' => '1', - 'is_uf_link' => '1', - 'is_update_dupe' => '1', - 'cancel_URL' => 'http://example.org/cancel', - 'is_cms_user' => '1', - 'notify' => 'admin@example.org', - 'is_reserved' => '1', - 'name' => 'Test_Group_2', - 'created_id' => '1', - 'created_date' => '2013-07-28 08:49:19', - 'is_proximity_search' => '', - ), + 'id' => '2', + 'is_active' => 0, + 'group_type' => 'Individual,Contact', + 'title' => 'Test Group', + 'description' => '', + 'help_pre' => 'help pre', + 'help_post' => 'help post', + 'limit_listings_group_id' => '1', + 'post_URL' => 'http://example.org/post', + 'add_to_group_id' => '1', + 'add_captcha' => '1', + 'is_map' => '1', + 'is_edit_link' => '1', + 'is_uf_link' => '1', + 'is_update_dupe' => '1', + 'cancel_URL' => 'http://example.org/cancel', + 'is_cms_user' => '1', + 'notify' => 'admin@example.org', + 'is_reserved' => '1', + 'name' => 'Test_Group_2', + 'created_id' => '1', + 'created_date' => '2013-07-28 08:49:19', + 'is_proximity_search' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testUFGroupCreate and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testUFGroupCreate +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFGroup/Delete.php b/api/v3/examples/UFGroup/Delete.php index 7c11095bfe..f909a776b5 100644 --- a/api/v3/examples/UFGroup/Delete.php +++ b/api/v3/examples/UFGroup/Delete.php @@ -1,47 +1,63 @@ 2, -); -try{ - $result = civicrm_api3('uf_group', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_group delete API. + * + * + * @return array + * API result array + */ +function uf_group_delete_example() { + $params = array( + 'id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('uf_group', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_group_delete_expectedresult(){ +function uf_group_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => true, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => TRUE, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testUFGroupDelete and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testUFGroupDelete +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFGroup/Get.php b/api/v3/examples/UFGroup/Get.php index 9711d93470..5a2aab584a 100644 --- a/api/v3/examples/UFGroup/Get.php +++ b/api/v3/examples/UFGroup/Get.php @@ -1,73 +1,89 @@ 2, -); -try{ - $result = civicrm_api3('uf_group', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_group get API. + * + * + * @return array + * API result array + */ +function uf_group_get_example() { + $params = array( + 'id' => 2, + ); -return $result; + try{ + $result = civicrm_api3('uf_group', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_group_get_expectedresult(){ +function uf_group_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 2, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( '2' => array( - 'id' => '2', - 'is_active' => 0, - 'group_type' => 'Individual,Contact', - 'title' => 'Test Group', - 'help_pre' => 'help pre', - 'help_post' => 'help post', - 'limit_listings_group_id' => '1', - 'post_URL' => 'http://example.org/post', - 'add_to_group_id' => '1', - 'add_captcha' => '1', - 'is_map' => '1', - 'is_edit_link' => '1', - 'is_uf_link' => '1', - 'is_update_dupe' => '1', - 'cancel_URL' => 'http://example.org/cancel', - 'is_cms_user' => '1', - 'notify' => 'admin@example.org', - 'is_reserved' => '1', - 'name' => 'Test_Group_2', - 'created_id' => '1', - 'created_date' => '2013-07-28 08:49:19', - 'is_proximity_search' => 0, - ), + 'id' => '2', + 'is_active' => 0, + 'group_type' => 'Individual,Contact', + 'title' => 'Test Group', + 'help_pre' => 'help pre', + 'help_post' => 'help post', + 'limit_listings_group_id' => '1', + 'post_URL' => 'http://example.org/post', + 'add_to_group_id' => '1', + 'add_captcha' => '1', + 'is_map' => '1', + 'is_edit_link' => '1', + 'is_uf_link' => '1', + 'is_update_dupe' => '1', + 'cancel_URL' => 'http://example.org/cancel', + 'is_cms_user' => '1', + 'notify' => 'admin@example.org', + 'is_reserved' => '1', + 'name' => 'Test_Group_2', + 'created_id' => '1', + 'created_date' => '2013-07-28 08:49:19', + 'is_proximity_search' => 0, + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testUFGroupGet and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testUFGroupGet +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFJoin/Create.php b/api/v3/examples/UFJoin/Create.php index 5eaba20a6e..22ba41dca0 100644 --- a/api/v3/examples/UFJoin/Create.php +++ b/api/v3/examples/UFJoin/Create.php @@ -1,65 +1,81 @@ 'CiviContribute', - 'entity_table' => 'civicrm_contribution_page', - 'entity_id' => 1, - 'weight' => 1, - 'uf_group_id' => 11, - 'is_active' => 1, - 'sequential' => 1, -); -try{ - $result = civicrm_api3('uf_join', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_join create API. + * + * + * @return array + * API result array + */ +function uf_join_create_example() { + $params = array( + 'module' => 'CiviContribute', + 'entity_table' => 'civicrm_contribution_page', + 'entity_id' => 1, + 'weight' => 1, + 'uf_group_id' => 11, + 'is_active' => 1, + 'sequential' => 1, + ); -return $result; + try{ + $result = civicrm_api3('uf_join', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_join_create_expectedresult(){ +function uf_join_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 0, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 0, + 'values' => array( '0' => array( - 'id' => '1', - 'is_active' => '1', - 'module' => 'CiviContribute', - 'entity_table' => 'civicrm_contribution_page', - 'entity_id' => '1', - 'weight' => '1', - 'uf_group_id' => '11', - 'module_data' => '', - ), + 'id' => '1', + 'is_active' => '1', + 'module' => 'CiviContribute', + 'entity_table' => 'civicrm_contribution_page', + 'entity_id' => '1', + 'weight' => '1', + 'uf_group_id' => '11', + 'module_data' => '', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateUFJoin and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateUFJoin +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFJoinTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFJoin/Get.php b/api/v3/examples/UFJoin/Get.php index d56f326129..13039bbe1a 100644 --- a/api/v3/examples/UFJoin/Get.php +++ b/api/v3/examples/UFJoin/Get.php @@ -1,60 +1,76 @@ 'civicrm_contribution_page', - 'entity_id' => 1, - 'sequential' => 1, -); -try{ - $result = civicrm_api3('uf_join', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_join get API. + * + * + * @return array + * API result array + */ +function uf_join_get_example() { + $params = array( + 'entity_table' => 'civicrm_contribution_page', + 'entity_id' => 1, + 'sequential' => 1, + ); -return $result; + try{ + $result = civicrm_api3('uf_join', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_join_get_expectedresult(){ +function uf_join_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '0' => array( - 'id' => '1', - 'is_active' => '1', - 'module' => 'CiviContribute', - 'entity_table' => 'civicrm_contribution_page', - 'entity_id' => '1', - 'weight' => '1', - 'uf_group_id' => '11', - ), + 'id' => '1', + 'is_active' => '1', + 'module' => 'CiviContribute', + 'entity_table' => 'civicrm_contribution_page', + 'entity_id' => '1', + 'weight' => '1', + 'uf_group_id' => '11', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetUFJoinId and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetUFJoinId +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFJoinTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/UFMatch/Get.php b/api/v3/examples/UFMatch/Get.php index ca93d3f382..a725941e2f 100644 --- a/api/v3/examples/UFMatch/Get.php +++ b/api/v3/examples/UFMatch/Get.php @@ -1,55 +1,71 @@ 69, -); -try{ - $result = civicrm_api3('uf_match', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using uf_match get API. + * + * + * @return array + * API result array + */ +function uf_match_get_example() { + $params = array( + 'contact_id' => 69, + ); -return $result; + try{ + $result = civicrm_api3('uf_match', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function uf_match_get_expectedresult(){ +function uf_match_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'domain_id' => '1', - 'uf_id' => '42', - 'contact_id' => '69', - ), + 'id' => '1', + 'domain_id' => '1', + 'uf_id' => '42', + 'contact_id' => '69', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetUFID and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetUFID +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFMatchTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Website/Create.php b/api/v3/examples/Website/Create.php index b490c1707f..80d91694cb 100644 --- a/api/v3/examples/Website/Create.php +++ b/api/v3/examples/Website/Create.php @@ -1,57 +1,73 @@ 3, - 'url' => 'website.com', - 'website_type_id' => 1, -); -try{ - $result = civicrm_api3('website', 'create', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using website create API. + * + * + * @return array + * API result array + */ +function website_create_example() { + $params = array( + 'contact_id' => 3, + 'url' => 'website.com', + 'website_type_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('website', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function website_create_expectedresult(){ +function website_create_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 1, + 'values' => array( '1' => array( - 'id' => '1', - 'contact_id' => '3', - 'url' => 'website.com', - 'website_type_id' => '1', - ), + 'id' => '1', + 'contact_id' => '3', + 'url' => 'website.com', + 'website_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testCreateWebsite and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testCreateWebsite +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Website/Delete.php b/api/v3/examples/Website/Delete.php index 75daecd2eb..f5febfdd8e 100644 --- a/api/v3/examples/Website/Delete.php +++ b/api/v3/examples/Website/Delete.php @@ -1,47 +1,63 @@ 1, -); -try{ - $result = civicrm_api3('website', 'delete', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using website delete API. + * + * + * @return array + * API result array + */ +function website_delete_example() { + $params = array( + 'id' => 3, + ); -return $result; + try{ + $result = civicrm_api3('website', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function website_delete_expectedresult(){ +function website_delete_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, -); + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testDeleteWebsite and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testDeleteWebsite +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Website/Get.php b/api/v3/examples/Website/Get.php index 7b98281ea6..e3475fd460 100644 --- a/api/v3/examples/Website/Get.php +++ b/api/v3/examples/Website/Get.php @@ -1,57 +1,73 @@ 1, - 'url' => 'website.com', - 'website_type_id' => 1, -); -try{ - $result = civicrm_api3('website', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using website get API. + * + * + * @return array + * API result array + */ +function website_get_example() { + $params = array( + 'contact_id' => 4, + 'url' => 'website.com', + 'website_type_id' => 1, + ); -return $result; + try{ + $result = civicrm_api3('website', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } + + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function website_get_expectedresult(){ +function website_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => array( - '1' => array( - 'id' => '1', - 'contact_id' => '1', - 'url' => 'website.com', - 'website_type_id' => '1', - ), + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 2, + 'values' => array( + '2' => array( + 'id' => '2', + 'contact_id' => '4', + 'url' => 'website.com', + 'website_type_id' => '1', + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetWebsite and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetWebsite +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Website/GetFields.php b/api/v3/examples/Website/GetFields.php index bd16132d6b..5b945173f1 100644 --- a/api/v3/examples/Website/GetFields.php +++ b/api/v3/examples/Website/GetFields.php @@ -1,89 +1,106 @@ 'get', -); -try{ - $result = civicrm_api3('website', 'getfields', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} +/** + * Test Generated example of using website getfields API. + * + * + * @return array + * API result array + */ +function website_getfields_example() { + $params = array( + 'action' => 'get', + ); + + try{ + $result = civicrm_api3('website', 'getfields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function website_getfields_expectedresult(){ +function website_getfields_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 4, - 'values' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 4, + 'values' => array( 'id' => array( - 'name' => 'id', - 'type' => 1, - 'title' => 'Website ID', - 'required' => true, - 'api.aliases' => array( - '0' => 'website_id', - ), + 'name' => 'id', + 'type' => 1, + 'title' => 'Website ID', + 'required' => TRUE, + 'api.aliases' => array( + '0' => 'website_id', ), + ), 'contact_id' => array( - 'name' => 'contact_id', - 'type' => 1, - 'title' => 'Contact', - 'FKClassName' => 'CRM_Contact_DAO_Contact', - ), + 'name' => 'contact_id', + 'type' => 1, + 'title' => 'Contact', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'FKApiName' => 'Contact', + ), 'url' => array( - 'name' => 'url', - 'type' => 2, - 'title' => 'Website', - 'maxlength' => 128, - 'size' => 30, - 'import' => true, - 'where' => 'civicrm_website.url', - 'headerPattern' => '/Website/i', - 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', - 'export' => true, - 'html' => array( - 'type' => 'Text', - ), + 'name' => 'url', + 'type' => 2, + 'title' => 'Website', + 'maxlength' => 128, + 'size' => 30, + 'import' => TRUE, + 'where' => 'civicrm_website.url', + 'headerPattern' => '/Website/i', + 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', + 'export' => TRUE, + 'html' => array( + 'type' => 'Text', ), + ), 'website_type_id' => array( - 'name' => 'website_type_id', - 'type' => 1, - 'title' => 'Website Type', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'website_type', - ), + 'name' => 'website_type_id', + 'type' => 1, + 'title' => 'Website Type', + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'optionGroupName' => 'website_type', ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetFields and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetFields +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at diff --git a/api/v3/examples/Website/GetWithMetadata.php b/api/v3/examples/Website/GetWithMetadata.php index 3ed1be650c..e7f2857c65 100644 --- a/api/v3/examples/Website/GetWithMetadata.php +++ b/api/v3/examples/Website/GetWithMetadata.php @@ -1,96 +1,114 @@ array( + +/** + * Test Generated example of using website get API. + * + * Demonostrates returning field metadata + * + * @return array + * API result array + */ +function website_get_example() { + $params = array( + 'options' => array( 'metadata' => array( - '0' => 'fields', - ), + '0' => 'fields', + ), ), -); + ); -try{ - $result = civicrm_api3('website', 'get', $params); -} -catch (CiviCRM_API3_Exception $e) { - // handle error here - $errorMessage = $e->getMessage(); - $errorCode = $e->getErrorCode(); - $errorData = $e->getExtraParams(); - return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); -} + try{ + $result = civicrm_api3('website', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array( + 'error' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ); + } -return $result; + return $result; } /** - * Function returns array of result expected from previous function + * Function returns array of result expected from previous function. + * + * @return array + * API result array */ -function website_get_expectedresult(){ +function website_get_expectedresult() { $expectedResult = array( - 'is_error' => 0, - 'version' => 3, - 'count' => 0, - 'values' => array(), - 'metadata' => array( + 'is_error' => 0, + 'version' => 3, + 'count' => 0, + 'values' => array(), + 'metadata' => array( 'fields' => array( - 'id' => array( - 'name' => 'id', - 'type' => '1', - 'title' => 'Website ID', - 'required' => '1', - 'api.aliases' => array( - '0' => 'website_id', - ), - ), - 'contact_id' => array( - 'name' => 'contact_id', - 'type' => '1', - 'title' => 'Contact', - 'FKClassName' => 'CRM_Contact_DAO_Contact', - ), - 'url' => array( - 'name' => 'url', - 'type' => '2', - 'title' => 'Website', - 'maxlength' => '128', - 'size' => '30', - 'import' => '1', - 'where' => 'civicrm_website.url', - 'headerPattern' => '/Website/i', - 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', - 'export' => '1', - 'html' => array( - 'type' => 'Text', - ), - ), - 'website_type_id' => array( - 'name' => 'website_type_id', - 'type' => '1', - 'title' => 'Website Type', - 'html' => array( - 'type' => 'Select', - ), - 'pseudoconstant' => array( - 'optionGroupName' => 'website_type', - ), - ), + 'id' => array( + 'name' => 'id', + 'type' => '1', + 'title' => 'Website ID', + 'required' => '1', + 'api.aliases' => array( + '0' => 'website_id', + ), ), + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => '1', + 'title' => 'Contact', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'FKApiName' => 'Contact', + ), + 'url' => array( + 'name' => 'url', + 'type' => '2', + 'title' => 'Website', + 'maxlength' => '128', + 'size' => '30', + 'import' => '1', + 'where' => 'civicrm_website.url', + 'headerPattern' => '/Website/i', + 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', + 'export' => '1', + 'html' => array( + 'type' => 'Text', + ), + ), + 'website_type_id' => array( + 'name' => 'website_type_id', + 'type' => '1', + 'title' => 'Website Type', + 'html' => array( + 'type' => 'Select', + ), + 'pseudoconstant' => array( + 'optionGroupName' => 'website_type', + ), + ), + ), ), -); + ); return $expectedResult; } - -/* -* This example has been generated from the API test suite. The test that created it is called -* -* testGetMetadata and can be found in +/** +* This example has been generated from the API test suite. +* The test that created it is called +* testGetMetadata +* and can be found in * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -- 2.25.1