public function executeIndex(sfWebRequest $request) { $this->asso = $this->getRoute()->getObject(); $this->checkAuthorisation($this->asso); $this->compte_banquaires = CompteBanquaireTable::getInstance()->getAllForAsso($this->asso)->execute(); $this->getResponse()->setSlot('current_asso', $this->asso); }
public function configure() { $this->widgetSchema['commentaire']->setLabel('Raison'); // virement possible à toutes les assos if ($this->getObject()->getAsso()->isNew()) { $add_empty = '- Choisis une asso -'; } else { $add_empty = false; $this->widgetSchema['asso_compte_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'CompteBanquaire', 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->getObject()->getAsso()), 'add_empty' => false, 'label' => 'Compte Recepteur')); $this->validatorSchema['asso_compte_id'] = new sfValidatorDoctrineChoice(array('model' => 'CompteBanquaire', 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->getObject()->getAsso()))); } $this->widgetSchema['asso_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Asso'), 'method' => 'getName', 'key_method' => 'getLogin', 'add_empty' => $add_empty, 'label' => 'Destinataire')); $this->setDefault('asso_id', $this->getObject()->getAsso()->getLogin()); $this->validatorSchema['asso_id'] = new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Asso'), 'column' => 'login')); $this->widgetSchema['emetteur_compte_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'CompteBanquaire', 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->getObject()->getEmetteur()), 'add_empty' => false, 'label' => 'Compte Emetteur')); $this->validatorSchema['emetteur_compte_id'] = new sfValidatorDoctrineChoice(array('model' => 'CompteBanquaire', 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->getObject()->getEmetteur()))); // montant, moyen de paiement et moyen_commentaire $this->widgetSchema['montant'] = new sfWidgetFormInputText(); $this->validatorSchema['montant'] = new ValidatorNumberNotNull(); $this->widgetSchema['moyen_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'TransactionMoyen', 'add_empty' => false)); $this->validatorSchema['moyen_id'] = new sfValidatorDoctrineChoice(array('model' => 'TransactionMoyen')); $this->widgetSchema['moyen_commentaire'] = new sfWidgetFormTextarea(); $this->validatorSchema['moyen_commentaire'] = new sfValidatorString(array('required' => false)); $this->widgetSchema['emetteur_id'] = new sfWidgetFormInputHidden(); unset($this['transaction_id'], $this['transaction_emetteur_id']); }
public function executeCompte(sfWebRequest $request) { $this->forward404Unless($this->compte = $this->getRoute()->getObject()); $this->asso = $this->compte->getAsso(); $this->checkAuthorisation($this->asso); $this->getResponse()->setSlot('current_asso', $this->asso); $this->chooser = new sfWidgetFormDoctrineChoice(array('model' => 'CompteBanquaire', 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->asso))); $this->transactions = TransactionTable::getInstance()->getJournalForCompte($this->compte)->execute(); $this->setTemplate('index'); }
public function configure() { $this->widgetSchema['asso_id'] = new SfWidgetFormInputHidden(); $this->widgetSchema['transactions'] = new portailWidgetFormDoctrineChoice(array('label' => 'Achats', 'model' => 'Transaction', 'query' => TransactionTable::getInstance()->getRemboursablesForAsso($this->getObject()->getAsso()), 'add_empty' => false, 'multiple' => true, 'method' => 'noteDeFraisRepr', 'renderer_class' => 'portailWidgetFormSelectCheckbox', 'renderer_options' => array('dynamic_attributes' => array('data-montant' => 'getMontantAbsolute', 'data-nom' => 'getMoyenCommentaire')))); $this->validatorSchema['transactions'] = new sfValidatorDoctrineChoice(array('model' => 'Transaction', 'query' => TransactionTable::getInstance()->getRemboursablesForAsso($this->getObject()->getAsso()), 'multiple' => true, 'min' => 1)); $this->validatorSchema['transaction_id'] = new sfValidatorPass(); // on ajoute tous les champs liés à la transaction $this->widgetSchema['moyen_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'TransactionMoyen', 'add_empty' => false)); $this->validatorSchema['moyen_id'] = new sfValidatorDoctrineChoice(array('model' => 'TransactionMoyen')); $this->widgetSchema['compte_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'CompteBanquaire', 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->getObject()->getAsso()), 'add_empty' => false)); $this->validatorSchema['compte_id'] = new sfValidatorDoctrineChoice(array('model' => 'CompteBanquaire', 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->getObject()->getAsso()))); $this->widgetSchema['moyen_commentaire'] = new sfWidgetFormInput(array(), array('placeholder' => 'n° du chèque ou laisser vide')); $this->validatorSchema['moyen_commentaire'] = new sfValidatorString(array('required' => false)); unset($this['created_at'], $this['updated_at'], $this['deleted_at']); }
public function configure() { $this->widgetSchema['asso_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['compte_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CompteBanquaire'), 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->getObject()->getAsso()), 'add_empty' => false)); $this->validatorSchema['compte_id'] = new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CompteBanquaire'), 'query' => CompteBanquaireTable::getInstance()->getAllForAsso($this->getObject()->getAsso()))); $this->widgetSchema['budget_poste_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BudgetPoste'), 'query' => BudgetPosteTable::getInstance()->getAllForAsso($this->getObject()->getAsso()), 'method' => 'transactionNewRepr', 'add_empty' => '- Pas de poste lié -', 'label' => 'Poste du budget')); $this->validatorSchema['budget_poste_id'] = new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BudgetPoste'), 'query' => BudgetPosteTable::getInstance()->getAllForAsso($this->getObject()->getAsso()), 'required' => false)); $this->widgetSchema['date_transaction'] = new portailWidgetFormDate(); $this->widgetSchema['date_rapprochement'] = new portailWidgetFormDate(array(), array('placeholder' => 'À compléter plus tard')); unset($this['created_at'], $this['updated_at'], $this['deleted_at'], $this['note_de_frais_id']); $this->widgetSchema['montant'] = new portailWidgetFormMontant(); $this->validatorSchema['montant'] = new portailValidatorMontant(); $this->getWidgetSchema()->setPositions(array('id', 'asso_id', 'compte_id', 'budget_poste_id', 'libelle', 'montant', 'commentaire', 'date_transaction', 'date_rapprochement', 'date_rapprochement', 'moyen_id', 'moyen_commentaire')); $this->widgetSchema['libelle'] = new sfWidgetFormInput(array('label' => 'Libellé'), array('placeholder' => 'Nom de la transaction')); $this->widgetSchema['moyen_commentaire'] = new sfWidgetFormInput(array(), array('placeholder' => 'n° de chèque ou nom de membre')); $this->validatorSchema['moyen_commentaire']->setOption('required', false); $this->validatorSchema['date_rapprochement'] = new sfValidatorDate(array('required' => false)); // soit la date de rapprochement est nulle, soit elle est plus tard que la date de transaction $this->validatorSchema->setPostValidator(new sfValidatorOr(array(new sfValidatorSchemaFilter('date_rapprochement', new portailValidatorNull(array('required' => false))), new sfValidatorSchemaCompare('date_rapprochement', sfValidatorSchemaCompare::GREATER_THAN, 'date_transaction')), array(), array('invalid' => 'La date de rapprochement doit être supérieure à la date de la transaction'))); }