public function getDistinctStatus()
 {
     $status = array('' => 'All', 'opened' => 'Opened');
     $all_status = LoanStatus::getAvailableStatus();
     foreach ($this->createFlatDistinct('loan_status', 'status', 'status')->execute() as $record) {
         $status[$record->getStatus()] = $all_status[$record->getStatus()];
     }
     return $status;
 }
 public function executeLoanStatus()
 {
     $this->defineForm();
     $this->loanstatus = Doctrine::getTable('LoanStatus')->getLoanStatus($this->eid);
     $this->form = new informativeWorkflowForm(null, array('available_status' => LoanStatus::getAvailableStatus()));
 }
Esempio n. 3
0
 public function executeAddStatus(sfWebRequest $request)
 {
     if ($request->isXmlHttpRequest()) {
         $form = new LoanStatusForm(null, array('available_status' => LoanStatus::getAvailableStatus()));
         $form->bind(array('comment' => $request->getParameter('comment'), 'status' => $request->getParameter('status')));
         if ($form->isValid()) {
             $data = array('loan_ref' => $request->getParameter('id'), 'status' => $request->getParameter('status'), 'comment' => $request->getParameter('comment'), 'user_ref' => $this->getUser()->getId());
             $loanstatus = new LoanStatus();
             $loanstatus->fromArray($data);
             $loanstatus->save();
             return $this->renderText('ok');
         } else {
             return $this->renderText('notok' . $form->getErrorSchema());
         }
         // else : nothing append, and it's a good thing
     }
     $this->redirect('board/index');
 }