Does this work? p = person.getPersion(20384) person.unvoidPersion(p)
Cheers, -Burke On Mon, Mar 26, 2012 at 10:18 PM, Erick Mugoma <[email protected]>wrote: > Thanks Ben and Mark. > The guideline worked fine especially when using the uuid. However I also > wrote the following code to unvoid the person but it failed. Maybe am using > the wrong method call?? see the code below: > > org.openmrs.Person px = person.getPerson(20384); > px.setVoided(false); > px.setVoidReason(""); > px.setVoidedBy(null); > person.savePerson(px); > > The above code runs successfully but no changes are persisted to the > database. > > Thanks > > Erick > > > On Mon, Mar 26, 2012 at 6:10 PM, Ben Wolfe <[email protected]> wrote: > >> I was going to suggest that Mark, but then looked at the javadocs. Looks >> like there is a PatientService.voidPatientIdentfier(PI, String) method that >> makes this easier >> >> You could do: >> PatientIdentifier pi = >> patient.getPatientIdentifierByUuid("123wf9329349234"); >> patient.voidPatientIdentifier(pi, "because it smells like moldy cheese"); >> >> (assuming "patient" is still aliased to Context.getPatientService()) >> >> See http://api.openmrs.org for latest javadoc. (or >> http://resources.openmrs.org/doc-1.8/ for earlier) >> >> Ben >> >> >> On Mon, Mar 26, 2012 at 10:49 AM, Mark Goodrich <[email protected]>wrote: >> >>> Erick,**** >>> >>> ** ** >>> >>> I haven’t tested this, but if you know the id of the patient identifier, >>> you should be able to do something like this:**** >>> >>> ** ** >>> >>> org.openmrs.PatientIdentifier identifier = >>> patient.getPatientIdentifier(123);**** >>> >>> identifier.setVoided(false);**** >>> >>> identifier.setVoidReason("");**** >>> >>> identifier.setVoidedBy(null);**** >>> >>> patient.savePatientIdentifier(identifier);**** >>> >>> ** ** >>> >>> Take care,**** >>> >>> Mark**** >>> >>> ** ** >>> >>> *From:* [email protected] [mailto:[email protected]] *On >>> Behalf Of *Erick Mugoma >>> *Sent:* Monday, March 26, 2012 12:41 AM >>> *To:* [email protected] >>> *Subject:* [OPENMRS-IMPLEMENTERS] Groovy code to Un-void Patient >>> Identifier**** >>> >>> ** ** >>> >>> Hi >>> Can someone show me how to write a simple groovy code that can be used >>> to un-void a specific patient Identifier. I don't want to do this using SQL >>> since we are running the sync module and I want the changes to be >>> propagated to all the children. >>> >>> Any help will be greatly appreciated. >>> >>> Thanks >>> >>> Erick**** >>> ------------------------------ >>> >>> Click here to >>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from >>> OpenMRS Implementers' mailing list >>> **** >>> ------------------------------ >>> Click here to >>> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from >>> OpenMRS Implementers' mailing list >>> >> >> ------------------------------ >> Click here to >> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from >> OpenMRS Implementers' mailing list >> > > ------------------------------ > Click here to > unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from > OpenMRS Implementers' mailing list > _________________________________________ To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to [email protected] with "SIGNOFF openmrs-implement-l" in the body (not the subject) of your e-mail. [mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l]

