public function getParentalIndex() { $parentalIndex = "#" . str_pad($this->getId(), 3, '0', STR_PAD_LEFT); $this->level = 1; if ($this->getParent() !== null && $this->getParent() != 0) { $p = TransactionStatusPeer::retrieveByPK($this->getParent()); $parentalIndex = str_pad($p->getParentalIndex(), 3, '0', STR_PAD_LEFT) . "_" . $parentalIndex; $this->level += $p->level; } $this->parentalIndex = $parentalIndex; return $parentalIndex; }
public static function doSelectFiltered(Criteria $criteria, $con = null) { $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $depts = $dept->getChildRecurs(array()); $criteria->add(TransactionStatusPeer::ID, $depts, Criteria::IN); $tmp_depts = TransactionStatusPeer::doSelect($criteria); $depts = array(); foreach ($tmp_depts as $key => $val) { $pi = $val->getParentalIndex(); $prefix = ''; for ($i = 0; $i < $val->level - 1; $i++) { $prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue(); } $val->setName($prefix . $val->getName()); $val->setCode($prefix . $val->getCode()); $depts[$pi] = $val; } ksort($depts); $result = array(); foreach ($depts as $r) { $result[] = $r; } return $result; }
public function getTransactionStatus($con = null) { include_once 'lib/model/om/BaseTransactionStatusPeer.php'; if ($this->aTransactionStatus === null && $this->transaction_status_id !== null) { $this->aTransactionStatus = TransactionStatusPeer::retrieveByPK($this->transaction_status_id, $con); } return $this->aTransactionStatus; }
public function countTransactionStatussRelatedByParent($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseTransactionStatusPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(TransactionStatusPeer::PARENT, $this->getId()); return TransactionStatusPeer::doCount($criteria, $distinct, $con); }
public function executeDelete() { $transaction_status = TransactionStatusPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($transaction_status); $ref_error = 0; foreach ($transaction_status->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $transaction_status->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('transaction_status/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('transaction_status/delete', '_ERR_DELETE_ (' . $transaction_status->toString() . ' - id:' . $transaction_status->getId() . ')'); } else { $transaction_status->delete(); } return $this->forward('transaction_status', 'list'); }
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(TransactionStatusPeer::ID, $pks, Criteria::IN); $objs = TransactionStatusPeer::doSelect($criteria, $con); } return $objs; }
public static function doSelectJoinAllExceptAcademicCalendar(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VSppPeer::addSelectColumns($c); $startcol2 = VSppPeer::NUM_COLUMNS - VSppPeer::NUM_LAZY_LOAD_COLUMNS + 1; StudentPeer::addSelectColumns($c); $startcol3 = $startcol2 + StudentPeer::NUM_COLUMNS; AcademicCostPeer::addSelectColumns($c); $startcol4 = $startcol3 + AcademicCostPeer::NUM_COLUMNS; UserPeer::addSelectColumns($c); $startcol5 = $startcol4 + UserPeer::NUM_COLUMNS; AcademicProcessPeer::addSelectColumns($c); $startcol6 = $startcol5 + AcademicProcessPeer::NUM_COLUMNS; PaymentModelPeer::addSelectColumns($c); $startcol7 = $startcol6 + PaymentModelPeer::NUM_COLUMNS; TransactionStatusPeer::addSelectColumns($c); $startcol8 = $startcol7 + TransactionStatusPeer::NUM_COLUMNS; AcademicCostComponentPeer::addSelectColumns($c); $startcol9 = $startcol8 + AcademicCostComponentPeer::NUM_COLUMNS; $c->addJoin(VSppPeer::STUDENT_ID, StudentPeer::ID); $c->addJoin(VSppPeer::ACADEMIC_COST_ID, AcademicCostPeer::ID); $c->addJoin(VSppPeer::USER_ID, UserPeer::ID); $c->addJoin(VSppPeer::ACADEMIC_PROCESS_ID, AcademicProcessPeer::ID); $c->addJoin(VSppPeer::PAYMENT_MODEL_ID, PaymentModelPeer::ID); $c->addJoin(VSppPeer::TRANSACTION_STATUS_ID, TransactionStatusPeer::ID); $c->addJoin(VSppPeer::ACADEMIC_COST_COMPONENT_ID, AcademicCostComponentPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VSppPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = StudentPeer::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->getStudent(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addVSpp($obj1); break; } } if ($newObject) { $obj2->initVSpps(); $obj2->addVSpp($obj1); } $omClass = AcademicCostPeer::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->getAcademicCost(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addVSpp($obj1); break; } } if ($newObject) { $obj3->initVSpps(); $obj3->addVSpp($obj1); } $omClass = UserPeer::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->getUser(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVSpp($obj1); break; } } if ($newObject) { $obj4->initVSpps(); $obj4->addVSpp($obj1); } $omClass = AcademicProcessPeer::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->getAcademicProcess(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addVSpp($obj1); break; } } if ($newObject) { $obj5->initVSpps(); $obj5->addVSpp($obj1); } $omClass = PaymentModelPeer::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->getPaymentModel(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addVSpp($obj1); break; } } if ($newObject) { $obj6->initVSpps(); $obj6->addVSpp($obj1); } $omClass = TransactionStatusPeer::getOMClass(); $cls = Propel::import($omClass); $obj7 = new $cls(); $obj7->hydrate($rs, $startcol7); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj7 = $temp_obj1->getTransactionStatus(); if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { $newObject = false; $temp_obj7->addVSpp($obj1); break; } } if ($newObject) { $obj7->initVSpps(); $obj7->addVSpp($obj1); } $omClass = AcademicCostComponentPeer::getOMClass(); $cls = Propel::import($omClass); $obj8 = new $cls(); $obj8->hydrate($rs, $startcol8); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj8 = $temp_obj1->getAcademicCostComponent(); if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) { $newObject = false; $temp_obj8->addVSpp($obj1); break; } } if ($newObject) { $obj8->initVSpps(); $obj8->addVSpp($obj1); } $results[] = $obj1; } return $results; }
public static function doSelectJoinAllExceptPaymentModel(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } PaymentJournalPeer::addSelectColumns($c); $startcol2 = PaymentJournalPeer::NUM_COLUMNS - PaymentJournalPeer::NUM_LAZY_LOAD_COLUMNS + 1; AcademicCostPeer::addSelectColumns($c); $startcol3 = $startcol2 + AcademicCostPeer::NUM_COLUMNS; JobPeer::addSelectColumns($c); $startcol4 = $startcol3 + JobPeer::NUM_COLUMNS; AcademicProcessPeer::addSelectColumns($c); $startcol5 = $startcol4 + AcademicProcessPeer::NUM_COLUMNS; TransactionStatusPeer::addSelectColumns($c); $startcol6 = $startcol5 + TransactionStatusPeer::NUM_COLUMNS; $c->addJoin(PaymentJournalPeer::ACADEMIC_COST_ID, AcademicCostPeer::ID); $c->addJoin(PaymentJournalPeer::JOB_ID, JobPeer::ID); $c->addJoin(PaymentJournalPeer::ACADEMIC_PROCESS_ID, AcademicProcessPeer::ID); $c->addJoin(PaymentJournalPeer::TRANSACTION_STATUS_ID, TransactionStatusPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = PaymentJournalPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = AcademicCostPeer::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->getAcademicCost(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addPaymentJournal($obj1); break; } } if ($newObject) { $obj2->initPaymentJournals(); $obj2->addPaymentJournal($obj1); } $omClass = JobPeer::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->getJob(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addPaymentJournal($obj1); break; } } if ($newObject) { $obj3->initPaymentJournals(); $obj3->addPaymentJournal($obj1); } $omClass = AcademicProcessPeer::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->getAcademicProcess(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addPaymentJournal($obj1); break; } } if ($newObject) { $obj4->initPaymentJournals(); $obj4->addPaymentJournal($obj1); } $omClass = TransactionStatusPeer::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->getTransactionStatus(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addPaymentJournal($obj1); break; } } if ($newObject) { $obj5->initPaymentJournals(); $obj5->addPaymentJournal($obj1); } $results[] = $obj1; } return $results; }