diff --git a/updates/36/36017/ud/ddlview.sql b/updates/36/36017/ud/ddlview.sql index 7f6a67e7b..0e194fd99 100644 --- a/updates/36/36017/ud/ddlview.sql +++ b/updates/36/36017/ud/ddlview.sql @@ -1014,7 +1014,7 @@ SELECT distinct on (sector_id) s.sector_id, JOIN config_user_x_expl USING (expl_id) LEFT JOIN macrosector m USING (macrosector_id) LEFT JOIN edit_typevalue et ON et.id::text = s.sector_type::text AND et.typevalue::text = 'sector_type'::text - where username = current_user and sector_id > 0 + where username = current_user and (sector_id > 0 or sector <-9) union SELECT distinct on (sector_id) s.sector_id, s.name, @@ -1037,7 +1037,7 @@ SELECT distinct on (sector_id) s.sector_id, LEFT JOIN ( SELECT DISTINCT node.sector_id, node.expl_id FROM node WHERE node.state > 0) a USING (sector_id) LEFT JOIN macrosector m USING (macrosector_id) LEFT JOIN edit_typevalue et ON et.id::text = s.sector_type::text AND et.typevalue::text = 'sector_type'::text - where s.sector_id > 0 and a.sector_id is null + where (s.sector_id > 0 or s.sector <-9) and a.sector_id is null ORDER BY 1; diff --git a/updates/36/36017/utils/ddlview.sql b/updates/36/36017/utils/ddlview.sql index 765da6f47..c2824013d 100644 --- a/updates/36/36017/utils/ddlview.sql +++ b/updates/36/36017/utils/ddlview.sql @@ -13,18 +13,18 @@ SET search_path = SCHEMA_NAME, public, pg_catalog; CREATE OR REPLACE VIEW vu_exploitation as select e.* from exploitation e JOIN config_user_x_expl USING (expl_id) -where username = current_user and expl_id > 0 +where username = current_user and (expl_id > 0 or expl_id < -9) order by 1; CREATE OR REPLACE VIEW vu_macroexploitation as select distinct on (macroexpl_id) m.* from macroexploitation m join exploitation using (macroexpl_id) JOIN config_user_x_expl USING (expl_id) -where username = current_user and macroexpl_id > 0 +where username = current_user and (macroexpl_id > 0 or macroexpl_id < -9) UNION select distinct on (macroexpl_id) m.* from macroexploitation m LEFT join exploitation using (macroexpl_id) -where expl_id IS NULL and macroexpl_id > 0 +where expl_id IS NULL and (macroexpl_id > 0 or macroexpl_id < -9) order by 1; CREATE OR REPLACE VIEW vu_macrosector as @@ -33,22 +33,22 @@ join sector using (macrosector_id) JOIN (SELECT DISTINCT sector_id, expl_id FROM node WHERE state > 0) a USING (sector_id) join exploitation using (expl_id) JOIN config_user_x_expl USING (expl_id) -where username = current_user and macrosector_id > 0 +where username = current_user and (macrosector_id > 0 or macrosector_id < -9) UNION select distinct on (macrosector_id) m.* from macrosector m LEFT join sector using (macrosector_id) -where sector_id IS NULL and macrosector_id > 0 +where sector_id IS NULL and (macrosector_id > 0 or macrosector_id < -9) order by 1; CREATE OR REPLACE VIEW vu_ext_municipality as select m.* from ext_municipality m join (SELECT DISTINCT muni_id, expl_id FROM node WHERE state > 0) a USING (muni_id) JOIN config_user_x_expl USING (expl_id) -where username = current_user and muni_id > 0 +where username = current_user and (muni_id > 0 or muni_id < -9) UNION select m.* from ext_municipality m LEFT join (SELECT DISTINCT muni_id, expl_id FROM node WHERE state > 0) a USING (muni_id) -where a.muni_id IS NULL and muni_id > 0 +where a.muni_id IS NULL and (muni_id > 0 or muni_id < -9) order by 1; CREATE OR REPLACE VIEW v_edit_exploitation diff --git a/updates/36/36017/ws/ddlview.sql b/updates/36/36017/ws/ddlview.sql index 927d39760..0ea2c4dd8 100644 --- a/updates/36/36017/ws/ddlview.sql +++ b/updates/36/36017/ws/ddlview.sql @@ -891,7 +891,7 @@ SELECT DISTINCT ON (s.sector_id) s.sector_id, JOIN config_user_x_expl USING (expl_id) LEFT JOIN macrosector m USING (macrosector_id) LEFT JOIN edit_typevalue et ON et.id::text = s.sector_type::text AND et.typevalue::text = 'sector_type'::text - WHERE config_user_x_expl.username::text = CURRENT_USER AND s.sector_id > 0 + WHERE config_user_x_expl.username::text = CURRENT_USER AND (s.sector_id > 0 or s.sector_id < -9) UNION select s.sector_id, s.name, @@ -916,7 +916,7 @@ SELECT DISTINCT ON (s.sector_id) s.sector_id, LEFT JOIN ( SELECT DISTINCT node.sector_id, node.expl_id FROM node WHERE node.state > 0) a USING (sector_id) LEFT JOIN macrosector m USING (macrosector_id) LEFT JOIN edit_typevalue et ON et.id::text = s.sector_type::text AND et.typevalue::text = 'sector_type'::text - where s.sector_id > 0 and a.sector_id is null + where (s.sector_id > 0 or s.sector_id < -9) and a.sector_id is null ORDER BY 1;