Beispiel #1
0
    accessforbidden();
}
$object = new Building($db);
/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
if ($action == 'update' && !$_POST["cancel"] && $user->rights->place->write) {
    $error = 0;
    if (empty($ref)) {
        $error++;
        $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")) . '</div>';
    }
    if (!$error) {
        $object->fetch($id);
        $object->ref = $ref;
        $object->lat = $lat;
        $object->lng = $lng;
        $object->description = $_POST["description"];
        $object->note_public = $_POST["note_public"];
        $object->note_private = $_POST["note_private"];
        $result = $object->update($user);
        if ($result > 0) {
            Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
            exit;
        } else {
            $mesg = '<div class="error">' . $object->error . '</div>';
            $action = 'edit';
        }
    } else {