Skip to content

Commit

Permalink
fix(muni_id and sector_id): add columns sector_id and muni_id to trg_…
Browse files Browse the repository at this point in the history
…edit_tables
  • Loading branch information
mguzman14 committed Aug 27, 2024
1 parent 930add6 commit b433f6e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
7 changes: 4 additions & 3 deletions ud/ftrg/ud_gw_trg_edit_raingage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ BEGIN
END IF;

-- FEATURE INSERT
INSERT INTO raingage (rg_id, form_type, intvl, scf, rgage_type, timser_id, fname, sta, units, the_geom, expl_id)
VALUES (NEW.rg_id, NEW.form_type, NEW.intvl, NEW.scf, NEW.rgage_type, NEW.timser_id, NEW.fname, NEW.sta, NEW.units, NEW.the_geom, NEW.expl_id);
INSERT INTO raingage (rg_id, form_type, intvl, scf, rgage_type, timser_id, fname, sta, units, the_geom, expl_id, muni_id)
VALUES (NEW.rg_id, NEW.form_type, NEW.intvl, NEW.scf, NEW.rgage_type, NEW.timser_id, NEW.fname, NEW.sta, NEW.units, NEW.the_geom, NEW.expl_id, NEW.muni_id);

RETURN NEW;

Expand All @@ -41,7 +41,8 @@ BEGIN

-- UPDATE values
UPDATE raingage
SET rg_id=NEW.rg_id, form_type=NEW.form_type, intvl=NEW.intvl, scf=NEW.scf, rgage_type=NEW.rgage_type, timser_id=NEW.timser_id, fname=NEW.fname, sta=NEW.sta, units=NEW.units, the_geom=NEW.the_geom, expl_id=NEW.expl_id
SET rg_id=NEW.rg_id, form_type=NEW.form_type, intvl=NEW.intvl, scf=NEW.scf, rgage_type=NEW.rgage_type, timser_id=NEW.timser_id, fname=NEW.fname, sta=NEW.sta,
units=NEW.units, the_geom=NEW.the_geom, expl_id=NEW.expl_id, muni_id=NEW.muni_id
WHERE rg_id = OLD.rg_id;

RETURN NEW;
Expand Down
6 changes: 3 additions & 3 deletions utils/ftrg/gw_trg_edit_dimensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ BEGIN

-- Insert
INSERT INTO dimensions (id, distance, depth, the_geom, x_label, y_label, rotation_label, offset_label, direction_arrow, x_symbol, y_symbol,
feature_id, feature_type, state, expl_id, observ, comment)
feature_id, feature_type, state, expl_id, observ, comment, sector_id, muni_id)
VALUES (NEW.id, NEW.distance, NEW.depth, NEW.the_geom, NEW.x_label, NEW.y_label, NEW.rotation_label, NEW.offset_label, NEW.direction_arrow,
NEW.x_symbol, NEW.y_symbol, NEW.feature_id, NEW.feature_type, NEW.state, NEW.expl_id, NEW.observ, NEW.comment);
NEW.x_symbol, NEW.y_symbol, NEW.feature_id, NEW.feature_type, NEW.state, NEW.expl_id, NEW.observ, NEW.comment, NEW.sector_id, NEW.muni_id);


RETURN NEW;
Expand All @@ -65,7 +65,7 @@ BEGIN
SET id=NEW.id, distance=NEW.distance, depth=NEW.depth, the_geom=NEW.the_geom, x_label=NEW.x_label, y_label=NEW.y_label,
rotation_label=NEW.rotation_label, offset_label=NEW.offset_label, direction_arrow=NEW.direction_arrow, x_symbol=NEW.x_symbol,
y_symbol=NEW.y_symbol, feature_id=NEW.feature_id, feature_type=NEW.feature_type,
expl_id=NEW.expl_id, observ=NEW.observ, state=NEW.state, comment=NEW.comment, lastupdate=now(), lastupdate_user = current_user
expl_id=NEW.expl_id, observ=NEW.observ, state=NEW.state, comment=NEW.comment, lastupdate=now(), lastupdate_user = current_user, sector_id=NEW.sector_id, muni_id=NEW.muni_id
WHERE id=NEW.id;

