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

0 views
Skip to first unread message

fray...@users.adullact.net

unread,
May 8, 2024, 8:32:59 AMMay 8
to openmairie...@googlegroups.com
Author: fraynaud
Date: 2024-05-08 14:32:56 +0200 (Wed, 08 May 2024)
New Revision: 4958

Modified:
openmairie_exemple/branches/om5_rad/
openmairie_exemple/branches/om5_rad/HISTORY.txt
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/obj/om_actions.class.php
openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php
Log:

om_action methode etat



Index: openmairie_exemple/branches/om5_rad
===================================================================
--- openmairie_exemple/branches/om5_rad 2024-05-07 18:44:49 UTC (rev 4957)
+++ openmairie_exemple/branches/om5_rad 2024-05-08 12:32:56 UTC (rev 4958)

Property changes on: openmairie_exemple/branches/om5_rad
___________________________________________________________________
Modified: svn:externals
## -6,5 +6,6 ##
core https://scm.adullact.net/anonscm/svn/openmairie/openmairie_exemple/tags/4.10.0/core/
lib https://scm.adullact.net/anonscm/svn/openmairie/openmairie_exemple/tags/4.10.0/lib/
php https://scm.adullact.net/anonscm/svn/openmairie/openmairie_exemple/tags/4.10.0/php/
+om-theme https://scm.adullact.net/anonscm/svn/openmairie/externals/om-theme/kaf/trunk/


Modified: openmairie_exemple/branches/om5_rad/HISTORY.txt
===================================================================
--- openmairie_exemple/branches/om5_rad/HISTORY.txt 2024-05-07 18:44:49 UTC (rev 4957)
+++ openmairie_exemple/branches/om5_rad/HISTORY.txt 2024-05-08 12:32:56 UTC (rev 4958)
@@ -145,10 +145,17 @@
* 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
+* Mise au point install et om_setup 01/05/2024

+version 1.2.0 ajout d'un module édition -> construction de méthodes d'initialisation état, sous-état et action
+- Evolution : surcharge om_etat dans obj : ajout d'un champ table_name -> clé secondaire
+- suppression de la surcharge obj/ om_etat, om_sousetat et om_requete et ajout de champs 08/05/2024
+- regeneration om_table à faire avec suppression des clés secondaires
+- Evolution : om_actions : ajout de la méthode : ajouter un état + requete sql

+
+- Evolution : om_forms : ajout d'une méthode : ajouter un sous état sur les champs clé secondaires
+
4.10.0 (29/11/2022
-------------------

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-07 18:44:49 UTC (rev 4957)
+++ openmairie_exemple/branches/om5_rad/data/pgsql/init_gen_plus.sql 2024-05-08 12:32:56 UTC (rev 4958)
@@ -59,6 +59,14 @@
table_name character varying(40)
);

+
+
+-- module édition
+
+--alter table om_etat add column table_name varchar(40);
+--alter table om_sousetat add column table_name varchar(40);
+--alter table om_requete add column table_name varchar(40);
+
-- pk

ALTER TABLE ONLY om_tables_parametre
@@ -78,3 +86,5 @@
NO MINVALUE
NO MAXVALUE
CACHE 1;
+
+

Modified: openmairie_exemple/branches/om5_rad/data/pgsql/init_temp.sql
===================================================================
--- openmairie_exemple/branches/om5_rad/data/pgsql/init_temp.sql 2024-05-07 18:44:49 UTC (rev 4957)
+++ openmairie_exemple/branches/om5_rad/data/pgsql/init_temp.sql 2024-05-08 12:32:56 UTC (rev 4958)
@@ -126,3 +126,17 @@

ALTER TABLE ONLY om_triggers
ADD CONSTRAINT om_triggers_event_object_table_fkey FOREIGN KEY (event_object_table) REFERENCES om_tables(table_name);
+
+-- edition
+
+ALTER TABLE ONLY om_etat
+ ADD CONSTRAINT om_etat_om_tables_fkey FOREIGN KEY (table_name) REFERENCES om_tables(table_name);
+
+ALTER TABLE ONLY om_sousetat
+ ADD CONSTRAINT om_sousetat_om_tables_fkey FOREIGN KEY (table_name) REFERENCES om_tables(table_name);
+
+ALTER TABLE ONLY om_requete
+ ADD CONSTRAINT om_requete_om_tables_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-05-07 18:44:49 UTC (rev 4957)
+++ openmairie_exemple/branches/om5_rad/gen/obj/om_tables.class.php 2024-05-08 12:32:56 UTC (rev 4958)
@@ -1,6 +1,6 @@
<?php
//$Id$
-//gen openMairie le 30/04/2024 22:09
+//gen openMairie le 05/05/2024 18:30

require_once PATH_OPENMAIRIE."om_dbform.class.php";

