示例#1
0
    $res = @(include "../../main.inc.php");
}
if (!$res && file_exists("../../../main.inc.php")) {
    $res = @(include "../../../main.inc.php");
}
if (!$res) {
    die("Include of main fails");
}
// class
dol_include_once("/immobilier/class/immeuble.class.php");
// Securite acces client
if ($user->societe_id > 0) {
    accessforbidden();
}
llxHeader('', 'Properties');
$immeuble_static = new Immeuble($db);
/*
* Immeuble
*
*/
$page = $_GET["page"];
if ($page < 0) {
    $page = 0;
}
$limit = $conf->liste_limit;
$offset = $limit * $page;
$sql = "SELECT i.rowid , i.nom , i.nb_locaux as nblocaux, i.numero, i.street, i.zipcode , i.town";
$sql .= " FROM " . MAIN_DB_PREFIX . "immo_immeuble as i";
$sql .= " WHERE i.statut = 'Actif' ";
if ($user->id != 1) {
    $sql .= " AND i.proprietaire_id=" . $user->id;
示例#2
0
    print '<td><input name="type" size="10" value="' . $local->type . '"</td></tr>';
    print '<tr><td width="20%">' . $langs->trans("Commentaire") . '</td>';
    print '<td><input name="commentaire" size="10" value="' . $local->commentaire . '"</td></tr>';
    print '<tr><td width="20%">' . $langs->trans("Statut") . '</td>';
    print '<td>';
    print $html->selectarray('statut', $local->status_array, $local->statut);
    print '</td></tr>';
    print '<tr><td>&nbsp;</td><td><input type="submit" class="button" value="' . $langs->trans("Sauvegarder") . '"><input type="cancel" class="button" value="' . $langs->trans("Cancel") . '"></td></tr>';
    print '</table>';
    print '</form>';
} else {
    llxheader('', $langs->trans("ImoLocalDetail"), '');
    $local = new Local($db, GETPOST('id'));
    $head = local_prepare_head($local);
    dol_fiche_head($head, 'maininfo', $langs->trans("ImoLocalDetail"), 0, 'propertie');
    $immeuble = new Immeuble($db);
    $result = $immeuble->fetch($local->immeuble_id);
    if ($result < 0) {
        setEventMessage($immeuble->error, 'errors');
    }
    print '<table class="border" width="100%">';
    print '<tr><td width="20%">' . $langs->trans("NomLocal") . '</td>';
    print '<td>' . $local->nom . '</td></tr>';
    print '<tr><td width="20%">' . $langs->trans("Adresse") . '</td>';
    print '<td>' . $local->adresse . '</td></tr>';
    print '<tr><td width="20%">' . $langs->trans("Commentaire") . '</td>';
    print '<td>' . $local->commentaire . '</td></tr>';
    print '<tr><td width="20%">' . $langs->trans("Statut") . '</td>';
    print '<td>' . $local->statut . '</td></tr>';
    print '<tr><td width="20%">' . $langs->trans("Immeuble") . '</td>';
    print '<td>' . $immeuble->nom . '</td></tr>';
    $res = $immeuble->create($user);
    if ($res == 0) {
        Header("Location: " . DOL_URL_ROOT . "/immobilier/immeuble.php");
    } else {
        if ($res == -3) {
            $_error = 1;
            $action = "create";
        }
        if ($res == -4) {
            $_error = 2;
            $action = "create";
        }
    }
} elseif (GETPOST("action") == 'maj') {
    print 'toto';
    $immeuble = new Immeuble($db, GETPOST('id'));
    $immeuble->nom = GETPOST("nom");
    $immeuble->nblocaux = GETPOST("nblocaux");
    $immeuble->commentaire = GETPOST("commentaire");
    $immeuble->statut = GETPOST("statut");
    $immeuble->numero = GETPOST("numero");
    $immeuble->street = GETPOST("street");
    $immeuble->zipcode = GETPOST("zipcode");
    $immeuble->town = GETPOST("town");
    $immeuble->longitude = GETPOST("longitude");
    $immeuble->latitude = GETPOST("latitude");
    $e_immeuble = $immeuble;
    $res = $immeuble->update();
    header("Location: " . DOL_URL_ROOT . "/immobilier/immeuble/fiche_immeuble.php?id=" . $immeuble->id);
    if ($res >= 0) {
        setEventMessage($langs->trans("SocialContributionAdded"), 'mesgs');