[openmairie-framework-Commits] r4939 - in openmairie_exemple/branches/om5_rad: . app data/pgsql gen/obj gen/sql/pgsql sql/pgsql

0 views
Skip to first unread message

fray...@users.adullact.net

unread,
Apr 25, 2024, 9:01:23 AMApr 25
to openmairie...@googlegroups.com
Author: fraynaud
Date: 2024-04-25 15:01:20 +0200 (Thu, 25 Apr 2024)
New Revision: 4939

Modified:
openmairie_exemple/branches/om5_rad/TODO.txt
openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php
openmairie_exemple/branches/om5_rad/data/pgsql/init_gen.sql
openmairie_exemple/branches/om5_rad/data/pgsql/init_gen_plus.sql
openmairie_exemple/branches/om5_rad/data/pgsql/init_temp.sql
openmairie_exemple/branches/om5_rad/gen/obj/om_tables.class.php
openmairie_exemple/branches/om5_rad/gen/sql/pgsql/om_tables.inc.php
openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php
Log:
ajout des vues et des actions




Modified: openmairie_exemple/branches/om5_rad/TODO.txt
===================================================================
--- openmairie_exemple/branches/om5_rad/TODO.txt 2024-04-24 20:30:18 UTC (rev 4938)
+++ openmairie_exemple/branches/om5_rad/TODO.txt 2024-04-25 13:01:20 UTC (rev 4939)
@@ -68,7 +68,7 @@
JOIN ON sousform.cle_secondaire = form.cle_primaire
GROUP BY form.cleprimaire

-CREATE OR REPLACE VIEW om5.article_montant_ht AS
+CREATE OR REPLACE VIEW om5.famille.montant_ht AS
SELECT famille.famille,
sum(montant_ht) AS montant_ht
FROM om5.article
@@ -88,3 +88,37 @@
table_schema "om5";
table_name"article"

+-> pb si creation de vue pour supprimer table -> drop table cascade
+
+Actions
+=======
+- enlever supprimer, modifier
+
+- edition -> voir un parametre dans view
+
+ $this->class_actions[8] = array(
+ "identifier" => "edition_2",
+ "portlet" => array(
+ "type"=>"action-blank",
+ "libelle" => _("fiche(s) payée(s)"),
+ "order" => 50,
+ "class" => "pdf-16",
+ ),
+ "view" => "edition_paye",
+ );
+
+ function edition_paye(){
+ //Verification de l'accessibilité sur l'élément
+ $this->checkAccessibility();
+ //Récupération de ses paramètres
+ $collectivite = $this->f->getCollectivite($_SESSION['collectivite']);
+ //Génération du PDF
+ $this->setValFFromVal();
+ $result = $this->compute_pdf_output('etat', 'paye',$collectivite, $this->getVal(($this->clePrimaire)));
+ //Affichage du PDF
+ $this->expose_pdf_output(
+ $result['pdf_output'],
+ $result['filename']
+ );
+
+ }

Modified: openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php 2024-04-24 20:30:18 UTC (rev 4938)
+++ openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php 2024-04-25 13:01:20 UTC (rev 4939)
@@ -231,23 +231,22 @@
),
);

+ $links[] = array(
+ "href" => OM_ROUTE_TAB."&obj=om_vues",
+ "class" => "om_vues",
+ "title" => _("gestion des vues"),
+ "right" => array("om_vues", "om_vues_tab", ),
+ "open" => array(
+ "tab.php|om_vues",
+ "index.php|om_vues[module=tab]",
+ "form.php|om_vues",
+ "index.php|om_vues[module=form]",
+ ),
+ );
+

