public function addChoice($name, $prix, $stock) { $choice = new Choice($this->id, $name, $prix, $stock); $choice->insert(); return $choice; }
public function checkStatus($payutcClient, $funId) { $transaction = $payutcClient->getTransactionInfo(array("fun_id" => $funId, "tra_id" => $this->payutc_tra_id)); if ($transaction->status != $this->status) { $this->date_paiement = date("Y-m-d H:i:s"); $this->status = $transaction->status; $this->update(); if ($this->status == 'V') { $desc = new Desc($this->fk_desc_id); $choice = new Choice(); $choice->select($this->fk_choice_id); // send $to = $this->user_mail; $subject = "[ShotgunUTC] - Confirmation d'achat"; $message = "Bonjour {$this->user_prenom} {$this->user_nom},<br />\n <br />\n Ce mail vient confirmer que tu as bien acheté une place pour :<br />\n {$desc->titre} - {$choice->name}<br />\n <br />\n Ton n° de reservation est le : {$this->id}<br />\n <br />\n Normalement les organisateurs te recontacteront prochainement pour te donner plus d'informations.<br />\n Si ce n'est pas le cas, contacte les ;) <br />\n <br />\n En cas de problème, n'essaie pas de contacter shotgun@assos.utc.fr (personne ne reçoit l'adresse)<br />\n Pour les problèmes 'techniques' tu peux contacter simde@assos.utc.fr<br />\n "; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Shotgunutc <*****@*****.**>' . "\r\n"; mail($to, $subject, $message, $headers); } } return $this->status; }
// article cotisant $payutcClient->setProduct(array("obj_id" => $choice->payutc_art_idC, "name" => $desc->titre . " " . $choice->name, "parent" => $desc->payutc_cat_id, "prix" => $choice->priceC, "stock" => $choice->stock, "image" => '', "alcool" => 0, "cotisant" => False, "fun_id" => $desc->payutc_fun_id)); // article non cotisant // $payutcClient->setProduct(array( // "obj_id" => $choice->payutc_art_idNC, // "name" => $desc->titre." ".$choice->name, // "parent" => $desc->payutc_cat_id, // "prix" => $choice->priceNC, // "stock" => $choice->stock, // "image" => '', // "alcool" => 0, // "cotisant" => False, // "fun_id" => $desc->payutc_fun_id)); $choice->update(); } else { $choice = new Choice($id); $form = $choice->getForm("Création d'un choix", "addchoice?id=" . $id, "Ajouter"); $form->load(); try { // Création de l'article cotisant dans payutc $ret = $payutcClient->setProduct(array("name" => $desc->titre . " " . $choice->name, "parent" => $desc->payutc_cat_id, "prix" => $choice->priceC, "stock" => $choice->stock, "image" => '', "alcool" => 0, "cotisant" => False, "fun_id" => $desc->payutc_fun_id)); if (isset($ret->success)) { $choice->payutc_art_idC = $ret->success; } // Création de l'article non cotisant dans payutc // $ret = $payutcClient->setProduct(array( // "name" => $desc->titre." ".$choice->name, // "parent" => $desc->payutc_cat_id, // "prix" => $choice->priceNC, // "stock" => $choice->stock, // "image" => '',
public static function getAll($desc_id = null) { $qb = self::getQbBase(); if ($desc_id) { $qb->where('c.fk_desc_id = :desc_id')->setParameter('desc_id', $desc_id); } $ret = array(); foreach ($qb->execute()->fetchAll() as $data) { $choice = new Choice(); $choice->bind($data); $ret[] = $choice; } return $ret; }