Beispiel #1
0
 public function getDueDate()
 {
     $c = new Criteria();
     $c->add(CirHistoryPeer::COL_ITEM_ID, $this->getId());
     $c->add(CirHistoryPeer::RETURN_DATE, null, Criteria::EQUAL);
     $c->addOr(CirHistoryPeer::RETURN_DATE, '', Criteria::EQUAL);
     $ch = CirHistoryPeer::doSelectOne($c);
     return $ch->getDueDate('d-m-Y H:i:s');
 }
Beispiel #2
0
    echo $item->getCollection()->getCatalog()->getCatCategory()->toString();
    ?>
"
</td></tr>
</table>
<?php 
} else {
    $member_id = $item->getMemberId();
    #$member_name = $member_id == null? null : $item->getMember()->getName();
    $status_name = $member_id == null ? null : $item->getColStatus()->getName();
    if ($member_id) {
        $c = new Criteria();
        #$c->add(CirHistoryPeer::MEMBER_ID, $member_id);
        $c->add(CirHistoryPeer::COL_ITEM_ID, $item->getId());
        $c->add(CirHistoryPeer::RETURN_DATE, null);
        $cir_hist = CirHistoryPeer::doSelectOne($c);
    }
    $actions = array();
    array_push($actions, array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
    array_push($actions, array('name' => 'cancel', 'url' => "{$returnModule}/{$returnAction}", 'color' => 'white'));
    echo form_remote_tag(array('url' => 'col_item/doOrder', 'update' => 'content', 'script' => 'true', 'name' => 'edit_form', 'before' => "this.blur();showIndicator('content', 'snakebig_black');", 'complete' => "hideIndicator()"));
    echo include_partial('global/title', array('actions' => $actions, 'subtitle' => $item->toString() . ($sf_request->hasErrors() ? '<div class=form_error>* ' . __('_FORM_HAS_ERROR_') . '</div>' : ''), 'type' => '', 'title' => __($_title)));
    ?>

<?php 
    echo object_input_hidden_tag($item, 'getId');
    echo input_hidden_tag('action_type', '');
    echo input_hidden_tag('member_id', $member->getId());
    echo input_hidden_tag('return_module', $returnModule);
    echo input_hidden_tag('return_action', $returnAction);
    ?>
Beispiel #3
0
 public function getCirHistoryId($criteria = null, $con = null)
 {
     $c = new Criteria();
     $c->add(CirHistoryPeer::MEMBER_ID, $this->getId());
     return CirHistoryPeer::doSelectOne($c);
 }
Beispiel #4
0
 public function executeReturnOrder()
 {
     $this->returnModule = 'visitor_list';
     $this->returnAction = 'return';
     $this->_title = 'ReturnOrder';
     $this->item = ColItemPeer::retrieveByPK($this->getRequestParameter('id'));
     $c = new Criteria();
     $c->add(CirHistoryPeer::COL_ITEM_ID, $this->item->getId());
     $c->add(CirHistoryPeer::RETURN_DATE, null);
     $cir_hist = CirHistoryPeer::doSelectOne($c);
     $this->member = $cir_hist->getMember();
     $this->max_loan_limit = false;
     $this->forward404Unless($this->item);
     $this->setTemplate('order');
 }
Beispiel #5
0
 public function executeDoOrder()
 {
     $return_module = $this->getRequestParameter('return_module');
     $return_action = $this->getRequestParameter('return_action');
     #$member = MemberPeer::retrieveByCode($this->getRequestParameter('code'));
     $member_id = $this->getRequestParameter('member_id');
     $col_item_id = $this->getRequestParameter('id');
     $order_type = $this->getRequestParameter('order_type');
     $c = new Criteria();
     $c->add(ColStatusPeer::CODE, $order_type, Criteria::EQUAL);
     $col_status = ColStatusPeer::doSelectOne($c);
     $col_item = ColItemPeer::retrieveByPK($col_item_id);
     $this->forward404Unless($member_id && $col_item && $col_status);
     $col_item->setColStatus($col_status);
     $now = time();
     if ($order_type == 'available') {
         $col_item->setMemberId(null);
         $col_item->setColConditionId($this->getRequestParameter('col_condition_id'));
         $c = new Criteria();
         $c->add(CirHistoryPeer::MEMBER_ID, $member_id);
         $c->add(CirHistoryPeer::COL_ITEM_ID, $col_item_id);
         $c->add(CirHistoryPeer::RETURN_DATE, null);
         $cir_hist = CirHistoryPeer::doSelectOne($c);
         $cir_hist->setReturnDate(date('Y-m-d H:i:s', $now));
         $cir_hist->setReturnNote($this->getRequestParameter('return_note'));
         $cir_hist->setFine($this->getRequestParameter('fine'));
         $cir_hist->setMiscFine($this->getRequestParameter('misc_fine'));
         $cir_hist->save();
     } else {
         $col_item->setMemberId($member_id);
         $cir_hist = new CirHistory();
         $cir_hist->setColItem($col_item);
         $cir_hist->setMemberId($member_id);
         $cir_hist->setColStatus($col_status);
         $cir_hist->setOrderDate(date('Y-m-d H:i:s', $now));
         $cir_hist->setOrderNote($this->getRequestParameter('order_note'));
         $cir_hist->setDueDate(date('Y-m-d H:i:s', $cir_hist->getRegulation()->getLoanLength() * 60 * 60 * 24 + $now));
         $cir_hist->save();
     }
     $col_item->save();
     $this->forward($return_module, $return_action);
 }