Changeset 4156
- Timestamp:
- 05/09/08 13:36:21 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/trunk/src/web/org/openmrs/web/controller/patient/NewPatientFormController.java
r4095 r4156 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 newIdentifiers.add(pi); 178 179 179 180 if (log.isDebugEnabled()) { 180 log.debug("Creating patient identifier with identifier: " + id entifiers[i]);181 log.debug("Creating patient identifier with identifier: " + id); 181 182 log.debug("and type: " + types[i]); 182 183 log.debug("and location: " + locs[i]); … … 184 185 185 186 try { 186 if (pit.hasCheckDigit() && !OpenmrsUtil.isValidCheckDigit(id entifiers[i])) {187 log.error("hasCheckDigit and is not valid: " + pit.getName() + " " + id entifiers[i]);187 if (pit.hasCheckDigit() && !OpenmrsUtil.isValidCheckDigit(id)) { 188 log.error("hasCheckDigit and is not valid: " + pit.getName() + " " + id); 188 189 String msg = getMessageSourceAccessor().getMessage("error.checkdigits.verbose", args); 189 190 errors.rejectValue("identifier", msg); 190 191 } 191 // else if (pit.hasCheckDigit() == false && id entifiers[i].contains("-")) {192 // log.error("hasn't CheckDigit and contains '-': " + pit.getName() + " " + id entifiers[i]);193 // String[] args2 = {"-", id entifiers[i]};192 // else if (pit.hasCheckDigit() == false && id.contains("-")) { 193 // log.error("hasn't CheckDigit and contains '-': " + pit.getName() + " " + id); 194 // String[] args2 = {"-", id}; 194 195 // String msg = getMessageSourceAccessor().getMessage("error.character.invalid", args2); 195 196 // errors.rejectValue("identifier", msg); 196 197 // } 197 198 } catch (Exception e) { 198 log.error("exception thrown with: " + pit.getName() + " " + id entifiers[i]);199 log.error("exception thrown with: " + pit.getName() + " " + id); 199 200 log.error("Error while adding patient identifiers to savedIdentifier list", e); 200 201 String msg = getMessageSourceAccessor().getMessage("error.checkdigits", args);