Changeset 5294
- Timestamp:
- 08/16/08 15:01:43 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/registration/metadata/config.xml
r5217 r5294 6 6 <id>registration</id> 7 7 <name>Registration Module</name> 8 <version> 1.0</version>8 <version>0.7</version> 9 9 <package>org.openmrs.module.@MODULE_ID@</package> 10 10 <author>Saptarshi Purkayastha</author> openmrs-modules/registration/metadata/moduleApplicationContext.xml
r5217 r5294 26 26 <property name="sessionForm"><value>true</value></property> 27 27 <property name="commandName"><value>patient</value></property> 28 <property name="successView"><value>registrationSummary.list</value></property>28 <property name="successView"><value>registrationSummary.list</value></property> 29 29 <property name="commandClass"><value>org.openmrs.module.registration.model.RegisterPatientModel</value></property> 30 30 <property name="formView"><value>/module/@MODULE_ID@/registerPatientForm</value></property> openmrs-modules/registration/web/src/org/openmrs/module/registration/web/controller/RegisterPatientFormController.java
r5259 r5294 30 30 import org.dom4j.io.SAXReader; 31 31 import org.dom4j.io.XMLWriter; 32 import org.jaxen.XPath; 33 import org.jaxen.dom4j.Dom4jXPath; 32 34 import org.openmrs.Location; 33 35 import org.openmrs.Patient; … … 66 68 Location location = new Location(1); 67 69 PatientIdentifierType identType = patientService.getPatientIdentifierType(1); 68 PatientIdentifier patientIdentifier = new PatientIdentifier(patientModel.getIdentifierString(), identType, location); 70 String patientIdentifierString = patientModel.getIdentifierString(); 71 PatientIdentifier patientIdentifier = new PatientIdentifier(patientIdentifierString, identType, location); 69 72 openmrsPatient.addIdentifier(patientIdentifier); 70 73 … … 79 82 Document document = reader.read(availableIDs.toURI().toURL()); 80 83 Element root = document.getRootElement(); 81 List list = document.selectNodes("//patientIDs/available"); 84 XPath xpathSelector = new Dom4jXPath("//patientIDs/available"); 85 List list = xpathSelector.selectNodes(document); 82 86 if (list.size() > 0) { 83 87 Element usedNode = (Element) list.get(0); … … 91 95 writer.write(document); 92 96 writer.close(); 93 97 94 98 patientService.savePatient(openmrsPatient); 95 return new ModelAndView(new RedirectView(getSuccessView() ));99 return new ModelAndView(new RedirectView(getSuccessView()+"?patientIdentifier="+patientIdentifierString)); 96 100 } 97 101 … … 130 134 SAXReader reader = new SAXReader(); 131 135 Document document = reader.read(availableIDs.toURI().toURL()); 132 Element root = document.getRootElement();133 List list = document.selectNodes("//patientIDs/available");136 XPath xpathSelector = new Dom4jXPath("//patientIDs/available"); 137 List list = xpathSelector.selectNodes(document); 134 138 if (list.size() > 0) { 135 139 if (list.size() < 5) { 136 registerPatientModel.setMessage("Very Few IDs (" +list.size()+") Left. Please Upload New IDs");140 registerPatientModel.setMessage("Very Few IDs (" + list.size() + ") Left. Please Upload New IDs"); 137 141 } 138 142 registerPatientModel.setIdentifierString(((Element) list.get(0)).getText()); 139 } 140 else { 143 } else { 141 144 registerPatientModel.setMessage("No Identifiers Left. Please Upload New IDs"); 142 145 } 143 } else{146 } else { 144 147 registerPatientModel.setMessage("AvailableIDs File Not Found. Please Upload Generated File from Options Page"); 145 148 }