Пример #1
0
 /**
  * 
  */
 public function technicalFeedbackAction()
 {
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->_helper->layout()->disableLayout();
     }
     $id = $this->_getParam('id');
     $this->view->feedbackFields = $this->_mapper->getTechnicalFeedback($id);
     $businessPlan = $this->_mapper->fetchBusinessPlan($id);
     $row = $this->_mapper->fetchTechnicalFeedback($id);
     if (!empty($row)) {
         $data = $row->toArray();
     } else {
         $data = array('fk_id_businessplan' => $id);
     }
     $formTecnhicalFeedback = new Fefop_Form_TechnicalFeedback();
     $formTecnhicalFeedback->setAction($this->_helper->url('save-technical-feedback'));
     //$formTecnhicalFeedback->addAutomaticFields( $tecnhicalFeedback );
     $formTecnhicalFeedback->populate($data);
     if (!empty($businessPlan->fk_id_fefop_contract) && !empty($businessPlan->submitted)) {
         foreach ($formTecnhicalFeedback as $element) {
             $element->setAttrib('disabled', true);
         }
         $formTecnhicalFeedback->removeDisplayGroup('toolbar');
     }
     $this->view->amount_contract = $this->_mapper->getTotal($id, 'total_expense');
     $this->view->amount_max = $this->_mapper->getMaxContractAmount($id);
     if ($this->view->amount_contract <= $this->view->amount_max) {
         $formTecnhicalFeedback->getElement('amount')->setValue(1);
     }
     $this->view->form = $formTecnhicalFeedback;
 }