コード例 #1
0
ファイル: actions.class.php プロジェクト: newZinc/timehive
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form->setValue('account_id', $this->getUser()->getAttribute('account_id'));
         $time_item_type = $form->save();
         $this->getUser()->setFlash('saved.success', 1);
         $this->redirect('adminTimeItemType/edit?id=' . $time_item_type->getId());
     }
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: newZinc/timehive
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form->setValue('account_id', $this->getUser()->getAttribute('account_id'));
         $role = $form->save();
         unset($role->Credentials);
         $role->save();
         foreach ($request->getParameter('credential') as $credential_id => $value) {
             $roleCredential = new RoleCredential();
             $roleCredential->role_id = $role->id;
             $roleCredential->credential_id = $credential_id;
             $roleCredential->save();
         }
         $this->getUser()->setFlash('saved.success', 1);
         $this->redirect('adminRole/edit?id=' . $role->getId());
     }
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: TheoJD/portail
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $parameters = $request->getParameter($form->getName());
     $form->bind($parameters, $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $this->getContext()->getConfiguration()->loadHelpers('Number');
         // On crée la transaction correspondante
         $transaction = new Transaction();
         $transaction->asso_id = $parameters['asso_id'];
         $transaction->compte_id = $parameters['compte_id'];
         $transaction->libelle = 'Remboursement ' . $parameters['nom'];
         $transaction->commentaire = "Remboursement des achats suivants :\n";
         // Voir ci-dessous
         $transaction->montant = 0;
         // On fera le total plus tard !
         $transaction->date_transaction = date('Y-m-d');
         $transaction->moyen_id = $parameters['moyen_id'];
         $transaction->moyen_commentaire = $parameters['moyen_commentaire'];
         $transaction->save();
         $form->setValue('transaction_id', $transaction->getPrimaryKey());
         $note_de_frais = $form->save();
         foreach ($parameters['transactions'] as $transaction_id) {
             $transaction2 = $note_de_frais->addAchatFromId($transaction_id);
             $transaction->commentaire .= $this->format_transaction($transaction2) . "\n";
         }
         $transaction->save();
         $this->redirect('ndf', $note_de_frais->getAsso());
     }
 }
コード例 #4
0
ファイル: actions.class.php プロジェクト: TheoJD/portail
 protected function processForm(sfWebRequest $request, sfForm $form, $emetteur, $asso)
 {
     $parameters = $request->getParameter($form->getName());
     $form->bind($parameters, $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $montant = abs($parameters['montant']);
         var_dump(Doctrine);
         $t = new Transaction();
         // Transaction côté asso
         $t_e = new Transaction();
         // Transaction côté pôle
         // Asso
         $t->Asso = $asso;
         $t_e->Asso = $emetteur;
         // Compte
         $t->compte_id = $parameters['asso_compte_id'];
         $t_e->compte_id = $parameters['emetteur_compte_id'];
         // Libellé
         $t_e->libelle = sprintf('Avance de Trésorie %s', $asso->getName());
         $t->libelle = sprintf('Avance de Trésorie %s', $emetteur->getName());
         $t_e->montant = -($t->montant = $montant);
         $t_e->commentaire = $t->commentaire = $parameters['commentaire'];
         $t->moyen_id = $t_e->moyen_id = $parameters['moyen_id'];
         $t->moyen_commentaire = $t_e->moyen_commentaire = $parameters['moyen_commentaire'];
         $t->date_transaction = $t_e->date_transaction = date('Y-m-d');
         $t->save();
         $t_e->save();
         $form->setValue('transaction_emetteur_id', $t_e);
         $form->setValue('transaction_id', $t);
         $form->setValue('asso_id', $asso->getPrimaryKey());
         $avance_treso = $form->save();
         $this->redirect('avances', $emetteur);
     }
 }