$action = ''; } } // Modification entrepot if ($action == 'update' && $_POST["cancel"] != $langs->trans("Cancel")) { $object = new Entrepot($db); if ($object->fetch($id)) { $object->libelle = $_POST["libelle"]; $object->description = $_POST["desc"]; $object->statut = $_POST["statut"]; $object->lieu = $_POST["lieu"]; $object->address = $_POST["address"]; $object->zip = $_POST["zipcode"]; $object->town = $_POST["town"]; $object->country_id = $_POST["country_id"]; if ($object->update($id, $user) > 0) { $action = ''; //$mesg = '<div class="ok">Fiche mise a jour</div>'; } else { $action = 'edit'; $mesg = '<div class="error">' . $object->error . '</div>'; } } else { $action = 'edit'; $mesg = '<div class="error">' . $object->error . '</div>'; } } if ($_POST["cancel"] == $langs->trans("Cancel")) { $action = ''; } /*
/** * testEntrepotUpdate * * @param Entrepot $localobject Entrepot * @return void * * @depends testEntrepotFetch * The depends says test is run only if previous is ok */ public function testEntrepotUpdate($localobject) { global $conf, $user, $langs, $db; $conf = $this->savconf; $user = $this->savuser; $langs = $this->savlangs; $db = $this->savdb; $localobject->note = 'New note after update'; $result = $localobject->update($localobject->id, $user); print __METHOD__ . " id=" . $localobject->id . " result=" . $result . "\n"; $this->assertLessThan($result, 0); return $localobject; }
$object = new Entrepot($db); if ($object->fetch($_POST["id"])) { $object->libelle = $_POST["libelle"]; $object->description = $_POST["desc"]; $object->statut = $_POST["statut"]; $object->lieu = $_POST["lieu"]; $object->address = $_POST["address"]; $object->cp = $_POST["zipcode"]; $object->ville = $_POST["town"]; $object->pays_id = $_POST["country_id"]; $object->zip = $_POST["zipcode"]; $object->town = $_POST["town"]; $object->country_id = $_POST["country_id"]; if ( $object->update($_POST["id"], $user) > 0) { $action = ''; $_GET["id"] = $_POST["id"]; //$mesg = '<div class="ok">Fiche mise a jour</div>'; } else { $action = 'edit'; $_GET["id"] = $_POST["id"]; $mesg = '<div class="error">'.$object->error.'</div>'; } } else { $action = 'edit';
// Modification entrepot if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) { $entrepot = new Entrepot($db); if ($entrepot->fetch($_POST["id"])) { $entrepot->libelle = $_POST["libelle"]; $entrepot->description = $_POST["desc"]; $entrepot->statut = $_POST["statut"]; $entrepot->lieu = $_POST["lieu"]; $entrepot->address = $_POST["address"]; $entrepot->cp = $_POST["cp"]; $entrepot->ville = $_POST["ville"]; $entrepot->pays_id = $_POST["pays_id"]; if ( $entrepot->update($_POST["id"], $user) > 0) { $_GET["action"] = ''; $_GET["id"] = $_POST["id"]; //$mesg = '<div class="ok">Fiche mise � jour</div>'; } else { $_GET["action"] = 'edit'; $_GET["id"] = $_POST["id"]; $mesg = '<div class="error">'.$entrepot->error.'</div>'; } } else { $_GET["action"] = 'edit';