public function getRegulation() { $member_type_id = $this->getMember()->getType(); $cat_category_id = $this->getColItem()->getCatalog()->getCatCategoryId(); $c = new Criteria(); $c->add(CirRegulationPeer::MEMBER_TYPE_ID, $member_type_id); $c->add(CirRegulationPeer::CAT_CATEGORY_ID, $cat_category_id); return CirRegulationPeer::doSelectOne($c); }
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(CirRegulationPeer::ID, $pks, Criteria::IN); $objs = CirRegulationPeer::doSelect($criteria, $con); } return $objs; }
public function executeDelete() { $cir_regulation = CirRegulationPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($cir_regulation); $cir_regulation->delete(); return $this->redirect('cir_regulation/list'); }
public function getCirRegulationsJoinCatCategory($criteria = null, $con = null) { include_once 'lib/model/om/BaseCirRegulationPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collCirRegulations === null) { if ($this->isNew()) { $this->collCirRegulations = array(); } else { $criteria->add(CirRegulationPeer::MEMBER_TYPE_ID, $this->getId()); $this->collCirRegulations = CirRegulationPeer::doSelectJoinCatCategory($criteria, $con); } } else { $criteria->add(CirRegulationPeer::MEMBER_TYPE_ID, $this->getId()); if (!isset($this->lastCirRegulationCriteria) || !$this->lastCirRegulationCriteria->equals($criteria)) { $this->collCirRegulations = CirRegulationPeer::doSelectJoinCatCategory($criteria, $con); } } $this->lastCirRegulationCriteria = $criteria; return $this->collCirRegulations; }
public function executeTransaction() { $this->returnModule = 'visitor_list'; $this->returnAction = 'transaction'; $member = MemberPeer::retrieveByPk($this->getRequestParameter('member_id')); $this->forward404Unless($member); $this->member = $member; $actions2 = array(array('name' => '<span>Sirkulasi Koleksi</span>', 'url' => 'visitor_list/transaction?member_id=' . $member->getId(), 'color' => 'sun', 'type' => 'direct')); array_unshift($actions2, array('name' => '<span>Daftar Kunjungan</span>', 'url' => 'visitor_list/list', 'color' => 'sky')); $this->actions2 = $actions2; $code = trim($this->getRequestParameter('code')); if ($code != null && $code != '') { $c = new Criteria(); $c->add(ColItemPeer::INDEX_NO, $code); $ci = ColItemPeer::doSelectOne($c); $c = new Criteria(); $c->add(CirRegulationPeer::DEPARTMENT_ID, $ci->getColLocation()->getDepartmentId()); $c->add(CirRegulationPeer::MEMBER_TYPE_ID, $member->getType()); $c->add(CirRegulationPeer::CAT_CATEGORY_ID, $ci->getCatalog()->getCatCategoryId()); $regulation = CirRegulationPeer::doSelectOne($c); if ($regulation->getCanLoan() === true) { $this->can_loan = true; $this->length = $regulation->getLoanLength(); } $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); if ($regulation->getMaxLoan() <= count($cir_hist_array)) { $this->max_loan_limit = true; } if ($code != null && $code != '' && $ci != null) { $this->item = $ci; $this->member = $member; $this->regulation = $regulation; $this->_title = 'LoanOrder'; $this->setTemplate('order'); } else { $this->getRequest()->setParameter('code', ''); $this->err_title = 'ERROR_IN_CHECK_OUT'; $this->err_msg = 'ITEM_NOT_FOUND'; } } }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CirRegulationPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setMemberTypeId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setCatCategoryId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setCanLoan($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setLoanLength($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setExtTime($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setFinePerDay($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setMaxLoan($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setCanDownload($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setStrictMaxLoan($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setId($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setDepartmentId($arr[$keys[10]]); } }
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 = ' ' . $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; } }
public function executeOrder() { $this->returnModule = 'catalog'; $this->returnAction = 'listItem'; $this->_title = 'LoanOrder'; $member = MemberPeer::retrieveByCode($this->getRequestParameter('code')); $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, $item->getColLocation()->getDepartmentId()); $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->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; } }