27 define (
'ATTR_IMMEUBLE',5000);
28 define (
'ATTR_COPROP',5001);
61 $this->cn->exec_sql(
'create schema coprop');
62 $this->cn->exec_sql(
"create sequence coprop.appel_fond_id");
68 $fiche_def =
new Fiche_Def($this->cn);
71 $fiche_def->add(array(
73 'nom_mod' =>
'Copropriétaires - plugin',
74 'fd_description'=>
'Liste des copropriétaires, catégorie créée par le plugin copropriété',
78 $lot_def =
new Fiche_Def($this->cn);
82 'nom_mod' =>
'Lots - plugin',
83 'fd_description'=>
'Liste des lots, catégorie créée par le plugin copropriété',
88 $imm_def =
new Fiche_Def($this->cn);
91 'nom_mod' =>
'immeuble - plugin',
92 'fd_description'=>
'Liste des immeubles, catégorie créée par le plugin copropriété',
95 $immeuble = $imm_def->id;
98 $this->cn->exec_sql(
"insert into attr_def (ad_id,ad_text,ad_type,ad_size,ad_extra)
99 values (".
ATTR_COPROP.
",'Copropriétaire','select','22','select f_id,vw_name from vw_fiche_attr where fd_id = $copro ')");
100 $this->cn->exec_sql(
"insert into attr_def (ad_id,ad_text,ad_type,ad_size,ad_extra) values
101 (".
ATTR_IMMEUBLE.
",'Immeuble','select','22','select f_id,vw_name from vw_fiche_attr where fd_id = $immeuble ');");
106 $imm_def->InsertAttribut(14);
107 $imm_def->InsertAttribut(15);
108 $imm_def->InsertAttribut(24);
109 $imm_def->InsertAttribut(16);
111 $fiche_def->InsertAttribut(27);
112 $fiche_def->InsertAttribut(32);
113 $fiche_def->InsertAttribut(10);
114 $fiche_def->InsertAttribut(33);
117 $this->cn->exec_sql(
"CREATE OR REPLACE VIEW coprop.summary AS
118 SELECT a.f_id AS lot_id, m.ad_value AS building_id, c.ad_value AS coprop_id
120 JOIN fiche f1 ON f1.f_id = a.f_id
121 JOIN ( SELECT fd1.f_id, fd1.ad_value
122 FROM fiche_detail fd1
124 JOIN ( SELECT fd1.f_id, fd1.ad_value
125 FROM fiche_detail fd1
126 WHERE fd1.ad_id = ".
ATTR_COPROP.
") c ON c.f_id = a.f_id
127 WHERE f1.fd_id = ".
$lot.
" AND a.ad_id = 1");
129 $this->immeuble_id=$immeuble;
137 CREATE TABLE coprop.parameter
141 CONSTRAINT copro_parameter_pkey PRIMARY KEY (pr_id)
144 $this->cn->exec_sql(
$sql);
147 'categorie_lot' => $this->lot_id,
148 'categorie_coprop' => $this->coprop_id,
149 'categorie_immeuble' => $this->immeuble_id,
150 'categorie_appel' => 0,
152 'categorie_charge'=>0,
156 foreach (
$array as $code => $value)
158 $this->cn->exec_sql(
'insert into coprop.parameter(pr_id,pr_value) values ($1,$2)', array($code, $value));
164 $file=dirname(__FILE__).
"/../sql/create_table.sql";
165 $this->cn->execute_script(
$file);
171 $version=$cn->get_value(
'select max(v_id) from coprop.version');
174 $file=dirname(__FILE__).
"/../sql/upgrade$i.sql";
175 $this->cn->execute_script(
$file);
install()
install the plugin, create all the needed schema, tables, proc in the database
if(isset($_POST['remove'])) $array