Example #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');
 }
Example #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);
    ?>
Example #3
0
 public function getJobCategory($criteria = null, $con = null)
 {
     $c = new Criteria();
     $c->add(CirHistoryPeer::MEMBER_ID, $this->getId());
     return CirHistoryPeer::doSelect($c);
 }
Example #4
0
 public function getCirHistorysJoinMember($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseCirHistoryPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collCirHistorys === null) {
         if ($this->isNew()) {
             $this->collCirHistorys = array();
         } else {
             $criteria->add(CirHistoryPeer::COL_STATUS_ID, $this->getId());
             $this->collCirHistorys = CirHistoryPeer::doSelectJoinMember($criteria, $con);
         }
     } else {
         $criteria->add(CirHistoryPeer::COL_STATUS_ID, $this->getId());
         if (!isset($this->lastCirHistoryCriteria) || !$this->lastCirHistoryCriteria->equals($criteria)) {
             $this->collCirHistorys = CirHistoryPeer::doSelectJoinMember($criteria, $con);
         }
     }
     $this->lastCirHistoryCriteria = $criteria;
     return $this->collCirHistorys;
 }
Example #5
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(CirHistoryPeer::ID, $pks, Criteria::IN);
         $objs = CirHistoryPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #6
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = CirHistoryPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setColItemId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setMemberId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setColStatusId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setOrderDate($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setDueDate($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setReturnDate($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setOrderNote($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setReturnNote($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setFine($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setMiscFine($arr[$keys[10]]);
     }
 }
Example #7
0
 public function executeTest()
 {
     $criteria = new Criteria();
     $criteria->addAsColumn("jumlah", 'COUNT(' . CirHistoryPeer::MEMBER_ID . ')');
     $criteria->addGroupByColumn(CirHistoryPeer::MEMBER_ID);
     $criteria->setLimit(10);
     $data = CirHistoryPeer::doSelect($criteria);
     foreach ($data as $d) {
         var_dump($d->toArray());
         echo '<hr />';
     }
     die;
 }
Example #8
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');
 }
Example #9
0
 public function filterLate($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'CODE3') {
             $c->addJoin(CirHistoryPeer::MEMBER_ID, MemberPeer::ID);
             $column = MemberPeer::gettableMap()->getColumn('CODE3');
         } elseif ($key == 'CODE') {
             $c->addJoin(CirHistoryPeer::MEMBER_ID, MemberPeer::ID);
             $column = MemberPeer::gettableMap()->getColumn('CODE');
         } elseif ($key == 'NAME') {
             $c->addJoin(CirHistoryPeer::MEMBER_ID, MemberPeer::ID);
             $column = MemberPeer::gettableMap()->getColumn('NAME');
         } elseif ($key == 'TITLE') {
             $c->addJoin(ColItemPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(CirHistoryPeer::COL_ITEM_ID, ColItemPeer::ID);
             $column = CatalogPeer::gettableMap()->getColumn('TITLE');
         } elseif ($key == 'department_id') {
             $c->addJoin(ColItemPeer::COL_LOCATION_ID, ColLocationPeer::ID);
             $c->addJoin(CirHistoryPeer::COL_ITEM_ID, ColItemPeer::ID);
             $column = ColLocationPeer::gettableMap()->getColumn('DEPARTMENT_ID');
         } else {
             $column = CirHistoryPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIME) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->addAnd($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
Example #10
0
 public function executeOrderMember()
 {
     $this->returnModule = 'catalog';
     $this->returnAction = 'showMemberNondigital?id=' . $this->getRequestParameter('catalog_id');
     $member_id = $this->getUser()->getAttribute('user_id', null, 'bo');
     $member = MemberPeer::retrieveByPK($member_id);
     $id = $this->getRequestParameter('id');
     $item = ColItemPeer::retrieveByPk($id);
     $this->forward404Unless($item);
     $this->forward404Unless($member);
     $c = new Criteria();
     $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
     $c->add(CirRegulationPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
     $c->add(CirRegulationPeer::MEMBER_TYPE_ID, $member->getType());
     $c->add(CirRegulationPeer::CAT_CATEGORY_ID, $item->getCatalog()->getCatCategoryId());
     $regulation = CirRegulationPeer::doSelectOne($c);
     if (!$regulation) {
         $this->forward($this->returnModule, $this->returnAction);
     }
     $c = new Criteria();
     $c->add(CirHistoryPeer::MEMBER_ID, $member->getId());
     $c->add(CirHistoryPeer::RETURN_DATE, null);
     $c->addJoin(CirHistoryPeer::COL_ITEM_ID, ColItemPeer::ID);
     $c->addJoin(ColItemPeer::CATALOG_ID, CatalogPeer::ID);
     $c->add(CatalogPeer::CAT_CATEGORY_ID, $regulation->getCatCategoryId());
     $cir_hist_array = CirHistoryPeer::doSelect($c);
     $this->subtitle = '&nbsp;' . $item->toString() . ' - judul:' . $item->getCatalog()->getTitle() . ' (' . $item->getId() . ')';
     $this->member = $member;
     $this->item = $item;
     $this->regulation = $regulation;
     $this->can_loan = true;
     $this->max_loan_limit = false;
     if ($regulation->getCanLoan() !== true) {
         $this->can_loan = false;
     }
     if ($regulation->getMaxLoan() <= count($cir_hist_array)) {
         $this->max_loan_limit = true;
     }
 }
Example #11
0
 public function executeDelete()
 {
     $cir_history = CirHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($cir_history);
     $cir_history->delete();
     return $this->redirect('cir_history/list');
 }
Example #12
0
 public function executeDoOrder()
 {
     $return_module = $this->getRequestParameter('return_module');
     $return_action = $this->getRequestParameter('return_action');
     $member_id = $this->getRequestParameter('member_id');
     $col_item_id = $this->getRequestParameter('id');
     $order_type = $this->getRequestParameter('order_type');
     $length = $this->getRequestParameter('length');
     $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'));
         if (!$length || $length != null) {
             $cir_hist->setDueDate(date('Y-m-d H:i:s', $length * 60 * 60 * 24 + $now));
         } else {
             $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);
 }