fray...@users.adullact.net
unread,May 2, 2024, 5:42:25 AMMay 2Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openmairie...@googlegroups.com
Author: fraynaud
Date: 2024-05-02 11:42:22 +0200 (Thu, 02 May 2024)
New Revision: 4952
Modified:
openmairie_exemple/branches/om5_rad/HISTORY.txt
openmairie_exemple/branches/om5_rad/TODO.txt
openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php
openmairie_exemple/branches/om5_rad/app/js/script.js
openmairie_exemple/branches/om5_rad/app/om_gen_plus.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/install/om_setup_config.php
openmairie_exemple/branches/om5_rad/obj/om_forms.class.php
openmairie_exemple/branches/om5_rad/obj/om_tables.class.php
Log:
diverses corrections
Modified: openmairie_exemple/branches/om5_rad/HISTORY.txt
===================================================================
--- openmairie_exemple/branches/om5_rad/HISTORY.txt 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/HISTORY.txt 2024-05-02 09:42:22 UTC (rev 4952)
@@ -145,6 +145,9 @@
* Evolution : om_forms + om_gen_plus : changement du champs "double précision" en "numeric" 01/05/2024
* Evolution : om_tables : methode de remise en ordre par défaut liste et champs 01/05/2024
* bug : menu affichage composition : creation om_forms_liste (class et inc) 01/05/2024
+* Evolution : generation om_etat et om_sousetat dans le menu om5_no_code -> a reprendre a cause de gen
+* bug : script.js : numeric, om_forms : conrole calcul sql, om_gen_plus : format sql
+* Mise au point install et om_setup 01/05/2024
4.10.0 (29/11/2022
Modified: openmairie_exemple/branches/om5_rad/TODO.txt
===================================================================
--- openmairie_exemple/branches/om5_rad/TODO.txt 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/TODO.txt 2024-05-02 09:42:22 UTC (rev 4952)
@@ -115,6 +115,12 @@
- mettre en place les triggers champs calculés
- mettre en place les vues : agrégation champs sql
- action édition
+- om_etat et sous_etat
+ rajouter un champ table_name en etat et sous etat
+ clé secondaire avec om_tables
+ select_multiple pour om_sousetat (ts les champs pour état)
+ etat : requete si no exists
+ ajouter l action etat -> en generation
* tb
==
Modified: openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php 2024-05-02 09:42:22 UTC (rev 4952)
@@ -221,7 +221,7 @@
$links[] = array(
"href" => OM_ROUTE_TAB."&obj=om_tables",
"class" => "om_tables",
- "title" => _("gestion des tables"),
+ "title" => _("gestion tables"),
"right" => array("om_tables", "om_tables_tab", ),
"open" => array(
"tab.php|om_tables",
@@ -234,7 +234,7 @@
$links[] = array(
"href" => OM_ROUTE_TAB."&obj=om_vues",
"class" => "om_vues",
- "title" => _("gestion des vues"),
+ "title" => _("gestion vues"),
"right" => array("om_vues", "om_vues_tab", ),
"open" => array(
"tab.php|om_vues",
@@ -247,7 +247,7 @@
$links[] = array(
"href" => OM_ROUTE_TAB."&obj=om_proc",
"class" => "om_vues",
- "title" => _("gestion des procédures"),
+ "title" => _("gestion procédures"),
"right" => array("om_proc", "om_proc_tab", ),
"open" => array(
"tab.php|om_proc",
@@ -260,8 +260,8 @@
$links[] = array(
"href" => OM_ROUTE_FORM."&obj=om_forms&idx=0&action=4",
"class" => "om_forms",
- "title" => __("composition formulaire"),
- "description" => __("Composition des formulaires"),
+ "title" => __("composition formulaires"),
+ "description" => __("Composition formulaires"),
"right" => array("om_forms", ),
"open" => array(
"tab.php|om_forms",
@@ -274,7 +274,7 @@
$links[] = array(
"href" => OM_ROUTE_FORM."&obj=om_forms_liste&idx=0&action=6",
"class" => "om_forms",
- "title" => __("composition des listes"),
+ "title" => __("composition listes"),
"description" => __("Composition listes."),
"right" => array("om_forms", ),
"open" => array(
@@ -285,13 +285,37 @@
),
);
+// index.php?module=gen&view=editions_etat
+ $links[] = array(
+ "href" => OM_ROUTE_MODULE_GEN."&view=editions_etat",
+ "class" => "om_gen",
+ "title" => __("générer état"),
+ "description" => __("generation d'un squelette d'état"),
+ "right" => array("om_forms", ),
+ //"open" => array(
+ // OM_ROUTE_MODULE_GEN."&view=editions_etat",
+ //),
+ );
+ $links[] = array(
+ //"href" => OM_ROUTE_MODULE_GEN."&view=editions_sousetat",
+ "href" => "../app/index.php?module=gen&view=editions_sousetat",
+ "class" => "om_gen",
+ "title" => __("générer sous état"),
+ "description" => __("generation d'un squelette de sous état"),
+ "right" => array("om_forms", ),
+ //"open" => array(
+ // OM_ROUTE_MODULE_GEN."&view=editions_etat",
+ //),
+ );
+
$rubrik['links'] = $links;
//
$menu_apres[] = $rubrik;
// }}}
+//print_r($menu["om-menu-rubrik-administration"]);
$this->config__menu = array_merge(
$menu_avant,
@@ -298,6 +322,9 @@
$parent_menu,
$menu_apres
);
+
+
+
}
Modified: openmairie_exemple/branches/om5_rad/app/js/script.js
===================================================================
--- openmairie_exemple/branches/om5_rad/app/js/script.js 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/app/js/script.js 2024-05-02 09:42:22 UTC (rev 4952)
@@ -61,7 +61,7 @@
document.getElementById('lib-column_name').innerHTML='Nom du champs';
document.getElementById('lib-tables').innerHTML='';
// calcul
- if(champ == 'integer' || champ == 'double precision' || champ == 'sql' ){
+ if(champ == 'integer' || champ == 'numeric' || champ == 'sql' ){
document.f2.elements['calcul'].hidden=false;
}else{
document.f2.elements['calcul'].hidden=true;
Modified: openmairie_exemple/branches/om5_rad/app/om_gen_plus.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/app/om_gen_plus.class.php 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/app/om_gen_plus.class.php 2024-05-02 09:42:22 UTC (rev 4952)
@@ -855,8 +855,8 @@
// formatage -> cast en numeric -> en 2 caractères : reste à droite en colonne et pas to_char
// arrondi la somme au centiéme si millième supérieur à 5 : 0,055 = 0,06
$champaffiche.= "'round(".$this->table.".".$elem["name"];
- $champaffiche.= '::numeric ,2) ';
- $champaffiche.= "as \"'.__(\"".$libelle."\").'\"',";
+ $champaffiche.= ' ,2) '; // ::numeric
+ $champaffiche.= " as \"'.__(\"".$libelle."\").'\"',";
}
if($elem['data_type']== 'boolean'){ // format oui/non
$champaffiche.= "\"case ".$this->table.".".$elem["name"]." when 't' then 'Oui' else 'Non' end as \\\"\".__(\"".$libelle."\").\"\\\"\",";
@@ -864,8 +864,8 @@
// 'round(montant_ht::numeric*1.2321, 2) as "'.__("montant ttc").'"',
if($elem['type']== 'sql'){ //
if($elem['calcul']!=''){
- $champaffiche.= "'".$elem['calcul'];
- $champaffiche.= '';
+ $champaffiche.= "'round(".$elem['calcul'];
+ $champaffiche.= ' ,2) ';
$champaffiche.= "as \"'.__(\"".$libelle."\").'\"',";
}else
$champaffiche.= "' \'\' as \"'.__(\"".$libelle."\").'\"',";
Modified: openmairie_exemple/branches/om5_rad/data/pgsql/init_gen.sql
===================================================================
--- openmairie_exemple/branches/om5_rad/data/pgsql/init_gen.sql 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/data/pgsql/init_gen.sql 2024-05-02 09:42:22 UTC (rev 4952)
@@ -60,7 +60,7 @@
prosrc
from pg_proc
inner join pg_namespace on pg_namespace.oid=pg_proc.pronamespace
- where nspname='om5'; -- :'schema';
+ where nspname= :'schema';
CREATE OR REPLACE VIEW om_triggers AS
SELECT
@@ -74,16 +74,9 @@
action_orientation,
action_timing
from information_schema.triggers
- where trigger_schema = 'om5'; -- :'schema';
+ where trigger_schema = :'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_contraintes', 1);
-INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
-(nextval('om_droit_seq'), 'om_vues', 1);
-INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
-(nextval('om_droit_seq'), 'om_champs', 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-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/data/pgsql/init_gen_plus.sql 2024-05-02 09:42:22 UTC (rev 4952)
@@ -3,7 +3,7 @@
-- SET search_path = om5, public, pg_catalog;
--- mettre les om_droits
+-- tables
INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
(nextval('om_droit_seq'), 'om_forms', 1);
INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
@@ -11,12 +11,31 @@
INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
(nextval('om_droit_seq'), 'om_actions', 1);
INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
-(nextval('om_droit_seq'), 'om_proc', 1);
+(nextval('om_droit_seq'), 'om_forms_liste', 1);
+
+-- vues
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_contraintes', 1);
+INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
+(nextval('om_droit_seq'), 'om_vues', 1);
+INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
+(nextval('om_droit_seq'), 'om_champs', 1);
+INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
(nextval('om_droit_seq'), 'om_triggers', 1);
+INSERT INTO om_droit (om_droit, libelle, om_profil) VALUES
+(nextval('om_droit_seq'), 'om_proc', 1);
+-- profil hiérarchique
+INSERT INTO om_profil (om_profil, libelle, hierarchie) VALUES
+(nextval('om_profil_seq'), 'UTILISATEUR', 3);
+UPDATE om_profil set hierarchie = 5 where libelle = 'ADMINISTRATEUR';
+-- enlever gen
+
+
-- tables
CREATE TABLE om_tables_parametre
Modified: openmairie_exemple/branches/om5_rad/install/om_setup_config.php
===================================================================
--- openmairie_exemple/branches/om5_rad/install/om_setup_config.php 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/install/om_setup_config.php 2024-05-02 09:42:22 UTC (rev 4952)
@@ -53,7 +53,7 @@
// echo " ".$str3." -> ";
$res = pg_query($con, $str3);
if (!$res)
- echo _("erreur requete").$str3;
+ echo '<b>'._("erreur requete").$str3."</b><br>";
//else
// echo _("executé");
}
@@ -67,19 +67,19 @@
$query = file_get_contents($filesql);
$res = pg_query($con, $query);
if (!$res)
- echo _("erreur requete").$str3;
+ echo '<b>-> '._("erreur requete")."</b><br>";
else
- echo _("executé");
+ echo '<b>-> '._("executé")."</b><br>";
echo "<br>";
}
function requete($sql,$con){
$res = pg_query($con, $sql);
- echo $sql;
+ echo substr($sql,0,50);
if (!$res)
- echo " erreur requete<br>";
+ echo '<b> ->'._("erreur requete").$str3."</b><br>";
else
- echo " executé<br>";
+ echo '<b> ->'._("executé")."</b><br>";
}
@@ -326,7 +326,7 @@
// vues sur information_schema pour le schema (récupération de la variable SCHEMA
// qui n'est pas valorisée dans /data/pgsql/init_gen.sql
echo "<b>"._("Ajout des vues et des droits du projet om5_rad ")."</b><br>";
- requete("CREATE OR REPLACE VIEW ".SCHEMA.".om_tables AS
+ requete("CREATE OR REPLACE VIEW om_tables AS
SELECT tables.table_name, table_schema, table_type,
obj_description((table_schema||'.'||tables.table_name)::regclass::oid) as comment,
parametres->>'libelle' as libelle,
@@ -355,13 +355,22 @@
WHERE constraint_type = 'FOREIGN KEY' AND tc.table_schema = '".SCHEMA."'",$con);
requete("CREATE OR REPLACE VIEW om_vues AS
SELECT table_name, table_schema, view_definition FROM information_schema.views
- where table_schema='".SCHEMA."'",$con);
- // om_droits
- requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_tables', 1)",$con);
- requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_champs', 1)",$con);
- requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_contraintes', 1)",$con);
- requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_vues', 1)",$con);
-
+ where table_schema='".SCHEMA."'",$con);
+ requete("CREATE OR REPLACE VIEW om_proc AS
+ SELECT proname, prosrc from pg_proc inner join pg_namespace on pg_namespace.oid=pg_proc.pronamespace
+ where nspname='".SCHEMA."'",$con);
+ requete("CREATE OR REPLACE VIEW om_triggers AS
+ SELECT trigger_name, trigger_schema, event_manipulation, event_object_table,
+ action_order, action_condition, action_statement, action_orientation, action_timing
+ from information_schema.triggers
+ where trigger_schema ='".SCHEMA."'",$con);
+ // om_droits -> dans om_gen_plus.sql
+ //requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_tables', 1)",$con);
+ //requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_champs', 1)",$con);
+ //requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_contraintes', 1)",$con);
+ //requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_vues', 1)",$con);
+ //requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_triggers', 1)",$con);
+ //requete("INSERT INTO ".SCHEMA.".om_droit (om_droit, libelle, om_profil) VALUES (nextval('".SCHEMA.".om_droit_seq'), 'om_proc', 1)",$con);
}
/* Fermeture de la connection */
pg_close($con);
Modified: openmairie_exemple/branches/om5_rad/obj/om_forms.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/obj/om_forms.class.php 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/obj/om_forms.class.php 2024-05-02 09:42:22 UTC (rev 4952)
@@ -163,6 +163,7 @@
$form->setType("bloc", "select");
$form->setType("type", "select");
$form->setType("libelle", "hidden"); // libelle = champs original
+ $form->setType("libelle_court", "hidden"); // libelle = champs original
$form->setType("tables", "select"); // cle secondaire
$form->setType("liste", "select");
}
@@ -358,7 +359,8 @@
$this->f->addToLog("obj/om_champs_class.php: db->getOne(\"".$calcul."\");", DEBUG_MODE);
}
// verification que les champs existent dans la table en cours
- if($this->valF['data_type'] == "numeric" or $this->valF['data_type'] == "integer"){
+ if($this->valF['data_type'] == "numeric" or $this->valF['data_type'] == "integer"
+ or $this->valF['data_type']=='sql'){
$tp=str_replace("*", "|*|",$calcul);
$tp=str_replace("+", "|+|",$tp);
$tp=str_replace("-", "|-|",$tp);
@@ -540,8 +542,8 @@
$val['calcul']=$this->verifier_calcul($val['calcul']);
$val['libelle']=$this->verifier_libelle($val['libelle']);
// data_type -> type sql
- if($this->valF['data_type']=='sql')
- $this->valF['type']= 'sql';
+ if($val['data_type']=='sql')
+ $val['type']= 'sql';
if ($this->correct) {
// type : sql
if($this->valF['type']!= 'sql'){
Modified: openmairie_exemple/branches/om5_rad/obj/om_tables.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/obj/om_tables.class.php 2024-05-01 16:29:07 UTC (rev 4951)
+++ openmairie_exemple/branches/om5_rad/obj/om_tables.class.php 2024-05-02 09:42:22 UTC (rev 4952)
@@ -634,7 +634,8 @@
$this->f->addToLog("app/om_champs_class.php: db->query(".$sql."\", ".print_r($temp, true).");", DEBUG_MODE);
$this->f->isDatabaseError($res);
$position=0;
- $this->addToMessage("<b>"._("liste")."</b>");
+ $this->addToMessage("<b>"._("liste")."</b>");
+ $this->f->db->autoCommit(false);
while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$position++;
// update position