diff --git a/updates/36/36012/ws/ddl.sql b/updates/36/36012/ws/ddl.sql index 611d43ac53..831aefe09b 100644 --- a/updates/36/36012/ws/ddl.sql +++ b/updates/36/36012/ws/ddl.sql @@ -374,4 +374,6 @@ SELECT gw_fct_admin_manage_fields($${"data":{"action":"DROP","table":"inp_dscena DROP VIEW IF EXISTS vi_parent_arc; DROP VIEW IF EXISTS vi_parent_node; DROP VIEW IF EXISTS vi_parent_hydrometer; -DROP VIEW IF EXISTS v_edit_field_valve; \ No newline at end of file +DROP VIEW IF EXISTS v_edit_field_valve; + +SELECT gw_fct_admin_manage_fields($${"data":{"action":"ADD","table":"inp_shortpipe", "column":"custom_dint", "dataType":"integer"}}$$); diff --git a/updates/36/36012/ws/ddlview.sql b/updates/36/36012/ws/ddlview.sql index 3036349922..ffc18f2e37 100644 --- a/updates/36/36012/ws/ddlview.sql +++ b/updates/36/36012/ws/ddlview.sql @@ -39,10 +39,8 @@ AS SELECT d.dma_id, d.name, d.macrodma_id, d.sector_id, - s.name as sector_name, d.expl_id, - e.name as expl_name, - et.idval, + et.idval as dma_type, d.descript, d.pattern_id, d.graphconfig::text AS graphconfig, @@ -58,8 +56,6 @@ AS SELECT d.dma_id, d.lastupdate_user, d.the_geom FROM dma d - LEFT JOIN sector s USING (sector_id) - LEFT JOIN exploitation e USING (expl_id) LEFT JOIN edit_typevalue et on et.id = dma_type AND typevalue = 'dma_type' ORDER BY d.dma_id; @@ -67,10 +63,8 @@ CREATE OR REPLACE VIEW vu_presszone AS SELECT p.presszone_id, p.name, p.sector_id, - s.name as sector_name, p.expl_id, - e.name as expl_name, - et.idval, + et.idval as presszone_type, p.descript, p.head, p.graphconfig::text AS graphconfig, @@ -84,8 +78,6 @@ AS SELECT p.presszone_id, p.lastupdate_user, p.the_geom FROM presszone p - LEFT JOIN sector s USING (sector_id) - LEFT JOIN exploitation e USING (expl_id) LEFT JOIN edit_typevalue et on et.id = presszone_type AND typevalue = 'presszone_type' ORDER BY p.presszone_id; @@ -95,24 +87,20 @@ AS SELECT d.dqa_id, d.macrodqa_id, d.descript, d.sector_id, - s.name as sector_name, d.expl_id, - e.name as expl_name, - et.idval, + et.idval as dqa_type, d.pattern_id, d.graphconfig::text AS graphconfig, d.stylesheet::text AS stylesheet, d.link, d.active, - d.undelete, + d.undelete, d.tstamp, d.insert_user, d.lastupdate, d.lastupdate_user, d.the_geom FROM dqa d - LEFT JOIN sector s USING (sector_id) - LEFT JOIN exploitation e USING (expl_id) LEFT JOIN edit_typevalue et on et.id = dqa_type AND typevalue = 'dqa_type' ORDER BY d.dqa_id; @@ -3720,9 +3708,12 @@ CREATE OR REPLACE VIEW ve_epa_inlet AS LEFT JOIN v_rpt_node USING (node_id); +drop view ve_epa_shortpipe; CREATE OR REPLACE VIEW ve_epa_shortpipe AS SELECT inp_shortpipe.node_id, inp_shortpipe.minorloss, + cat_dint, + inp_shortpipe.custom_dint, v.to_arc, CASE WHEN v.active is true and v.to_arc IS NOT NULL THEN 'CV'::character varying(12) @@ -3748,7 +3739,8 @@ CREATE OR REPLACE VIEW ve_epa_shortpipe AS v_rpt_arc.reaction_min, v_rpt_arc.ffactor_max, v_rpt_arc.ffactor_min - FROM inp_shortpipe + FROM vu_node + JOIN inp_shortpipe USING (node_id) LEFT JOIN v_rpt_arc ON concat(inp_shortpipe.node_id, '_n2a') = v_rpt_arc.arc_id::text LEFT JOIN man_valve v ON v.node_id::text = inp_shortpipe.node_id::text; diff --git a/updates/36/36012/ws/dml.sql b/updates/36/36012/ws/dml.sql index 944f9d99a1..91a16473dd 100644 --- a/updates/36/36012/ws/dml.sql +++ b/updates/36/36012/ws/dml.sql @@ -142,9 +142,7 @@ VALUES('edit_typevalue', 'presszone_type', 'presszone', 'presszone_type', true); INSERT INTO sys_foreignkey (typevalue_table, typevalue_name, target_table, target_field, active) VALUES('edit_typevalue', 'dma_type', 'dma', 'dma_type', true); -INSERT INTO edit_typevalue VALUES ('edit_typevalue', 'dqa_type','UDEFINED', 'UDEFINED'); - -INSERT INTO edit_typevalue VALUES ('edit_typevalue', 'dma_type','UDEFINED', 'UDEFINED'); +INSERT INTO edit_typevalue VALUES ('dma_type','UNDEFINED', 'UNDEFINED'); ALTER TABLE edit_typevalue DISABLE TRIGGER gw_trg_typevalue_config_fk; UPDATE edit_typevalue SET id = upper(id), idval=upper(idval) WHERE typevalue IN ('sector_type'); @@ -192,4 +190,73 @@ delete from config_form_fields where columnname = 'cat_arctype_id' and formname delete from sys_table where id = 'vi_parent_arc'; delete from sys_table where id = 'vi_parent_connec'; delete from sys_table where id = 'vi_parent_hydrometer'; -delete from sys_table where id = 'v_edit_field_valve'; \ No newline at end of file +delete from sys_table where id = 'v_edit_field_valve'; + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('v_edit_dma', 'form_feature', 'tab_none', 'dma_type', 'lyt_data_1', 18, 'string', 'combo', 'dma_type', 'dma_type', false, false, true, false, 'SELECT id, idval FROM edit_typevalue WHERE typevalue=''dma_type''', false); + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, dv_orderby_id, widgetcontrols, hidden) +VALUES ('v_edit_dma', 'form_feature', 'tab_none', 'sector_id', 'lyt_data_1', 19, 'string', 'combo', 'sector_id', 'sector_id', false, false, true, false, 'SELECT sector_id as id, name as idval FROM sector WHERE sector_id IS NOT NULL', true, '{"setMultiline": false, "valueRelation":{"nullValue":false, "layer": "v_edit_sector", "activated": true, "keyColumn": "sector_id", "valueColumn": "name", "filterExpression": null}}', false); + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, dv_orderby_id, widgetcontrols, hidden) +VALUES ('v_edit_dqa', 'form_feature', 'tab_none', 'sector_id', 'lyt_data_1', 15, 'string', 'combo', 'sector_id', 'sector_id', false, false, true, false, 'SELECT sector_id as id, name as idval FROM sector WHERE sector_id IS NOT NULL', true, '{"setMultiline": false, "valueRelation":{"nullValue":false, "layer": "v_edit_sector", "activated": true, "keyColumn": "sector_id", "valueColumn": "name", "filterExpression": null}}', false); + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, dv_orderby_id, widgetcontrols, hidden) +VALUES ('v_edit_presszone', 'form_feature', 'tab_none', 'sector_id', 'lyt_data_1', 11, 'string', 'combo', 'sector_id', 'sector_id', false, false, true, false, 'SELECT sector_id as id, name as idval FROM sector WHERE sector_id IS NOT NULL', true, '{"setMultiline": false, "valueRelation":{"nullValue":false, "layer": "v_edit_sector", "activated": true, "keyColumn": "sector_id", "valueColumn": "name", "filterExpression": null}}', false); + + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('ve_epa_inlet', 'form_feature', 'tab_epa', 'demand', 'lyt_epa_data_1', 17, 'string', 'text', 'Demand:', 'Demand', false, false, true, false, NULL, false); + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, dv_isnullvalue, hidden) +VALUES ('ve_epa_inlet', 'form_feature', 'tab_epa', 'demand_pattern_id', 'lyt_epa_data_1', 18, 'string', 'combo', 'Demand pattern:', 'Demand pattern', false, false, true, false, +'SELECT pattern_id as id, pattern_id as idval FROM inp_pattern', true, false); + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('ve_epa_inlet', 'form_feature', 'tab_epa', 'emitter_coeff', 'lyt_epa_data_1', 19, 'string', 'text', 'Emitter coef:', 'Emitter coef', false, false, true, false, NULL, false); + + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('v_edit_inp_inlet', 'form_feature', 'tab_epa', 'demand', 'lyt_epa_data_1', 14, 'string', 'text', 'Demand:', 'Demand', false, false, true, false, NULL, false); + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, dv_isnullvalue, hidden) +VALUES ('v_edit_inp_inlet', 'form_feature', 'tab_epa', 'demand_pattern_id', 'lyt_epa_data_1', 15, 'string', 'combo', 'Demand pattern:', 'Demand pattern', false, false, true, false, +'SELECT pattern_id as id, pattern_id as idval FROM inp_pattern', true, false); + +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('v_edit_inp_inlet', 'form_feature', 'tab_epa', 'emitter_coeff', 'lyt_epa_data_1', 16, 'string', 'text', 'Emitter coef:', 'Emitter coef', false, false, true, false, NULL, false); + + +UPDATE config_form_fields SET iseditable=false, dv_querytext=null, dv_parent_id=null where formname='v_edit_inp_shortpipe' and columnname='to_arc'; +UPDATE config_form_fields SET iseditable=false, dv_orderby_id=null, dv_isnullvalue=null where formname='v_edit_inp_shortpipe' and columnname='status'; +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('v_edit_inp_shortpipe', 'form_feature', 'tab_epa', 'cat_dint', 'lyt_data_1', 15, 'string', 'text', 'Cat dint:', 'Cat dint', false, false, false, false, NULL, false); +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('v_edit_inp_shortpipe', 'form_feature', 'tab_epa', 'custom_dint', 'lyt_data_1', 16, 'string', 'text', 'Custom dint:', 'Custom dint', false, false, true, false, NULL, false); + + +UPDATE config_form_fields SET iseditable=false where formname='ve_epa_shortpipe' and columnname='to_arc'; +UPDATE config_form_fields SET dv_orderby_id=null, dv_isnullvalue=null where formname='ve_epa_shortpipe' and columnname='status'; +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('ve_epa_shortpipe', 'form_feature', 'tab_epa', 'cat_dint', 'lyt_epa_data_1', 7, 'string', 'text', 'Cat dint:', 'Cat dint', false, false, false, false, NULL, false); +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('ve_epa_shortpipe', 'form_feature', 'tab_epa', 'custom_dint', 'lyt_epa_data_1', 8, 'string', 'text', 'Custom dint:', 'Custom dint', false, false, true, false, NULL, false); + + +UPDATE config_form_fields SET iseditable=false where formname='ve_epa_valve' and columnname='to_arc'; +UPDATE config_form_fields SET widgettype='text', iseditable=false, dv_querytext=null, dv_orderby_id=null, dv_isnullvalue=null where formname='ve_epa_valve' and columnname='status'; +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('ve_epa_valve', 'form_feature', 'tab_epa', 'cat_dint', 'lyt_epa_data_1', 13, 'string', 'text', 'Cat dint:', 'Cat dint', false, false, false, false, NULL, false); +UPDATE config_form_fields SET layoutorder=14 where formname='ve_epa_valve' and columnname='custom_dint'; + + +UPDATE config_form_fields SET iseditable=false, dv_querytext=null where formname='v_edit_inp_valve' and columnname='to_arc'; +UPDATE config_form_fields SET iseditable=false, dv_querytext=null, dv_orderby_id=null, dv_isnullvalue=null where formname='v_edit_inp_valve' and columnname='status'; +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('v_edit_inp_valve', 'form_feature', 'tab_epa', 'cat_dint', 'lyt_data_1', 20, 'string', 'text', 'Cat dint:', 'Cat dint', false, false, false, false, NULL, false); +INSERT INTO config_form_fields(formname, formtype, tabname, columnname, layoutname, layoutorder, datatype, widgettype, label, tooltip, ismandatory, isparent, iseditable, isautoupdate, dv_querytext, hidden) +VALUES ('v_edit_inp_valve', 'form_feature', 'tab_epa', 'custom_dint', 'lyt_data_1', 21, 'string', 'text', 'Custom dint:', 'Custom dint', false, false, true, false, NULL, false); + +UPDATE config_form_fields SET iseditable=false where columnname='macrominsector_id'; +UPDATE config_form_fields SET iseditable=false where columnname='to_arc' and formname like 've_node%'; + diff --git a/updates/36/36012/ws/trg.sql b/updates/36/36012/ws/trg.sql index fd51bf0717..eb8d9eb861 100644 --- a/updates/36/36012/ws/trg.sql +++ b/updates/36/36012/ws/trg.sql @@ -71,10 +71,10 @@ FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_arc('inp_virtualpump'); CREATE TRIGGER gw_trg_edit_inp_arc_virtualvalve INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_virtualvalve FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_arc('inp_virtualvalve'); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_pipe +CREATE TRIGGER gw_trg_edit_inp_dscenario_pipe INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_pipe FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('PIPE'); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_virtualvalve +CREATE TRIGGER gw_trg_edit_inp_dscenario_virtualvalve INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_virtualvalve FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('VIRTUALVALVE'); CREATE TRIGGER gw_trg_edit_inp_dscenario_virtualpump INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_virtualpump @@ -89,34 +89,34 @@ FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_man_connec_pol('man_fountain_pol'); CREATE TRIGGER gw_trg_edit_man_tank_pol INSTEAD OF INSERT OR DELETE OR UPDATE ON ve_pol_tank FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_man_node_pol('man_tank_pol'); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_pump +CREATE TRIGGER gw_trg_edit_inp_dscenario_pump INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_pump FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('PUMP'); CREATE TRIGGER gw_trg_edit_inp_node_pump INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_pump_additional FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_node('inp_pump_additional'); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_pump_additional +CREATE TRIGGER gw_trg_edit_inp_dscenario_pump_additional INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_pump_additional FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('PUMP_ADDITIONAL'); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_shortpipe +CREATE TRIGGER gw_trg_edit_inp_dscenario_shortpipe INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_shortpipe FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('SHORTPIPE'); CREATE TRIGGER gw_trg_edit_inp_node_shortpipe INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_shortpipe FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_node('inp_shortpipe'); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_connec +CREATE TRIGGER gw_trg_edit_inp_dscenario_connec INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_connec FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('CONNEC'); CREATE TRIGGER gw_trg_edit_inp_connec INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_connec FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_connec(); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_tank +CREATE TRIGGER gw_trg_edit_inp_dscenario_tank INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_tank FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('TANK'); CREATE TRIGGER gw_trg_edit_inp_node_tank INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_tank FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_node('inp_tank'); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_reservoir +CREATE TRIGGER gw_trg_edit_inp_dscenario_reservoir INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_reservoir FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('RESERVOIR'); CREATE TRIGGER gw_trg_edit_inp_node_reservoir INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_reservoir @@ -128,7 +128,7 @@ FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('VALVE'); CREATE TRIGGER gw_trg_edit_inp_node_valve INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_valve FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_node('inp_valve'); -CREATE TRIGGER gw_trg_edit_inp_dscenario_junction INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_inlet +CREATE TRIGGER gw_trg_edit_inp_dscenario_inlet INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_dscenario_inlet FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_inp_dscenario('INLET'); CREATE TRIGGER gw_trg_edit_inp_node_inlet INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_inp_inlet @@ -148,3 +148,13 @@ FOR EACH ROW EXECUTE PROCEDURE gw_trg_edit_ve_epa('inlet'); CREATE TRIGGER gw_trg_edit_link INSTEAD OF INSERT OR UPDATE OR DELETE ON v_edit_link FOR EACH ROW EXECUTE PROCEDURE gw_trg_edit_link(); + +CREATE TRIGGER gw_trg_edit_dma INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_dma +FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_dma('dma'); + +CREATE TRIGGER gw_trg_edit_presszone INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_presszone +FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_presszone(); + +CREATE TRIGGER gw_trg_edit_dqa INSTEAD OF INSERT OR DELETE OR UPDATE ON v_edit_dqa +FOR EACH ROW EXECUTE FUNCTION gw_trg_edit_dqa(); + diff --git a/ws/ftrg/ws_gw_trg_edit_dma.sql b/ws/ftrg/ws_gw_trg_edit_dma.sql index d02d45e890..e5c0ec9216 100644 --- a/ws/ftrg/ws_gw_trg_edit_dma.sql +++ b/ws/ftrg/ws_gw_trg_edit_dma.sql @@ -26,7 +26,7 @@ BEGIN -- expl_id IF ((SELECT COUNT(*) FROM exploitation WHERE active IS TRUE) = 0) THEN - RETURN NULL; + RETURN NULL; END IF; IF NEW.the_geom IS NOT NULL THEN @@ -53,9 +53,9 @@ BEGIN ON CONFLICT (pattern_id) DO NOTHING; END IF; - INSERT INTO dma (dma_id, name, descript, macrodma_id, the_geom, undelete, expl_id, pattern_id, link, minc, maxc, effc, graphconfig, stylesheet, active, avg_press) - VALUES (NEW.dma_id, NEW.name, NEW.descript, NEW.macrodma_id, NEW.the_geom, NEW.undelete, NEW.expl_id, NEW.pattern_id, NEW.link, NEW.minc, - NEW.maxc, NEW.effc, NEW.graphconfig::json, NEW.stylesheet::json, NEW.active, NEW.avg_press; + INSERT INTO dma (dma_id, name, descript, macrodma_id, the_geom, undelete, expl_id, pattern_id, link, effc, graphconfig, stylesheet, active, avg_press, dma_type) + VALUES (NEW.dma_id, NEW.name, NEW.descript, NEW.macrodma_id, NEW.the_geom, NEW.undelete, NEW.expl_id, NEW.pattern_id, NEW.link, + NEW.effc, NEW.graphconfig::json, NEW.stylesheet::json, NEW.active, NEW.avg_press, NEW.dma_type); RETURN NEW; @@ -63,7 +63,7 @@ BEGIN UPDATE dma SET dma_id=NEW.dma_id, name=NEW.name, descript=NEW.descript, the_geom=NEW.the_geom, undelete=NEW.undelete, expl_id=NEW.expl_id, - pattern_id=NEW.pattern_id, link=NEW.link, minc=NEW.minc, maxc=NEW.maxc, effc=NEW.effc, graphconfig=NEW.graphconfig::json, + pattern_id=NEW.pattern_id, link=NEW.link, effc=NEW.effc, graphconfig=NEW.graphconfig::json, dma_type=NEW.dma_type, stylesheet = NEW.stylesheet::json, active=NEW.active, avg_press=NEW.avg_press, macrodma_id = NEW.macrodma_id, lastupdate=now(), lastupdate_user = current_user WHERE dma_id=OLD.dma_id; @@ -71,7 +71,7 @@ BEGIN ELSIF TG_OP = 'DELETE' THEN - DELETE FROM dma WHERE dma_id = OLD.dma_id; + DELETE FROM dma WHERE dma_id = OLD.dma_id; RETURN NULL; END IF; diff --git a/ws/ftrg/ws_gw_trg_edit_dqa.sql b/ws/ftrg/ws_gw_trg_edit_dqa.sql index 58ff6e4d3e..70cf40eec8 100644 --- a/ws/ftrg/ws_gw_trg_edit_dqa.sql +++ b/ws/ftrg/ws_gw_trg_edit_dqa.sql @@ -19,7 +19,7 @@ BEGIN -- expl_id IF ((SELECT COUNT(*) FROM exploitation WHERE active IS TRUE) = 0) THEN - RETURN NULL; + RETURN NULL; END IF; IF NEW.the_geom IS NOT NULL THEN IF NEW.expl_id IS NULL THEN @@ -32,9 +32,9 @@ BEGIN NEW.active = TRUE; END IF; - INSERT INTO dqa (dqa_id, name, expl_id, macrodqa_id, descript, undelete, the_geom, pattern_id, dqa_type, link, graphconfig, stylesheet,active, avg_press) + INSERT INTO dqa (dqa_id, name, expl_id, macrodqa_id, descript, undelete, the_geom, pattern_id, dqa_type, link, graphconfig, stylesheet,active) VALUES (NEW.dqa_id, NEW.name, NEW.expl_id, NEW.macrodqa_id, NEW.descript, NEW.undelete, NEW.the_geom, NEW.pattern_id, NEW.dqa_type, - NEW.link, NEW.graphconfig::json, NEW.stylesheet::json, NEW.active, NEW.avg_press); + NEW.link, NEW.graphconfig::json, NEW.stylesheet::json, NEW.active); RETURN NEW; @@ -43,14 +43,14 @@ BEGIN UPDATE dqa SET dqa_id=NEW.dqa_id, name=NEW.name, expl_id=NEW.expl_id, macrodqa_id=NEW.macrodqa_id, descript=NEW.descript, undelete=NEW.undelete, the_geom=NEW.the_geom, pattern_id=NEW.pattern_id, dqa_type=NEW.dqa_type, link=NEW.link, graphconfig=NEW.graphconfig::json, - stylesheet = NEW.stylesheet::json, active=NEW.active, lastupdate=now(), lastupdate_user = current_user, avg_press = NEW.avg_press + stylesheet = NEW.stylesheet::json, active=NEW.active, lastupdate=now(), lastupdate_user = current_user WHERE dqa_id=OLD.dqa_id; RETURN NEW; ELSIF TG_OP = 'DELETE' THEN - DELETE FROM dqa WHERE dqa_id = OLD.dqa_id; + DELETE FROM dqa WHERE dqa_id = OLD.dqa_id; RETURN NULL; END IF; END; diff --git a/ws/ftrg/ws_gw_trg_edit_node.sql b/ws/ftrg/ws_gw_trg_edit_node.sql index db8313806b..3fa085a639 100644 --- a/ws/ftrg/ws_gw_trg_edit_node.sql +++ b/ws/ftrg/ws_gw_trg_edit_node.sql @@ -556,8 +556,8 @@ BEGIN INSERT INTO man_junction (node_id) VALUES(NEW.node_id); ELSIF v_man_table='man_pump' THEN - INSERT INTO man_pump (node_id, max_flow, min_flow, nom_flow, power, pressure, elev_height, name, pump_number) - VALUES(NEW.node_id, NEW.max_flow, NEW.min_flow, NEW.nom_flow, NEW.power, NEW.pressure, NEW.elev_height, NEW.name, NEW.pump_number); + INSERT INTO man_pump (node_id, max_flow, min_flow, nom_flow, power, pressure, elev_height, name, pump_number, to_arc) + VALUES(NEW.node_id, NEW.max_flow, NEW.min_flow, NEW.nom_flow, NEW.power, NEW.pressure, NEW.elev_height, NEW.name, NEW.pump_number, NEW.to_arc); ELSIF v_man_table='man_reduction' THEN @@ -574,10 +574,10 @@ BEGIN ELSIF v_man_table='man_valve' THEN INSERT INTO man_valve (node_id,closed, broken, buried,irrigation_indicator,pression_entry, pression_exit, depth_valveshaft,regulator_situation, regulator_location, regulator_observ, - lin_meters, exit_type,exit_code,drive_type, cat_valve2, ordinarystatus, shutter, brand2, model2, valve_type) + lin_meters, exit_type,exit_code,drive_type, cat_valve2, ordinarystatus, shutter, brand2, model2, valve_type, to_arc, active) VALUES (NEW.node_id, NEW.closed, NEW.broken, NEW.buried, NEW.irrigation_indicator, NEW.pression_entry, NEW.pression_exit, NEW.depth_valveshaft, NEW.regulator_situation, NEW.regulator_location, NEW.regulator_observ, NEW.lin_meters, NEW.exit_type, NEW.exit_code, NEW.drive_type, NEW.cat_valve2, NEW.ordinarystatus, - NEW.shutter, NEW.brand2, NEW.model2, NEW.valve_type); + NEW.shutter, NEW.brand2, NEW.model2, NEW.valve_type, NEW.to_arc, NEW.active); ELSIF v_man_table='man_manhole' THEN INSERT INTO man_manhole (node_id, name) VALUES(NEW.node_id, NEW.name); @@ -933,7 +933,7 @@ BEGIN ELSIF v_man_table ='man_pump' THEN UPDATE man_pump SET max_flow=NEW.max_flow, min_flow=NEW.min_flow, nom_flow=NEW.nom_flow, "power"=NEW.power, - pressure=NEW.pressure, elev_height=NEW.elev_height, name=NEW.name, pump_number=NEW.pump_number + pressure=NEW.pressure, elev_height=NEW.elev_height, name=NEW.name, pump_number=NEW.pump_number, to_arc=NEW.to_arc WHERE node_id=OLD.node_id; ELSIF v_man_table ='man_manhole' THEN @@ -968,7 +968,7 @@ BEGIN SET closed=NEW.closed, broken=NEW.broken, buried=NEW.buried, irrigation_indicator=NEW.irrigation_indicator, pression_entry=NEW.pression_entry, pression_exit=NEW.pression_exit, depth_valveshaft=NEW.depth_valveshaft, regulator_situation=NEW.regulator_situation, regulator_location=NEW.regulator_location, regulator_observ=NEW.regulator_observ, lin_meters=NEW.lin_meters, exit_type=NEW.exit_type, exit_code=NEW.exit_code, drive_type=NEW.drive_type, cat_valve2=NEW.cat_valve2, ordinarystatus = NEW.ordinarystatus, - shutter=NEW.shutter, brand2=NEW.brand2, model2=NEW.model2, valve_type=NEW.valve_type + shutter=NEW.shutter, brand2=NEW.brand2, model2=NEW.model2, valve_type=NEW.valve_type, to_arc=NEW.to_arc, active=NEW.active WHERE node_id=OLD.node_id; ELSIF v_man_table ='man_register' THEN diff --git a/ws/ftrg/ws_gw_trg_edit_ve_epa.sql b/ws/ftrg/ws_gw_trg_edit_ve_epa.sql index aa7c94950b..0b47125e0e 100644 --- a/ws/ftrg/ws_gw_trg_edit_ve_epa.sql +++ b/ws/ftrg/ws_gw_trg_edit_ve_epa.sql @@ -62,7 +62,7 @@ BEGIN init_quality=NEW.init_quality WHERE node_id=OLD.node_id; ELSIF v_epatype = 'shortpipe' THEN - UPDATE inp_shortpipe SET minorloss=NEW.minorloss, bulk_coeff = NEW.bulk_coeff, wall_coeff = NEW.wall_coeff WHERE node_id=OLD.node_id; + UPDATE inp_shortpipe SET minorloss=NEW.minorloss, bulk_coeff = NEW.bulk_coeff, wall_coeff = NEW.wall_coeff, custom_dint=NEW.custom_dint WHERE node_id=OLD.node_id; IF NEW.to_arc IS NOT NULL AND ((NEW.to_arc != OLD.to_arc) OR OLD.to_arc IS NULL) THEN INSERT INTO config_graph_checkvalve VALUES (NEW.node_id, NEW.to_arc) @@ -77,7 +77,8 @@ BEGIN UPDATE inp_inlet SET initlevel=NEW.initlevel, minlevel=NEW.minlevel, maxlevel=NEW.maxlevel, diameter=NEW.diameter, minvol=NEW.minvol, curve_id=NEW.curve_id, pattern_id=NEW.pattern_id, head = NEW.head, overflow=NEW.overflow, mixing_model=NEW.mixing_model, mixing_fraction=NEW.mixing_fraction, reaction_coeff=NEW.reaction_coeff, init_quality=NEW.init_quality, - source_type=NEW.source_type, source_quality=NEW.source_quality, source_pattern_id=NEW.source_pattern_id WHERE node_id=OLD.node_id; + source_type=NEW.source_type, source_quality=NEW.source_quality, source_pattern_id=NEW.source_pattern_id, + demand=NEW.demand, demand_pattern_id=NEW.demand_pattern_id, emitter_coeff=NEW.emitter_coeff WHERE node_id=OLD.node_id; ELSIF v_epatype = 'connec' THEN UPDATE inp_connec SET demand=NEW.demand, pattern_id=NEW.pattern_id, peak_factor=NEW.peak_factor, custom_roughness = NEW.custom_roughness,