Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
08/06/08 17:17:55 (5 months ago)
Author:
mseaton
Message:

synchronization_bidirectional_branch: merge from [4734] to [5181].

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/branches/data_synchronization_bidirectional/src/api/org/openmrs/api/impl/EncounterServiceImpl.java

    r4969 r5183  
    3131import org.openmrs.api.EncounterService; 
    3232import org.openmrs.api.ObsService; 
     33import org.openmrs.api.OrderService; 
    3334import org.openmrs.api.context.Context; 
    3435import org.openmrs.api.db.EncounterDAO; 
     
    6162         * @see org.openmrs.api.EncounterService#saveEncounter(org.openmrs.Encounter) 
    6263         */ 
    63         public void saveEncounter(Encounter encounter) throws APIException { 
     64        public Encounter saveEncounter(Encounter encounter) throws APIException { 
    6465                Date now = new Date(); 
    6566                User me = Context.getAuthenticatedUser(); 
     
    151152                        } 
    152153                } 
     154                return encounter; 
    153155        } 
    154156 
     
    211213         *      java.lang.String) 
    212214         */ 
    213         public void voidEncounter(Encounter encounter, String reason) { 
     215        public Encounter voidEncounter(Encounter encounter, String reason) { 
    214216                if (reason == null) 
    215217                        reason = ""; 
     
    221223                        } 
    222224                } 
     225                 
     226                OrderService orderService = Context.getOrderService(); 
     227                for (Order o : encounter.getOrders()) { 
     228                        if (!o.isVoided()) { 
     229                                orderService.voidOrder(o, reason); 
     230                        } 
     231                } 
    223232 
    224233                encounter.setVoided(true); 
     
    227236                encounter.setVoidReason(reason); 
    228237                saveEncounter(encounter); 
     238                return encounter; 
    229239        } 
    230240 
     
    232242         * @see org.openmrs.api.EncounterService#unvoidEncounter(org.openmrs.Encounter) 
    233243         */ 
    234         public void unvoidEncounter(Encounter encounter) throws APIException { 
     244        public Encounter unvoidEncounter(Encounter encounter) throws APIException { 
    235245                String voidReason = encounter.getVoidReason(); 
    236246                if (voidReason == null) 
     
    248258                encounter.setVoidReason(null); 
    249259                saveEncounter(encounter); 
     260                return encounter; 
    250261        } 
    251262 
     
    290301         * @see org.openmrs.api.EncounterService#saveEncounterType(org.openmrs.EncounterType) 
    291302         */ 
    292         public void saveEncounterType(EncounterType encounterType) { 
     303        public EncounterType saveEncounterType(EncounterType encounterType) { 
    293304                if (encounterType.getCreator() == null) { 
    294305                        encounterType.setCreator(Context.getAuthenticatedUser()); 
     
    297308                 
    298309                dao.saveEncounterType(encounterType); 
     310                return encounterType; 
    299311        } 
    300312 
     
    340352         * @see org.openmrs.api.EncounterService#retireEncounterType(org.openmrs.EncounterType) 
    341353         */ 
    342         public void retireEncounterType(EncounterType encounterType, String reason) 
     354        public EncounterType retireEncounterType(EncounterType encounterType, String reason) 
    343355                throws APIException { 
    344356                encounterType.setRetired(true); 
     
    346358                encounterType.setDateRetired(new Date()); 
    347359                encounterType.setRetireReason(reason); 
    348                 dao.saveEncounterType(encounterType); 
     360                saveEncounterType(encounterType); 
     361                return encounterType; 
    349362        } 
    350363 
     
    352365         * @see org.openmrs.api.EncounterService#unretireEncounterType(org.openmrs.EncounterType) 
    353366         */ 
    354         public void unretireEncounterType(EncounterType encounterType) 
     367        public EncounterType unretireEncounterType(EncounterType encounterType) 
    355368                throws APIException { 
    356369                encounterType.setRetired(false); 
     
    358371                encounterType.setDateRetired(null); 
    359372                encounterType.setRetireReason(null); 
    360                 dao.saveEncounterType(encounterType); 
     373                saveEncounterType(encounterType); 
     374                return encounterType; 
    361375        } 
    362376