@@ -140,7 +140,7 @@ public <o extends Order> o getOrder(Integer orderId, Class<o> orderClassType) th
140
140
* java.util.List, java.util.List)
141
141
*/
142
142
public <Ord extends Order > List <Ord > getOrders (Class <Ord > orderClassType , List <Patient > patients ,
143
- List <Concept > concepts , List <User > orderers , List <Encounter > encounters ) {
143
+ List <Concept > concepts , List <User > orderers , List <Encounter > encounters ) {
144
144
if (orderClassType == null )
145
145
throw new APIException (
146
146
"orderClassType cannot be null. An order type of Order.class or DrugOrder.class is required" );
@@ -181,16 +181,17 @@ public synchronized String getNewOrderNumber() {
181
181
182
182
String gpTextValue = globalProperty .getPropertyValue ();
183
183
if (!StringUtils .hasText (gpTextValue )) {
184
- gpTextValue = ORDER_NUMBER_START_VALUE ;
184
+ throw new APIException ("Invalid value for global property named: "
185
+ + OpenmrsConstants .GLOBAL_PROPERTY_NEXT_ORDER_NUMBER );
185
186
}
186
187
187
188
Long gpNumericValue = null ;
188
189
try {
189
190
gpNumericValue = Long .parseLong (gpTextValue );
190
191
}
191
192
catch (NumberFormatException ex ) {
192
- gpNumericValue = 1l ;
193
- gpTextValue = ORDER_NUMBER_START_VALUE ;
193
+ throw new APIException ( "Invalid value for global property named: "
194
+ + OpenmrsConstants . GLOBAL_PROPERTY_NEXT_ORDER_NUMBER ) ;
194
195
}
195
196
196
197
String orderNumber = ORDER_NUMBER_PREFIX + gpTextValue ;
@@ -217,7 +218,8 @@ public Order getOrderByOrderNumber(String orderNumber) {
217
218
}
218
219
219
220
/**
220
- * @see org.openmrs.api.OrderService#getOrderHistoryByConcept(org.openmrs.Patient, org.openmrs.Concept)
221
+ * @see org.openmrs.api.OrderService#getOrderHistoryByConcept(org.openmrs.Patient,
222
+ * org.openmrs.Concept)
221
223
*/
222
224
@ Override
223
225
public List <Order > getOrderHistoryByConcept (Patient patient , Concept concept ) {
0 commit comments