Exemplo n.º 1
0
    def returnBook(self, args, recForUndo = True):
        r = Rental(int(args[0]), 1, 1, date.today(), date.today(), False)
        r = self._repo.find(r)
        old_r = deepcopy(self._repo.find(r))
        self._validator.rentalValidator(r)
        r.retDate = date.today()
        self._repo.upd(r)

        if recForUndo == True:
            undo = FunctionCall(self.updateRental, [old_r.id, old_r.bookId, old_r.clientId, old_r.renDate, old_r.dueDate, old_r.retDate], False)
            redo = FunctionCall(self.updateRental, [r.id, r.bookId, r.clientId, r.renDate, r.dueDate, r.retDate], False)
            operation = Operation(redo, undo)
            self._undo_ctrl.recordOp(operation)
Exemplo n.º 2
0
 def returnBook(self, args):
     r = Rental(int(args[0]), 1, 1, date.today(), date.today(), False)
     r = self.__rental_repo.find(r)
     self.__validator.rentalValidator(r)
     r.retDate = date.today()