end;\r
$$;
+CREATE FUNCTION %%NEWSCHEMA%%.del_staffgroup(vidstaffgroup text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ \r
+begin\r
+ delete from %%NEWSCHEMA%%.staffgroups where id = vidstaffgroup;\r
+ return true;\r
+end;\r
+$$;
+
+CREATE FUNCTION %%NEWSCHEMA%%.del_workplan(vidworkplan text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ wpl record;\r
+ staffcnt int4;\r
+begin\r
+ select * into wpl from %%NEWSCHEMA%%.workplans where id=vidworkplan;\r
+ select count(id_staff) into staffcnt from %%NEWSCHEMA%%.staffcontract where id_contractworkplan=vidworkplan;\r
+ if (wpl.isdefault is null and staffcnt == 0) then\r
+ delete from %%NEWSCHEMA%%.workplandays where id_workplan = vidworkplan;\r
+ delete from %%NEWSCHEMA%%.workplans where id = vidworkplan;\r
+ end if;\r
+ return true;\r
+end;\r
+$$;
+
+CREATE FUNCTION %%NEWSCHEMA%%.del_worktime(vidworktime text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ wpl record;\r
+ staffcnt int4;\r
+begin\r
+ select * into wpl from %%NEWSCHEMA%%.worktimes where id=vidworktime;\r
+ if (wpl.isdefault is null) then\r
+ delete from %%NEWSCHEMA%%.worktimes where id = vidworktime;\r
+ end if;\r
+ return true;\r
+end;\r
+$$;
+
CREATE FUNCTION %%NEWSCHEMA%%.delete_workplan(pid_workplan text) RETURNS boolean
LANGUAGE plpgsql
AS $$\r
loop
perform %%NEWSCHEMA%%.set_staffperiodday_sums(pday.id);
end loop;
- raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
+ --raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
perform %%NEWSCHEMA%%.set_staffperiodweeks(pid_period,pid_staff);\r
return true;\r
end;\r
\r
\r
/*wkcon.diffhours = wkcon.totalhours-wkcon.contracthours;\r
- raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/\r
+ --raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/\r
--raise notice 'id=% cdays=% chours=% diffhours=%',wkcon.id,wkcon.contractdays,wkcon.contracthours,wkcon.diffhours;\r
\r
\r
dateend date;
rp record;\r
begin
- raise notice 'After update exec %',new.id;
+ --raise notice 'After update exec %',new.id;
UPDATE %%NEWSCHEMA%%.staffcontract sc SET weekdays = wp.weekdays , weekhours = wp.weekhours,defaultfreedays= wp.freeweekdayslist from %%NEWSCHEMA%%.workplans wp where wp.id =sc.id_contractworkplan and sc.id=new.id \r
returning id_staff,startdate,enddate into idstaff,datestart,dateend; \r
- raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
+ --raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
if datestart is not null and dateend is null then
for rp in select id from %%NEWSCHEMA%%.reportperiod where datestart between startdate and enddate or startdate > datestart
loop
- raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
+ --raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
perform %%NEWSCHEMA%%.set_staffperioddays(rp.id, idstaff);
end loop;
elsif dateend is not null then
for rp in select id from %%NEWSCHEMA%%.reportperiod where enddate >= datestart and (startdate <= dateend)
loop
- raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
+ --raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
perform %%NEWSCHEMA%%.set_staffperioddays(rp.id, idstaff);
end loop;
end if;
staffreportid text;
rdays record;\r
begin
- raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
+ --raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
if (pid_period is not null and pid_staff is not null) then\r
for rdays in select id from %%NEWSCHEMA%%.staffreportperioddays where id_staff=pid_staff and id_reportperiod=pid_period
loop
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Dario', '40:00:00', 6, '["3"]', 'f0e63e3e-e55e-c80d-99fc-b4bfe6fa3312', '2020-08-04 08:36:32.000204', '2020-08-04 08:31:44.522208', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Christian', '40:00:00', 6, '["1"]', 'c2e086cf-32d7-7f1c-cff1-09c13172ade3', '2020-08-04 07:57:55.113324', '2020-08-04 07:54:51.907014', NULL);
-INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Maria', '40:00:00', 6, '["1"]', 'f8666bc6-abed-a3ab-35d5-b6df495a0eea', '2020-07-28 16:52:33.308504', '2020-07-23 12:27:10.908142', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Josiane', '40:00:00', 6, '["1"]', 'e14fcef9-5c90-e979-0ba8-86d86d29fbe2', '2020-07-28 16:52:45.894425', '2020-07-23 12:27:10.908142', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Karim', '40:00:00', 6, '["4"]', 'a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58', '2020-07-28 16:52:56.111965', '2020-07-23 12:27:10.908142', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Marco', '39:50:00', 6, '["3"]', 'fde8026f-b370-af76-1026-0dc638348a7e', '2020-07-28 16:53:12.236836', '2020-07-23 12:27:10.908142', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Standard', '00:00:00', 0, '["1","2","3","4","5","6","7"]', 'a57742b1-b03c-21d1-54b1-bd0259375d89', '2020-07-30 11:42:45.867982', '2020-07-30 10:31:05.577147', true);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Francesca', '40:00:00', 6, '["1"]', '7172f97b-38d0-ae8e-3a38-1d893e34b56f', '2020-08-04 08:45:23.784369', '2020-08-04 08:41:02.137229', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Catia', '40:00:00', 6, '["4"]', 'fbd5ac24-becf-c358-45c4-65518415ebb8', '2020-08-04 09:02:36.160395', '2020-07-23 12:27:10.908142', NULL);
+INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Maria', '40:00:00', 6, '["1"]', 'f8666bc6-abed-a3ab-35d5-b6df495a0eea', '2020-08-09 19:31:17.276671', '2020-07-23 12:27:10.908142', NULL);
--
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('fde8026f-b370-af76-1026-0dc638348a7e', 3, NULL, NULL, NULL, NULL, NULL, 'cc10f61d-6027-fb62-9ad4-d929d593c15e', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 5, '11:00:00', '14:30:00', '17:30:00', '23:00:00', '01:00:00', 'bc0bd37b-233c-7311-b352-0aa40779cb7c', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('fbd5ac24-becf-c358-45c4-65518415ebb8', 4, NULL, NULL, NULL, NULL, NULL, '2616bad1-9854-3fce-885b-5ceaa63d0f15', 1, '2020-08-04 09:02:36.160395', '2020-07-23 12:27:10.908142');
+INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 3, '10:30:00', '14:30:00', '17:00:00', '22:00:00', '01:00:00', '87086679-4efa-ccc6-a462-7cb07e1e7d7d', 1, '2020-08-09 19:31:17.276671', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('fbd5ac24-becf-c358-45c4-65518415ebb8', 5, '10:30:00', '14:30:00', '17:30:00', '22:30:00', '01:00:00', 'c59edca6-4e4f-39a9-0427-5a7aeaec58cc', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58', 1, '10:30:00', '14:30:00', '17:30:00', '22:30:00', '01:00:00', '301be505-5ba5-c9be-9d71-f3883008c0e7', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58', 2, '10:30:00', '14:30:00', '17:30:00', '22:30:00', '01:00:00', '73ee417e-09a1-9e54-8ce9-f2505a67b46b', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('fbd5ac24-becf-c358-45c4-65518415ebb8', 6, '17:30:00', '22:00:00', NULL, NULL, NULL, '3436f93a-c588-4d5d-0c91-7df00c36695a', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 1, NULL, NULL, NULL, NULL, NULL, 'fc908e33-71bc-515b-3bb2-9f0cb555eb43', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58', 4, NULL, NULL, NULL, NULL, NULL, 'd0eace23-0584-f27b-429f-b2cd8ea40600', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
-INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 3, '10:30:00', '14:30:00', '17:00:00', '22:00:00', '01:00:00', '87086679-4efa-ccc6-a462-7cb07e1e7d7d', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 2, '10:30:00', '14:30:00', NULL, NULL, '00:30:00', '51dc876e-7334-b13d-595d-ab3aad7b21dc', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('3ff4557c-b9c6-a2ff-eec3-89ad034b6556', 2, NULL, NULL, NULL, NULL, NULL, 'c101686a-3fda-3c0d-4a20-2dfd48b462df', 1, '2020-07-28 16:56:13.28377', '2020-07-24 08:22:07.805921');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 4, '10:30:00', '14:30:00', '17:00:00', '22:00:00', '01:00:00', '2a1fbaa1-5414-99f3-2527-4fcd962e5eb5', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', '::1', '2020-06-29 10:20:13.672259', 'LO-LO-5db9d96c-445d-2786-b92d-52dd34b1494c', NULL);
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'POT/1.0.0 Windows_NT/10.0.18363/x64', '::1', '2020-07-04 11:27:05.060868', 'bfca2b98-81b3-fb1e-51ce-6e06863522bb', NULL);
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'POT/1.0.0 Windows_NT/10.0.18363/ia32', '::1', '2020-07-07 08:30:39.076713', '0e7ddbbf-eb49-3211-3655-4863898349e2', NULL);
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('833ccc12-d964-1314-8be7-06e614666686', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 Edg/84.0.522.52', '::1', '2020-08-09 20:37:29.22789', 'e067d523-1a05-ee58-7dea-73efd030d5cc', '{"schemata": "portanova"}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', '', '', '2020-07-10 11:34:43.326975', 'LO-LO-LO-645ae142-0f89-468f-dbc6-a6670a1b9bf5', '{}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', '', '', '2020-07-10 11:35:14.382476', 'LO-LO-3319df7c-6fd4-ee6e-fdc8-17b24a802a0b', '{"schemata":""}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', '', '', '2020-07-10 11:37:09.334911', 'LO-7213b294-350e-d220-b02d-ffb81044af74', '{"schemata":"test"}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0', '::1', '2020-07-23 12:33:29.414745', 'LO-LO-bff6a206-87af-d529-8266-bca458e1786d', '{"schemata": "portanova"}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0', '::1', '2020-07-24 16:42:55.137598', 'LO-304e0346-4cb0-67c4-dcbb-9557c33c4336', '{"schemata":"portanova"}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0', '::1', '2020-07-28 10:47:38.95606', '4c48f22a-515d-c8f3-0cdd-458304e49523', '{"schemata":"portanova"}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-03 15:02:38.486102', 'LO-LO-LO-LO-LO-LO-LO-LO-LO-1aab37e9-6b62-b088-9db2-eb20969effae', '{"schemata": "portanova"}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-03 17:07:40.851315', 'LO-LO-LO-LO-LO-LO-LO-LO-4153c4ff-c185-fa16-cf24-a54695fc7281', '{"schemata":"portanova"}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-04 07:53:56.664758', 'LO-LO-LO-LO-LO-LO-LO-0bc5edbb-8e14-79a7-c169-0c4cfe7cac9c', '{"schemata":"portanova"}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-04 16:36:05.902211', 'LO-LO-LO-LO-LO-LO-89e3d552-9819-b99f-123c-223e1f1d4e2d', '{"schemata":"portanova"}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-05 08:26:34.74338', 'LO-LO-LO-LO-LO-35e80a85-1fdb-4eaf-0fae-abe67c064724', '{"schemata":"portanova"}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-06 09:05:17.371751', 'LO-LO-LO-LO-2af69d6f-fccd-f066-0a81-c335bc9e19cb', '{"schemata": ""}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-06 09:05:49.584275', 'LO-LO-LO-a1bcccdf-e744-4255-b5d5-1f9da4725028', '{"schemata": ""}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 09:52:12.992059', 'LO-LO-1bc90d9f-14c8-6a99-8c53-44092da183c3', '{"schemata": "portanova"}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 14:22:21.625457', 'LO-f3fead4b-a2fb-cf7a-17a2-703399a3b7eb', '{"schemata":"portanova"}');
-INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 14:49:20.777947', '0bb4c4df-275c-9303-f908-b639c105dee6', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-03 15:02:38.486102', 'LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-1aab37e9-6b62-b088-9db2-eb20969effae', '{"schemata": "portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-03 17:07:40.851315', 'LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-4153c4ff-c185-fa16-cf24-a54695fc7281', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-04 07:53:56.664758', 'LO-LO-LO-LO-LO-LO-LO-LO-LO-0bc5edbb-8e14-79a7-c169-0c4cfe7cac9c', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-04 16:36:05.902211', 'LO-LO-LO-LO-LO-LO-LO-LO-89e3d552-9819-b99f-123c-223e1f1d4e2d', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-05 08:26:34.74338', 'LO-LO-LO-LO-LO-LO-LO-35e80a85-1fdb-4eaf-0fae-abe67c064724', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-06 09:05:17.371751', 'LO-LO-LO-LO-LO-LO-2af69d6f-fccd-f066-0a81-c335bc9e19cb', '{"schemata": ""}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-06 09:05:49.584275', 'LO-LO-LO-LO-LO-a1bcccdf-e744-4255-b5d5-1f9da4725028', '{"schemata": ""}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 09:52:12.992059', 'LO-LO-LO-LO-1bc90d9f-14c8-6a99-8c53-44092da183c3', '{"schemata": "portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 14:22:21.625457', 'LO-LO-LO-f3fead4b-a2fb-cf7a-17a2-703399a3b7eb', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 14:49:20.777947', 'LO-LO-0bb4c4df-275c-9303-f908-b639c105dee6', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 18:40:10.767929', 'LO-8831e8d8-b4fa-4191-c22d-8ae1ea4fde38', '{"schemata":"testmyapp"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 18:40:45.635217', '46378e01-af04-4896-d071-45b8d1fa5816', '{"schemata": "portanova"}');
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: -
--
-INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-10-10 17:12:11.934747', NULL, 'kilian.saffran@gmail.com', NULL, '6tgfkew', '["portanova"]', '["2","5","3","4"]', 'Saffran', 'Kilian', '+352691504574', 'Gérant', '8a8728fd-d37d-3a41-757c-bf73d4b9b410', 'admin', '4e46e03a-932e-36ac-e885-572fb86841b3');
INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-12-20 11:03:08.757357', NULL, 'kilian@saffran.lu', NULL, NULL, '["portanova"]', '["5"]', 'Saffran', 'Kilian', '691504574', NULL, '8a8728fd-d37d-3a41-757c-bf73d4b9b410', 'teamleader', '833ccc12-d964-1314-8be7-06e614666686');
INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-12-29 16:53:19.68549', NULL, 'ksaffran@dks.lu', NULL, NULL, '["portanova","testmyapp"]', '["3","5"]', 'Saffran', 'Kilian', NULL, NULL, '716d62c1-f6c7-07bb-17ec-8b5825b9696b', 'admin', 'e9e6880b-75c7-70b5-ce61-49cf6d62630f');
+INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-10-10 17:12:11.934747', NULL, 'kilian.saffran@gmail.com', NULL, '6tgfkew', '["portanova"]', '["2","5","3","4"]', 'Saffran', 'Kilian', '+352691504574', 'Gérant', '8a8728fd-d37d-3a41-757c-bf73d4b9b410', 'manager', '4e46e03a-932e-36ac-e885-572fb86841b3');
--
ALTER FUNCTION portanova.del_staffcontract(pid_staffcontract text) OWNER TO potlu_user;
+--
+-- Name: del_staffgroup(text); Type: FUNCTION; Schema: portanova; Owner: potlu_user
+--
+
+CREATE FUNCTION portanova.del_staffgroup(vidstaffgroup text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+
+begin
+ delete from portanova.staffgroups where id = vidstaffgroup;
+ return true;
+end;
+$$;
+
+
+ALTER FUNCTION portanova.del_staffgroup(vidstaffgroup text) OWNER TO potlu_user;
+
+--
+-- Name: del_workplan(text); Type: FUNCTION; Schema: portanova; Owner: potlu_user
+--
+
+CREATE FUNCTION portanova.del_workplan(vidworkplan text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+ wpl record;
+ staffcnt int4;
+begin
+ select * into wpl from portanova.workplans where id=vidworkplan;
+ select count(id_staff) into staffcnt from portanova.staffcontract where id_contractworkplan=vidworkplan;
+ if (wpl.isdefault is null and staffcnt == 0) then
+ delete from portanova.workplandays where id_workplan = vidworkplan;
+ delete from portanova.workplans where id = vidworkplan;
+ end if;
+ return true;
+end;
+$$;
+
+
+ALTER FUNCTION portanova.del_workplan(vidworkplan text) OWNER TO potlu_user;
+
+--
+-- Name: del_worktime(text); Type: FUNCTION; Schema: portanova; Owner: potlu_user
+--
+
+CREATE FUNCTION portanova.del_worktime(vidworktime text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+ wpl record;
+ staffcnt int4;
+begin
+ select * into wpl from portanova.worktimes where id=vidworktime;
+ if (wpl.isdefault is null) then
+ delete from portanova.worktimes where id = vidworktime;
+ end if;
+ return true;
+end;
+$$;
+
+
+ALTER FUNCTION portanova.del_worktime(vidworktime text) OWNER TO potlu_user;
+
--
-- Name: delete_workplan(text); Type: FUNCTION; Schema: portanova; Owner: potlu_user
--
loop
perform portanova.set_staffperiodday_sums(pday.id);
end loop;
- raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
+ --raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
perform portanova.set_staffperiodweeks(pid_period,pid_staff);
return true;
end;
/*wkcon.diffhours = wkcon.totalhours-wkcon.contracthours;
- raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/
+ --raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/
--raise notice 'id=% cdays=% chours=% diffhours=%',wkcon.id,wkcon.contractdays,wkcon.contracthours,wkcon.diffhours;
dateend date;
rp record;
begin
- raise notice 'After update exec %',new.id;
+ --raise notice 'After update exec %',new.id;
UPDATE portanova.staffcontract sc SET weekdays = wp.weekdays , weekhours = wp.weekhours,defaultfreedays= wp.freeweekdayslist from portanova.workplans wp where wp.id =sc.id_contractworkplan and sc.id=new.id
returning id_staff,startdate,enddate into idstaff,datestart,dateend;
- raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
+ --raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
if datestart is not null and dateend is null then
for rp in select id from portanova.reportperiod where datestart between startdate and enddate or startdate > datestart
loop
- raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
+ --raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
perform portanova.set_staffperioddays(rp.id, idstaff);
end loop;
elsif dateend is not null then
for rp in select id from portanova.reportperiod where enddate >= datestart and (startdate <= dateend)
loop
- raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
+ --raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
perform portanova.set_staffperioddays(rp.id, idstaff);
end loop;
end if;
staffreportid text;
rdays record;
begin
- raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
+ --raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
if (pid_period is not null and pid_staff is not null) then
for rdays in select id from portanova.staffreportperioddays where id_staff=pid_staff and id_reportperiod=pid_period
loop
ALTER FUNCTION public.day_name(day_index text) OWNER TO potlu_user;
+--
+-- Name: del_user(text); Type: FUNCTION; Schema: public; Owner: potlu_user
+--
+
+CREATE FUNCTION public.del_user(vuserid text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+
+begin
+ delete from public.users where id = vuserid;
+ return true;
+end;
+$$;
+
+
+ALTER FUNCTION public.del_user(vuserid text) OWNER TO potlu_user;
+
--
-- Name: getsession(text, text, text); Type: FUNCTION; Schema: public; Owner: potlu_user
--
NULL::text AS job,
NULL::text AS id_company,
NULL::text AS company,
- NULL::text AS usergroups;
+ NULL::text AS usergroups,
+ NULL::text AS id_usergroup;
ALTER TABLE public.vw_userslist OWNER TO potlu_user;
fde8026f-b370-af76-1026-0dc638348a7e 3 \N \N \N \N \N cc10f61d-6027-fb62-9ad4-d929d593c15e 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
f8666bc6-abed-a3ab-35d5-b6df495a0eea 5 11:00:00 14:30:00 17:30:00 23:00:00 01:00:00 bc0bd37b-233c-7311-b352-0aa40779cb7c 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
fbd5ac24-becf-c358-45c4-65518415ebb8 4 \N \N \N \N \N 2616bad1-9854-3fce-885b-5ceaa63d0f15 1 2020-08-04 09:02:36.160395 2020-07-23 12:27:10.908142
+f8666bc6-abed-a3ab-35d5-b6df495a0eea 3 10:30:00 14:30:00 17:00:00 22:00:00 01:00:00 87086679-4efa-ccc6-a462-7cb07e1e7d7d 1 2020-08-09 19:31:17.276671 2020-07-23 12:27:10.908142
fbd5ac24-becf-c358-45c4-65518415ebb8 5 10:30:00 14:30:00 17:30:00 22:30:00 01:00:00 c59edca6-4e4f-39a9-0427-5a7aeaec58cc 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58 1 10:30:00 14:30:00 17:30:00 22:30:00 01:00:00 301be505-5ba5-c9be-9d71-f3883008c0e7 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58 2 10:30:00 14:30:00 17:30:00 22:30:00 01:00:00 73ee417e-09a1-9e54-8ce9-f2505a67b46b 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
fbd5ac24-becf-c358-45c4-65518415ebb8 6 17:30:00 22:00:00 \N \N \N 3436f93a-c588-4d5d-0c91-7df00c36695a 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
f8666bc6-abed-a3ab-35d5-b6df495a0eea 1 \N \N \N \N \N fc908e33-71bc-515b-3bb2-9f0cb555eb43 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58 4 \N \N \N \N \N d0eace23-0584-f27b-429f-b2cd8ea40600 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
-f8666bc6-abed-a3ab-35d5-b6df495a0eea 3 10:30:00 14:30:00 17:00:00 22:00:00 01:00:00 87086679-4efa-ccc6-a462-7cb07e1e7d7d 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
f8666bc6-abed-a3ab-35d5-b6df495a0eea 2 10:30:00 14:30:00 \N \N 00:30:00 51dc876e-7334-b13d-595d-ab3aad7b21dc 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
3ff4557c-b9c6-a2ff-eec3-89ad034b6556 2 \N \N \N \N \N c101686a-3fda-3c0d-4a20-2dfd48b462df 1 2020-07-28 16:56:13.28377 2020-07-24 08:22:07.805921
f8666bc6-abed-a3ab-35d5-b6df495a0eea 4 10:30:00 14:30:00 17:00:00 22:00:00 01:00:00 2a1fbaa1-5414-99f3-2527-4fcd962e5eb5 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
COPY portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) FROM stdin;
Horaire Dario 40:00:00 6 ["3"] f0e63e3e-e55e-c80d-99fc-b4bfe6fa3312 2020-08-04 08:36:32.000204 2020-08-04 08:31:44.522208 \N
Horaire Christian 40:00:00 6 ["1"] c2e086cf-32d7-7f1c-cff1-09c13172ade3 2020-08-04 07:57:55.113324 2020-08-04 07:54:51.907014 \N
-Horaire Maria 40:00:00 6 ["1"] f8666bc6-abed-a3ab-35d5-b6df495a0eea 2020-07-28 16:52:33.308504 2020-07-23 12:27:10.908142 \N
Horaire Josiane 40:00:00 6 ["1"] e14fcef9-5c90-e979-0ba8-86d86d29fbe2 2020-07-28 16:52:45.894425 2020-07-23 12:27:10.908142 \N
Horaire Karim 40:00:00 6 ["4"] a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58 2020-07-28 16:52:56.111965 2020-07-23 12:27:10.908142 \N
Horaire Marco 39:50:00 6 ["3"] fde8026f-b370-af76-1026-0dc638348a7e 2020-07-28 16:53:12.236836 2020-07-23 12:27:10.908142 \N
Standard 00:00:00 0 ["1","2","3","4","5","6","7"] a57742b1-b03c-21d1-54b1-bd0259375d89 2020-07-30 11:42:45.867982 2020-07-30 10:31:05.577147 t
Horaire Francesca 40:00:00 6 ["1"] 7172f97b-38d0-ae8e-3a38-1d893e34b56f 2020-08-04 08:45:23.784369 2020-08-04 08:41:02.137229 \N
Horaire Catia 40:00:00 6 ["4"] fbd5ac24-becf-c358-45c4-65518415ebb8 2020-08-04 09:02:36.160395 2020-07-23 12:27:10.908142 \N
+Horaire Maria 40:00:00 6 ["1"] f8666bc6-abed-a3ab-35d5-b6df495a0eea 2020-08-09 19:31:17.276671 2020-07-23 12:27:10.908142 \N
\.
e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 ::1 2020-06-29 10:20:13.672259 LO-LO-5db9d96c-445d-2786-b92d-52dd34b1494c \N
e9e6880b-75c7-70b5-ce61-49cf6d62630f POT/1.0.0 Windows_NT/10.0.18363/x64 ::1 2020-07-04 11:27:05.060868 bfca2b98-81b3-fb1e-51ce-6e06863522bb \N
e9e6880b-75c7-70b5-ce61-49cf6d62630f POT/1.0.0 Windows_NT/10.0.18363/ia32 ::1 2020-07-07 08:30:39.076713 0e7ddbbf-eb49-3211-3655-4863898349e2 \N
+833ccc12-d964-1314-8be7-06e614666686 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 Edg/84.0.522.52 ::1 2020-08-09 20:37:29.22789 e067d523-1a05-ee58-7dea-73efd030d5cc {"schemata": "portanova"}
e9e6880b-75c7-70b5-ce61-49cf6d62630f 2020-07-10 11:34:43.326975 LO-LO-LO-645ae142-0f89-468f-dbc6-a6670a1b9bf5 {}
e9e6880b-75c7-70b5-ce61-49cf6d62630f 2020-07-10 11:35:14.382476 LO-LO-3319df7c-6fd4-ee6e-fdc8-17b24a802a0b {"schemata":""}
e9e6880b-75c7-70b5-ce61-49cf6d62630f 2020-07-10 11:37:09.334911 LO-7213b294-350e-d220-b02d-ffb81044af74 {"schemata":"test"}
e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 ::1 2020-07-23 12:33:29.414745 LO-LO-bff6a206-87af-d529-8266-bca458e1786d {"schemata": "portanova"}
e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 ::1 2020-07-24 16:42:55.137598 LO-304e0346-4cb0-67c4-dcbb-9557c33c4336 {"schemata":"portanova"}
e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 ::1 2020-07-28 10:47:38.95606 4c48f22a-515d-c8f3-0cdd-458304e49523 {"schemata":"portanova"}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-03 15:02:38.486102 LO-LO-LO-LO-LO-LO-LO-LO-LO-1aab37e9-6b62-b088-9db2-eb20969effae {"schemata": "portanova"}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-03 17:07:40.851315 LO-LO-LO-LO-LO-LO-LO-LO-4153c4ff-c185-fa16-cf24-a54695fc7281 {"schemata":"portanova"}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-04 07:53:56.664758 LO-LO-LO-LO-LO-LO-LO-0bc5edbb-8e14-79a7-c169-0c4cfe7cac9c {"schemata":"portanova"}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-04 16:36:05.902211 LO-LO-LO-LO-LO-LO-89e3d552-9819-b99f-123c-223e1f1d4e2d {"schemata":"portanova"}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-05 08:26:34.74338 LO-LO-LO-LO-LO-35e80a85-1fdb-4eaf-0fae-abe67c064724 {"schemata":"portanova"}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-06 09:05:17.371751 LO-LO-LO-LO-2af69d6f-fccd-f066-0a81-c335bc9e19cb {"schemata": ""}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-06 09:05:49.584275 LO-LO-LO-a1bcccdf-e744-4255-b5d5-1f9da4725028 {"schemata": ""}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 09:52:12.992059 LO-LO-1bc90d9f-14c8-6a99-8c53-44092da183c3 {"schemata": "portanova"}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 14:22:21.625457 LO-f3fead4b-a2fb-cf7a-17a2-703399a3b7eb {"schemata":"portanova"}
-e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 14:49:20.777947 0bb4c4df-275c-9303-f908-b639c105dee6 {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-03 15:02:38.486102 LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-1aab37e9-6b62-b088-9db2-eb20969effae {"schemata": "portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-03 17:07:40.851315 LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-4153c4ff-c185-fa16-cf24-a54695fc7281 {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-04 07:53:56.664758 LO-LO-LO-LO-LO-LO-LO-LO-LO-0bc5edbb-8e14-79a7-c169-0c4cfe7cac9c {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-04 16:36:05.902211 LO-LO-LO-LO-LO-LO-LO-LO-89e3d552-9819-b99f-123c-223e1f1d4e2d {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-05 08:26:34.74338 LO-LO-LO-LO-LO-LO-LO-35e80a85-1fdb-4eaf-0fae-abe67c064724 {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-06 09:05:17.371751 LO-LO-LO-LO-LO-LO-2af69d6f-fccd-f066-0a81-c335bc9e19cb {"schemata": ""}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-06 09:05:49.584275 LO-LO-LO-LO-LO-a1bcccdf-e744-4255-b5d5-1f9da4725028 {"schemata": ""}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 09:52:12.992059 LO-LO-LO-LO-1bc90d9f-14c8-6a99-8c53-44092da183c3 {"schemata": "portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 14:22:21.625457 LO-LO-LO-f3fead4b-a2fb-cf7a-17a2-703399a3b7eb {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 14:49:20.777947 LO-LO-0bb4c4df-275c-9303-f908-b639c105dee6 {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 18:40:10.767929 LO-8831e8d8-b4fa-4191-c22d-8ae1ea4fde38 {"schemata":"testmyapp"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 18:40:45.635217 46378e01-af04-4896-d071-45b8d1fa5816 {"schemata": "portanova"}
\.
--
COPY public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) FROM stdin;
-0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-10-10 17:12:11.934747 \N kilian.saffran@gmail.com \N 6tgfkew ["portanova"] ["2","5","3","4"] Saffran Kilian +352691504574 Gérant 8a8728fd-d37d-3a41-757c-bf73d4b9b410 admin 4e46e03a-932e-36ac-e885-572fb86841b3
0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-12-20 11:03:08.757357 \N kilian@saffran.lu \N \N ["portanova"] ["5"] Saffran Kilian 691504574 \N 8a8728fd-d37d-3a41-757c-bf73d4b9b410 teamleader 833ccc12-d964-1314-8be7-06e614666686
0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-12-29 16:53:19.68549 \N ksaffran@dks.lu \N \N ["portanova","testmyapp"] ["3","5"] Saffran Kilian \N \N 716d62c1-f6c7-07bb-17ec-8b5825b9696b admin e9e6880b-75c7-70b5-ce61-49cf6d62630f
+0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-10-10 17:12:11.934747 \N kilian.saffran@gmail.com \N 6tgfkew ["portanova"] ["2","5","3","4"] Saffran Kilian +352691504574 Gérant 8a8728fd-d37d-3a41-757c-bf73d4b9b410 manager 4e46e03a-932e-36ac-e885-572fb86841b3
\.
us.job,
us.id_company,
co.company,
- ugrp.groupname AS usergroups
+ ugrp.groupname AS usergroups,
+ ugrp.id AS id_usergroup
FROM ((public.users us
LEFT JOIN public.companies co ON ((us.id_company = co.id)))
LEFT JOIN public.usergroups ugrp ON ((ugrp.id = us.id_usergroup)))
$$;
+--
+-- Name: del_staffgroup(text); Type: FUNCTION; Schema: portanova; Owner: -
+--
+
+CREATE FUNCTION portanova.del_staffgroup(vidstaffgroup text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ \r
+begin\r
+ delete from portanova.staffgroups where id = vidstaffgroup;\r
+ return true;\r
+end;\r
+$$;
+
+
+--
+-- Name: del_workplan(text); Type: FUNCTION; Schema: portanova; Owner: -
+--
+
+CREATE FUNCTION portanova.del_workplan(vidworkplan text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ wpl record;\r
+ staffcnt int4;\r
+begin\r
+ select * into wpl from portanova.workplans where id=vidworkplan;\r
+ select count(id_staff) into staffcnt from portanova.staffcontract where id_contractworkplan=vidworkplan;\r
+ if (wpl.isdefault is null and staffcnt == 0) then\r
+ delete from portanova.workplandays where id_workplan = vidworkplan;\r
+ delete from portanova.workplans where id = vidworkplan;\r
+ end if;\r
+ return true;\r
+end;\r
+$$;
+
+
+--
+-- Name: del_worktime(text); Type: FUNCTION; Schema: portanova; Owner: -
+--
+
+CREATE FUNCTION portanova.del_worktime(vidworktime text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ wpl record;\r
+ staffcnt int4;\r
+begin\r
+ select * into wpl from portanova.worktimes where id=vidworktime;\r
+ if (wpl.isdefault is null) then\r
+ delete from portanova.worktimes where id = vidworktime;\r
+ end if;\r
+ return true;\r
+end;\r
+$$;
+
+
--
-- Name: delete_workplan(text); Type: FUNCTION; Schema: portanova; Owner: -
--
loop
perform portanova.set_staffperiodday_sums(pday.id);
end loop;
- raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
+ --raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
perform portanova.set_staffperiodweeks(pid_period,pid_staff);\r
return true;\r
end;\r
\r
\r
/*wkcon.diffhours = wkcon.totalhours-wkcon.contracthours;\r
- raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/\r
+ --raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/\r
--raise notice 'id=% cdays=% chours=% diffhours=%',wkcon.id,wkcon.contractdays,wkcon.contracthours,wkcon.diffhours;\r
\r
\r
dateend date;
rp record;\r
begin
- raise notice 'After update exec %',new.id;
+ --raise notice 'After update exec %',new.id;
UPDATE portanova.staffcontract sc SET weekdays = wp.weekdays , weekhours = wp.weekhours,defaultfreedays= wp.freeweekdayslist from portanova.workplans wp where wp.id =sc.id_contractworkplan and sc.id=new.id \r
returning id_staff,startdate,enddate into idstaff,datestart,dateend; \r
- raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
+ --raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
if datestart is not null and dateend is null then
for rp in select id from portanova.reportperiod where datestart between startdate and enddate or startdate > datestart
loop
- raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
+ --raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
perform portanova.set_staffperioddays(rp.id, idstaff);
end loop;
elsif dateend is not null then
for rp in select id from portanova.reportperiod where enddate >= datestart and (startdate <= dateend)
loop
- raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
+ --raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
perform portanova.set_staffperioddays(rp.id, idstaff);
end loop;
end if;
staffreportid text;
rdays record;\r
begin
- raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
+ --raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
if (pid_period is not null and pid_staff is not null) then\r
for rdays in select id from portanova.staffreportperioddays where id_staff=pid_staff and id_reportperiod=pid_period
loop
$$;
+--
+-- Name: del_user(text); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.del_user(vuserid text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ \r
+begin\r
+ delete from public.users where id = vuserid;\r
+ return true;\r
+end;\r
+$$;
+
+
--
-- Name: getsession(text, text, text); Type: FUNCTION; Schema: public; Owner: -
--
NULL::text AS job,
NULL::text AS id_company,
NULL::text AS company,
- NULL::text AS usergroups;
+ NULL::text AS usergroups,
+ NULL::text AS id_usergroup;
--
us.job,
us.id_company,
co.company,
- ugrp.groupname AS usergroups
+ ugrp.groupname AS usergroups,
+ ugrp.id AS id_usergroup
FROM ((public.users us
LEFT JOIN public.companies co ON ((us.id_company = co.id)))
LEFT JOIN public.usergroups ugrp ON ((ugrp.id = us.id_usergroup)))
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Dario', '40:00:00', 6, '["3"]', 'f0e63e3e-e55e-c80d-99fc-b4bfe6fa3312', '2020-08-04 08:36:32.000204', '2020-08-04 08:31:44.522208', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Christian', '40:00:00', 6, '["1"]', 'c2e086cf-32d7-7f1c-cff1-09c13172ade3', '2020-08-04 07:57:55.113324', '2020-08-04 07:54:51.907014', NULL);
-INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Maria', '40:00:00', 6, '["1"]', 'f8666bc6-abed-a3ab-35d5-b6df495a0eea', '2020-07-28 16:52:33.308504', '2020-07-23 12:27:10.908142', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Josiane', '40:00:00', 6, '["1"]', 'e14fcef9-5c90-e979-0ba8-86d86d29fbe2', '2020-07-28 16:52:45.894425', '2020-07-23 12:27:10.908142', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Karim', '40:00:00', 6, '["4"]', 'a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58', '2020-07-28 16:52:56.111965', '2020-07-23 12:27:10.908142', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Marco', '39:50:00', 6, '["3"]', 'fde8026f-b370-af76-1026-0dc638348a7e', '2020-07-28 16:53:12.236836', '2020-07-23 12:27:10.908142', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Standard', '00:00:00', 0, '["1","2","3","4","5","6","7"]', 'a57742b1-b03c-21d1-54b1-bd0259375d89', '2020-07-30 11:42:45.867982', '2020-07-30 10:31:05.577147', true);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Francesca', '40:00:00', 6, '["1"]', '7172f97b-38d0-ae8e-3a38-1d893e34b56f', '2020-08-04 08:45:23.784369', '2020-08-04 08:41:02.137229', NULL);
INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Catia', '40:00:00', 6, '["4"]', 'fbd5ac24-becf-c358-45c4-65518415ebb8', '2020-08-04 09:02:36.160395', '2020-07-23 12:27:10.908142', NULL);
+INSERT INTO portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) VALUES ('Horaire Maria', '40:00:00', 6, '["1"]', 'f8666bc6-abed-a3ab-35d5-b6df495a0eea', '2020-08-09 19:31:17.276671', '2020-07-23 12:27:10.908142', NULL);
--
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('fde8026f-b370-af76-1026-0dc638348a7e', 3, NULL, NULL, NULL, NULL, NULL, 'cc10f61d-6027-fb62-9ad4-d929d593c15e', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 5, '11:00:00', '14:30:00', '17:30:00', '23:00:00', '01:00:00', 'bc0bd37b-233c-7311-b352-0aa40779cb7c', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('fbd5ac24-becf-c358-45c4-65518415ebb8', 4, NULL, NULL, NULL, NULL, NULL, '2616bad1-9854-3fce-885b-5ceaa63d0f15', 1, '2020-08-04 09:02:36.160395', '2020-07-23 12:27:10.908142');
+INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 3, '10:30:00', '14:30:00', '17:00:00', '22:00:00', '01:00:00', '87086679-4efa-ccc6-a462-7cb07e1e7d7d', 1, '2020-08-09 19:31:17.276671', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('fbd5ac24-becf-c358-45c4-65518415ebb8', 5, '10:30:00', '14:30:00', '17:30:00', '22:30:00', '01:00:00', 'c59edca6-4e4f-39a9-0427-5a7aeaec58cc', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58', 1, '10:30:00', '14:30:00', '17:30:00', '22:30:00', '01:00:00', '301be505-5ba5-c9be-9d71-f3883008c0e7', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58', 2, '10:30:00', '14:30:00', '17:30:00', '22:30:00', '01:00:00', '73ee417e-09a1-9e54-8ce9-f2505a67b46b', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('fbd5ac24-becf-c358-45c4-65518415ebb8', 6, '17:30:00', '22:00:00', NULL, NULL, NULL, '3436f93a-c588-4d5d-0c91-7df00c36695a', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 1, NULL, NULL, NULL, NULL, NULL, 'fc908e33-71bc-515b-3bb2-9f0cb555eb43', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58', 4, NULL, NULL, NULL, NULL, NULL, 'd0eace23-0584-f27b-429f-b2cd8ea40600', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
-INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 3, '10:30:00', '14:30:00', '17:00:00', '22:00:00', '01:00:00', '87086679-4efa-ccc6-a462-7cb07e1e7d7d', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 2, '10:30:00', '14:30:00', NULL, NULL, '00:30:00', '51dc876e-7334-b13d-595d-ab3aad7b21dc', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('3ff4557c-b9c6-a2ff-eec3-89ad034b6556', 2, NULL, NULL, NULL, NULL, NULL, 'c101686a-3fda-3c0d-4a20-2dfd48b462df', 1, '2020-07-28 16:56:13.28377', '2020-07-24 08:22:07.805921');
INSERT INTO portanova.workplandays (id_workplan, weekday, start1, end1, start2, end2, pause, id, weeknum, modified, created) VALUES ('f8666bc6-abed-a3ab-35d5-b6df495a0eea', 4, '10:30:00', '14:30:00', '17:00:00', '22:00:00', '01:00:00', '2a1fbaa1-5414-99f3-2527-4fcd962e5eb5', 1, '2020-07-23 11:59:40.886617', '2020-07-23 12:27:10.908142');
ALTER FUNCTION portanova.del_staffcontract(pid_staffcontract text) OWNER TO potlu_user;
+--
+-- Name: del_staffgroup(text); Type: FUNCTION; Schema: portanova; Owner: potlu_user
+--
+
+CREATE FUNCTION portanova.del_staffgroup(vidstaffgroup text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ \r
+begin\r
+ delete from portanova.staffgroups where id = vidstaffgroup;\r
+ return true;\r
+end;\r
+$$;
+
+
+ALTER FUNCTION portanova.del_staffgroup(vidstaffgroup text) OWNER TO potlu_user;
+
+--
+-- Name: del_workplan(text); Type: FUNCTION; Schema: portanova; Owner: potlu_user
+--
+
+CREATE FUNCTION portanova.del_workplan(vidworkplan text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ wpl record;\r
+ staffcnt int4;\r
+begin\r
+ select * into wpl from portanova.workplans where id=vidworkplan;\r
+ select count(id_staff) into staffcnt from portanova.staffcontract where id_contractworkplan=vidworkplan;\r
+ if (wpl.isdefault is null and staffcnt == 0) then\r
+ delete from portanova.workplandays where id_workplan = vidworkplan;\r
+ delete from portanova.workplans where id = vidworkplan;\r
+ end if;\r
+ return true;\r
+end;\r
+$$;
+
+
+ALTER FUNCTION portanova.del_workplan(vidworkplan text) OWNER TO potlu_user;
+
+--
+-- Name: del_worktime(text); Type: FUNCTION; Schema: portanova; Owner: potlu_user
+--
+
+CREATE FUNCTION portanova.del_worktime(vidworktime text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$\r
+declare \r
+ wpl record;\r
+ staffcnt int4;\r
+begin\r
+ select * into wpl from portanova.worktimes where id=vidworktime;\r
+ if (wpl.isdefault is null) then\r
+ delete from portanova.worktimes where id = vidworktime;\r
+ end if;\r
+ return true;\r
+end;\r
+$$;
+
+
+ALTER FUNCTION portanova.del_worktime(vidworktime text) OWNER TO potlu_user;
+
--
-- Name: delete_workplan(text); Type: FUNCTION; Schema: portanova; Owner: potlu_user
--
loop
perform portanova.set_staffperiodday_sums(pday.id);
end loop;
- raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
+ --raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
perform portanova.set_staffperiodweeks(pid_period,pid_staff);\r
return true;\r
end;\r
\r
\r
/*wkcon.diffhours = wkcon.totalhours-wkcon.contracthours;\r
- raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/\r
+ --raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/\r
--raise notice 'id=% cdays=% chours=% diffhours=%',wkcon.id,wkcon.contractdays,wkcon.contracthours,wkcon.diffhours;\r
\r
\r
dateend date;
rp record;\r
begin
- raise notice 'After update exec %',new.id;
+ --raise notice 'After update exec %',new.id;
UPDATE portanova.staffcontract sc SET weekdays = wp.weekdays , weekhours = wp.weekhours,defaultfreedays= wp.freeweekdayslist from portanova.workplans wp where wp.id =sc.id_contractworkplan and sc.id=new.id \r
returning id_staff,startdate,enddate into idstaff,datestart,dateend; \r
- raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
+ --raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
if datestart is not null and dateend is null then
for rp in select id from portanova.reportperiod where datestart between startdate and enddate or startdate > datestart
loop
- raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
+ --raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
perform portanova.set_staffperioddays(rp.id, idstaff);
end loop;
elsif dateend is not null then
for rp in select id from portanova.reportperiod where enddate >= datestart and (startdate <= dateend)
loop
- raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
+ --raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
perform portanova.set_staffperioddays(rp.id, idstaff);
end loop;
end if;
staffreportid text;
rdays record;\r
begin
- raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
+ --raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
if (pid_period is not null and pid_staff is not null) then\r
for rdays in select id from portanova.staffreportperioddays where id_staff=pid_staff and id_reportperiod=pid_period
loop
fde8026f-b370-af76-1026-0dc638348a7e 3 \N \N \N \N \N cc10f61d-6027-fb62-9ad4-d929d593c15e 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
f8666bc6-abed-a3ab-35d5-b6df495a0eea 5 11:00:00 14:30:00 17:30:00 23:00:00 01:00:00 bc0bd37b-233c-7311-b352-0aa40779cb7c 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
fbd5ac24-becf-c358-45c4-65518415ebb8 4 \N \N \N \N \N 2616bad1-9854-3fce-885b-5ceaa63d0f15 1 2020-08-04 09:02:36.160395 2020-07-23 12:27:10.908142
+f8666bc6-abed-a3ab-35d5-b6df495a0eea 3 10:30:00 14:30:00 17:00:00 22:00:00 01:00:00 87086679-4efa-ccc6-a462-7cb07e1e7d7d 1 2020-08-09 19:31:17.276671 2020-07-23 12:27:10.908142
fbd5ac24-becf-c358-45c4-65518415ebb8 5 10:30:00 14:30:00 17:30:00 22:30:00 01:00:00 c59edca6-4e4f-39a9-0427-5a7aeaec58cc 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58 1 10:30:00 14:30:00 17:30:00 22:30:00 01:00:00 301be505-5ba5-c9be-9d71-f3883008c0e7 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58 2 10:30:00 14:30:00 17:30:00 22:30:00 01:00:00 73ee417e-09a1-9e54-8ce9-f2505a67b46b 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
fbd5ac24-becf-c358-45c4-65518415ebb8 6 17:30:00 22:00:00 \N \N \N 3436f93a-c588-4d5d-0c91-7df00c36695a 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
f8666bc6-abed-a3ab-35d5-b6df495a0eea 1 \N \N \N \N \N fc908e33-71bc-515b-3bb2-9f0cb555eb43 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58 4 \N \N \N \N \N d0eace23-0584-f27b-429f-b2cd8ea40600 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
-f8666bc6-abed-a3ab-35d5-b6df495a0eea 3 10:30:00 14:30:00 17:00:00 22:00:00 01:00:00 87086679-4efa-ccc6-a462-7cb07e1e7d7d 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
f8666bc6-abed-a3ab-35d5-b6df495a0eea 2 10:30:00 14:30:00 \N \N 00:30:00 51dc876e-7334-b13d-595d-ab3aad7b21dc 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
3ff4557c-b9c6-a2ff-eec3-89ad034b6556 2 \N \N \N \N \N c101686a-3fda-3c0d-4a20-2dfd48b462df 1 2020-07-28 16:56:13.28377 2020-07-24 08:22:07.805921
f8666bc6-abed-a3ab-35d5-b6df495a0eea 4 10:30:00 14:30:00 17:00:00 22:00:00 01:00:00 2a1fbaa1-5414-99f3-2527-4fcd962e5eb5 1 2020-07-23 11:59:40.886617 2020-07-23 12:27:10.908142
COPY portanova.workplans (workplan, weekhours, weekdays, freeweekdayslist, id, modified, created, isdefault) FROM stdin;
Horaire Dario 40:00:00 6 ["3"] f0e63e3e-e55e-c80d-99fc-b4bfe6fa3312 2020-08-04 08:36:32.000204 2020-08-04 08:31:44.522208 \N
Horaire Christian 40:00:00 6 ["1"] c2e086cf-32d7-7f1c-cff1-09c13172ade3 2020-08-04 07:57:55.113324 2020-08-04 07:54:51.907014 \N
-Horaire Maria 40:00:00 6 ["1"] f8666bc6-abed-a3ab-35d5-b6df495a0eea 2020-07-28 16:52:33.308504 2020-07-23 12:27:10.908142 \N
Horaire Josiane 40:00:00 6 ["1"] e14fcef9-5c90-e979-0ba8-86d86d29fbe2 2020-07-28 16:52:45.894425 2020-07-23 12:27:10.908142 \N
Horaire Karim 40:00:00 6 ["4"] a0fbbf10-ac5e-7cd8-0be0-a3bb2c9bdb58 2020-07-28 16:52:56.111965 2020-07-23 12:27:10.908142 \N
Horaire Marco 39:50:00 6 ["3"] fde8026f-b370-af76-1026-0dc638348a7e 2020-07-28 16:53:12.236836 2020-07-23 12:27:10.908142 \N
Standard 00:00:00 0 ["1","2","3","4","5","6","7"] a57742b1-b03c-21d1-54b1-bd0259375d89 2020-07-30 11:42:45.867982 2020-07-30 10:31:05.577147 t
Horaire Francesca 40:00:00 6 ["1"] 7172f97b-38d0-ae8e-3a38-1d893e34b56f 2020-08-04 08:45:23.784369 2020-08-04 08:41:02.137229 \N
Horaire Catia 40:00:00 6 ["4"] fbd5ac24-becf-c358-45c4-65518415ebb8 2020-08-04 09:02:36.160395 2020-07-23 12:27:10.908142 \N
+Horaire Maria 40:00:00 6 ["1"] f8666bc6-abed-a3ab-35d5-b6df495a0eea 2020-08-09 19:31:17.276671 2020-07-23 12:27:10.908142 \N
\.
$$;
+--
+-- Name: del_staffgroup(text); Type: FUNCTION; Schema: portanova; Owner: -
+--
+
+CREATE FUNCTION portanova.del_staffgroup(vidstaffgroup text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+
+begin
+ delete from portanova.staffgroups where id = vidstaffgroup;
+ return true;
+end;
+$$;
+
+
+--
+-- Name: del_workplan(text); Type: FUNCTION; Schema: portanova; Owner: -
+--
+
+CREATE FUNCTION portanova.del_workplan(vidworkplan text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+ wpl record;
+ staffcnt int4;
+begin
+ select * into wpl from portanova.workplans where id=vidworkplan;
+ select count(id_staff) into staffcnt from portanova.staffcontract where id_contractworkplan=vidworkplan;
+ if (wpl.isdefault is null and staffcnt == 0) then
+ delete from portanova.workplandays where id_workplan = vidworkplan;
+ delete from portanova.workplans where id = vidworkplan;
+ end if;
+ return true;
+end;
+$$;
+
+
+--
+-- Name: del_worktime(text); Type: FUNCTION; Schema: portanova; Owner: -
+--
+
+CREATE FUNCTION portanova.del_worktime(vidworktime text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+ wpl record;
+ staffcnt int4;
+begin
+ select * into wpl from portanova.worktimes where id=vidworktime;
+ if (wpl.isdefault is null) then
+ delete from portanova.worktimes where id = vidworktime;
+ end if;
+ return true;
+end;
+$$;
+
+
--
-- Name: delete_workplan(text); Type: FUNCTION; Schema: portanova; Owner: -
--
loop
perform portanova.set_staffperiodday_sums(pday.id);
end loop;
- raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
+ --raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
perform portanova.set_staffperiodweeks(pid_period,pid_staff);
return true;
end;
/*wkcon.diffhours = wkcon.totalhours-wkcon.contracthours;
- raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/
+ --raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/
--raise notice 'id=% cdays=% chours=% diffhours=%',wkcon.id,wkcon.contractdays,wkcon.contracthours,wkcon.diffhours;
dateend date;
rp record;
begin
- raise notice 'After update exec %',new.id;
+ --raise notice 'After update exec %',new.id;
UPDATE portanova.staffcontract sc SET weekdays = wp.weekdays , weekhours = wp.weekhours,defaultfreedays= wp.freeweekdayslist from portanova.workplans wp where wp.id =sc.id_contractworkplan and sc.id=new.id
returning id_staff,startdate,enddate into idstaff,datestart,dateend;
- raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
+ --raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
if datestart is not null and dateend is null then
for rp in select id from portanova.reportperiod where datestart between startdate and enddate or startdate > datestart
loop
- raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
+ --raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
perform portanova.set_staffperioddays(rp.id, idstaff);
end loop;
elsif dateend is not null then
for rp in select id from portanova.reportperiod where enddate >= datestart and (startdate <= dateend)
loop
- raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
+ --raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
perform portanova.set_staffperioddays(rp.id, idstaff);
end loop;
end if;
staffreportid text;
rdays record;
begin
- raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
+ --raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
if (pid_period is not null and pid_staff is not null) then
for rdays in select id from portanova.staffreportperioddays where id_staff=pid_staff and id_reportperiod=pid_period
loop
-- Data for Name: companies; Type: TABLE DATA; Schema: public; Owner: -
--
-INSERT INTO public.companies (company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated, reportperiodunit, reportperiodlength, reportperiodstart, id, datasetname, phone) VALUES ('test', '4, rue Principale', '3770', 'Tétange', 'Luxemburg', NULL, NULL, NULL, 'test', NULL, NULL, 'kilian@saffran.lu', 's.à r.l.', NULL, NULL, NULL, NULL, 'd1f1e10e-48ef-d422-3930-0d702e05c689', NULL, NULL);
-INSERT INTO public.companies (company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated, reportperiodunit, reportperiodlength, reportperiodstart, id, datasetname, phone) VALUES ('TEST2', '8b, rue du Moulin', '6914', 'Roodt-sur-Syre', 'Luxemburg', NULL, NULL, NULL, 'test2', NULL, NULL, 'support@dks.lu', NULL, NULL, NULL, NULL, NULL, '9c2ff129-6b43-f4ce-4f6d-823bed531152', NULL, NULL);
INSERT INTO public.companies (company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated, reportperiodunit, reportperiodlength, reportperiodstart, id, datasetname, phone) VALUES ('Test', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'testmyapp', NULL, NULL, NULL, NULL, NULL, '', 8, '2020-03-04', '716d62c1-f6c7-07bb-17ec-8b5825b9696b', 'TESTMYAPP', NULL);
INSERT INTO public.companies (company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated, reportperiodunit, reportperiodlength, reportperiodstart, id, datasetname, phone) VALUES ('IL CANTUCCIO', '14, Avenue de la Faïencerie', '1510', 'Luxembourg', 'Luxemburg', NULL, 'B27344', '', 'portanova', NULL, NULL, 'support@dks.lu', 's.à r.l.', NULL, 'week', 8, '2019-12-30', '8a8728fd-d37d-3a41-757c-bf73d4b9b410', 'Porta Nova', '');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', '::1', '2020-06-29 10:20:13.672259', 'LO-LO-5db9d96c-445d-2786-b92d-52dd34b1494c', NULL);
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'POT/1.0.0 Windows_NT/10.0.18363/x64', '::1', '2020-07-04 11:27:05.060868', 'bfca2b98-81b3-fb1e-51ce-6e06863522bb', NULL);
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'POT/1.0.0 Windows_NT/10.0.18363/ia32', '::1', '2020-07-07 08:30:39.076713', '0e7ddbbf-eb49-3211-3655-4863898349e2', NULL);
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('833ccc12-d964-1314-8be7-06e614666686', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 Edg/84.0.522.52', '::1', '2020-08-09 20:37:29.22789', 'e067d523-1a05-ee58-7dea-73efd030d5cc', '{"schemata": "portanova"}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', '', '', '2020-07-10 11:34:43.326975', 'LO-LO-LO-645ae142-0f89-468f-dbc6-a6670a1b9bf5', '{}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', '', '', '2020-07-10 11:35:14.382476', 'LO-LO-3319df7c-6fd4-ee6e-fdc8-17b24a802a0b', '{"schemata":""}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', '', '', '2020-07-10 11:37:09.334911', 'LO-7213b294-350e-d220-b02d-ffb81044af74', '{"schemata":"test"}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0', '::1', '2020-07-23 12:33:29.414745', 'LO-LO-bff6a206-87af-d529-8266-bca458e1786d', '{"schemata": "portanova"}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0', '::1', '2020-07-24 16:42:55.137598', 'LO-304e0346-4cb0-67c4-dcbb-9557c33c4336', '{"schemata":"portanova"}');
INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0', '::1', '2020-07-28 10:47:38.95606', '4c48f22a-515d-c8f3-0cdd-458304e49523', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-03 15:02:38.486102', 'LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-1aab37e9-6b62-b088-9db2-eb20969effae', '{"schemata": "portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-03 17:07:40.851315', 'LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-4153c4ff-c185-fa16-cf24-a54695fc7281', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-04 07:53:56.664758', 'LO-LO-LO-LO-LO-LO-LO-LO-LO-0bc5edbb-8e14-79a7-c169-0c4cfe7cac9c', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-04 16:36:05.902211', 'LO-LO-LO-LO-LO-LO-LO-LO-89e3d552-9819-b99f-123c-223e1f1d4e2d', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-05 08:26:34.74338', 'LO-LO-LO-LO-LO-LO-LO-35e80a85-1fdb-4eaf-0fae-abe67c064724', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-06 09:05:17.371751', 'LO-LO-LO-LO-LO-LO-2af69d6f-fccd-f066-0a81-c335bc9e19cb', '{"schemata": ""}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-06 09:05:49.584275', 'LO-LO-LO-LO-LO-a1bcccdf-e744-4255-b5d5-1f9da4725028', '{"schemata": ""}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 09:52:12.992059', 'LO-LO-LO-LO-1bc90d9f-14c8-6a99-8c53-44092da183c3', '{"schemata": "portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 14:22:21.625457', 'LO-LO-LO-f3fead4b-a2fb-cf7a-17a2-703399a3b7eb', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 14:49:20.777947', 'LO-LO-0bb4c4df-275c-9303-f908-b639c105dee6', '{"schemata":"portanova"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 18:40:10.767929', 'LO-8831e8d8-b4fa-4191-c22d-8ae1ea4fde38', '{"schemata":"testmyapp"}');
+INSERT INTO public.sessions (id_user, user_agent, remote_addr, created, id, sessiondata) VALUES ('e9e6880b-75c7-70b5-ce61-49cf6d62630f', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', '::1', '2020-08-09 18:40:45.635217', '46378e01-af04-4896-d071-45b8d1fa5816', '{"schemata": "portanova"}');
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: -
--
-INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-12-29 16:53:19.68549', NULL, 'ksaffran@dks.lu', NULL, NULL, '["portanova"]', '["3","5"]', 'Saffran', 'Kilian', NULL, NULL, '8a8728fd-d37d-3a41-757c-bf73d4b9b410', 'admin', 'e9e6880b-75c7-70b5-ce61-49cf6d62630f');
-INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-10-10 17:12:11.934747', NULL, 'kilian.saffran@gmail.com', NULL, '6tgfkew', '["portanova"]', '["2","5","3","4"]', 'Saffran', 'Kilian', '+352691504574', 'Gérant', '8a8728fd-d37d-3a41-757c-bf73d4b9b410', 'admin', '4e46e03a-932e-36ac-e885-572fb86841b3');
INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-12-20 11:03:08.757357', NULL, 'kilian@saffran.lu', NULL, NULL, '["portanova"]', '["5"]', 'Saffran', 'Kilian', '691504574', NULL, '8a8728fd-d37d-3a41-757c-bf73d4b9b410', 'teamleader', '833ccc12-d964-1314-8be7-06e614666686');
+INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-12-29 16:53:19.68549', NULL, 'ksaffran@dks.lu', NULL, NULL, '["portanova","testmyapp"]', '["3","5"]', 'Saffran', 'Kilian', NULL, NULL, '716d62c1-f6c7-07bb-17ec-8b5825b9696b', 'admin', 'e9e6880b-75c7-70b5-ce61-49cf6d62630f');
+INSERT INTO public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) VALUES ('0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-10-10 17:12:11.934747', NULL, 'kilian.saffran@gmail.com', NULL, '6tgfkew', '["portanova"]', '["2","5","3","4"]', 'Saffran', 'Kilian', '+352691504574', 'Gérant', '8a8728fd-d37d-3a41-757c-bf73d4b9b410', 'manager', '4e46e03a-932e-36ac-e885-572fb86841b3');
--
ALTER FUNCTION public.day_name(day_index text) OWNER TO potlu_user;
--
--- Name: getdates(date, integer); Type: FUNCTION; Schema: public; Owner: potlu_user
+-- Name: del_user(text); Type: FUNCTION; Schema: public; Owner: potlu_user
--
-CREATE FUNCTION public.getdates(startdate date, days integer) RETURNS SETOF date
+CREATE FUNCTION public.del_user(vuserid text) RETURNS boolean
LANGUAGE plpgsql
AS $$\r
- BEGIN\r
- return QUERY select date(startdate + s*'1day'::interval) as daydate from generate_series(0,days-1) s ;\r
- END; \r
-$$;
-
-
-ALTER FUNCTION public.getdates(startdate date, days integer) OWNER TO potlu_user;
-
---
--- Name: getdateslist(date, integer); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.getdateslist(startdate date, days integer) RETURNS text
- LANGUAGE plpgsql
- AS $$\r
- declare \r
- ret text;\r
- begin\r
- select string_agg(to_char(getdates,'YYYY-MM-DD'),',') into ret from getdates(startdate,days); \r
- return ret;\r
- END; \r
-$$;
-
-
-ALTER FUNCTION public.getdateslist(startdate date, days integer) OWNER TO potlu_user;
-
---
--- Name: getmondays(integer); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.getmondays(vyear integer) RETURNS SETOF date
- LANGUAGE plpgsql
- AS $$
- BEGIN
- return QUERY select date(daydate) as mondays from (
- select (vyear || '-01-01')::date + s*'1day'::interval as daydate from
- generate_series(0,(vyear ||'-12-31')::date - (vyear || '-01-01')::date) s) xx where extract('isodow' from daydate)=1;
- END;
+declare \r
+ \r
+begin\r
+ delete from public.users where id = vuserid;\r
+ return true;\r
+end;\r
$$;
-ALTER FUNCTION public.getmondays(vyear integer) OWNER TO potlu_user;
+ALTER FUNCTION public.del_user(vuserid text) OWNER TO potlu_user;
--
-- Name: getsession(text, text, text); Type: FUNCTION; Schema: public; Owner: potlu_user
ALTER FUNCTION public.getsession(vidsession text, vremoteaddr text, vuseragent text) OWNER TO potlu_user;
---
--- Name: getsundays(integer); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.getsundays(vyear integer) RETURNS SETOF date
- LANGUAGE plpgsql
- AS $$
- BEGIN
- return QUERY select date(daydate) as sundays from (
- select (vyear || '-01-01')::date + s*'1day'::interval as daydate from
- generate_series(0,(vyear ||'-12-31')::date - (vyear || '-01-01')::date) s) xx where extract('isodow' from daydate)=7;
- END;
-$$;
-
-
-ALTER FUNCTION public.getsundays(vyear integer) OWNER TO potlu_user;
-
--
-- Name: getuuid(); Type: FUNCTION; Schema: public; Owner: potlu_user
--
ALTER FUNCTION public.getuuid() OWNER TO potlu_user;
---
--- Name: getweeks(integer); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.getweeks(vyear integer) RETURNS TABLE(cw integer, mondays date, sundays date)
- LANGUAGE plpgsql
- AS $$
- BEGIN
- return QUERY select extract('week' from daydate)::int4 as cw,date(daydate - interval '3 days') as mondays , date(daydate + interval '3 days') as sundays from (
- select (vyear || '-01-01')::date + s*'1day'::interval as daydate from
- generate_series(0,(vyear ||'-12-31')::date - (vyear || '-01-01')::date) s) xx where extract('isodow' from daydate)=4;
- END;
-$$;
-
-
-ALTER FUNCTION public.getweeks(vyear integer) OWNER TO potlu_user;
-
---
--- Name: getweeksbydaterange(date, date); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.getweeksbydaterange(datefrom date, dateto date) RETURNS TABLE(calyear integer, calweek integer, weekstart date, weekend date)
- LANGUAGE plpgsql
- AS $$
- BEGIN
- return QUERY select date_part('isoyear',daydate)::int as calyear,date_part('week',daydate)::int4 as calweek,date(date_trunc('week',daydate)) as weekstart , date(date_trunc('week',daydate) + interval '6 days') as weekend
-from
-(select datefrom + s*'1 day'::interval as daydate from
-(select * from generate_series(0,dateto - datefrom )s)x ) d group by calyear,calweek,weekstart,weekend order by weekstart,weekend;
-
- END;
-$$;
-
-
-ALTER FUNCTION public.getweeksbydaterange(datefrom date, dateto date) OWNER TO potlu_user;
-
---
--- Name: json_object_set_keys(json, text[], anyarray); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.json_object_set_keys(json json, keys_to_set text[], values_to_set anyarray) RETURNS json
- LANGUAGE sql IMMUTABLE STRICT
- AS $$\r
-SELECT concat('{', string_agg(to_json("key") || ':' || "value", ','), '}')::json\r
- FROM (SELECT *\r
- FROM json_each("json")\r
- WHERE "key" <> ALL ("keys_to_set")\r
- UNION ALL\r
- SELECT DISTINCT ON ("keys_to_set"["index"])\r
- "keys_to_set"["index"],\r
- CASE\r
- WHEN "values_to_set"["index"] IS NULL THEN 'null'::json\r
- ELSE to_json("values_to_set"["index"])\r
- END\r
- FROM generate_subscripts("keys_to_set", 1) AS "keys"("index")\r
- JOIN generate_subscripts("values_to_set", 1) AS "values"("index")\r
- USING ("index")) AS "fields"\r
-$$;
-
-
-ALTER FUNCTION public.json_object_set_keys(json json, keys_to_set text[], values_to_set anyarray) OWNER TO potlu_user;
-
--
-- Name: random_string(integer); Type: FUNCTION; Schema: public; Owner: potlu_user
--
ALTER FUNCTION public.setsessiondata(vsid text, vkey text, vvalue text) OWNER TO potlu_user;
---
--- Name: staffworplan_contracthours(text, integer); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.staffworplan_contracthours(vschemaname text, vcontractid integer) RETURNS void
- LANGUAGE plpgsql
- AS $$\r
-declare\r
- cur_contracthours TEXT;\r
- cur_startdate date;\r
- cur_enddate date;\r
- cur_id_staff text;\r
- BEGIN\r
- execute 'select startdate,enddate,id_staff,to_char(to_timestamp((round(weekhours/weekdays,3)) * 60), ''MI:SS:00'') from ' || vschemaname || '.staffcontract where id=' || vcontractid || ';' into cur_startdate,cur_enddate,cur_id_staff,cur_contracthours;\r
- if cur_enddate is null then\r
- execute 'update ' || vschemaname || '.staffworkplan SET contracthours='''|| cur_contracthours || ''' WHERE id_staff=' || cur_id_staff || ' and daydate>=date(''' || to_char(cur_startdate,'YYYY-MM-DD') || ''');'; \r
- else \r
- execute 'update ' || vschemaname || '.staffworkplan SET contracthours='''|| cur_contracthours || ''' WHERE id_staff=' || cur_id_staff || ' and daydate between date(''' || to_char(cur_startdate,'YYYY-MM-DD') || ''') and date(''' || to_char(cur_enddate,'YYYY-MM-DD') || ''');';\r
- end if;\r
- END; \r
-$$;
-
-
-ALTER FUNCTION public.staffworplan_contracthours(vschemaname text, vcontractid integer) OWNER TO potlu_user;
-
---
--- Name: trg_update_basemonthhours(); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.trg_update_basemonthhours() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
- BEGIN
- new.monthhours = new.weekhours*173/40;
-
- RETURN NEW;
- END;
-$$;
-
-
-ALTER FUNCTION public.trg_update_basemonthhours() OWNER TO potlu_user;
-
--
-- Name: trg_update_modified(); Type: FUNCTION; Schema: public; Owner: potlu_user
--
ALTER FUNCTION public.trg_update_modified() OWNER TO potlu_user;
---
--- Name: trg_update_monthhours(); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.trg_update_monthhours() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
- BEGIN
- new.monthhours = new.weekhours*173/40;
-
- RETURN NEW;
- END;
-$$;
-
-
-ALTER FUNCTION public.trg_update_monthhours() OWNER TO potlu_user;
-
---
--- Name: trg_update_monthlyhours(); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.trg_update_monthlyhours() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
- BEGIN
- new.monthhours = new.weekhours*173/40;
-
- RETURN NEW;
- END;
-$$;
-
-
-ALTER FUNCTION public.trg_update_monthlyhours() OWNER TO potlu_user;
-
---
--- Name: weekvacancy(text, double precision, integer); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.weekvacancy(vschema text, vcalweek double precision, vidstaff integer) RETURNS text
- LANGUAGE plpgsql
- AS $$\r
- declare \r
- vret text;\r
- xsql text;\r
- begin\r
- xsql := 'select ''{"vacancy":{'' || string_agg(''"'' || id_vacancytype || ''":'' || row_to_json(weekvacancy),'','') || ''}}'' from (\r
-select vk.id_vacancytype,sum(vk.vacancyhours) as vacancyhours,vt.vacancyname,vt.color,vt.isworktime from portanova.staffworkplan vk\r
-\r
-join ' || vschema || '.vacancytypes vt on (vt.id=vk.id_vacancytype)\r
-where date_part(''week'', daydate)= ' || vcalweek || ' and id_staff= ' || vidstaff || ' group by vk.id_vacancytype,vt.vacancyname,vt.color,vt.isworktime) weekvacancy;';\r
- --raise notice '%s',xsql;\r
- execute xsql into vret;\r
-return vret;\r
-END; \r
-$$;
-
-
-ALTER FUNCTION public.weekvacancy(vschema text, vcalweek double precision, vidstaff integer) OWNER TO potlu_user;
-
---
--- Name: weekvacancy(text, double precision, text); Type: FUNCTION; Schema: public; Owner: potlu_user
---
-
-CREATE FUNCTION public.weekvacancy(vschema text, vcalweek double precision, vidstaff text) RETURNS text
- LANGUAGE plpgsql
- AS $$\r
- declare \r
- vret text;\r
- xsql text;\r
- begin\r
- xsql := 'select ''{"vacancy":{'' || string_agg(''"'' || id_vacancytype || ''":'' || row_to_json(weekvacancy),'','') || ''}}'' from (\r
-select vk.id_vacancytype,sum(vk.vacancyhours) as vacancyhours,vt.vacancyname,vt.color,vt.isworktime from portanova.staffworkplan vk\r
-\r
-join ' || vschema || '.vacancytypes vt on (vt.id=vk.id_vacancytype)\r
-where date_part(''week'', daydate)= ' || vcalweek || ' and id_staff= ' || vidstaff || ' group by vk.id_vacancytype,vt.vacancyname,vt.color,vt.isworktime) weekvacancy;';\r
- --raise notice '%s',xsql;\r
- execute xsql into vret;\r
-return vret;\r
-END; \r
-$$;
-
-
-ALTER FUNCTION public.weekvacancy(vschema text, vcalweek double precision, vidstaff text) OWNER TO potlu_user;
-
SET default_tablespace = '';
SET default_with_oids = false;
NULL::text AS job,
NULL::text AS id_company,
NULL::text AS company,
- NULL::text AS usergroups;
+ NULL::text AS usergroups,
+ NULL::text AS id_usergroup;
ALTER TABLE public.vw_userslist OWNER TO potlu_user;
--
COPY public.companies (company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated, reportperiodunit, reportperiodlength, reportperiodstart, id, datasetname, phone) FROM stdin;
-test 4, rue Principale 3770 Tétange Luxemburg \N \N \N test \N \N kilian@saffran.lu s.à r.l. \N \N \N \N d1f1e10e-48ef-d422-3930-0d702e05c689 \N \N
-TEST2 8b, rue du Moulin 6914 Roodt-sur-Syre Luxemburg \N \N \N test2 \N \N support@dks.lu \N \N \N \N \N 9c2ff129-6b43-f4ce-4f6d-823bed531152 \N \N
Test \N \N \N \N \N \N \N testmyapp \N \N \N \N \N 8 2020-03-04 716d62c1-f6c7-07bb-17ec-8b5825b9696b TESTMYAPP \N
IL CANTUCCIO 14, Avenue de la Faïencerie 1510 Luxembourg Luxemburg \N B27344 portanova \N \N support@dks.lu s.à r.l. \N week 8 2019-12-30 8a8728fd-d37d-3a41-757c-bf73d4b9b410 Porta Nova
\.
e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 ::1 2020-06-29 10:20:13.672259 LO-LO-5db9d96c-445d-2786-b92d-52dd34b1494c \N
e9e6880b-75c7-70b5-ce61-49cf6d62630f POT/1.0.0 Windows_NT/10.0.18363/x64 ::1 2020-07-04 11:27:05.060868 bfca2b98-81b3-fb1e-51ce-6e06863522bb \N
e9e6880b-75c7-70b5-ce61-49cf6d62630f POT/1.0.0 Windows_NT/10.0.18363/ia32 ::1 2020-07-07 08:30:39.076713 0e7ddbbf-eb49-3211-3655-4863898349e2 \N
+833ccc12-d964-1314-8be7-06e614666686 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 Edg/84.0.522.52 ::1 2020-08-09 20:37:29.22789 e067d523-1a05-ee58-7dea-73efd030d5cc {"schemata": "portanova"}
e9e6880b-75c7-70b5-ce61-49cf6d62630f 2020-07-10 11:34:43.326975 LO-LO-LO-645ae142-0f89-468f-dbc6-a6670a1b9bf5 {}
e9e6880b-75c7-70b5-ce61-49cf6d62630f 2020-07-10 11:35:14.382476 LO-LO-3319df7c-6fd4-ee6e-fdc8-17b24a802a0b {"schemata":""}
e9e6880b-75c7-70b5-ce61-49cf6d62630f 2020-07-10 11:37:09.334911 LO-7213b294-350e-d220-b02d-ffb81044af74 {"schemata":"test"}
e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 ::1 2020-07-23 12:33:29.414745 LO-LO-bff6a206-87af-d529-8266-bca458e1786d {"schemata": "portanova"}
e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 ::1 2020-07-24 16:42:55.137598 LO-304e0346-4cb0-67c4-dcbb-9557c33c4336 {"schemata":"portanova"}
e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 ::1 2020-07-28 10:47:38.95606 4c48f22a-515d-c8f3-0cdd-458304e49523 {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-03 15:02:38.486102 LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-1aab37e9-6b62-b088-9db2-eb20969effae {"schemata": "portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-03 17:07:40.851315 LO-LO-LO-LO-LO-LO-LO-LO-LO-LO-4153c4ff-c185-fa16-cf24-a54695fc7281 {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-04 07:53:56.664758 LO-LO-LO-LO-LO-LO-LO-LO-LO-0bc5edbb-8e14-79a7-c169-0c4cfe7cac9c {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-04 16:36:05.902211 LO-LO-LO-LO-LO-LO-LO-LO-89e3d552-9819-b99f-123c-223e1f1d4e2d {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-05 08:26:34.74338 LO-LO-LO-LO-LO-LO-LO-35e80a85-1fdb-4eaf-0fae-abe67c064724 {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-06 09:05:17.371751 LO-LO-LO-LO-LO-LO-2af69d6f-fccd-f066-0a81-c335bc9e19cb {"schemata": ""}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-06 09:05:49.584275 LO-LO-LO-LO-LO-a1bcccdf-e744-4255-b5d5-1f9da4725028 {"schemata": ""}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 09:52:12.992059 LO-LO-LO-LO-1bc90d9f-14c8-6a99-8c53-44092da183c3 {"schemata": "portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 14:22:21.625457 LO-LO-LO-f3fead4b-a2fb-cf7a-17a2-703399a3b7eb {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 14:49:20.777947 LO-LO-0bb4c4df-275c-9303-f908-b639c105dee6 {"schemata":"portanova"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 18:40:10.767929 LO-8831e8d8-b4fa-4191-c22d-8ae1ea4fde38 {"schemata":"testmyapp"}
+e9e6880b-75c7-70b5-ce61-49cf6d62630f Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 ::1 2020-08-09 18:40:45.635217 46378e01-af04-4896-d071-45b8d1fa5816 {"schemata": "portanova"}
\.
--
COPY public.users (userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company, id_usergroup, id) FROM stdin;
-0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-12-29 16:53:19.68549 \N ksaffran@dks.lu \N \N ["portanova"] ["3","5"] Saffran Kilian \N \N 8a8728fd-d37d-3a41-757c-bf73d4b9b410 admin e9e6880b-75c7-70b5-ce61-49cf6d62630f
-0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-10-10 17:12:11.934747 \N kilian.saffran@gmail.com \N 6tgfkew ["portanova"] ["2","5","3","4"] Saffran Kilian +352691504574 Gérant 8a8728fd-d37d-3a41-757c-bf73d4b9b410 admin 4e46e03a-932e-36ac-e885-572fb86841b3
0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-12-20 11:03:08.757357 \N kilian@saffran.lu \N \N ["portanova"] ["5"] Saffran Kilian 691504574 \N 8a8728fd-d37d-3a41-757c-bf73d4b9b410 teamleader 833ccc12-d964-1314-8be7-06e614666686
+0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-12-29 16:53:19.68549 \N ksaffran@dks.lu \N \N ["portanova","testmyapp"] ["3","5"] Saffran Kilian \N \N 716d62c1-f6c7-07bb-17ec-8b5825b9696b admin e9e6880b-75c7-70b5-ce61-49cf6d62630f
+0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-10-10 17:12:11.934747 \N kilian.saffran@gmail.com \N 6tgfkew ["portanova"] ["2","5","3","4"] Saffran Kilian +352691504574 Gérant 8a8728fd-d37d-3a41-757c-bf73d4b9b410 manager 4e46e03a-932e-36ac-e885-572fb86841b3
\.
us.job,
us.id_company,
co.company,
- ugrp.groupname AS usergroups
+ ugrp.groupname AS usergroups,
+ ugrp.id AS id_usergroup
FROM ((public.users us
LEFT JOIN public.companies co ON ((us.id_company = co.id)))
LEFT JOIN public.usergroups ugrp ON ((ugrp.id = us.id_usergroup)))
+--
+-- PostgreSQL database dump
+--
-
-
-
-
-
+-- Dumped from database version 11.7 (Debian 11.7-0+deb10u1)
+-- Dumped by pg_dump version 11.7 (Debian 11.7-0+deb10u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_min_messages = warning;
SET row_security = off;
-
-
-
+--
+-- Name: public; Type: SCHEMA; Schema: -; Owner: -
+--
CREATE SCHEMA public;
-
-
-
+--
+-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
+--
COMMENT ON SCHEMA public IS 'standard public schema';
-
-
-
+--
+-- Name: add_schemalink(text, text); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.add_schemalink(vdatatsetname text, vschemaname text) RETURNS text
LANGUAGE plpgsql
$$;
-
-
-
+--
+-- Name: checklogin(text, text, text, text); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.checklogin(vusername text, vpassword text, vremoteaddr text, vuseragent text) RETURNS text
LANGUAGE plpgsql
$$;
-
-
-
+--
+-- Name: day_name(text); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.day_name(day_index text) RETURNS text
LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE
$$;
+--
+-- Name: del_user(text); Type: FUNCTION; Schema: public; Owner: -
+--
-
-
-
-CREATE FUNCTION public.getdates(startdate date, days integer) RETURNS SETOF date
+CREATE FUNCTION public.del_user(vuserid text) RETURNS boolean
LANGUAGE plpgsql
AS $$
- BEGIN
- return QUERY select date(startdate + s*'1day'::interval) as daydate from generate_series(0,days-1) s ;
- END;
-$$;
-
-
-
-
-
-
-CREATE FUNCTION public.getdateslist(startdate date, days integer) RETURNS text
- LANGUAGE plpgsql
- AS $$
- declare
- ret text;
- begin
- select string_agg(to_char(getdates,'YYYY-MM-DD'),',') into ret from getdates(startdate,days);
- return ret;
- END;
-$$;
-
-
-
-
-
-
-CREATE FUNCTION public.getmondays(vyear integer) RETURNS SETOF date
- LANGUAGE plpgsql
- AS $$
- BEGIN
- return QUERY select date(daydate) as mondays from (
- select (vyear || '-01-01')::date + s*'1day'::interval as daydate from
- generate_series(0,(vyear ||'-12-31')::date - (vyear || '-01-01')::date) s) xx where extract('isodow' from daydate)=1;
- END;
+declare
+
+begin
+ delete from public.users where id = vuserid;
+ return true;
+end;
$$;
-
-
-
+--
+-- Name: getsession(text, text, text); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.getsession(vidsession text, vremoteaddr text, vuseragent text) RETURNS TABLE(idsession text, id text, username text, usergroup text, sessiondata json)
LANGUAGE plpgsql
$$;
-
-
-
-
-CREATE FUNCTION public.getsundays(vyear integer) RETURNS SETOF date
- LANGUAGE plpgsql
- AS $$
- BEGIN
- return QUERY select date(daydate) as sundays from (
- select (vyear || '-01-01')::date + s*'1day'::interval as daydate from
- generate_series(0,(vyear ||'-12-31')::date - (vyear || '-01-01')::date) s) xx where extract('isodow' from daydate)=7;
- END;
-$$;
-
-
-
-
-
+--
+-- Name: getuuid(); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.getuuid() RETURNS text
LANGUAGE plpgsql
$$;
-
-
-
-
-CREATE FUNCTION public.getweeks(vyear integer) RETURNS TABLE(cw integer, mondays date, sundays date)
- LANGUAGE plpgsql
- AS $$
- BEGIN
- return QUERY select extract('week' from daydate)::int4 as cw,date(daydate - interval '3 days') as mondays , date(daydate + interval '3 days') as sundays from (
- select (vyear || '-01-01')::date + s*'1day'::interval as daydate from
- generate_series(0,(vyear ||'-12-31')::date - (vyear || '-01-01')::date) s) xx where extract('isodow' from daydate)=4;
- END;
-$$;
-
-
-
-
-
-
-CREATE FUNCTION public.getweeksbydaterange(datefrom date, dateto date) RETURNS TABLE(calyear integer, calweek integer, weekstart date, weekend date)
- LANGUAGE plpgsql
- AS $$
- BEGIN
- return QUERY select date_part('isoyear',daydate)::int as calyear,date_part('week',daydate)::int4 as calweek,date(date_trunc('week',daydate)) as weekstart , date(date_trunc('week',daydate) + interval '6 days') as weekend
-from
-(select datefrom + s*'1 day'::interval as daydate from
-(select * from generate_series(0,dateto - datefrom )s)x ) d group by calyear,calweek,weekstart,weekend order by weekstart,weekend;
-
- END;
-$$;
-
-
-
-
-
-
-CREATE FUNCTION public.json_object_set_keys(json json, keys_to_set text[], values_to_set anyarray) RETURNS json
- LANGUAGE sql IMMUTABLE STRICT
- AS $$
-SELECT concat('{', string_agg(to_json("key") || ':' || "value", ','), '}')::json
- FROM (SELECT *
- FROM json_each("json")
- WHERE "key" <> ALL ("keys_to_set")
- UNION ALL
- SELECT DISTINCT ON ("keys_to_set"["index"])
- "keys_to_set"["index"],
- CASE
- WHEN "values_to_set"["index"] IS NULL THEN 'null'::json
- ELSE to_json("values_to_set"["index"])
- END
- FROM generate_subscripts("keys_to_set", 1) AS "keys"("index")
- JOIN generate_subscripts("values_to_set", 1) AS "values"("index")
- USING ("index")) AS "fields"
-$$;
-
-
-
-
-
+--
+-- Name: random_string(integer); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.random_string(vlength integer) RETURNS text
LANGUAGE plpgsql
$$;
-
-
-
+--
+-- Name: setjsonkeyvalue(text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.setjsonkeyvalue(vschemata text, vtable text, vcol text, vid text, vkey text, vvalue text) RETURNS json
LANGUAGE plpgsql
$$;
-
-
-
+--
+-- Name: setsessiondata(text, text, text); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.setsessiondata(vsid text, vkey text, vvalue text) RETURNS json
LANGUAGE plpgsql
$$;
-
-
-
-
-CREATE FUNCTION public.staffworplan_contracthours(vschemaname text, vcontractid integer) RETURNS void
- LANGUAGE plpgsql
- AS $$
-declare
- cur_contracthours TEXT;
- cur_startdate date;
- cur_enddate date;
- cur_id_staff text;
- BEGIN
- execute 'select startdate,enddate,id_staff,to_char(to_timestamp((round(weekhours/weekdays,3)) * 60), ''MI:SS:00'') from ' || vschemaname || '.staffcontract where id=' || vcontractid || ';' into cur_startdate,cur_enddate,cur_id_staff,cur_contracthours;
- if cur_enddate is null then
- execute 'update ' || vschemaname || '.staffworkplan SET contracthours='''|| cur_contracthours || ''' WHERE id_staff=' || cur_id_staff || ' and daydate>=date(''' || to_char(cur_startdate,'YYYY-MM-DD') || ''');';
- else
- execute 'update ' || vschemaname || '.staffworkplan SET contracthours='''|| cur_contracthours || ''' WHERE id_staff=' || cur_id_staff || ' and daydate between date(''' || to_char(cur_startdate,'YYYY-MM-DD') || ''') and date(''' || to_char(cur_enddate,'YYYY-MM-DD') || ''');';
- end if;
- END;
-$$;
-
-
-
-
-
-
-CREATE FUNCTION public.trg_update_basemonthhours() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
- BEGIN
- new.monthhours = new.weekhours*173/40;
-
- RETURN NEW;
- END;
-$$;
-
-
-
-
-
+--
+-- Name: trg_update_modified(); Type: FUNCTION; Schema: public; Owner: -
+--
CREATE FUNCTION public.trg_update_modified() RETURNS trigger
LANGUAGE plpgsql
$$;
-
-
-
-
-CREATE FUNCTION public.trg_update_monthhours() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
- BEGIN
- new.monthhours = new.weekhours*173/40;
-
- RETURN NEW;
- END;
-$$;
-
-
-
-
-
-
-CREATE FUNCTION public.trg_update_monthlyhours() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
- BEGIN
- new.monthhours = new.weekhours*173/40;
-
- RETURN NEW;
- END;
-$$;
-
-
-
-
-
-
-CREATE FUNCTION public.weekvacancy(vschema text, vcalweek double precision, vidstaff integer) RETURNS text
- LANGUAGE plpgsql
- AS $$
- declare
- vret text;
- xsql text;
- begin
- xsql := 'select ''{"vacancy":{'' || string_agg(''"'' || id_vacancytype || ''":'' || row_to_json(weekvacancy),'','') || ''}}'' from (
-select vk.id_vacancytype,sum(vk.vacancyhours) as vacancyhours,vt.vacancyname,vt.color,vt.isworktime from portanova.staffworkplan vk
-
-join ' || vschema || '.vacancytypes vt on (vt.id=vk.id_vacancytype)
-where date_part(''week'', daydate)= ' || vcalweek || ' and id_staff= ' || vidstaff || ' group by vk.id_vacancytype,vt.vacancyname,vt.color,vt.isworktime) weekvacancy;';
- --raise notice '%s',xsql;
- execute xsql into vret;
-return vret;
-END;
-$$;
-
-
-
-
-
-
-CREATE FUNCTION public.weekvacancy(vschema text, vcalweek double precision, vidstaff text) RETURNS text
- LANGUAGE plpgsql
- AS $$
- declare
- vret text;
- xsql text;
- begin
- xsql := 'select ''{"vacancy":{'' || string_agg(''"'' || id_vacancytype || ''":'' || row_to_json(weekvacancy),'','') || ''}}'' from (
-select vk.id_vacancytype,sum(vk.vacancyhours) as vacancyhours,vt.vacancyname,vt.color,vt.isworktime from portanova.staffworkplan vk
-
-join ' || vschema || '.vacancytypes vt on (vt.id=vk.id_vacancytype)
-where date_part(''week'', daydate)= ' || vcalweek || ' and id_staff= ' || vidstaff || ' group by vk.id_vacancytype,vt.vacancyname,vt.color,vt.isworktime) weekvacancy;';
- --raise notice '%s',xsql;
- execute xsql into vret;
-return vret;
-END;
-$$;
-
-
SET default_tablespace = '';
SET default_with_oids = false;
-
-
-
+--
+-- Name: companies; Type: TABLE; Schema: public; Owner: -
+--
CREATE TABLE public.companies (
company text,
);
-
-
-
+--
+-- Name: labels; Type: TABLE; Schema: public; Owner: -
+--
CREATE TABLE public.labels (
id text NOT NULL,
);
-
-
-
+--
+-- Name: preferences; Type: TABLE; Schema: public; Owner: -
+--
CREATE TABLE public.preferences (
id text DEFAULT public.getuuid() NOT NULL,
);
-
-
-
+--
+-- Name: sectorworktime; Type: TABLE; Schema: public; Owner: -
+--
CREATE TABLE public.sectorworktime (
id text DEFAULT public.getuuid() NOT NULL,
);
-
-
-
+--
+-- Name: sessions; Type: TABLE; Schema: public; Owner: -
+--
CREATE TABLE public.sessions (
id_user text,
);
-
-
-
+--
+-- Name: usergroups; Type: TABLE; Schema: public; Owner: -
+--
CREATE TABLE public.usergroups (
id text NOT NULL,
);
-
-
-
+--
+-- Name: users; Type: TABLE; Schema: public; Owner: -
+--
CREATE TABLE public.users (
userpassword text,
);
-
-
-
+--
+-- Name: vw_companiesdata; Type: VIEW; Schema: public; Owner: -
+--
CREATE VIEW public.vw_companiesdata AS
SELECT companies.id,
FROM public.companies;
-
-
-
+--
+-- Name: vw_companieslist; Type: VIEW; Schema: public; Owner: -
+--
CREATE VIEW public.vw_companieslist AS
SELECT companies.id,
FROM public.companies;
-
-
-
+--
+-- Name: vw_schemata; Type: VIEW; Schema: public; Owner: -
+--
CREATE VIEW public.vw_schemata AS
SELECT sct.schema_name AS schemaname,
WHERE (((sct.schema_owner)::text = 'potlu_user'::text) AND ((sct.schema_name)::text <> 'public'::text));
-
-
-
+--
+-- Name: vw_sectorlist; Type: VIEW; Schema: public; Owner: -
+--
CREATE VIEW public.vw_sectorlist AS
SELECT DISTINCT sectorworktime.sector
ORDER BY sectorworktime.sector;
-
-
-
+--
+-- Name: vw_usergroupslist; Type: VIEW; Schema: public; Owner: -
+--
CREATE VIEW public.vw_usergroupslist AS
SELECT usergroups.id,
FROM public.usergroups;
-
-
-
+--
+-- Name: vw_userschemaaccess; Type: VIEW; Schema: public; Owner: -
+--
CREATE VIEW public.vw_userschemaaccess AS
SELECT us.id AS id_user,
LEFT JOIN public.companies cp ON ((cp.schemata = us.schemaaccess)));
-
-
-
+--
+-- Name: vw_usersdata; Type: VIEW; Schema: public; Owner: -
+--
CREATE VIEW public.vw_usersdata AS
SELECT users.id,
FROM public.users;
-
-
-
+--
+-- Name: vw_userslist; Type: VIEW; Schema: public; Owner: -
+--
CREATE VIEW public.vw_userslist AS
SELECT
NULL::text AS job,
NULL::text AS id_company,
NULL::text AS company,
- NULL::text AS usergroups;
-
-
-
+ NULL::text AS usergroups,
+ NULL::text AS id_usergroup;
+--
+-- Name: companies companies_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
ALTER TABLE ONLY public.companies
ADD CONSTRAINT companies_pkey PRIMARY KEY (id);
-
-
-
+--
+-- Name: labels labels_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
ALTER TABLE ONLY public.labels
ADD CONSTRAINT labels_pkey PRIMARY KEY (id);
-
-
-
+--
+-- Name: preferences preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
ALTER TABLE ONLY public.preferences
ADD CONSTRAINT preferences_pkey PRIMARY KEY (id);
-
-
-
+--
+-- Name: sectorworktime sectorworktime_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
ALTER TABLE ONLY public.sectorworktime
ADD CONSTRAINT sectorworktime_pkey PRIMARY KEY (id);
-
-
-
+--
+-- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
ALTER TABLE ONLY public.sessions
ADD CONSTRAINT sessions_pkey PRIMARY KEY (id);
-
-
-
+--
+-- Name: users uniq_username; Type: CONSTRAINT; Schema: public; Owner: -
+--
ALTER TABLE ONLY public.users
ADD CONSTRAINT uniq_username UNIQUE (username);
-
-
-
+--
+-- Name: usergroups usergroups_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
ALTER TABLE ONLY public.usergroups
ADD CONSTRAINT usergroups_pkey PRIMARY KEY (id);
-
-
-
+--
+-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
-
-
-
+--
+-- Name: vw_userslist _RETURN; Type: RULE; Schema: public; Owner: -
+--
CREATE OR REPLACE VIEW public.vw_userslist AS
SELECT us.id,
us.job,
us.id_company,
co.company,
- ugrp.groupname AS usergroups
+ ugrp.groupname AS usergroups,
+ ugrp.id AS id_usergroup
FROM ((public.users us
LEFT JOIN public.companies co ON ((us.id_company = co.id)))
LEFT JOIN public.usergroups ugrp ON ((ugrp.id = us.id_usergroup)))
GROUP BY us.id, co.id, ugrp.id;
-
-
-
+--
+-- PostgreSQL database dump complete
+--
end;
$$;
+CREATE FUNCTION %%NEWSCHEMA%%.del_staffgroup(vidstaffgroup text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+
+begin
+ delete from %%NEWSCHEMA%%.staffgroups where id = vidstaffgroup;
+ return true;
+end;
+$$;
+
+CREATE FUNCTION %%NEWSCHEMA%%.del_workplan(vidworkplan text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+ wpl record;
+ staffcnt int4;
+begin
+ select * into wpl from %%NEWSCHEMA%%.workplans where id=vidworkplan;
+ select count(id_staff) into staffcnt from %%NEWSCHEMA%%.staffcontract where id_contractworkplan=vidworkplan;
+ if (wpl.isdefault is null and staffcnt == 0) then
+ delete from %%NEWSCHEMA%%.workplandays where id_workplan = vidworkplan;
+ delete from %%NEWSCHEMA%%.workplans where id = vidworkplan;
+ end if;
+ return true;
+end;
+$$;
+
+CREATE FUNCTION %%NEWSCHEMA%%.del_worktime(vidworktime text) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+declare
+ wpl record;
+ staffcnt int4;
+begin
+ select * into wpl from %%NEWSCHEMA%%.worktimes where id=vidworktime;
+ if (wpl.isdefault is null) then
+ delete from %%NEWSCHEMA%%.worktimes where id = vidworktime;
+ end if;
+ return true;
+end;
+$$;
+
CREATE FUNCTION %%NEWSCHEMA%%.delete_workplan(pid_workplan text) RETURNS boolean
LANGUAGE plpgsql
AS $$
loop
perform %%NEWSCHEMA%%.set_staffperiodday_sums(pday.id);
end loop;
- raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
+ --raise notice 'start set_staffperiodweeks % % ',pid_period,pid_staff;
perform %%NEWSCHEMA%%.set_staffperiodweeks(pid_period,pid_staff);
return true;
end;
/*wkcon.diffhours = wkcon.totalhours-wkcon.contracthours;
- raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/
+ --raise notice 'contractdays: % contracthours: % totalhours: % diffhours: %',wkcon.contractdays,wkcon.contracthours,wkcon.totalhours,wkcon.diffhours;*/
--raise notice 'id=% cdays=% chours=% diffhours=%',wkcon.id,wkcon.contractdays,wkcon.contracthours,wkcon.diffhours;
dateend date;
rp record;
begin
- raise notice 'After update exec %',new.id;
+ --raise notice 'After update exec %',new.id;
UPDATE %%NEWSCHEMA%%.staffcontract sc SET weekdays = wp.weekdays , weekhours = wp.weekhours,defaultfreedays= wp.freeweekdayslist from %%NEWSCHEMA%%.workplans wp where wp.id =sc.id_contractworkplan and sc.id=new.id
returning id_staff,startdate,enddate into idstaff,datestart,dateend;
- raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
+ --raise notice 'idstaff % startdate % enddate %',idstaff,datestart,dateend;
if datestart is not null and dateend is null then
for rp in select id from %%NEWSCHEMA%%.reportperiod where datestart between startdate and enddate or startdate > datestart
loop
- raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
+ --raise notice 'run update_staff_in_period startdate % => %',datestart ,rp.id;
perform %%NEWSCHEMA%%.set_staffperioddays(rp.id, idstaff);
end loop;
elsif dateend is not null then
for rp in select id from %%NEWSCHEMA%%.reportperiod where enddate >= datestart and (startdate <= dateend)
loop
- raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
+ --raise notice 'run update_staff_in_period startdate % enddate % => %',datestart,dateend,rp.id;
perform %%NEWSCHEMA%%.set_staffperioddays(rp.id, idstaff);
end loop;
end if;
staffreportid text;
rdays record;
begin
- raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
+ --raise notice 'update staff in period called rp: % st: %',pid_period,pid_staff;
if (pid_period is not null and pid_staff is not null) then
for rdays in select id from %%NEWSCHEMA%%.staffreportperioddays where id_staff=pid_staff and id_reportperiod=pid_period
loop