forked from Darkjeff/ultimateimmo
/
immeuble.php
121 lines (99 loc) · 3.91 KB
/
immeuble.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id: liste.php 8 2011-01-21 15:50:38Z hregis $
* $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/ventilation/liste.php,v $
*/
/**
* \file htdocs/compta/ventilation/immeuble.php
* \ingroup compta
* \brief Page de ventilation des lignes de facture
*/
// Dolibarr environment
$res=@include("../main.inc.php");
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php");
if (! $res && file_exists("../../main.inc.php")) $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;
}
$sql .= " ORDER BY i.nom ASC " . $db->plimit ( $limit + 1, $offset );
$result = $db->query ( $sql );
if ($result) {
$num_lignes = $db->num_rows ( $result );
$i = 0;
print_barre_liste ( "Immeubles", $page, "immeuble.php", "", $sortfield, $sortorder, '', $num_lignes );
print '<a class="butAction" href="immeuble/fiche_immeuble.php?action=create">nouveau bien</a>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("NomImmeuble").'</td>';
print '<td>'.$langs->trans("NombreLocaux").'</td>';
print '<td>'.$langs->trans("numero").'</td>';
print '<td>'.$langs->trans("street").'</td>';
print '<td>'.$langs->trans("zipcode").'</td>';
print '<td>'.$langs->trans("town").'</td>';
print '<td> </td>';
print "</tr>\n";
$var = True;
while ( $i < min ( $num_lignes, $limit ) ) {
$objp = $db->fetch_object ( $result );
$var = ! $var;
print "<tr $bc[$var]>";
print '<td width="80">';
$immeuble_static->id = $objp->rowid;
$immeuble_static->nom = $objp->rowid;
print $immeuble_static->getNomUrl ( 0, '20' );
print '</td>';
print '<td>' . stripslashes ( nl2br ( $objp->nom ) ) . '</td>';
print '<td>' . stripslashes ( nl2br ( $objp->nblocaux ) ) . '</td>';
print '<td>' . stripslashes ( nl2br ( $objp->numero ) ) . '</td>';
print '<td>' . stripslashes ( nl2br ( $objp->street ) ) . '</td>';
print '<td>' . stripslashes ( nl2br ( $objp->zipcode ) ) . '</td>';
print '<td>' . stripslashes ( nl2br ( $objp->town ) ) . '</td>';
print "</tr>";
$i ++;
}
print "</table>";
} else {
print $db->error ();
}
$db->close ();
llxFooter ( "<em>Dernière modification $Date: 2009/02/20 22:54:07 $ révision $Revision: 1.15 $</em>" );
?>