query(sprintf("SELECT L.loan_id, b.title, ct.coll_type_name, i.item_code, L.loan_date, L.due_date, L.return_date, L.renewed, IF(lr.reborrow_limit IS NULL, IF(L.renewed>=mt.reborrow_limit, 1, 0), IF(L.renewed>=lr.reborrow_limit, 1, 0)) AS extend FROM loan AS L LEFT JOIN item AS i ON L.item_code=i.item_code LEFT JOIN mst_coll_type AS ct ON i.coll_type_id=ct.coll_type_id LEFT JOIN member AS m ON L.member_id=m.member_id LEFT JOIN mst_member_type AS mt ON m.member_type_id=mt.member_type_id LEFT JOIN mst_loan_rules AS lr ON mt.member_type_id=lr.member_type_id AND i.coll_type_id = lr.coll_type_id LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id WHERE L.is_lent=1 AND L.is_return=0 AND L.member_id='%s'", $memberID)); // query modified by Indra Sutriadi // create table object $loan_list = new simbio_table(); $loan_list->table_attr = 'align="center" width="100%" cellpadding="3" cellspacing="0"'; $loan_list->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"'; $loan_list->highlight_row = true; // table header $headers = array(__('Return'), __('Extend'), __('Item Code'), __('Title'), __('Col. Type'), __('Loan Date'), __('Due Date')); $loan_list->setHeader($headers); // row number init $row = 1; $is_overdue = false; /* modified by Indra Sutriadi */ $circulation->ignore_holidays_fine_calc = $sysconf['ignore_holidays_fine_calc']; $circulation->holiday_dayname = $_SESSION['holiday_dayname']; $circulation->holiday_date = $_SESSION['holiday_date']; /* end of modification */ while ($loan_list_data = $loan_list_query->fetch_assoc()) { // alternate the row color $row_class = ($row%2 == 0)?'alterCell':'alterCell2'; // return link $return_link = ' '; // extend link // check if membership already expired if ($_SESSION['is_expire']) { $extend_link = ' '; } else { // check if this loan just already renewed if ($loan_list_data['return_date'] == date('Y-m-d') || in_array($loan_list_data['loan_id'], $_SESSION['reborrowed']) || $loan_list_data['extend'] == 1) { $extend_link = ' '; } else { $extend_link = ' '; } } // renewed flag if ($loan_list_data['renewed'] > 0) { $loan_list_data['title'] = $loan_list_data['title'].' - '.__('Extended').''; } // check for overdue $curr_date = date('Y-m-d'); $overdue = $circulation->countOverdueValue($loan_list_data['loan_id'], $curr_date); if ($overdue) { $is_overdue = true; $loan_list_data['title'] .= '
'.__('OVERDUED for').' '.$overdue['days'].' '.__('days(s) with fines value').' '.$overdue['value'].'
'; //mfc } // row colums array $fields = array( $return_link, $extend_link, $loan_list_data['item_code'], $loan_list_data['title'], $loan_list_data['coll_type_name'], $loan_list_data['loan_date'], $loan_list_data['due_date'] ); // append data to table row $loan_list->appendTableRow($fields); // set the HTML attributes $loan_list->setCellAttr($row, null, "valign='top' class='$row_class'"); $loan_list->setCellAttr($row, 0, "valign='top' align='center' class='$row_class' style='width: 5%;'"); $loan_list->setCellAttr($row, 1, "valign='top' align='center' class='$row_class' style='width: 5%;'"); $loan_list->setCellAttr($row, 2, "valign='top' class='$row_class' style='width: 10%;'"); $loan_list->setCellAttr($row, 3, "valign='top' class='$row_class' style='width: 50%;'"); $loan_list->setCellAttr($row, 4, "valign='top' class='$row_class' style='width: 15%;'"); $row++; } // show reservation alert if any if (isset($_GET['reserveAlert']) AND !empty($_GET['reserveAlert'])) { $reservedItem = $dbs->escape_string(trim($_GET['reserveAlert'])); // get reservation data $reserve_q = $dbs->query(sprintf('SELECT r.member_id, m.member_name FROM reserve AS r LEFT JOIN member AS m ON r.member_id=m.member_id WHERE item_code=\'%s\' ORDER BY reserve_date ASC LIMIT 1', $reservedItem)); $reserve_d = $reserve_q->fetch_row(); $member = $reserve_d[1].' ('.$reserve_d[0].')'; $reserve_msg = str_replace(array('{itemCode}', '{member}'), array(''.$reservedItem.'', ''.$member.''), __('Item {itemCode} is being reserved by member {member}')); echo '
'.$reserve_msg.'
'; } // create e-mail lin if there is overdue if ($is_overdue) { echo '
'.__('Send overdues notice e-mail').'
'."\n"; } echo $loan_list->printTable(); // hidden form for return and extend process echo '
'; ?>