Source:
<code>public DrugOrder map(EncounterTransaction.DrugOrder drugOrder, Encounter encounter) { DrugOrder openMRSDrugOrder = createDrugOrder(drugOrder); openMRSDrugOrder.setCareSetting(getCareSettingFrom(drugOrder, openMRSDrugOrder)); Drug drug = getDrugFrom(drugOrder, openMRSDrugOrder); if(drug == null) { throw new APIException("No such drug : " + drugOrder.getDrug().getName()); } openMRSDrugOrder.setDrug(drug); openMRSDrugOrder.setEncounter(encounter); openMRSDrugOrder.setDateActivated(drugOrder.getDateActivated()); openMRSDrugOrder.setScheduledDate(drugOrder.getScheduledDate()); openMRSDrugOrder.setUrgency(drugOrder.getScheduledDate() != null ? Order.Urgency.ON_SCHEDULED_DATE : DEFAULT_URGENCY); openMRSDrugOrder.setDuration(drugOrder.getDuration()); openMRSDrugOrder.setDurationUnits(orderMetadataService.getDurationUnitsConceptByName(drugOrder.getDurationUnits())); try { if (drugOrder.getDosingInstructionType() != null) { openMRSDrugOrder.setDosingType((Class<? extends DosingInstructions>) Context.loadClass(drugOrder.getDosingInstructionType())); } } catch (ClassNotFoundException e) { throw new APIException("Class not found for : DosingInstructionType " + drugOrder.getDosingInstructionType(), e); } if (Order.Action.REVISE == openMRSDrugOrder.getAction() && openMRSDrugOrder.getDuration() != null) { <START> openMRSDrugOrder.setAutoExpireDate(null); <END> } dosingInstructionsMapper.map(drugOrder.getDosingInstructions(), openMRSDrugOrder); openMRSDrugOrder.setInstructions(drugOrder.getInstructions()); Provider provider = encounter.getEncounterProviders().iterator().next().getProvider(); openMRSDrugOrder.setOrderer(provider); return openMRSDrugOrder; }</code><technical_language>This allow clients send auto expire date. Instead of setting null, copy auto expire date client (regardless of order action duration)</technical_language>

Target:
public DrugOrder map(EncounterTransaction.DrugOrder drugOrder, Encounter encounter) { DrugOrder openMRSDrugOrder = createDrugOrder(drugOrder); openMRSDrugOrder.setCareSetting(getCareSettingFrom(drugOrder, openMRSDrugOrder)); Drug drug = getDrugFrom(drugOrder, openMRSDrugOrder); if (drug == null) { throw new APIException("No such drug : " + drugOrder.getDrug().getName()); } openMRSDrugOrder.setDrug(drug); openMRSDrugOrder.setEncounter(encounter); openMRSDrugOrder.setDateActivated(drugOrder.getDateActivated()); openMRSDrugOrder.setScheduledDate(drugOrder.getScheduledDate()); openMRSDrugOrder.setUrgency(drugOrder.getScheduledDate() != null ? Order.Urgency.ON_SCHEDULED_DATE : DEFAULT_URGENCY); openMRSDrugOrder.setDuration(drugOrder.getDuration()); openMRSDrugOrder.setDurationUnits(orderMetadataService.getDurationUnitsConceptByName(drugOrder.getDurationUnits())); openMRSDrugOrder.setAutoExpireDate(drugOrder.getAutoExpireDate()); try { if (drugOrder.getDosingInstructionType() != null) { openMRSDrugOrder.setDosingType((Class<? extends DosingInstructions>) Context.loadClass(drugOrder.getDosingInstructionType())); } } catch (ClassNotFoundException e) { throw new APIException("Class not found for : DosingInstructionType " + drugOrder.getDosingInstructionType(), e); } dosingInstructionsMapper.map(drugOrder.getDosingInstructions(), openMRSDrugOrder); openMRSDrugOrder.setInstructions(drugOrder.getInstructions()); Provider provider = encounter.getEncounterProviders().iterator().next().getProvider(); openMRSDrugOrder.setOrderer(provider); return openMRSDrugOrder; }