Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
109d6845
Unverified
Commit
109d6845
authored
5 years ago
by
Seamus Lee
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #15425 from eileenmcnaughton/loc_clean
[NFC] minor simplification
parents
0ad6fff1
9a350644
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Event/Form/ManageEvent/Location.php
+1
-2
1 addition, 2 deletions
CRM/Event/Form/ManageEvent/Location.php
api/v3/LocBlock.php
+1
-0
1 addition, 0 deletions
api/v3/LocBlock.php
tests/phpunit/CRM/Core/BAO/LocationTest.php
+2
-101
2 additions, 101 deletions
tests/phpunit/CRM/Core/BAO/LocationTest.php
with
4 additions
and
103 deletions
CRM/Event/Form/ManageEvent/Location.php
+
1
−
2
View file @
109d6845
...
...
@@ -262,8 +262,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent {
}
// create/update event location
$location
=
CRM_Core_BAO_Location
::
create
(
$params
,
TRUE
,
'event'
);
$params
[
'loc_block_id'
]
=
$location
[
'id'
];
$params
[
'loc_block_id'
]
=
CRM_Core_BAO_Location
::
create
(
$params
,
TRUE
,
'event'
)[
'id'
];
// finally update event params
$params
[
'id'
]
=
$this
->
_id
;
...
...
This diff is collapsed.
Click to expand it.
api/v3/LocBlock.php
+
1
−
0
View file @
109d6845
...
...
@@ -41,6 +41,7 @@
* API result array.
*
* @throws \API_Exception
* @throws \CiviCRM_API3_Exception
*/
function
civicrm_api3_loc_block_create
(
$params
)
{
$entities
=
[];
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/CRM/Core/BAO/LocationTest.php
+
2
−
101
View file @
109d6845
...
...
@@ -148,9 +148,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase {
$params
[
'contact_id'
]
=
$contactId
;
$location
=
CRM_Core_BAO_Location
::
create
(
$params
);
$locBlockId
=
CRM_Utils_Array
::
value
(
'id'
,
$location
);
$locBlockId
=
CRM_Core_BAO_Location
::
create
(
$params
);
//Now check DB for contact
$searchParams
=
[
...
...
@@ -201,8 +199,6 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase {
$compareParams
=
[
'phone'
=>
'9833910234'
];
$this
->
assertDBCompareValues
(
'CRM_Core_DAO_Phone'
,
$searchParams
,
$compareParams
);
//delete the location block
CRM_Core_BAO_Location
::
deleteLocBlock
(
$locBlockId
);
$this
->
contactDelete
(
$contactId
);
}
...
...
@@ -267,8 +263,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase {
//create location block.
//with various element of location block
//like address, phone, email, im.
$location
=
CRM_Core_BAO_Location
::
create
(
$params
,
NULL
,
TRUE
);
$locBlockId
=
CRM_Utils_Array
::
value
(
'id'
,
$location
);
$locBlockId
=
CRM_Core_BAO_Location
::
create
(
$params
,
NULL
,
TRUE
)[
'id'
];
//update event record with location block id
$eventParams
=
[
...
...
@@ -356,100 +351,6 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase {
$this
->
contactDelete
(
$this
->
_contactId
);
}
/**
* DeleteLocBlock() method
* delete the location block
* created with various elements.
*/
public
function
testDeleteLocBlock
()
{
$this
->
_contactId
=
$this
->
individualCreate
();
//create test event record.
$event
=
$this
->
eventCreate
();
$params
[
'location'
][
1
]
=
[
'location_type_id'
=>
1
,
'is_primary'
=>
1
,
'address'
=>
[
'street_address'
=>
'Saint Helier St'
,
'supplemental_address_1'
=>
'Hallmark Ct'
,
'supplemental_address_2'
=>
'Jersey Village'
,
'supplemental_address_3'
=>
'My Town'
,
'city'
=>
'Newark'
,
'postal_code'
=>
'01903'
,
'country_id'
=>
1228
,
'state_province_id'
=>
1029
,
'geo_code_1'
=>
'18.219023'
,
'geo_code_2'
=>
'-105.00973'
,
],
'email'
=>
[
'1'
=>
[
'email'
=>
'john.smith@example.org'
],
],
'phone'
=>
[
'1'
=>
[
'phone_type_id'
=>
1
,
'phone'
=>
'303443689'
,
],
'2'
=>
[
'phone_type_id'
=>
2
,
'phone'
=>
'9833910234'
,
],
],
'im'
=>
[
'1'
=>
[
'name'
=>
'jane.doe'
,
'provider_id'
=>
1
,
],
],
];
$params
[
'entity_id'
]
=
$event
[
'id'
];
$params
[
'entity_table'
]
=
'civicrm_event'
;
//create location block.
//with various elements
//like address, phone, email, im.
$location
=
CRM_Core_BAO_Location
::
create
(
$params
,
NULL
,
TRUE
);
$locBlockId
=
CRM_Utils_Array
::
value
(
'id'
,
$location
);
//update event record with location block id
$eventParams
=
[
'id'
=>
$event
[
'id'
],
'loc_block_id'
=>
$locBlockId
,
];
CRM_Event_BAO_Event
::
add
(
$eventParams
);
//delete the location block
CRM_Core_BAO_Location
::
deleteLocBlock
(
$locBlockId
);
//Now check DB for location elements.
//Now check DB for Address
$this
->
assertDBNull
(
'CRM_Core_DAO_Address'
,
'Saint Helier St'
,
'id'
,
'street_address'
,
'Database check, Address deleted successfully.'
);
//Now check DB for Email
$this
->
assertDBNull
(
'CRM_Core_DAO_Email'
,
'john.smith@example.org'
,
'id'
,
'email'
,
'Database check, Email deleted successfully.'
);
//Now check DB for Phone
$this
->
assertDBNull
(
'CRM_Core_DAO_Phone'
,
'303443689'
,
'id'
,
'phone'
,
'Database check, Phone deleted successfully.'
);
//Now check DB for Mobile
$this
->
assertDBNull
(
'CRM_Core_DAO_Phone'
,
'9833910234'
,
'id'
,
'phone'
,
'Database check, Mobile deleted successfully.'
);
//Now check DB for IM
$this
->
assertDBNull
(
'CRM_Core_DAO_IM'
,
'jane.doe'
,
'id'
,
'name'
,
'Database check, IM deleted successfully.'
);
//cleanup DB by deleting the record.
$this
->
eventDelete
(
$event
[
'id'
]);
$this
->
contactDelete
(
$this
->
_contactId
);
//Now check DB for Event
$this
->
assertDBNull
(
'CRM_Event_DAO_Event'
,
$event
[
'id'
],
'id'
,
'id'
,
'Database check, Event deleted successfully.'
);
}
/**
* GetValues() method
* get the values of various location elements
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment