Ejemplo n.º 1
0
 public function executeDelete()
 {
     $payment_student = PaymentJournalPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($payment_student);
     $stu = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $ref_error = 0;
     foreach ($payment_student->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $payment_student->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('payment_student/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('payment_student/delete', '_ERR_DELETE_ (' . $payment_student->toString() . ' - id:' . $payment_student->getId() . ')');
     } else {
         $payment_student->delete();
     }
     if ($stu != null) {
         $this->getRequest()->setParameter('student_id', $stu->getId());
         return $this->forward('payment_student', 'listByStudent');
     }
     return $this->forward('payment_student', 'list');
 }
Ejemplo n.º 2
0
 public function executeShow()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $c = new Criteria();
     $c->add(JobPeer::CODE, $this->getModuleName());
     $job = JobPeer::doSelectOne($c);
     $acl = AclPeer::retrieveByPK($group_id, $job->getId());
     if (!$acl) {
         $this->forward('default', 'error404');
     }
     $payment_journal = PaymentJournalPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($payment_journal);
     $this->subtitle = $payment_journal->toString() . ' - id:' . $payment_journal->getId();
     $stu = StudentPeer::retrieveByPK($this->getContext()->getUser()->getAttribute('user_id', '', 'bo'));
     $actions = array(array('name' => 'back', 'url' => ' payment_journal_s/listByStudent?student_id=' . $stu->getId(), 'color' => 'white'));
     $this->actions = $actions;
     $this->payment_journal = $payment_journal;
 }