- /*
+
$links[] = array(
- "href" => OM_ROUTE_FORM."&obj=om_champs&idx=0&action=4",
- "class" => "om_champs",
- "title" => __("composition om_champs"),
- "description" => __("Composition des formulaires par table."),
- "right" => array("om_champs", ),
- "open" => array(
- "tab.php|om_champs",
- "index.php|om_champs[module=tab]",
- "form.php|om_champs",
- "index.php|om_champs[module=form]",
- ),
- );
- */
- $links[] = array(
"href" => OM_ROUTE_FORM."&obj=om_forms&idx=0&action=4",
"class" => "om_forms",
"title" => __("composition om_forms"),

Modified: openmairie_exemple/branches/om5_rad/data/pgsql/init_gen.sql
===================================================================
--- openmairie_exemple/branches/om5_rad/data/pgsql/init_gen.sql 2024-04-24 20:30:18 UTC (rev 4938)
+++ openmairie_exemple/branches/om5_rad/data/pgsql/init_gen.sql 2024-04-25 13:01:20 UTC (rev 4939)
@@ -20,27 +20,6 @@
left join om_tables_parametre on tables.table_name=om_tables_parametre.table_name
where table_type = 'BASE TABLE' and table_schema = :'schema'; -- ***

-
-CREATE OR REPLACE VIEW om_champs AS
- SELECT concat(table_name,'.',columns.column_name) as column_name,
- table_name,
- table_schema,
- data_type,
- is_nullable,
- character_maximum_length,
- column_default,
- col_description((table_schema||'.'||table_name)::regclass::oid, ordinal_position) as comment,
- parametres->>'libelle' as libelle,
- parametres->>'type' as type,
- parametres->>'bloc' as bloc,
- parametres->>'position' as position,
- parametres->>'calcul' as calcul,
- parametres->>'liste' as liste
- FROM information_schema.columns
- left join om_forms
- on concat(table_name,'.',columns.column_name)=om_forms.column_name
- where table_schema = :'schema' ;
-
CREATE OR REPLACE VIEW om_contraintes AS
SELECT tc.constraint_name,
tc.table_name,
@@ -52,12 +31,21 @@
JOIN information_schema.constraint_column_usage AS ccu USING (constraint_schema, constraint_name)
WHERE constraint_type = 'FOREIGN KEY' AND tc.table_schema = :'schema'; -- ***

+
+SET search_path = om5, public, pg_catalog;
+CREATE OR REPLACE VIEW om_vues AS
+ SELECT
+ table_name,
+ view_definition,
+ table_schema
+ FROM information_schema.views
+where table_schema = 'om5'; -- where schema_name = :'schema' ;
+
-- mettre les om_droits
INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
(nextval('om_droit_seq'), 'om_tables', 1);
INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
-(nextval('om_droit_seq'), 'om_champs', 1);
+(nextval('om_droit_seq'), 'om_contraintes', 1);
INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
-(nextval('om_droit_seq'), 'om_contraintes', 1);
+(nextval('om_droit_seq'), 'om_vues', 1);

-

Modified: openmairie_exemple/branches/om5_rad/data/pgsql/init_gen_plus.sql
===================================================================
--- openmairie_exemple/branches/om5_rad/data/pgsql/init_gen_plus.sql 2024-04-24 20:30:18 UTC (rev 4938)
+++ openmairie_exemple/branches/om5_rad/data/pgsql/init_gen_plus.sql 2024-04-25 13:01:20 UTC (rev 4939)
@@ -27,3 +27,23 @@

ALTER TABLE ONLY om_tables_parametre
ADD CONSTRAINT om_tables_parametre_pkey PRIMARY KEY (table_name);
+
+CREATE TABLE om_actions(
+ om_actions integer not null,
+ libelle character varying(40) not null,
+ module character varying(40) not null,
+ parametres jsonb,
+ table_name character varying(40)
+);
+
+CREATE SEQUENCE om_actions_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+ALTER TABLE ONLY om_actions
+ ADD CONSTRAINT om_actions_pkey PRIMARY KEY (om_actions);
+
+INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
+(nextval('om_droit_seq'), 'om_actions', 1);

Modified: openmairie_exemple/branches/om5_rad/data/pgsql/init_temp.sql
===================================================================
--- openmairie_exemple/branches/om5_rad/data/pgsql/init_temp.sql 2024-04-24 20:30:18 UTC (rev 4938)
+++ openmairie_exemple/branches/om5_rad/data/pgsql/init_temp.sql 2024-04-25 13:01:20 UTC (rev 4939)
@@ -16,23 +16,6 @@
recherche integer
);

-CREATE TABLE om_champs (
- column_name character varying(120) NOT NULL,
- table_name character varying(40),
- table_schema character varying(40),
- data_type character varying(40),
- character_maximum_length integer,
- is_nullable character varying(5),
- column_default character varying(40),
- comment text,
- parametres text,
- libelle varchar(80),
- type varchar(40),
- bloc varchar(5),
- position integer,
- calcul varchar(255),
- liste integer
-);

CREATE TABLE om_forms (
column_name character varying(120) NOT NULL,
@@ -62,18 +45,32 @@
);


-create table om_vues
-
+create table om_vues (
+ table_name character varying(80) not null,
+ view_definition text
+);


