コード例 #1
0
ファイル: actions.class.php プロジェクト: TheoJD/portail
 public function executeIndex(sfWebRequest $request)
 {
     $this->asso = $this->getRoute()->getObject();
     $this->checkAuthorisation($this->asso);
     $this->budget_categories = BudgetCategorieTable::getInstance()->getActiveCategories($this->asso->getId())->execute();
     $this->getResponse()->setSlot('current_asso', $this->asso);
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: TheoJD/portail
 public function executeNew(sfWebRequest $request)
 {
     $this->forward404Unless($this->budget = BudgetTable::getInstance()->find(array($request->getParameter('budget'))), sprintf('Object budget does not exist (%s).', $request->getParameter('budget')));
     $this->forward404Unless($this->categorie = BudgetCategorieTable::getInstance()->find(array($request->getParameter('categorie'))), sprintf('Object budget does not exist (%s).', $request->getParameter('categorie')));
     $this->checkAuthorisation($this->budget->getAsso());
     $poste = new BudgetPoste();
     $poste->setBudget($this->budget);
     $poste->setBudgetCategorie($this->categorie);
     $poste->setAsso($this->budget->getAsso());
     $this->form = new BudgetPosteForm($poste);
     $this->getResponse()->setSlot('current_asso', $this->budget->getAsso());
 }
コード例 #3
0
 public function configure()
 {
     unset($this['created_at'], $this['updated_at'], $this['deleted_at']);
     $this->widgetSchema['budget_categorie_id'] = new sfWidgetFormDoctrineChoice(array('label' => 'Catégorie', 'model' => $this->getRelatedModelName('BudgetCategorie'), 'query' => BudgetCategorieTable::getInstance()->getAllForAsso($this->getObject()->getAsso()), 'add_empty' => false));
     $this->validatorSchema['budget_categorie_id'] = new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BudgetCategorie'), 'query' => BudgetCategorieTable::getInstance()->getAllForAsso($this->getObject()->getAsso())));
     $this->widgetSchema['asso_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['budget_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['prix_unitaire'] = new portailWidgetFormMontant();
     $this->validatorSchema['prix_unitaire'] = new portailValidatorMontant();
     $this->validatorSchema['nombre'] = new sfValidatorNumber(array('min' => 1));
     $this->validatorSchema->setPostValidator(new sfValidatorSchemaFilter('prix_unitaire', new ValidatorNumberNotNull(array('not_null' => true))));
     $this->getWidgetSchema()->setPositions(array('id', 'asso_id', 'budget_id', 'nom', 'budget_categorie_id', 'nombre', 'prix_unitaire', 'commentaire'));
 }
コード例 #4
0
ファイル: Budget.class.php プロジェクト: TheoJD/portail
 public function getCategoriesWithoutEntry()
 {
     $q = BudgetCategorieTable::getInstance()->getActiveCategories($this->getAssoId())->andWhere('(SELECT COUNT(*) FROM BudgetPoste b WHERE b.budget_categorie_id = q.id AND b.budget_id = ?) = 0', $this->getPrimaryKey());
     return $q;
 }