[TRUNK-4537] Add a way to Delete a specific Provider forever Created: 2014-11-12  Updated: 2015-09-17  Resolved: 2015-09-17

Status: Closed
Project: OpenMRS Core
Component/s: None
Affects Version/s: Platform 1.11.0
Fix Version/s: Platform 2.0.0

Type: New Feature Priority: Should
Reporter: Kaweesi Joseph Assignee: Jakub Kondrat
Resolution: Fixed Votes: 0
Labels: intro, soldevelo
Remaining Estimate: 0 minutes
Time Spent: 1 day, 1 hour
Original Estimate: Not Specified

Attachments: PNG File inuse.png     PNG File provider.png     PNG File success.png    
Issue Links:
Duplicate
is duplicated by TRUNK-4527 Provide UI to "Delete Forever" unused... Closed
Complexity: Low

 Description   

Currently we are only allowing the user to retire providers as can seen at: http://snag.gy/s69nW.jpg
In this ticket, you are required to add a way on the provider's page like; ...openmrs/admin/provider/provider.form?providerId=2 of Deleting forever or purging a provider from the openmrs database,

This should only be allowed if there are no encounters associated with that provider.



 Comments   
Comment by Jakub Kondrat [ 2014-11-14 ]

PR: https://github.com/openmrs/openmrs-core/pull/1154

Comment by Daniel Kayiwa [ 2014-11-18 ]

Jakub Kondrat can you add some unit tests for this controller?

Comment by Jakub Kondrat [ 2014-12-02 ]

Daniel Kayiwa When I was adding the test it turned out that the provider deletion does not cascade to EncounterProviders and Orders. It results in the following exceptions:

Referential integrity constraint violation: "FKECB8777D8B226BCE: PUBLIC.ENCOUNTER_PROVIDER FOREIGN KEY(PROVIDER_ID) REFERENCES PUBLIC.PROVIDER(PROVIDER_ID) (1)"; SQL statement:
delete from provider where provider_id=? [23503-173]

Referential integrity constraint violation: "FKC3DF62E5C81E8A20: PUBLIC.ORDERS FOREIGN KEY(ORDERER) REFERENCES PUBLIC.PROVIDER(PROVIDER_ID) (1)"; SQL statement:
delete from provider where provider_id=? [23503-173]

Should I add encounterProvider and order sets to the Provider class/mappings, use existing services or manually purge the references using HQL?
https://github.com/jkondrat/openmrs-core/commit/6d80c950773f8529edcf26bae15688f543d4ea78

Comment by Darius Jazayeri [ 2014-12-02 ]

Per the description:

This should only be allowed if there are no encounters associated with that provider.
Comment by Jakub Kondrat [ 2015-01-08 ]

PR: https://github.com/openmrs/openmrs-core/pull/1242

Comment by Daniel Kayiwa [ 2015-01-09 ]

Jakub Kondrat can you attach a screenshot with the effects of your changes on the user interface?

Comment by Jakub Kondrat [ 2015-01-09 ]

Daniel Kayiwa
I have attached the screenshots

Comment by Daniel Kayiwa [ 2015-01-12 ]

Jakub Kondrat delete forever needs to be grouped separately as you can see here: http://uat01.openmrs.org:8080/openmrs/admin/encounters/encounterType.form?encounterTypeId=1

Comment by Jakub Kondrat [ 2015-01-15 ]

Daniel Kayiwa
I addressed your comments and updated the PR

Comment by Daniel Kayiwa [ 2015-01-15 ]

Merged at https://github.com/openmrs/openmrs-core/commit/97f4500bfb3e8709e1c11405b233db9b435208e1
Thanks Jakub Kondrat

Comment by Daniel Kayiwa [ 2015-01-15 ]

Jakub Kondrat you need to first ask the user to confirm this irreversible action.

Comment by Jakub Kondrat [ 2015-01-15 ]

Daniel Kayiwa
PR for confirmation dialog: https://github.com/openmrs/openmrs-core/pull/1277

Comment by Daniel Kayiwa [ 2015-01-15 ]

Jakub Kondrat just added another comment on github.

Comment by Daniel Kayiwa [ 2015-01-15 ]

Merged at https://github.com/openmrs/openmrs-core/commit/0933e3a3f44a40a5d2401a0cc0962f961e0a9b82
Thanks Jakub Kondrat

Generated at Thu Dec 13 11:25:08 UTC 2018 using JIRA 7.5.1#75006-sha1:7df2574a6cc842da727f00de4c5ce9ac07701368.