if ($_POST["action"] == 'add') { $object = new Fichinter($db); $object->socid = $_POST["socid"]; $object->duree = $_POST["duree"]; $object->fk_project = $_POST["projectid"]; $object->author = $user->id; $object->description = $_POST["description"]; $object->ref = $_POST["ref"]; $object->modelpdf = $_POST["model"]; if ($object->socid > 0) { $result = $object->create(); if ($result > 0) { $id=$result; // Force raffraichissement sur fiche venant d'etre cree $fichinterid=$result; } else { $langs->load("errors"); $mesg='<div class="error">'.$langs->trans($object->error).'</div>'; $action = 'create'; $_GET["socid"] = $_POST["socid"]; } } else {
/** * testFichinterCreate * * @return int */ public function testFichinterCreate() { global $conf, $user, $langs, $db; $conf = $this->savconf; $user = $this->savuser; $langs = $this->savlangs; $db = $this->savdb; $localobject = new Fichinter($this->savdb); $localobject->initAsSpecimen(); $result = $localobject->create($user); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); return $result; }