Changeset 4161 for openmrs/branches/data_synchronization_bidirectional/src/web/org/openmrs/web/controller/patient/NewPatientFormController.java
- Timestamp:
- 05/09/08 21:34:56 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/branches/data_synchronization_bidirectional/src/web/org/openmrs/web/controller/patient/NewPatientFormController.java
r4121 r4161 151 151 for (int i=0; i<identifiers.length;i++) { 152 152 // arguments for the spring error messages 153 String[] args = {identifiers[i]}; 153 String id = identifiers[i].trim(); 154 String[] args = {id}; 154 155 155 156 // add the new identifier only if they put in some identifier string 156 if (id entifiers[i].length() > 0) {157 if (id.length() > 0) { 157 158 158 159 // set up the actual identifier java object … … 173 174 loc = es.getLocation(Integer.valueOf(locs[i])); 174 175 175 PatientIdentifier pi = new PatientIdentifier(id entifiers[i], pit, loc);176 pi.setPreferred(pref.equals(id entifiers[i]+types[i]));176 PatientIdentifier pi = new PatientIdentifier(id, pit, loc); 177 pi.setPreferred(pref.equals(id+types[i])); 177 178 pi.setGuid(null); 178 179 newIdentifiers.add(pi); 179 180 180 181 if (log.isDebugEnabled()) { 181 log.debug("Creating patient identifier with identifier: " + id entifiers[i]);182 log.debug("Creating patient identifier with identifier: " + id); 182 183 log.debug("and type: " + types[i]); 183 184 log.debug("and location: " + locs[i]); … … 185 186 186 187 try { 187 if (pit.hasCheckDigit() && !OpenmrsUtil.isValidCheckDigit(id entifiers[i])) {188 log.error("hasCheckDigit and is not valid: " + pit.getName() + " " + id entifiers[i]);188 if (pit.hasCheckDigit() && !OpenmrsUtil.isValidCheckDigit(id)) { 189 log.error("hasCheckDigit and is not valid: " + pit.getName() + " " + id); 189 190 String msg = getMessageSourceAccessor().getMessage("error.checkdigits.verbose", args); 190 191 errors.rejectValue("identifier", msg); 191 192 } 192 // else if (pit.hasCheckDigit() == false && id entifiers[i].contains("-")) {193 // log.error("hasn't CheckDigit and contains '-': " + pit.getName() + " " + id entifiers[i]);194 // String[] args2 = {"-", id entifiers[i]};193 // else if (pit.hasCheckDigit() == false && id.contains("-")) { 194 // log.error("hasn't CheckDigit and contains '-': " + pit.getName() + " " + id); 195 // String[] args2 = {"-", id}; 195 196 // String msg = getMessageSourceAccessor().getMessage("error.character.invalid", args2); 196 197 // errors.rejectValue("identifier", msg); 197 198 // } 198 199 } catch (Exception e) { 199 log.error("exception thrown with: " + pit.getName() + " " + id entifiers[i]);200 log.error("exception thrown with: " + pit.getName() + " " + id); 200 201 log.error("Error while adding patient identifiers to savedIdentifier list", e); 201 202 String msg = getMessageSourceAccessor().getMessage("error.checkdigits", args);