+CREATE TABLE om_actions(
+ om_actions integer not null,
+ libelle character varying(40) not null,
+ module character varying(40) not null,
+ parametres jsonb,
+ table_name character varying(40)
+);
+
+CREATE SEQUENCE om_actions_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
-- pk

ALTER TABLE ONLY om_tables
ADD CONSTRAINT om_tables_pkey PRIMARY KEY (table_name);

-ALTER TABLE ONLY om_champs
- ADD CONSTRAINT om_champs_pkey PRIMARY KEY (column_name);
-
ALTER TABLE ONLY om_contraintes
ADD CONSTRAINT om_contraintes_pkey PRIMARY KEY (constraint_name);

@@ -80,15 +77,21 @@
ALTER TABLE ONLY om_forms
ADD CONSTRAINT om_forms_pkey PRIMARY KEY (column_name);

+ALTER TABLE ONLY om_vues
+ ADD CONSTRAINT om_vues_pkey PRIMARY KEY (table_name);

-
+ALTER TABLE ONLY om_actions
+ ADD CONSTRAINT om_actions_pkey PRIMARY KEY (om_actions);
+
+
-- fk

-ALTER TABLE ONLY om_champs
- ADD CONSTRAINT om_champs_table_name_fkey FOREIGN KEY (table_name) REFERENCES om_tables(table_name);
-
ALTER TABLE ONLY om_contraintes
ADD CONSTRAINT om_contraintes_om_tables_fkey FOREIGN KEY (table_name) REFERENCES om_tables(table_name);

ALTER TABLE ONLY om_forms
ADD CONSTRAINT om_forms_table_name_fkey FOREIGN KEY (table_name) REFERENCES om_tables(table_name);
+
+
+ALTER TABLE ONLY om_actions
+ ADD CONSTRAINT om_actions_table_name_fkey FOREIGN KEY (table_name) REFERENCES om_tables(table_name);

Modified: openmairie_exemple/branches/om5_rad/gen/obj/om_tables.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/gen/obj/om_tables.class.php 2024-04-24 20:30:18 UTC (rev 4938)
+++ openmairie_exemple/branches/om5_rad/gen/obj/om_tables.class.php 2024-04-25 13:01:20 UTC (rev 4939)
@@ -1,6 +1,6 @@
<?php
//$Id$
-//gen openMairie le 17/04/2024 15:24
+//gen openMairie le 25/04/2024 14:15

require_once PATH_OPENMAIRIE."om_dbform.class.php";

@@ -265,8 +265,8 @@
function cleSecondaire($id, &$dnu1 = null, $val = array(), $dnu2 = null) {
// On appelle la methode de la classe parent
parent::cleSecondaire($id);
- // Verification de la cle secondaire : om_champs
- $this->rechercheTable($this->f->db, "om_champs", "table_name", $id);
+ // Verification de la cle secondaire : om_actions
+ $this->rechercheTable($this->f->db, "om_actions", "table_name", $id);
// Verification de la cle secondaire : om_contraintes
$this->rechercheTable($this->f->db, "om_contraintes", "table_name", $id);
// Verification de la cle secondaire : om_forms

Modified: openmairie_exemple/branches/om5_rad/gen/sql/pgsql/om_tables.inc.php
===================================================================
--- openmairie_exemple/branches/om5_rad/gen/sql/pgsql/om_tables.inc.php 2024-04-24 20:30:18 UTC (rev 4938)
+++ openmairie_exemple/branches/om5_rad/gen/sql/pgsql/om_tables.inc.php 2024-04-25 13:01:20 UTC (rev 4939)
@@ -1,6 +1,6 @@
<?php
//$Id$
-//gen openMairie le 17/04/2024 15:24
+//gen openMairie le 25/04/2024 14:15

$DEBUG=0;
$serie=15;
@@ -64,7 +64,7 @@
* Gestion SOUSFORMULAIRE => $sousformulaire
*/
$sousformulaire = array(
- 'om_champs',
+ 'om_actions',
'om_contraintes',
'om_forms',
);

Modified: openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php
===================================================================
--- openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php 2024-04-24 20:30:18 UTC (rev 4938)
+++ openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php 2024-04-25 13:01:20 UTC (rev 4939)
@@ -29,4 +29,6 @@
$sousformulaire = array(
'om_forms',
'om_contraintes',
+ 'om_actions',
);
+

Reply all
Reply to author
Forward
0 new messages