public boolean checkout(String memberId) { if (bookItem.getIsReferenceOnly()) { ShowError("This book is Reference only and can't be issued"); return(false); } if (!BookLending.lendBook(this.getBarCode(), memberId)) { return(false); } this.updateBookItemStatus(BookStatus.LOANED); return(true); }
public bool renewBookItem(BookItem bookItem) { this.checkForFine(bookItem.getBarcode()); BookReservation bookReservation = BookReservation.fetchReservationDetails(bookItem.getBarcode()); // check if this book item has a pending reservation from another member if (bookReservation != null && bookReservation.getMemberId() != this.getMemberId()) { ShowError("This book is reserved by another member"); member.decrementTotalBooksCheckedout(); bookItem.updateBookItemState(BookStatus.RESERVED); bookReservation.sendBookAvailableNotification(); return(false); } else if (bookReservation != null) { // book item has a pending reservation from this member bookReservation.updateStatus(ReservationStatus.COMPLETED); } BookLending.lendBook(bookItem.getBarCode(), this.getMemberId()); bookItem.updateDueDate(LocalDate.now().plusDays(Constants.MAX_LENDING_DAYS)); return(true); }