RETURN NEW;
Expand Down
6 changes: 3 additions & 3 deletions utils/ftrg/gw_trg_edit_element.sql
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ BEGIN
-- FEATURE INSERT
INSERT INTO element (element_id, code, elementcat_id, model_id, brand_id, serial_number, "state", state_type, observ, "comment", function_type, category_type, location_type,
workcat_id, workcat_id_end, buildercat_id, builtdate, enddate, ownercat_id, rotation, link, verified, the_geom, label_x, label_y, label_rotation, publish,
inventory, undelete, expl_id, num_elements, pol_id, expl_id2)
inventory, undelete, expl_id, num_elements, pol_id, expl_id2, sector_id, muni_id)
VALUES (NEW.element_id, NEW.code, NEW.elementcat_id, NEW.model_id, NEW.brand_id, NEW.serial_number, NEW."state", NEW.state_type, NEW.observ, NEW."comment",
NEW.function_type, NEW.category_type, NEW.location_type, NEW.workcat_id, NEW.workcat_id_end, NEW.buildercat_id, NEW.builtdate, NEW.enddate,
NEW.ownercat_id, NEW.rotation, NEW.link, NEW.verified, NEW.the_geom, NEW.label_x, NEW.label_y, NEW.label_rotation, NEW.publish,
NEW.inventory, NEW.undelete, NEW.expl_id, NEW.num_elements, v_pol_id, NEW.expl_id2);
NEW.inventory, NEW.undelete, NEW.expl_id, NEW.num_elements, v_pol_id, NEW.expl_id2, NEW.sector_id, NEW.muni_id);

-- update element_x_feature table
IF v_tablefeature IS NOT NULL AND v_feature IS NOT NULL THEN
Expand Down Expand Up @@ -269,7 +269,7 @@ BEGIN
function_type=NEW.function_type, category_type=NEW.category_type, location_type=NEW.location_type, workcat_id=NEW.workcat_id, workcat_id_end=NEW.workcat_id_end,
buildercat_id=NEW.buildercat_id, builtdate=NEW.builtdate, enddate=NEW.enddate, ownercat_id=NEW.ownercat_id, rotation=NEW.rotation, link=NEW.link, verified=NEW.verified,
the_geom=NEW.the_geom, label_x=NEW.label_x, label_y=NEW.label_y, label_rotation=NEW.label_rotation, publish=NEW.publish, inventory=NEW.inventory, undelete=NEW.undelete,expl_id=NEW.expl_id, num_elements=NEW.num_elements,
lastupdate=now(), lastupdate_user=current_user, trace_featuregeom=NEW.trace_featuregeom
lastupdate=now(), lastupdate_user=current_user, trace_featuregeom=NEW.trace_featuregeom, sector_id=NEW.sector_id, muni_id=NEW.muni_id
WHERE element_id=OLD.element_id;

IF v_project_type = 'WS' THEN
Expand Down
12 changes: 6 additions & 6 deletions ws/ftrg/ws_gw_trg_edit_unconnected.sql
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ BEGIN
NEW.pond_id:= (SELECT nextval('pond_id_seq'));
END IF;

INSERT INTO pond (pond_id, connec_id, the_geom, expl_id, dma_id, state)
VALUES (NEW.pond_id, NEW.connec_id, NEW.the_geom, expl_id_int, NEW.dma_id, NEW."state");
INSERT INTO pond (pond_id, connec_id, the_geom, expl_id, dma_id, state, muni_id)
VALUES (NEW.pond_id, NEW.connec_id, NEW.the_geom, expl_id_int, NEW.dma_id, NEW."state", NEW.muni_id);

ELSIF man_table='pool' THEN
-- Pool ID
Expand All @@ -86,8 +86,8 @@ BEGIN
NEW.pool_id:= (SELECT nextval('pool_id_seq'));
END IF;

INSERT INTO pool(pool_id, connec_id, the_geom, expl_id,dma_id, state)
VALUES (NEW.pool_id, NEW.connec_id, NEW.the_geom, expl_id_int, NEW.dma_id, NEW."state");
INSERT INTO pool(pool_id, connec_id, the_geom, expl_id,dma_id, state, muni_id)
VALUES (NEW.pool_id, NEW.connec_id, NEW.the_geom, expl_id_int, NEW.dma_id, NEW."state", NEW.muni_id);


END IF;
Expand All @@ -101,12 +101,12 @@ BEGIN

IF man_table='pond' THEN
UPDATE pond
SET pond_id=NEW.pond_id, connec_id=NEW.connec_id, the_geom=NEW.the_geom, expl_id=NEW.expl_id, dma_id=NEW.dma_id, "state"=NEW."state"
SET pond_id=NEW.pond_id, connec_id=NEW.connec_id, the_geom=NEW.the_geom, expl_id=NEW.expl_id, dma_id=NEW.dma_id, "state"=NEW."state", muni_id=NEW.muni_id
WHERE pond_id=OLD.pond_id;

ELSIF man_table='pool' THEN
UPDATE pool
SET pool_id=NEW.pool_id, connec_id=NEW.connec_id, the_geom=NEW.the_geom, expl_id=NEW.expl_id, dma_id=NEW.dma_id, "state"=NEW."state"
SET pool_id=NEW.pool_id, connec_id=NEW.connec_id, the_geom=NEW.the_geom, expl_id=NEW.expl_id, dma_id=NEW.dma_id, "state"=NEW."state", muni_id=NEW.muni_id
WHERE pool_id=NEW.pool_id;

END IF;
Expand Down

0 comments on commit b433f6e

Please sign in to comment.