Esempio n. 1
0
 public function filter($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         $column = ColStatusPeer::getTableMap()->getColumn($key);
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
Esempio n. 2
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(ColStatusPeer::ID, $pks, Criteria::IN);
         $objs = ColStatusPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 3
0
 public static function doSelectJoinAllExceptColLocation(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     VOpacPeer::addSelectColumns($c);
     $startcol2 = VOpacPeer::NUM_COLUMNS - VOpacPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     CatalogPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + CatalogPeer::NUM_COLUMNS;
     DepartmentPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + DepartmentPeer::NUM_COLUMNS;
     CatCategoryPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + CatCategoryPeer::NUM_COLUMNS;
     ColStatusPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + ColStatusPeer::NUM_COLUMNS;
     $c->addJoin(VOpacPeer::CATALOG_ID, CatalogPeer::ID);
     $c->addJoin(VOpacPeer::DEPARTMENT_ID, DepartmentPeer::ID);
     $c->addJoin(VOpacPeer::CAT_CATEGORY_ID, CatCategoryPeer::ID);
     $c->addJoin(VOpacPeer::COL_STATUS_ID, ColStatusPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = VOpacPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = CatalogPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getCatalog();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addVOpac($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initVOpacs();
             $obj2->addVOpac($obj1);
         }
         $omClass = DepartmentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getDepartment();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addVOpac($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initVOpacs();
             $obj3->addVOpac($obj1);
         }
         $omClass = CatCategoryPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getCatCategory();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addVOpac($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initVOpacs();
             $obj4->addVOpac($obj1);
         }
         $omClass = ColStatusPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getColStatus();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addVOpac($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initVOpacs();
             $obj5->addVOpac($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Esempio n. 4
0
 public static function doSelectJoinAllExceptMember(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     CirHistoryPeer::addSelectColumns($c);
     $startcol2 = CirHistoryPeer::NUM_COLUMNS - CirHistoryPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     ColItemPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + ColItemPeer::NUM_COLUMNS;
     ColStatusPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + ColStatusPeer::NUM_COLUMNS;
     $c->addJoin(CirHistoryPeer::COL_ITEM_ID, ColItemPeer::ID);
     $c->addJoin(CirHistoryPeer::COL_STATUS_ID, ColStatusPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = CirHistoryPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = ColItemPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getColItem();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addCirHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initCirHistorys();
             $obj2->addCirHistory($obj1);
         }
         $omClass = ColStatusPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getColStatus();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addCirHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initCirHistorys();
             $obj3->addCirHistory($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Esempio n. 5
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ColStatusPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCode($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setName($arr[$keys[2]]);
     }
 }
Esempio n. 6
0
 public function getColStatus($con = null)
 {
     include_once 'lib/model/om/BaseColStatusPeer.php';
     if ($this->aColStatus === null && $this->col_status_id !== null) {
         $this->aColStatus = ColStatusPeer::retrieveByPK($this->col_status_id, $con);
     }
     return $this->aColStatus;
 }
Esempio n. 7
0
 public function executeDelete()
 {
     $col_status = ColStatusPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($col_status);
     $ref_error = 0;
     foreach ($col_status->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $col_status->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('col_status/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('col_status/delete', '_ERR_DELETE_ (' . $col_status->toString() . ' - id:' . $col_status->getId() . ')');
     } else {
         $col_status->delete();
     }
     return $this->forward('col_status', 'list');
 }
Esempio n. 8
0
 public static function doSelectJoinAllExceptColSource(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     ColItemPeer::addSelectColumns($c);
     $startcol2 = ColItemPeer::NUM_COLUMNS - ColItemPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     CatalogPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + CatalogPeer::NUM_COLUMNS;
     ColStatusPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + ColStatusPeer::NUM_COLUMNS;
     ColConditionPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + ColConditionPeer::NUM_COLUMNS;
     MemberPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + MemberPeer::NUM_COLUMNS;
     ColLocationPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + ColLocationPeer::NUM_COLUMNS;
     $c->addJoin(ColItemPeer::CATALOG_ID, CatalogPeer::ID);
     $c->addJoin(ColItemPeer::COL_STATUS_ID, ColStatusPeer::ID);
     $c->addJoin(ColItemPeer::COL_CONDITION_ID, ColConditionPeer::ID);
     $c->addJoin(ColItemPeer::MEMBER_ID, MemberPeer::ID);
     $c->addJoin(ColItemPeer::COL_LOCATION_ID, ColLocationPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = ColItemPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = CatalogPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getCatalog();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addColItem($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initColItems();
             $obj2->addColItem($obj1);
         }
         $omClass = ColStatusPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getColStatus();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addColItem($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initColItems();
             $obj3->addColItem($obj1);
         }
         $omClass = ColConditionPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getColCondition();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addColItem($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initColItems();
             $obj4->addColItem($obj1);
         }
         $omClass = MemberPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getMember();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addColItem($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initColItems();
             $obj5->addColItem($obj1);
         }
         $omClass = ColLocationPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getColLocation();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addColItem($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initColItems();
             $obj6->addColItem($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Esempio n. 9
0
 public function filterDetail($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'writer_id') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(CatalogWriterPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogWriterPeer::getTableMap()->getColumn('WRITER_ID');
         } elseif ($key == 'code') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'title') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('TITLE');
         } elseif ($key == 'cat_category_id') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('CAT_CATEGORY_ID');
         } elseif ($key == 'publisher_id') {
             $c->addJoin(VCatalogDetailPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('PUBLISHER_ID');
         } elseif ($key == 'col_status_id') {
             $c->addJoin(VCatalogDetailPeer::COL_STATUS_ID, ColStatusPeer::ID);
             $column = ColStatusPeer::getTableMap()->getColumn('COL_STATUS_ID');
         } elseif ($key == 'department_id') {
             $c->addJoin(VCatalogDetailPeer::DEPARTMENT_ID, DepartmentPeer::ID);
             $column = DepartmentPeer::getTableMap()->getColumn('DEPARTMENT_ID');
         } else {
             $column = VCatalogDetailPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER || $creoleType == CreoleTypes::BIGINT) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 } else {
                     if ($creoleType == CreoleTypes::NUMERIC) {
                         $c->add($name, $value, Criteria::EQUAL);
                     }
                 }
             }
         }
     }
 }
Esempio n. 10
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);
 }