00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action.php';
00027
00028
00029
00030
00042
00043 class FF_Action_LoanReturnSummary extends FF_Action {
00044
00045
00052 function run()
00053 {
00054 $o_tableWidget =& new FF_Smarty('twoColumnTable');
00055 $o_tableWidget->assign(array('S_table_columns' => 1,
00056 'T_table_header' => $this->getTableHeaderText(), 'has_table_header' => true));
00057 $this->renderSummaryTable($o_tableWidget);
00058 $this->o_output->o_tpl->append('content_middle', $o_tableWidget->fetch());
00059 $this->o_output->setPageName($this->getPageName());
00060 return $this->o_nextAction;
00061 }
00062
00063
00064
00065
00074 function renderSummaryTable(&$in_tableWidget)
00075 {
00076 $a_borrowers = $this->o_model->getReturnBorrowers();
00077 if (count($a_borrowers) == 0) {
00078 $in_tableWidget->append('rows', array('has_content_cell' => true,
00079 'T_table_content_cell' => _('No items were marked as returned'),
00080 'S_table_content_cell' => 'style="font-style: italic; text-align: center;"'));
00081 return;
00082 }
00083
00084 require_once dirname(__FILE__) . '/../Output/Checkout.php';
00085 $o_chkoutOutput =& new FF_Output_Checkout();
00086 $b_haveAlerted = false;
00087 foreach ($a_borrowers as $s_borrowerId => $s_numItemsReturned) {
00088 $this->o_model->setBorrowerId($s_borrowerId);
00089 $tmp_data = $o_chkoutOutput->getLinkedBorrower($s_borrowerId) .
00090 ': ' . sprintf(_('%s Item(s) Returned'), $s_numItemsReturned) . ' (' .
00091 $this->o_output->popupLink(
00092 'receiptWin', _('Receipt For this Borrower'),
00093 array('actionId' => ACTION_RETURN_RECEIPT,
00094 'returnTimestamp' => time(),
00095 'isPopup' => 1, 'borrowerId' => $s_borrowerId)) .
00096 ')';
00097
00098 $o_result =& $this->o_model->getOpenLoansForBorrower();
00099 $in_tableWidget->append('rows', array('has_field_cell' => true,
00100 'T_table_field_cell' => $tmp_data));
00101 if ($o_result->numRows() == 0) {
00102 $in_tableWidget->append('rows', array('has_content_cell' => true,
00103 'T_table_content_cell' => _('Borrower has no open loans.'),
00104 'S_table_content_cell' => 'style="font-style: italic;"'));
00105 }
00106 else {
00107 if (!$b_haveAlerted) {
00108 $this->o_output->setMessage(_('At least one borrower who returned items still has an open loan.'), FASTFRAME_WARNING_MESSAGE);
00109 $b_haveAlerted = true;
00110 }
00111
00112 $tmp_data = '<div style="font-weight: bold;">' .
00113 $this->o_output->imgTag('exclamation.gif', 'mini') . ' ' .
00114 _('Open Loans') . ':</div>';
00115 while ($a_row = $o_result->fetchRow()) {
00116 $this->o_model->reset();
00117 $this->o_model->importFromArray($a_row);
00118 $tmp_data .= '<div style="padding-left: 15px; margin-top: 5px;">' .
00119 $this->o_output->popupLink(
00120 'receiptWin',
00121 $this->o_output->imgTag('view.gif', 'actions'),
00122 array('actionId' => ACTION_DISPLAY,
00123 'objectId' => $this->o_model->getId(),
00124 'isPopup' => 1,
00125 'returnActionId' => ACTION_DISPLAY_SUMMARY),
00126 array('title' => _('Display Loan'))) .
00127 ' ' . $this->o_model->getFormattedStartDate() . ' - ' .
00128 $this->o_model->getFormattedDueDate() .
00129 '</div>';
00130 }
00131
00132 $in_tableWidget->append('rows', array('has_content_cell' => true,
00133 'T_table_content_cell' => $tmp_data));
00134 }
00135 }
00136 }
00137
00138
00139
00140
00147 function getPageName()
00148 {
00149 return _('Loan Return Summary');
00150 }
00151
00152
00153
00154
00161 function getTableHeaderText()
00162 {
00163 return $this->getPageName();
00164 }
00165
00166
00167 }
00168 ?>