*/ if ($user->rights->adherent->configurer && $_POST["action"] == 'add') { if ($_POST["button"] != $langs->trans("Cancel")) { $adht = new AdherentType($db); $adht->libelle = trim($_POST["libelle"]); $adht->cotisation = trim($_POST["cotisation"]); $adht->note = trim($_POST["comment"]); $adht->mail_valid = trim($_POST["mail_valid"]); $adht->vote = trim($_POST["vote"]); if ($adht->libelle) { $id=$adht->create($user->id); if ($id > 0) { Header("Location: type.php"); exit; } else { $mesg=$adht->error; $_GET["action"] = 'create'; } } else { $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); $_GET["action"] = 'create';
/** * testAdherentTypeCreate * * @return void */ public function testAdherentTypeCreate() { global $conf, $user, $langs, $db; $conf = $this->savconf; $user = $this->savuser; $langs = $this->savlangs; $db = $this->savdb; $localobject = new AdherentType($this->savdb); $localobject->statut = 1; $localobject->libelle = 'Adherent type test'; $localobject->cotisation = 1; $localobject->vote = 1; $result = $localobject->create($user); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); return $localobject->id; }