try { // $payutcClient->checkRight(array("user">true, "app"=>false, "fun_check"=>true, "fun_id"=>$fun_id)); checkRight($payutcClient, true, false, true, $fun_id); } catch (JsonException $e) { $app->flash('info', 'Vous n\'avez pas les droits suffisants.'); $app->redirect("admin"); } if (isset($_GET["desc_id"])) { $desc_id = $_GET["desc_id"]; $desc = new Desc($desc_id); $form = $desc->getForm("Modification d'un shotgun", "shotgunform?fun_id=" . $fun_id . "&desc_id=" . $desc_id, "Modifier"); $form->load(); $desc->update(); } else { $desc = new Desc(); $form = $desc->getForm("Création d'un shotgun", "createshotgun?fun_id=" . $fun_id, "Créer"); $form->load(); try { // Création de la catégorie dans payutc (celle ou on rentrera les articles) $ret = $payutcClient->setCategory(array("name" => $desc->titre, "parent_id" => null, "fun_id" => $fun_id)); if (isset($ret->success)) { $desc->payutc_fun_id = $fun_id; $desc->payutc_cat_id = $ret->success; } $desc_id = $desc->insert(); } catch (\Exception $e) { $app->flashNow('info', "Une erreur est survenu, la création du shotgun à échoué. => {$e->getMessage()}"); $app->render('header.php', array()); $app->render('form.php', array("form" => $form)); $app->render('footer.php', array('isAdminFondation' => $isAdminFondation)); return;