/**
  * extend item loan
  * @param   integer $int_loan_id
  * @return  integer/boolean
  **/
 public function extendItemLoan($int_loan_id)
 {
     // check if this item is being reserved by other member
     $_resv_q = $this->obj_db->query("SELECT l.item_code FROM reserve AS rs\n            INNER JOIN loan AS l ON rs.item_code=l.item_code\n            WHERE l.loan_id={$int_loan_id} AND rs.member_id!='" . $_SESSION['memberID'] . "'");
     if ($_resv_q->num_rows > 0) {
         return ITEM_RESERVED;
     }
     // return this item first
     self::returnItem($int_loan_id);
     // get loan rules for this loan
     $_loan_rules_q = $this->obj_db->query("SELECT loan_periode FROM mst_loan_rules AS lr LEFT JOIN\n            loan AS l ON lr.loan_rules_id=l.loan_rules_id WHERE loan_id={$int_loan_id}");
     if ($_loan_rules_q->num_rows > 0) {
         $_loan_rules_d = $_loan_rules_q->fetch_row();
         $this->loan_periode = $_loan_rules_d[0];
     }
     // due date
     $_loan_date = date('Y-m-d');
     // calculate due date
     $_due_date = simbio_date::getNextDate($this->loan_periode, $_loan_date);
     $_due_date = simbio_date::getNextDateNotHoliday($_due_date, $this->holiday_dayname, $this->holiday_date);
     $query = $this->obj_db->query("UPDATE loan SET renewed=renewed+1, due_date='{$_due_date}', is_return=0\n            WHERE loan_id={$int_loan_id} AND member_id='" . $this->member_id . "'");
     $_SESSION['reborrowed'][] = $int_loan_id;
     // add to receipt
     if (isset($_SESSION['receipt_record'])) {
         // get item data
         $_title_q = $this->obj_db->query('SELECT b.title, l.item_code FROM loan AS l
             LEFT JOIN item AS i ON l.item_code=i.item_code
             INNER JOIN biblio AS b ON i.biblio_id=b.biblio_id WHERE l.loan_id=' . $int_loan_id);
         $_title_d = $_title_q->fetch_assoc();
         $_SESSION['receipt_record']['extend'][] = array('itemCode' => $_title_d['item_code'], 'title' => $_title_d['title'], 'loanDate' => $_loan_date, 'dueDate' => $_due_date);
     }
     return true;
 }
 /**
  * extend item loan
  * @param   integer $int_loan_id
  * @return  integer/boolean
  **/
 public function extendItemLoan($int_loan_id)
 {
     // check if this item is being reserved by other member
     $_resv_q = $this->obj_db->query("SELECT l.item_code FROM reserve AS rs\n            INNER JOIN loan AS l ON rs.item_code=l.item_code\n            WHERE l.loan_id={$int_loan_id} AND rs.member_id!='" . $_SESSION['memberID'] . "'");
     if ($_resv_q->num_rows > 0) {
         return ITEM_RESERVED;
     }
     // return this item first
     self::returnItem($int_loan_id);
     // get loan rules for this loan
     $_loan_rules_q = $this->obj_db->query("SELECT loan_periode FROM mst_loan_rules AS lr LEFT JOIN\n            loan AS l ON lr.loan_rules_id=l.loan_rules_id WHERE loan_id={$int_loan_id}");
     if ($_loan_rules_q->num_rows > 0) {
         $_loan_rules_d = $_loan_rules_q->fetch_row();
         $this->loan_periode = $_loan_rules_d[0];
     }
     // due date
     $_loan_date = date('Y-m-d');
     // calculate due date
     $_due_date = simbio_date::getNextDate($this->loan_periode, $_loan_date);
     $_due_date = simbio_date::getNextDateNotHoliday($_due_date, $this->holiday_dayname, $this->holiday_date);
     $query = $this->obj_db->query("UPDATE loan SET renewed=renewed+1, due_date='{$_due_date}', is_return=0\n            WHERE loan_id={$int_loan_id} AND member_id='" . $this->member_id . "'");
     $_SESSION['reborrowed'][] = $int_loan_id;
     return true;
 }