@@ -269,8 +269,14 @@
$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_etat
+ $this->rechercheTable($this->f->db, "om_etat", "table_name", $id);
// Verification de la cle secondaire : om_forms
$this->rechercheTable($this->f->db, "om_forms", "table_name", $id);
+ // Verification de la cle secondaire : om_requete
+ $this->rechercheTable($this->f->db, "om_requete", "table_name", $id);
+ // Verification de la cle secondaire : om_sousetat
+ $this->rechercheTable($this->f->db, "om_sousetat", "table_name", $id);
// Verification de la cle secondaire : om_triggers
$this->rechercheTable($this->f->db, "om_triggers", "event_object_table", $id);
}

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-05-07 18:44:49 UTC (rev 4957)
+++ openmairie_exemple/branches/om5_rad/gen/sql/pgsql/om_tables.inc.php 2024-05-08 12:32:56 UTC (rev 4958)
@@ -1,6 +1,6 @@
<?php
//$Id$
-//gen openMairie le 30/04/2024 22:09
+//gen openMairie le 05/05/2024 18:30

$DEBUG=0;
$serie=15;
@@ -66,7 +66,10 @@
$sousformulaire = array(
'om_actions',
'om_contraintes',
+ 'om_etat',
'om_forms',
+ 'om_requete',
+ 'om_sousetat',
'om_triggers',
);


Modified: openmairie_exemple/branches/om5_rad/obj/om_actions.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/obj/om_actions.class.php 2024-05-07 18:44:49 UTC (rev 4957)
+++ openmairie_exemple/branches/om5_rad/obj/om_actions.class.php 2024-05-08 12:32:56 UTC (rev 4958)
@@ -8,6 +8,31 @@

class om_actions extends om_actions_gen {

+
+ function init_class_actions() {
+ parent::init_class_actions();
+ // modifier
+ //$this->class_actions[1] = array(); // pas de méthode modifier
+
+ // generer
+ $this->class_actions[4] = array(
+ "identifier" => "generer_etat",
+ "portlet" => array(
+ "type" => "action-direct-with-confirmation",
+ "libelle" => _("générer un état "),
+ "order" => 40,
+ "class" => "copy-16",
+ ),
+ "method" => "generer_etat",
+ "permission_suffix" => "om_actions",
+ //"condition" => array(
+ // "is_valider")
+ );
+ }
+
+
+
+
function setType(&$form,$maj) {
parent::setType($form, $maj);
if($maj==0){
@@ -33,4 +58,60 @@
}
}

+ function generer_etat(){
+ $obj = $this->getParameter('idxformulaire');
+ // recherche des champs
+ $sql = "select omforms ";
+ $sql .= " from ".DB_PREFIXE."om_forms ";
+ $sql .= " where table_name ='".$obj."'";
+ $res = $this->f->db->query($sql);
+ $this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE);
+ $this->f->isDatabaseError($res2);
+ // sql
+ $temp='';
+ $temp1='';
+ if($field!=array()){
+ for ($i = 0; $i < sizeof($field); $i++) {
+ $temp2=explode(".",$field[$i]);
+ $temp3=$temp2[1];
+ $temp.=$field[$i].' as '.$temp3.',';
+ $temp1.="[".$temp3.']'.chr(13).chr(10);
+ }
+ $temp=substr($temp, 0, strlen($temp)-1);
+ }
+
+
+ // om_requete
+ $this->f->db->autoCommit(false);
+ require_once "../core/obj/om_requete.class.php";
+ $om_requete = new om_requete_core("]", $this->f->db, $DEBUG);
+ $variable = '&';
+ //
+ $val = array(
+ "om_requete" => "",
+ "code" => $obj,
+ "libelle" => __("Requete")." '".$obj."'",
+ "description" => "créé le ".date('d/m/Y'),
+ "type" => "sql",
+ "requete" => "select * from &DB_PREFIXE".$obj." where ".$obj.".".$obj."='".$variable."idx'",
+ "classe" => "",
+ "methode" => "",
+ "merge_fields" => "",
+ );
+ //
+ $ret = $om_requete->ajouter($val, $this->f->db, null);
+ if ($ret !== true) {
+ //
+ $this->addToMessage(__("Erreur lors de l'ajout de la requête. Contactez votre administrateur."));
+ return "";
+ }
+ $this->addToMessage(__("création de requête"));
+ //$this->f->db->commit();
+
+ }
+
+
+
+
+
}

Modified: openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php
===================================================================
--- openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php 2024-05-07 18:44:49 UTC (rev 4957)
+++ openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php 2024-05-08 12:32:56 UTC (rev 4958)
@@ -3,6 +3,11 @@

include "../gen/sql/pgsql/om_tables.inc.php";

+// présentation
+$ent = " om5 no code -> "._("gestion de tables et génération des objets ");
+$tab_title = _("Table");
+$tab_description = _("Ce listing décrit les tables existantes pour votre application");
+
// Filtre listing standard
$selection = " where concat(table_schema,'.') = '".DB_PREFIXE."'";
$selection .= " and substring(om_tables.table_name,1,3) not like 'om_'";
@@ -26,10 +31,29 @@
"parametres->>'recherche' as recherche",
);

+
+$sousformulaire_parameters = array(
+ "om_forms" => array(
+ "title" => _("Formulaire"),
+ ),
+ "om_actions" => array(
+ "title" => _("Action"),
+ ),
+ "om_contraintes" => array(
+ "title" => _("clé secondaire"),
+ ),
+ "om_triggers" => array(
+ "title" => _("Trigger pgsql"),
+ ),
+
+);
+
+
$sousformulaire = array(
'om_forms',
+ 'om_actions',
'om_contraintes',
- 'om_actions',
'om_triggers',
+
);


Reply all
Reply to author
Forward
0 new messages