From d9ca4f53b4c7f12fb131daec8a25eaff0c939fc2 Mon Sep 17 00:00:00 2001 From: "kilian (dks-laptop)" Date: Wed, 25 Dec 2019 08:46:26 +0100 Subject: [PATCH] v20191224 --- backoffice/api/db.cgi | 54 +- backoffice/api/index.cgi | 19 +- backoffice/api/lib/dksdb.pm | 30 +- backoffice/api/lib/session.pm | 19 + .../data/schemata/defaultcompany.schema.sql | 159 ++-- backoffice/index.cgi | 2 +- backoffice/js/admin.js | 11 +- backoffice/js/formsave.js | 5 +- backoffice/js/module_global.js | 2 + backoffice/js/request.js | 8 +- backoffice/tmpl/block/dlgdataload.tt | 37 + backoffice/tmpl/block/dlgmessage.tt | 25 + .../companies/widgets/companies/companies.js | 6 + backoffice/tmpl/module/planning/index.js | 13 +- backoffice/tmpl/module/planning/index.tt | 4 +- .../widgets/reportperiod/dlg_reportperiod.tt | 2 +- .../widgets/reportperiod/reportperiod.js | 4 +- .../staffworkplan/frm_staffworkplan.tt | 11 +- .../widgets/staffworkplan/staffworkplan.js | 182 +++- .../staffworkplan/tbar_staffworkplan.tt | 1 + backoffice/tmpl/module/staff/index.js | 1 + backoffice/tmpl/module/staff/index.tt | 4 +- .../module/staff/widgets/staff/frm_staff.tt | 13 +- .../tmpl/module/staff/widgets/staff/staff.js | 66 +- .../staffcontract/dlg_staffcontract.tt | 24 + .../widgets/staffcontract/staffcontract.js | 122 +++ .../staffcontract/tbar_staffcontract.tt | 8 + .../staffcontract/tbl_staffcontract.tt | 7 + backoffice/tmpl/module/users/index.tt | 1 + .../module/users/widgets/users/dlg_users.tt | 2 +- .../tmpl/module/users/widgets/users/users.js | 23 +- backoffice/tmpl/skeleton/index.tt | 2 +- .../man/man3/Business::Tax::VAT::Validation.3 | 261 ++++++ .../potlu_db.newcompanyschema.pg.schema.sql | 159 ++-- dev/db/potlu_db.pg.data.sql | 287 ++++--- dev/db/potlu_db.pg.full.sql | 779 +++++++++--------- dev/db/potlu_db.pg.schema.sql | 518 ++++++------ dev/db/potlu_db.portanova.pg.data.sql | 110 +-- dev/db/potlu_db.portanova.pg.full.sql | 338 +++++--- dev/db/potlu_db.portanova.pg.schema.sql | 202 +++-- dev/db/potlu_db.public.pg.data.sql | 131 ++- dev/db/potlu_db.public.pg.full.sql | 242 +++--- dev/db/potlu_db.public.pg.install.schema.sql | 86 +- dev/db/potlu_db.public.pg.schema.sql | 170 ++-- 44 files changed, 2663 insertions(+), 1487 deletions(-) create mode 100644 backoffice/tmpl/block/dlgdataload.tt create mode 100644 backoffice/tmpl/block/dlgmessage.tt create mode 100644 backoffice/tmpl/module/staff/widgets/staffcontract/dlg_staffcontract.tt create mode 100644 backoffice/tmpl/module/staff/widgets/staffcontract/staffcontract.js create mode 100644 backoffice/tmpl/module/staff/widgets/staffcontract/tbar_staffcontract.tt create mode 100644 backoffice/tmpl/module/staff/widgets/staffcontract/tbl_staffcontract.tt create mode 100644 dev/db/l/man/man3/Business::Tax::VAT::Validation.3 diff --git a/backoffice/api/db.cgi b/backoffice/api/db.cgi index 1c5fa1fa..755864d5 100755 --- a/backoffice/api/db.cgi +++ b/backoffice/api/db.cgi @@ -7,7 +7,7 @@ use CGI::Cookie; # use CGI::Carp qw/fatalsToBrowser/; use File::Basename; use JSON::PP; - +use Data::Dumper; use dksconfig qw/$sitecfg/; use dksdb; @@ -34,12 +34,12 @@ if ($sess == undef){ # $html->{sess} =$sess; #my $datapath = $ENV{"DOCUMENT_ROOT"}.dirname(dirname($scriptpath)).'/data/'; if (($cgi->request_method() eq "GET") || ($cgi->request_method() eq "POST")){ - + my $db = dksdb->new(); my @params = $cgi->param(); foreach my $pp (@params){ $p->{$pp} = $cgi->param($pp); } - my $db = dksdb->new(); + if (exists($p->{get})){ my $schema = "public"; if (exists($p->{schemata})){ @@ -56,12 +56,14 @@ if (($cgi->request_method() eq "GET") || ($cgi->request_method() eq "POST")){ } elsif (exists($p->{set})){ my $type = "ins"; + foreach my $x (keys(%{$p})){ if (($x =~ /^ident_/) && ($p->{$x} ne "")){ $type = "upd"; last; } } + #checkidents my $x = $p; delete $x->{sid}; delete $x->{set}; @@ -78,6 +80,52 @@ if (($cgi->request_method() eq "GET") || ($cgi->request_method() eq "POST")){ } } } + elsif (exists($p->{upsert})){ + my $idents = (); + my $type=""; + foreach my $l (keys(%{$p})){ + if (($l =~ /^ident_/) && ($p->{$l} ne "")){ + $idents->{$l} = $l; + $idents->{$l} =~ s/^ident_//; + } + } + #print Dumper($idents); + + my $x = $p; + delete $x->{sid}; + delete $x->{upsert}; + if (keys(%{$idents}) > 0){ + my @cntsql = $db->create_cnt_statement($x); + #print Dumper(@cntsql); + my $cntres = $db->dbquery($cntsql[0]); + if ($cntres->{cnt} eq "0"){ + $type = "ins"; + foreach my $c (keys(%{$idents})){ + $x->{$idents->{$c}} = $x->{$c}; + delete($x->{$c}); + } + } else { + $type = "upd"; + } + #print Dumper($type); + #print Dumper($x); + my @sql = (); + if ($type eq "ins"){ + @sql = $db->create_ddl_insert($x); + }else { + @sql = $db->create_ddl_update($x); + } + #print Dumper(@sql); + if (scalar(@sql) > 0 ){ + my $rid = $db->dbquerysorted($sql[0]); + if (keys(%{$rid}) > 0 ){ + $html->{result} = $rid->{0}; + } + } + } else { + $html->{result} = "ERROR: no idents!"; + } + } elsif (exists($p->{del})){ my $x = $p; delete $x->{sid}; diff --git a/backoffice/api/index.cgi b/backoffice/api/index.cgi index 58a49ab7..e1940341 100755 --- a/backoffice/api/index.cgi +++ b/backoffice/api/index.cgi @@ -139,6 +139,13 @@ if (($cgi->request_method() eq "GET") || ($cgi->request_method() eq "POST")){ $html->{result}->{error} = $mret; } } + if ($p->{fn} eq "sendnewpassword"){ + #my $vcode = $se->randomstring(6); + #$vcode = lc($vcode); + #$db->dbexec("UPDATE users set vcode='".$vcode."' where id=".$sess->{id}.";"); + my $ret = $se->admin_sendpassword($p->{email}); + $html->{result}->{status} = $ret; + } if ($p->{fn} eq "savenewemail"){ $db->dbexec("update users set username='".$p->{email}."' where id=".$sess->{id}." and vcode='".$p->{vcode}."';"); $html->{result} = "OK"; @@ -174,10 +181,20 @@ if (($cgi->request_method() eq "GET") || ($cgi->request_method() eq "POST")){ if ($p->{fn} eq "installschema"){ my $schemasql = "select count(*) as cnt from information_schema.schemata where schema_name='".$db->securetext($p->{schemaname})."';"; my $dbschema = $db->dbquery($schemasql); + $html->{cnt} = $dbschema; + $html->{sql} = $schemasql; if ($dbschema->{cnt} eq "0"){ - $db->createdefinedschema("defaultcompany",$db->securetext($p->{schema})); + $html->{schemadata} = $db->createdefinedschema("defaultcompany",$db->securetext($p->{schemaname})); } } + if ($p->{fn} eq "getschemaaccess"){ + my $sql = "select schemata, company from companies where schemata in ( +select json_array_elements_text(schemaaccess) as schemaaccess from users where id=".$sess->{id}.") order by company;"; + if ($sess->{usergroups} =~ /admin/){ + $sql = "select schemata, company from companies order by company;"; + } + $html->{result} = $db->dbquerysorted($sql); + } } } diff --git a/backoffice/api/lib/dksdb.pm b/backoffice/api/lib/dksdb.pm index 13c1d5a7..4c5544a0 100644 --- a/backoffice/api/lib/dksdb.pm +++ b/backoffice/api/lib/dksdb.pm @@ -362,29 +362,37 @@ sub createdefinedschema(){ my $schematype = shift; my $schemaname = shift; my $ddlstr = ""; - my $sc = $self->dbquerysorted("select * from information_schema.schemata where schema_name='".$schemaname."';"); + my $sqlschema = "select * from information_schema.schemata where schema_name='".$schemaname."';"; + my $sc = $self->dbquerysorted($sqlschema); + my $ret->{sqlschema} = $sqlschema; if (keys(%{$sc}) > 0){ return; } my @schemaddl =(); - open(SCA,$sitecfg->{datapath}.'/schemata/'.$schematype.'.schema.sql'); - while (my $l = ){ - $l =~ s/%%NEWSCHEMA%%/$schemaname/g; - if ($l eq "\n"){ - if ($ddlstr ne ""){ - push(@schemaddl,$ddlstr); + my $ddlfile = dirname(dirname($ENV{SCRIPT_FILENAME})).'/data/schemata/'.$schematype.'.schema.sql'; + $ret->{ddlfile} = $ddlfile; + if (-e $ddlfile){ + open(SCA,$ddlfile); + while (my $l = ){ + $l =~ s/%%NEWSCHEMA%%/$schemaname/g; + if ($l eq "\n"){ + if ($ddlstr ne ""){ + push(@schemaddl,$ddlstr); + } + $ddlstr = ""; + next; } - $ddlstr = ""; - next; + $ddlstr .= $l; } - $ddlstr .= $l; + close(SCA); } - close(SCA); + $ret->{schemaddl} = @schemaddl; if (scalar(@schemaddl) > 0){ for(my $d;$ddbexec($schemaddl[$d]); } } + return $ret; } 1; diff --git a/backoffice/api/lib/session.pm b/backoffice/api/lib/session.pm index 0814d5fb..0bbd878a 100644 --- a/backoffice/api/lib/session.pm +++ b/backoffice/api/lib/session.pm @@ -56,6 +56,24 @@ sub savepassword(){ return 1; } +sub admin_sendpassword(){ + my $self = shift; + my $email = shift; + my $sql = "select id,userpassword from users where username='".$self->{db}->securetext($email)."';"; + my $ex = $self->{db}->dbquerysorted($sql); + my $ret = -1; + if (keys(%{$ex}) > 0){ + my $newpwd = $self->randomstring(12); + my $pwd = sha256_hex($newpwd); + $self->{db}->dbexec("UPDATE users SET userpassword = '".$pwd."' WHERE id=".$ex->{0}->{id}.";"); + my $data->{newpassword} = $newpwd; + my $eml = sendemail->new(); + $ret = $eml->sendemail('user_newpassword',$ex->{0}->{id},$email,$data,undef); + } + return $ret; +} + + sub passwordforgotten(){ my $self = shift; my $email = shift; @@ -139,6 +157,7 @@ sub registeruser(){ return $ret; } + sub validateaccount(){ my $self = shift; my $data = shift; diff --git a/backoffice/data/schemata/defaultcompany.schema.sql b/backoffice/data/schemata/defaultcompany.schema.sql index 027a8213..b1faeca8 100644 --- a/backoffice/data/schemata/defaultcompany.schema.sql +++ b/backoffice/data/schemata/defaultcompany.schema.sql @@ -59,6 +59,15 @@ CREATE SEQUENCE %%NEWSCHEMA%%.staff_id_seq ALTER SEQUENCE %%NEWSCHEMA%%.staff_id_seq OWNED BY %%NEWSCHEMA%%.staff.id; +CREATE TABLE %%NEWSCHEMA%%.staffcontract ( + id integer NOT NULL, + id_staff integer, + startdate date, + monthhours numeric, + weekhours numeric, + id_staffgroup integer +); + CREATE TABLE %%NEWSCHEMA%%.staffgroups ( id integer NOT NULL, groupname text, @@ -74,14 +83,6 @@ CREATE SEQUENCE %%NEWSCHEMA%%.staffgroups_id_seq ALTER SEQUENCE %%NEWSCHEMA%%.staffgroups_id_seq OWNED BY %%NEWSCHEMA%%.staffgroups.id; -CREATE TABLE %%NEWSCHEMA%%.staffperiodbase ( - id integer NOT NULL, - id_staff integer, - startdate date, - monthhours numeric, - weekhours numeric -); - CREATE SEQUENCE %%NEWSCHEMA%%.staffperiodbase_id_seq START WITH 1 INCREMENT BY 1 @@ -89,7 +90,7 @@ CREATE SEQUENCE %%NEWSCHEMA%%.staffperiodbase_id_seq NO MAXVALUE CACHE 1; -ALTER SEQUENCE %%NEWSCHEMA%%.staffperiodbase_id_seq OWNED BY %%NEWSCHEMA%%.staffperiodbase.id; +ALTER SEQUENCE %%NEWSCHEMA%%.staffperiodbase_id_seq OWNED BY %%NEWSCHEMA%%.staffcontract.id; CREATE TABLE %%NEWSCHEMA%%.stafftimetracks ( id bigint NOT NULL, @@ -176,6 +177,50 @@ CREATE VIEW %%NEWSCHEMA%%.vw_reportperiodlist AS reportperiod.enddate FROM %%NEWSCHEMA%%.reportperiod; +CREATE VIEW %%NEWSCHEMA%%.vw_staffcontractdata AS + SELECT staffcontract.id, + staffcontract.id_staff, + staffcontract.startdate, + staffcontract.monthhours, + staffcontract.weekhours, + staffcontract.id_staffgroup + FROM %%NEWSCHEMA%%.staffcontract; + +CREATE VIEW %%NEWSCHEMA%%.vw_staffcontractlist AS + SELECT sc.id, + sc.id_staff, + sc.startdate, + sc.weekhours, + sc.monthhours, + sc.id_staffgroup, + sg.groupname, + sg.groupcolor + FROM (%%NEWSCHEMA%%.staffcontract sc + LEFT JOIN %%NEWSCHEMA%%.staffgroups sg ON ((sc.id_staffgroup = sg.id))); + +CREATE VIEW %%NEWSCHEMA%%.vw_staffdata AS + SELECT staff.id, + staff.staffnumber, + staff.surname, + staff.prename, + staff.job, + staff.birthdate, + staff.entrydate, + staff.leavedate + FROM %%NEWSCHEMA%%.staff; + +CREATE VIEW %%NEWSCHEMA%%.vw_staffgroupsdata AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM %%NEWSCHEMA%%.staffgroups; + +CREATE VIEW %%NEWSCHEMA%%.vw_staffgroupslist AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM %%NEWSCHEMA%%.staffgroups; + CREATE VIEW %%NEWSCHEMA%%.vw_stafflist AS SELECT staff.id, staff.staffnumber, @@ -475,27 +520,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start1, + END) AS mon_timestart1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end1, + END) AS mon_timeend1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start2, + END) AS mon_timestart2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end2, + END) AS mon_timeend2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_pause, + END) AS mon_timepause, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -520,27 +565,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start1, + END) AS tue_timestart1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end1, + END) AS tue_timeend1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start2, + END) AS tue_timestart2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end2, + END) AS tue_timeend2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_pause, + END) AS tue_timepause, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -565,27 +610,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start1, + END) AS wed_timestart1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end1, + END) AS wed_timeend1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start2, + END) AS wed_timestart2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end2, + END) AS wed_timeend2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_pause, + END) AS wed_timepause, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -610,27 +655,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start1, + END) AS thu_timestart1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end1, + END) AS thu_timeend1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start2, + END) AS thu_timestart2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end2, + END) AS thu_timeend2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_pause, + END) AS thu_timepause, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -655,27 +700,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start1, + END) AS fri_timestart1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end1, + END) AS fri_timeend1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start2, + END) AS fri_timestart2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end2, + END) AS fri_timeend2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_pause, + END) AS fri_timepause, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -700,27 +745,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start1, + END) AS sat_timestart1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end1, + END) AS sat_timeend1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start2, + END) AS sat_timestart2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end2, + END) AS sat_timeend2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_pause, + END) AS sat_timepause, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -745,27 +790,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start1, + END) AS sun_timestart1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end1, + END) AS sun_timeend1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start2, + END) AS sun_timestart2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end2, + END) AS sun_timeend2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_pause, + END) AS sun_timepause, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -809,7 +854,9 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplanlist AS SELECT st.id AS id_staff, ((st.surname || ' '::text) || st.prename) AS staffname, - (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS calweek, + (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS dspcalweek, + (sp_dwt.calweek)::integer AS calweek, + sp_dwt.calyear, sp_dwt.week_timetotal, sp_dwt.weekbegin AS weekstart, date((sp_dwt.weekbegin + '7 days'::interval)) AS weekend, @@ -932,31 +979,31 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplanlist AS ((to_number("left"(sp_dwt.week_timetotal, 2), '99'::text) * (60)::numeric) + to_number("right"(sp_dwt.week_timetotal, 2), '99'::text)) AS weekminutes, sp_dwt.mon_id, sp_dwt.weekbegin AS mon_date, - ((COALESCE(((to_char((sp_dwt.mon_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, + ((COALESCE(((to_char((sp_dwt.mon_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, sp_dwt.mon_timetotal, sp_dwt.tue_id, date((sp_dwt.weekbegin + '1 day'::interval)) AS tue_date, - ((COALESCE(((to_char((sp_dwt.tue_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, + ((COALESCE(((to_char((sp_dwt.tue_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, sp_dwt.tue_timetotal, sp_dwt.wed_id, date((sp_dwt.weekbegin + '2 days'::interval)) AS wed_date, - ((COALESCE(((to_char((sp_dwt.wed_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, + ((COALESCE(((to_char((sp_dwt.wed_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, sp_dwt.wed_timetotal, sp_dwt.thu_id, date((sp_dwt.weekbegin + '3 days'::interval)) AS thu_date, - ((COALESCE(((to_char((sp_dwt.thu_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, + ((COALESCE(((to_char((sp_dwt.thu_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, sp_dwt.thu_timetotal, sp_dwt.fri_id, date((sp_dwt.weekbegin + '4 days'::interval)) AS fri_date, - ((COALESCE(((to_char((sp_dwt.fri_start1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, + ((COALESCE(((to_char((sp_dwt.fri_timestart1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, sp_dwt.fri_timetotal, sp_dwt.sat_id, date((sp_dwt.weekbegin + '5 days'::interval)) AS sat_date, - ((COALESCE(((to_char((sp_dwt.sat_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, + ((COALESCE(((to_char((sp_dwt.sat_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, sp_dwt.sat_timetotal, sp_dwt.sun_id, date((sp_dwt.weekbegin + '6 days'::interval)) AS sun_date, - ((COALESCE(((to_char((sp_dwt.sun_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, + ((COALESCE(((to_char((sp_dwt.sun_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, sp_dwt.sun_timetotal FROM (%%NEWSCHEMA%%.vw_staffworkplan_weekly sp_dwt LEFT JOIN %%NEWSCHEMA%%.staff st ON ((sp_dwt.id_staff = st.id))) @@ -1091,9 +1138,9 @@ ALTER TABLE ONLY %%NEWSCHEMA%%.sites ALTER COLUMN id SET DEFAULT nextval('%%NEWS ALTER TABLE ONLY %%NEWSCHEMA%%.staff ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staff_id_seq'::regclass); -ALTER TABLE ONLY %%NEWSCHEMA%%.staffgroups ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staffgroups_id_seq'::regclass); +ALTER TABLE ONLY %%NEWSCHEMA%%.staffcontract ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staffperiodbase_id_seq'::regclass); -ALTER TABLE ONLY %%NEWSCHEMA%%.staffperiodbase ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staffperiodbase_id_seq'::regclass); +ALTER TABLE ONLY %%NEWSCHEMA%%.staffgroups ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staffgroups_id_seq'::regclass); ALTER TABLE ONLY %%NEWSCHEMA%%.stafftimetracks ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.stafftimetracks_id_seq'::regclass); @@ -1119,7 +1166,7 @@ ALTER TABLE ONLY %%NEWSCHEMA%%.staff ALTER TABLE ONLY %%NEWSCHEMA%%.staffgroups ADD CONSTRAINT staffgroups_pkey PRIMARY KEY (id); -ALTER TABLE ONLY %%NEWSCHEMA%%.staffperiodbase +ALTER TABLE ONLY %%NEWSCHEMA%%.staffcontract ADD CONSTRAINT staffperiodbase_pkey PRIMARY KEY (id); ALTER TABLE ONLY %%NEWSCHEMA%%.stafftimetracks @@ -1140,5 +1187,5 @@ ALTER TABLE ONLY %%NEWSCHEMA%%.workplans ALTER TABLE ONLY %%NEWSCHEMA%%.worktypes ADD CONSTRAINT worktypes_pkey PRIMARY KEY (id); -CREATE TRIGGER trg_upd_%%NEWSCHEMA%%_weekhours BEFORE UPDATE OF weekhours ON %%NEWSCHEMA%%.staffperiodbase FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); +CREATE TRIGGER trg_upd_%%NEWSCHEMA%%_weekhours BEFORE UPDATE OF weekhours ON %%NEWSCHEMA%%.staffcontract FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); diff --git a/backoffice/index.cgi b/backoffice/index.cgi index e26f7748..dc568c69 100755 --- a/backoffice/index.cgi +++ b/backoffice/index.cgi @@ -185,7 +185,7 @@ if ($skl ne "skeleton/login.tt" && $vars->{page} =~ /^module/){ #END - iFrame - Modules $template->process($skl,$vars) || die "Template process failed: ", $template->error(), "\n"; - +# print "/*".Dumper($vars)."*/"; # if ($vars->{page} =~ /\.tt/){ # print '
'.Dumper($p)."
";
 # } 
diff --git a/backoffice/js/admin.js b/backoffice/js/admin.js
index d43a4bc6..f0c20a84 100644
--- a/backoffice/js/admin.js
+++ b/backoffice/js/admin.js
@@ -19,9 +19,13 @@ var admin = {
     getAllSchemata: function(){
       var x = choice["company"]["schemata"];
       
-      console.log(x.getValue(true));//.getValue(true));
+      //console.log(x.getValue(true));//.getValue(true));
       return x.getValue(true);
     },
+    reloadframe: function(){
+      console.log("reloadframe");
+      document.getElementById("moduleframe").contentWindow.location.reload();
+    },
     logout: function() {
         req.reqdata("POST", location.href, { "logout": "1" }, admin.reloadpage);
 
@@ -79,15 +83,16 @@ document.addEventListener("DOMContentLoaded", function() {
     choices : []
   });
   getschemata();
+  choice["company"]["schemata"].passedElement.element.addEventListener('change',function(){admin.reloadframe();});
 });
 
 function getschemata(){
-  req.reqdata("POST","db.cgi",{"get":"companieslist"},fillschematalist);
+  req.reqdata("POST","index.cgi",{"fn":"getschemaaccess"},fillschematalist);
 }
 
 function fillschematalist(data){
   console.log(data);
-  fillselectlist(choice["company"]["schemata"],data.sqldata,'schemata','company');
+  fillselectlist(choice["company"]["schemata"],data,'schemata','company');
   
   return false;
 }
diff --git a/backoffice/js/formsave.js b/backoffice/js/formsave.js
index 1b6f9a7c..10c8952a 100644
--- a/backoffice/js/formsave.js
+++ b/backoffice/js/formsave.js
@@ -3,6 +3,7 @@ function saveform(frmid,aftercallback){
   flds["fn"] ="saveform";
   flds["schemata"]=schemata;
   console.log(flds);
+  delete flds["null"]; 
   if (aftercallback){
     req.reqdata("POST","index.cgi",flds,aftercallback);
     formsaved({});
@@ -229,7 +230,7 @@ function fillformbydataclass(dataclass,data,readonly = false){
 }
 
 function fillformbydataclass2(dataclass,choices,data){
-  //console.log(data);
+  console.log(data);
   var frm = document.querySelectorAll('.data_'+ dataclass);
   if (data){
     for (var f in frm){
@@ -259,7 +260,7 @@ function fillformbydataclass2(dataclass,choices,data){
         if (frm[f].tagName == 'SELECT'){
           if (frm[f].classList.contains("choices__input")){
             if (frm[f].multiple == true){
-              //console.log(data[frm[f].id]);
+              console.log("is multiple: " + data[frm[f].id]);
               choices[frm[f].id].setChoiceByValue(JSON.parse(data[frm[f].id]));
             }else {
               choices[frm[f].id].setChoiceByValue(data[frm[f].id]);
diff --git a/backoffice/js/module_global.js b/backoffice/js/module_global.js
index b0fac45d..ec3d9b28 100644
--- a/backoffice/js/module_global.js
+++ b/backoffice/js/module_global.js
@@ -29,7 +29,9 @@ var module = {
     
   },
   viewdialog: function(dlgname,data){
+    
     if (document.getElementById('dlg_' +dlgname)){
+      console.log(dlgname);
       document.getElementById('dlg_' +dlgname).style.display = 'block';
     }else {
       alert('dlg_' +dlgname + ' not found!');
diff --git a/backoffice/js/request.js b/backoffice/js/request.js
index d8ea62ed..4e80e025 100644
--- a/backoffice/js/request.js
+++ b/backoffice/js/request.js
@@ -52,8 +52,8 @@ var req = {
     if (callback){
       async=true;
     }
-    console.log("DATA to send:");
-    console.log(data);
+    //console.log("DATA to send:");
+    //console.log(data);
     var request = new XMLHttpRequest();
     if (typeof data == 'object'){
       var xdata = [];
@@ -70,12 +70,12 @@ var req = {
     }else {
       rdata = data;
     }
-    //console.log("Data to send: " + decodeURIComponent(rdata));
+    console.log("Data to send: " + decodeURIComponent(rdata));
     var sendurl = api + url;
     if (method.toUpperCase() == 'GET'){
       sendurl = sendurl + '?' + rdata;
     }
-    //console.log("sending URL: " + method + " => " +sendurl + '?' + rdata);
+    console.log("sending URL: " + method + " => " +sendurl + '?' + rdata);
     request.open(method.toUpperCase(), sendurl, true);
     request.onload = function(){
       if (request.status >= 200 && request.status <= 400){
diff --git a/backoffice/tmpl/block/dlgdataload.tt b/backoffice/tmpl/block/dlgdataload.tt
new file mode 100644
index 00000000..4442209a
--- /dev/null
+++ b/backoffice/tmpl/block/dlgdataload.tt
@@ -0,0 +1,37 @@
+
+ +
+
+

+
+
+
Attentez s.v.p.!
+
+ +
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/backoffice/tmpl/block/dlgmessage.tt b/backoffice/tmpl/block/dlgmessage.tt new file mode 100644 index 00000000..49fcfca0 --- /dev/null +++ b/backoffice/tmpl/block/dlgmessage.tt @@ -0,0 +1,25 @@ +
+ +
+
+ × +

+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/backoffice/tmpl/module/companies/widgets/companies/companies.js b/backoffice/tmpl/module/companies/widgets/companies/companies.js index 4c9bbec1..72ac9b64 100644 --- a/backoffice/tmpl/module/companies/widgets/companies/companies.js +++ b/backoffice/tmpl/module/companies/widgets/companies/companies.js @@ -87,7 +87,12 @@ var companies ={ saveform(companies.name); if (document.getElementById("id").value == ""){ console.log("Install new schema now!"); + req.reqdata("POST","index.cgi",{"fn":"installschema","schemaname":document.getElementById("schemata").value},companies.afterschemainstall); } + module.viewpanel('tbl_' + companies.name); + }, + afterschemainstall: function(data){ + parent.getschemata(); }, checkschema(ev,fieldid){ var companyname = document.getElementById(fieldid).value; @@ -103,6 +108,7 @@ var companies ={ }, afterdeletecallback: function(data){ companies.gettbldata(); + module.viewpanel('tbl_' + companies.name); } diff --git a/backoffice/tmpl/module/planning/index.js b/backoffice/tmpl/module/planning/index.js index 1e2655ce..fa045243 100644 --- a/backoffice/tmpl/module/planning/index.js +++ b/backoffice/tmpl/module/planning/index.js @@ -7,18 +7,7 @@ function initpage(){ staffworkplan.inittable(); module.viewpanel("tbl_reportperiod"); //call("reportperiod","inittable"); - flatpickr(".timefield",{ - //altInput: true, - //altFormat: "H:i", - dateFormat: "H:i", - //allowInput: true, - defaultHour:'', - defaultMinute:'', - enableTime: true, - noCalendar: true, - time_24hr: true, - "locale": "fr", - }); + } diff --git a/backoffice/tmpl/module/planning/index.tt b/backoffice/tmpl/module/planning/index.tt index b36f380f..4f28839e 100644 --- a/backoffice/tmpl/module/planning/index.tt +++ b/backoffice/tmpl/module/planning/index.tt @@ -3,7 +3,7 @@
- + [% INCLUDE "module/$module/widgets/reportperiod/tbar_reportperiod.tt" %] [% INCLUDE "module/$module/widgets/staffworkplan/tbar_staffworkplan.tt" %]
@@ -13,6 +13,8 @@ [% INCLUDE "module/$module/widgets/staffworkplan/frm_staffworkplan.tt" %]
[% INCLUDE block/dlgdeleterow.tt %] +[% INCLUDE block/dlgmessage.tt %] +[% INCLUDE block/dlgdataload.tt %] [% INCLUDE "module/$module/widgets/reportperiod/dlg_reportperiod.tt" %] diff --git a/backoffice/tmpl/module/planning/widgets/reportperiod/dlg_reportperiod.tt b/backoffice/tmpl/module/planning/widgets/reportperiod/dlg_reportperiod.tt index deca2e18..998369a4 100644 --- a/backoffice/tmpl/module/planning/widgets/reportperiod/dlg_reportperiod.tt +++ b/backoffice/tmpl/module/planning/widgets/reportperiod/dlg_reportperiod.tt @@ -1,5 +1,5 @@ [% PROCESS macro/fields.tt %] -
+
diff --git a/backoffice/tmpl/module/planning/widgets/reportperiod/reportperiod.js b/backoffice/tmpl/module/planning/widgets/reportperiod/reportperiod.js index c7f45b61..acc267b7 100644 --- a/backoffice/tmpl/module/planning/widgets/reportperiod/reportperiod.js +++ b/backoffice/tmpl/module/planning/widgets/reportperiod/reportperiod.js @@ -63,8 +63,10 @@ var reportperiod ={ if (data && data.sqldata) { reportperiod.tbl.setData(data.sqldata);} }, add: function(){ - cleanform(reportperiod.name); + console.log("TEST Add Period!"); + //cleanform(reportperiod.name); module.viewdialog(reportperiod.name,null); + return false; }, remove: function(){ var udata = reportperiod.tbl.getSelectedData(); diff --git a/backoffice/tmpl/module/planning/widgets/staffworkplan/frm_staffworkplan.tt b/backoffice/tmpl/module/planning/widgets/staffworkplan/frm_staffworkplan.tt index 2ae89c74..4428044e 100644 --- a/backoffice/tmpl/module/planning/widgets/staffworkplan/frm_staffworkplan.tt +++ b/backoffice/tmpl/module/planning/widgets/staffworkplan/frm_staffworkplan.tt @@ -9,12 +9,13 @@

Plan de travail

- +
[% fieldmultiselectbox('id_staff','staffworkplan','Employé(es)','','','') %] [% fielddatebox('dates','staffworkplan','Date(s)','','','') %] [% fielddatebox('daterange','staffworkplan','Période','w3-half','','') %] - [% fieldmultiselectbox('weekdays','display','Jours','','','') %] -
+
+ [% #fieldmultiselectbox('weekdays','display','Jours','','','') %] +
[% fieldselectbox('id_workplan','staffworkplan','Modèle','w3-third','','','') %]
[% FOREACH tt IN wd %] @@ -37,8 +38,8 @@
- [% fieldselectbox("${wday}_id_vacancytype",'staffworkplan','Type Congé','','','','dayvacancy') %] - [% fieldtimebox("${wday}_vacancytime",'staffworkplan','Heures Congé','','','') %] + [% fieldselectbox("${wday}_vacancytype",'staffworkplan','Type Congé','','','','dayvacancy') %] + [% fieldtimebox("${wday}_vacancyhours",'staffworkplan','Heures Congé','','','') %]
diff --git a/backoffice/tmpl/module/planning/widgets/staffworkplan/staffworkplan.js b/backoffice/tmpl/module/planning/widgets/staffworkplan/staffworkplan.js index 5328e2c5..cb3fc5ac 100644 --- a/backoffice/tmpl/module/planning/widgets/staffworkplan/staffworkplan.js +++ b/backoffice/tmpl/module/planning/widgets/staffworkplan/staffworkplan.js @@ -1,26 +1,44 @@ //var tbl_staffworkplan = null; var weekdays= ["mon","tue","wed","thu","fri","sat","sun"]; +var jscalcdays= ["sun","mon","tue","wed","thu","fri","sat"]; var staffworkplan ={ tbl: null, current_workplan: null, datefrom: null, dateto: null, name: "staffworkplan", - choices:{"id_staff":null,"weekdays":null,"id_workplan":null,"dayvacancy":null}, + choices:{"id_staff":null,"id_workplan":null,"dayvacancy":null}, + dateinputs:{"dates":null,"daterange":null}, initform: function(){ - flatpickr("#dates",{altInput: true, + flatpickr(".timefield",{ + //altInput: true, + //altFormat: "H:i", + dateFormat: "H:i", + //allowInput: true, + defaultHour:'', + defaultMinute:'', + enableTime: true, + noCalendar: true, + time_24hr: true, + "locale": "fr", + }); + staffworkplan.dateinputs["dates"] = flatpickr("#dates",{altInput: true, altFormat: "d.m.Y", mode: "multiple", dateFormat: "Y-m-d", allowInput: false, "locale": "fr", + minDate: staffworkplan.datefrom, + maxdate: staffworkplan.dateto }); - flatpickr("#daterange",{altInput: true, + staffworkplan.dateinputs["daterange"] = flatpickr("#daterange",{altInput: true, altFormat: "d.m.Y", mode: "range", dateFormat: "Y-m-d", allowInput: false, "locale": "fr", + minDate: staffworkplan.datefrom, + maxdate: staffworkplan.dateto }); staffworkplan.choices["id_staff"] = new Choices('#id_staff',{ searchEnabled: false, @@ -42,14 +60,14 @@ var staffworkplan ={ shouldSortItems: false, choices : [{"value":"","label":""},{"value":"normal","label":"normal"},{"value":"extra","label":"extraordinaire"},{"value":"ill","label":"maladie"}] }); - staffworkplan.choices["weekdays"] = new Choices('#weekdays',{ - searchEnabled: false, - itemSelectText: '', - removeItemButton: true, - shouldSort: false, - shouldSortItems: false, - choices : [{"value":"1","label":"Lundi"},{"value":"2","label":"Mardi"},{"value":"3","label":"Mecredi"},{"value":"4","label":"Jeudi"},{"value":"5","label":"Vendredi"},{"value":"6","label":"Samedi"},{"value":"7","label":"Dimanche"}] - }); + // staffworkplan.choices["weekdays"] = new Choices('#weekdays',{ + // searchEnabled: false, + // itemSelectText: '', + // removeItemButton: true, + // shouldSort: false, + // shouldSortItems: false, + // choices : [{"value":"1","label":"Lundi"},{"value":"2","label":"Mardi"},{"value":"3","label":"Mecredi"},{"value":"4","label":"Jeudi"},{"value":"5","label":"Vendredi"},{"value":"6","label":"Samedi"},{"value":"7","label":"Dimanche"}] + // }); staffworkplan.getstaff(); staffworkplan.getwptemplates(); staffworkplan.choices["id_workplan"].passedElement.element.addEventListener('change', function(event){staffworkplan.getworkplan(event,this.id)},false); @@ -60,7 +78,7 @@ var staffworkplan ={ var vfields = document.getElementsByClassName("dayvacancy"); for (var i=0;iSemaine", field:"week_timetotal", bottomCalc:staffworkplan.periodtimesum}, { title: "Lundi", columns: [ @@ -132,10 +150,22 @@ var staffworkplan ={ staffworkplan.gettbldata(); }, gettbldata: function(){ - req.reqdata("POST", "db.cgi", { "get": staffworkplan.name + "list","schemata":schemata,"filter": "weekstart>=date('"+staffworkplan.datefrom+"') and weekend<=date('"+staffworkplan.dateto+"')" }, staffworkplan.loadtbldata); + if (staffworkplan.dateinputs["dates"]){ + staffworkplan.dateinputs["dates"].set('minDate',staffworkplan.datefrom); + staffworkplan.dateinputs["dates"].set('maxDate',staffworkplan.dateto); + } + if (staffworkplan.dateinputs["daterange"]){ + staffworkplan.dateinputs["daterange"].set('minDate',staffworkplan.datefrom); + staffworkplan.dateinputs["daterange"].set('maxDate',staffworkplan.dateto); + } + if (staffworkplan.datefrom && staffworkplan.dateto){ + req.reqdata("POST", "db.cgi", { "get": staffworkplan.name + "list","schemata":schemata,"filter": "weekstart>=date('"+staffworkplan.datefrom+"') and weekend<=date('"+staffworkplan.dateto+"')" }, staffworkplan.loadtbldata); + } + return false; }, loadtbldata: function(data){ if (data && data.sqldata) { staffworkplan.tbl.setData(data.sqldata);} + return false; }, add: function(){ cleanform2(staffworkplan.name,staffworkplan.choices); @@ -144,14 +174,17 @@ var staffworkplan ={ edit: function(){ var udata = staffworkplan.tbl.getSelectedData(); if (udata[0]) { + console.log(udata[0]); var wpdata = ""; cleanform2(staffworkplan.name,staffworkplan.choices); - req.reqdata("POST", "db.cgi", { "get": staffworkplan.name + "_weekly","schemata":schemata, "filter":"id_staff=" + udata[0].id_staff + " and calweek='" + udata[0].calweek + "' AND calyear='"+ udata[0].calyear +"'"}, staffworkplan.fillform); + req.reqdata("POST", "db.cgi", { "get": staffworkplan.name + "_weekly","schemata":schemata, "filter":"id_staff=" + udata[0].id_staff + " and calweek='" + udata[0].calweek + "' AND calyear='"+ udata[0].calyear +"' "}, staffworkplan.fillform); module.viewpanel('frm_' +staffworkplan.name); } }, fillform: function(data){ if (data && data.sqldata){ + data.sqldata[0]["dates"] = data.sqldata[0]["dates"].split(","); + data.sqldata[0]["id_staff"] = '["' + data.sqldata[0]["id_staff"].split('","') + '"]'; fillformbydataclass2(staffworkplan.name,staffworkplan.choices,data.sqldata[0]); } }, @@ -163,8 +196,89 @@ var staffworkplan ={ } }, saveform: function(){ + var datamsg = ""; var wpdata = getformcontent(staffworkplan.name); - console.log(wpdata); + if (!wpdata["staffworkplan_id_staff"]){ + datamsg += "pas d'employé(es) défini(es)!
"; + } + if (wpdata["staffworkplan_dates"] == "" && wpdata["staffworkplan_daterange"] == ""){ + datamsg += "pas de date(s) définie(s)!
"; + } + var ttlcnt = 0; + for (var f in wpdata){ + if (f.endsWith("timetotal")){ + if (wpdata[f] != ""){ + ttlcnt++; + } + } + } + if (ttlcnt == 0){ + datamsg += "pas de heures définie(s)!
" + } + if (datamsg != ""){ + showmessagedlg("Configuration incomplète!",'
'+ datamsg+'
'); + return false; + } + var allrows=[]; + showdataloaddlg('','
Attendez s.v.p.!
'); + for (var s=0;s" + id + " changed"); + //console.log("timefield: " + wday +"=>" + id + " changed"); var mt1 = 0; var mt2 = 0; var mtp = 0; @@ -220,17 +334,35 @@ var staffworkplan ={ mtp = timecalc.TimeToMinutes(document.getElementById(wday + "_timepause").value); } document.getElementById(wday + "_timetotal").value= timecalc.MinutesToTime(mt1+mt2-mtp); + var totaltester = /\d+:\d\d/; + var valcheck= document.getElementById(wday + "_timetotal").value; + if (valcheck && valcheck != ''){ + if ((valcheck == '00:00') || (!totaltester.test(valcheck))) { + document.getElementById(wday + "_timetotal").value =""; + } + } + }, periodtimesum: function(values, data, calcParams){ - console.log(values); - console.log(data); + // console.log(values); + //console.log(data); calc = 0; for (var i=0;i
\ No newline at end of file diff --git a/backoffice/tmpl/module/staff/index.js b/backoffice/tmpl/module/staff/index.js index d1c1fd99..b563275c 100644 --- a/backoffice/tmpl/module/staff/index.js +++ b/backoffice/tmpl/module/staff/index.js @@ -5,5 +5,6 @@ function initpage(){ console.log("Current Schema:" + schemata); staff.inittable(); + staffcontract.inittable(); module.viewpanel("tbl_staff"); } diff --git a/backoffice/tmpl/module/staff/index.tt b/backoffice/tmpl/module/staff/index.tt index 534c9073..d0c73836 100644 --- a/backoffice/tmpl/module/staff/index.tt +++ b/backoffice/tmpl/module/staff/index.tt @@ -8,6 +8,8 @@ [% INCLUDE "module/$module/widgets/staff/tbl_staff.tt" %] [% INCLUDE "module/$module/widgets/staff/frm_staff.tt" %]
+[% INCLUDE "module/$module/widgets/staffcontract/dlg_staffcontract.tt" %] [% INCLUDE block/dlgdeleterow.tt %] - \ No newline at end of file + + \ No newline at end of file diff --git a/backoffice/tmpl/module/staff/widgets/staff/frm_staff.tt b/backoffice/tmpl/module/staff/widgets/staff/frm_staff.tt index 0134e783..6e05f752 100644 --- a/backoffice/tmpl/module/staff/widgets/staff/frm_staff.tt +++ b/backoffice/tmpl/module/staff/widgets/staff/frm_staff.tt @@ -30,16 +30,5 @@
-
-

Données contractuelles

-
- - - - -
-
- -
-
+ [% INCLUDE "module/$module/widgets/staffcontract/tbl_staffcontract.tt" %] \ No newline at end of file diff --git a/backoffice/tmpl/module/staff/widgets/staff/staff.js b/backoffice/tmpl/module/staff/widgets/staff/staff.js index e4484d5f..2ac89d2f 100644 --- a/backoffice/tmpl/module/staff/widgets/staff/staff.js +++ b/backoffice/tmpl/module/staff/widgets/staff/staff.js @@ -4,15 +4,30 @@ var staff ={ tbl: null, tblperiodbase: null, current_user: null, + current_id: null, name: "staff", choices:{}, initform: function(){ - flatpickr(".datefield",{altInput: true, + flatpickr("#birthdate",{altInput: true, altFormat: "d.m.Y", dateFormat: "Y-m-d", allowInput: true, "locale": "fr", }); + flatpickr("#entrydate",{altInput: true, + altFormat: "d.m.Y", + dateFormat: "Y-m-d", + allowInput: true, + "locale": "fr", + weekNumbers: true, + }); + flatpickr("#leavedate",{altInput: true, + altFormat: "d.m.Y", + dateFormat: "Y-m-d", + allowInput: true, + "locale": "fr", + weekNumbers: true, + }); }, inittable: function(){ staff.initform(); @@ -58,45 +73,9 @@ var staff ={ headerFilter: "input" }] }); - staff.tblperiodbase = new Tabulator("#tbl_staffperiodbase", { - headerFilterPlaceholder: "filter...", - //height: "94vh", - layout: "fitDataFill", - selectable: 1, - rowContext:function(e, row){ - //e - the click event object - //row - row component - //var contextMenu = CtxMenu(); - //contextMenu.addItem("Editer", edit()); - // Add our custom function to the menu - //contextMenu.addItem("Hello World", ContextMenuExampleFunction); - - // Add a seperator - //contextMenu.addSeperator(); - e.preventDefault(); // prevent the browsers default context menu form appearing. - }, - columns: [ - { - title: "début", - field: "startdate", - align: "right", - formatter:"datetime",formatterParams:{inputFormat:"yyyy-mm-dd",outputFormat:"DD.MM.YYYY",invalidPlaceholder:""} - },{ - title: "h/semaine", - field: "weekhours", - align: "right", - sorter:"number", - formatter:"money",formatterParams:{decimal:",",thousand:".",symbol:" ",symbolAfter:"",precision:2}, - },{ - title: "h/mois", - field: "monthhours", - align: "right", - sorter:"number", - formatter:"money",formatterParams:{decimal:",",thousand:".",symbol:" ",symbolAfter:"",precision:2}, - }] -}); + staff.gettbldata(); - staff.gettblperiodbasedata(); + }, gettbldata: function(){ req.reqdata("POST", "db.cgi", { "get": staff.name + "list","schemata":schemata}, staff.loadtbldata); @@ -104,12 +83,7 @@ var staff ={ loadtbldata: function(data){ if (data && data.sqldata) { staff.tbl.setData(data.sqldata);} }, - gettblperiodbasedata: function(){ - req.reqdata("POST", "db.cgi", { "get": "staffperiodbaselist","schemata":schemata}, staff.loadtblperiodbasedata); - }, - loadtblperiodbasedata: function(data){ - if (data && data.sqldata) { staff.tblperiodbase.setData(data.sqldata);} - }, + add: function(){ cleanform2("staff",staff.choices); module.viewpanel(staff.name); @@ -122,8 +96,10 @@ var staff ={ //document.getElementById("company").removeEventListener('blur',function(){},true); var udata = staff.tbl.getSelectedData(); if (udata[0]) { + staff.current_id = udata[0].id; cleanform2(staff.name,staff.choices); req.reqdata("POST", "db.cgi", { "get": staff.name + "data","schemata":schemata, "filter":"id='" + udata[0].id + "'"}, staff.fillform); + staffcontract.gettbldata(); module.viewpanel("frm_" + staff.name); } }, diff --git a/backoffice/tmpl/module/staff/widgets/staffcontract/dlg_staffcontract.tt b/backoffice/tmpl/module/staff/widgets/staffcontract/dlg_staffcontract.tt new file mode 100644 index 00000000..37384c31 --- /dev/null +++ b/backoffice/tmpl/module/staff/widgets/staffcontract/dlg_staffcontract.tt @@ -0,0 +1,24 @@ +[% PROCESS macro/fields.tt %] +
+ +
+
+ × +

Données contractuelles

+
+
+
+ [% fieldhidden("id","staffcontract",'','') %] + [% fieldhidden("id_staff","staffcontract",'','') %] + [% fielddatebox("startdate","staffcontract","date début",'w3-third','','') %] + [% fieldeditbox("weekhours","staffcontract","heures par semaine","w3-third","","","") %] + [% fieldselectbox('id_staffgroup','staffcontract','Département','w3-third','','','') %] +
+
+
+ + +
+
+
\ No newline at end of file diff --git a/backoffice/tmpl/module/staff/widgets/staffcontract/staffcontract.js b/backoffice/tmpl/module/staff/widgets/staffcontract/staffcontract.js new file mode 100644 index 00000000..2b60e792 --- /dev/null +++ b/backoffice/tmpl/module/staff/widgets/staffcontract/staffcontract.js @@ -0,0 +1,122 @@ +var staffcontract = { + name: "staffcontract", + tbl: null, + choices:{"id_staffgroup":null}, + initform: function(){ + staffcontract.choices["id_staffgroup"] = new Choices('#id_staffgroup',{ + searchEnabled: false, + itemSelectText: '', + removeItemButton: true, + choices : [] + }); + flatpickr("#startdate",{altInput: true, + altFormat: "d.m.Y", + dateFormat: "Y-m-d", + allowInput: true, + "locale": "fr", + weekNumbers: true, + "disable": [ + function(date) { + // return true to disable + return (date.getDay() !== 1); + } + ], + }); + }, + inittable: function(){ + staffcontract.initform(); + + staffcontract.tbl = new Tabulator("#tbl_staffcontract", { + headerFilterPlaceholder: "filter...", + //height: "94vh", + layout: "fitDataFill", + selectable: 1, + rowContext:function(e, row){ + //e - the click event object + //row - row component + //var contextMenu = CtxMenu(); + //contextMenu.addItem("Editer", edit()); + // Add our custom function to the menu + //contextMenu.addItem("Hello World", ContextMenuExampleFunction); + + // Add a seperator + //contextMenu.addSeperator(); + e.preventDefault(); // prevent the browsers default context menu form appearing. + }, + columns: [ + { + title: "début", + field: "startdate", + //align: "right", + formatter:"datetime",formatterParams:{inputFormat:"YYYY-MM-DD",outputFormat:"DD.MM.YYYY",invalidPlaceholder:""} + },{ + title: "Département", + field: "groupname" + },{ + title: "h/semaine", + field: "weekhours", + align: "right", + sorter:"number", + formatter:"money",formatterParams:{decimal:",",thousand:".",symbol:" ",symbolAfter:"",precision:2}, + },{ + title: "h/mois", + field: "monthhours", + align: "right", + sorter:"number", + formatter:"money",formatterParams:{decimal:",",thousand:".",symbol:" ",symbolAfter:"",precision:2}, + }] +}); + staffcontract.getstaffgroups(); + }, + gettbldata: function(){ + req.reqdata("POST", "db.cgi", { "get": "staffcontractlist","schemata":schemata,"filter":"id_staff='"+ staff.current_id +"'"}, staffcontract.loadtbldata); + }, + loadtbldata: function(data){ + if (data && data.sqldata) { staffcontract.tbl.setData(data.sqldata);} + }, + add: function(){ + cleanform2("staffcontract",staffcontract.choices); + module.viewdialog(staffcontract.name); + //module.viewdialog(users.name,null); + //document.getElementById("company").addEventListener('blur', function(event){users.checkschema(event,this.id);},true); + //module.viewpanel('frm_' + users.name); + }, + edit: function(){ + //console.log("force remove event"); + //document.getElementById("company").removeEventListener('blur',function(){},true); + var udata = staffcontract.tbl.getSelectedData(); + if (udata[0]) { + cleanform2(staffcontract.name,staffcontract.choices); + req.reqdata("POST", "db.cgi", { "get": staffcontract.name + "data","schemata":schemata, "filter":"id='" + udata[0].id + "'"}, staffcontract.fillform); + module.viewdialog(staffcontract.name); + } + }, + fillform: function(data){ + //console.log("Fill Form 1"); + if (data && data.sqldata){ + //console.log("Fill Form 2"); + fillformbydataclass2(staffcontract.name,{},data.sqldata[0]); + } + }, + remove: function(){ + var udata = staffcontract.tbl.getSelectedData(); + if (udata[0]) { + var uid = udata[0].id; + showdeletedlg(staffcontract.name,uid,"Êtes vous sûre de supprimer les données sélectionnées?",staffcontract.afterdeletecallback); + //module.viewpanel('tbl_' + users.name); + } + }, + afterstaffcontractsaved: function(){ + staffcontract.gettbldata(); + document.getElementById('dlg_staffcontract').style.display='none'; + }, + afterdeletecallback: function(){ + staffcontract.gettbldata(); + }, + getstaffgroups: function(){ + req.reqdata("POST","db.cgi",{"get":"staffgroupslist","schemata":schemata},staffcontract.fillstaffgroups); + }, + fillstaffgroups: function(data){ + fillselectlist(staffcontract.choices["id_staffgroup"],data.sqldata,'id','groupname'); + }, +} \ No newline at end of file diff --git a/backoffice/tmpl/module/staff/widgets/staffcontract/tbar_staffcontract.tt b/backoffice/tmpl/module/staff/widgets/staffcontract/tbar_staffcontract.tt new file mode 100644 index 00000000..e982a6e0 --- /dev/null +++ b/backoffice/tmpl/module/staff/widgets/staffcontract/tbar_staffcontract.tt @@ -0,0 +1,8 @@ +
+
+ + + + +
+
\ No newline at end of file diff --git a/backoffice/tmpl/module/staff/widgets/staffcontract/tbl_staffcontract.tt b/backoffice/tmpl/module/staff/widgets/staffcontract/tbl_staffcontract.tt new file mode 100644 index 00000000..72443410 --- /dev/null +++ b/backoffice/tmpl/module/staff/widgets/staffcontract/tbl_staffcontract.tt @@ -0,0 +1,7 @@ +
+

Données contractuelles

+ [% INCLUDE "module/$module/widgets/staffcontract/tbar_staffcontract.tt" %] +
+ +
+
\ No newline at end of file diff --git a/backoffice/tmpl/module/users/index.tt b/backoffice/tmpl/module/users/index.tt index 2ea0ed29..a4be5dc5 100644 --- a/backoffice/tmpl/module/users/index.tt +++ b/backoffice/tmpl/module/users/index.tt @@ -9,6 +9,7 @@ [% INCLUDE "module/$module/widgets/users/tbl_users.tt" %] [% INCLUDE block/dlgdeleterow.tt %] +[% INCLUDE block/dlgmessage.tt %] [% INCLUDE "module/$module/widgets/users/dlg_users.tt" %] diff --git a/backoffice/tmpl/module/users/widgets/users/dlg_users.tt b/backoffice/tmpl/module/users/widgets/users/dlg_users.tt index 597fe653..3d69ea84 100644 --- a/backoffice/tmpl/module/users/widgets/users/dlg_users.tt +++ b/backoffice/tmpl/module/users/widgets/users/dlg_users.tt @@ -22,7 +22,7 @@
- +
diff --git a/backoffice/tmpl/module/users/widgets/users/users.js b/backoffice/tmpl/module/users/widgets/users/users.js index 98a6e339..c2010de5 100644 --- a/backoffice/tmpl/module/users/widgets/users/users.js +++ b/backoffice/tmpl/module/users/widgets/users/users.js @@ -2,7 +2,7 @@ //var weekdays= ["mon","tue","wed","thu","fri","sat","sun"]; var users ={ tbl: null, - current_user: null, + current_user: "[% session.id %]", name: "users", choices:{"id_company":null,"id_usergroups":null,"schemaaccess":null}, initform: function(){ @@ -44,7 +44,7 @@ var users ={ {title:"Entreprise", field:"company",headerFilter:"input"}, {title:"Nom", field:"surname",headerFilter:"input"}, {title:"Prénom", field:"prename",headerFilter:"input"}, - {title:"Accès",field:"group_ids",headerFilter:"input"}, + {title:"Accès",field:"usergroups",headerFilter:"input"}, {title:"Position",field:"job"}, {title:"Téléphone",field:"phone"}, {title:"E-mail",field:"username"}, @@ -95,8 +95,18 @@ var users ={ users.checkemail(); }, sendnewpassword: function(){ - //users.saveform(); + var fndata = {"fn":"sendnewpassword","email":document.getElementById("username").value}; + req.reqdata("POST","index.cgi",fndata,users.aftersendnewpassword); + }, + aftersendnewpassword: function(data){ + document.getElementById('dlg_users').style.display='none'; + if (data && data.status == 0){ + showmessagedlg("Nouveau mot de passe!","Nouveau mot de passe envoyé!"); + }else { + showmessagedlg("Erreur!","Une erreur c'est produite pour l'envoie d'un nouveau mot de passe!"); + } + }, afterdeletecallback: function(data){ users.gettbldata(); @@ -125,10 +135,13 @@ var users ={ fillselectlist(users.choices["schemaaccess"],data.sqldata,'schemaname','schemaname'); }, checkemail: function(){ - var newusername = document.getElementsByName("users_username").value; + var usernamex = document.getElementsByName("users_username"); + console.log(usernamex); + var newusername = usernamex[0].value; console.log("username: " + newusername); if (users.validateEmail(newusername)){ - req.reqdata("POST","db.cgi",{"get":"userdata","filter":"username='"+ newusername+ "' and id != " + document.getElementById("id").value},users.checkmailreturn); + + req.reqdata("POST","db.cgi",{"get":"usersdata","filter":"username='"+ newusername+ "' and id != " + users.current_user},users.checkmailreturn); }else { document.getElementById("usermsg").innerHTML= '
inserez un email valide s.v.p.!
'; } diff --git a/backoffice/tmpl/skeleton/index.tt b/backoffice/tmpl/skeleton/index.tt index 1523e58a..bcee1260 100644 --- a/backoffice/tmpl/skeleton/index.tt +++ b/backoffice/tmpl/skeleton/index.tt @@ -57,7 +57,7 @@ order by ap.sort;") %]  [% ap.name %] [% END %] - Logout +  Logout
diff --git a/dev/db/l/man/man3/Business::Tax::VAT::Validation.3 b/dev/db/l/man/man3/Business::Tax::VAT::Validation.3 new file mode 100644 index 00000000..0fca637e --- /dev/null +++ b/dev/db/l/man/man3/Business::Tax::VAT::Validation.3 @@ -0,0 +1,261 @@ +.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.if !\nF .nr F 0 +.if \nF>0 \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +.\} +.\" ======================================================================== +.\" +.IX Title "Business::Tax::VAT::Validation 3" +.TH Business::Tax::VAT::Validation 3 "2017-03-13" "perl v5.24.1" "User Contributed Perl Documentation" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +Business::Tax::VAT::Validation \- Validate EU VAT numbers against VIES +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 1 +\& use Business::Tax::VAT::Validation; +\& +\& my $hvatn=Business::Tax::VAT::Validation\->new(); +\& +\& # Check number +\& if ($hvatn\->check($VAT, [$member_state])){ +\& print "OK\en"; +\& } else { +\& print $hvatn\->get_last_error; +\& } +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This class provides an easy \s-1API\s0 to check European \s-1VAT\s0 numbers' syntax, +and if they has been registered by the competent authorities. +.PP +It asks the \s-1EU\s0 database (\s-1VIES\s0) for this, using its \s-1SOAP API. \s0 Basic checks that +the supplied \s-1VAT\s0 number fit the expected format for the specified \s-1EU\s0 member +state are performed first, to avoid unnecessarily sending queries to \s-1VIES\s0 for +input that could never be valid. +.SH "CONSTRUCTOR" +.IX Header "CONSTRUCTOR" +.IP "\fBnew\fR Class constructor." 4 +.IX Item "new Class constructor." +.Vb 1 +\& $hvatn=Business::Tax::VAT::Validation\->new(); +\& +\& +\& If your system is located behind a proxy : +\& +\& $hvatn=Business::Tax::VAT::Validation\->new(\-proxy => [\*(Aqhttp\*(Aq, \*(Aqhttp://example.com:8001/\*(Aq]); +\& +\& Note : See LWP::UserAgent for proxy options. +.Ve +.SH "PROPERTIES" +.IX Header "PROPERTIES" +.IP "\fBmember_states\fR Returns all member states 2\-digit codes as array" 4 +.IX Item "member_states Returns all member states 2-digit codes as array" +.Vb 1 +\& @ms=$hvatn\->member_states; +.Ve +.IP "\fBregular_expressions\fR \- Returns a hash list containing one regular expression for each country" 4 +.IX Item "regular_expressions - Returns a hash list containing one regular expression for each country" +If you want to test a \s-1VAT\s0 number format ouside this module, e.g. embedded as javascript in a web form. +.Sp +.Vb 1 +\& %re=$hvatn\->regular_expressions; +.Ve +.Sp +returns +.Sp +.Vb 5 +\& ( +\& AT => \*(AqU[0\-9]{8}\*(Aq, +\& ... +\& SK => \*(Aq[0\-9]{10}\*(Aq, +\& ); +.Ve +.SH "METHODS" +.IX Header "METHODS" +.IP "\fBcheck\fR \- Checks if a \s-1VAT\s0 number exists in the \s-1VIES\s0 database" 4 +.IX Item "check - Checks if a VAT number exists in the VIES database" +.Vb 1 +\& $ok=$hvatn\->check($vatNumber, [$countryCode]); +.Ve +.Sp +You may either provide the \s-1VAT\s0 number under its complete form (e.g. \s-1BE\-123456789, BE123456789\s0) +or specify the \s-1VAT\s0 and \s-1MSC \s0(vatNumber and countryCode) individually. +.Sp +Valid \s-1MS\s0 values are : +.Sp +.Vb 3 +\& AT, BE, BG, CY, CZ, DE, DK, EE, EL, ES, +\& FI, FR, GB, HU, IE, IT, LU, LT, LV, MT, +\& NL, PL, PT, RO, SE, SI, SK +.Ve +.IP "\fBlocal_check\fR \- Checks if a \s-1VAT\s0 number format is valid This method is based on regexps only and \s-1DOES NOT\s0 ask the \s-1VIES\s0 database" 4 +.IX Item "local_check - Checks if a VAT number format is valid This method is based on regexps only and DOES NOT ask the VIES database" +.Vb 1 +\& $ok=$hvatn\->local_check($VAT, [$member_state]); +.Ve +.IP "\fBinformations\fR \- Returns informations related to the last validated \s-1VAT\s0 number" 4 +.IX Item "informations - Returns informations related to the last validated VAT number" +.Vb 1 +\& %infos=$hvatn\->informations(); +.Ve +.IP "\fBget_last_error_code\fR \- Returns the last recorded error code" 4 +.IX Item "get_last_error_code - Returns the last recorded error code" +.PD 0 +.IP "\fBget_last_error\fR \- Returns the last recorded error" 4 +.IX Item "get_last_error - Returns the last recorded error" +.PD +.Vb 2 +\& my $err = $hvatn\->get_last_error_code(); +\& my $txt = $hvatn\->get_last_error(); +.Ve +.Sp +Possible errors are : +.RS 4 +.IP "\(bu" 4 +\&\-1 The provided \s-1VAT\s0 number is valid. +.IP "\(bu" 4 +0 Unknown \s-1MS\s0 code : Internal checkup failed (Specified Member State does not exist) +.IP "\(bu" 4 +1 Invalid \s-1VAT\s0 number format : Internal checkup failed (bad syntax) +.IP "\(bu" 4 +2 This \s-1VAT\s0 number doesn't exist in \s-1EU\s0 database : distant checkup +.IP "\(bu" 4 +3 This \s-1VAT\s0 number contains errors : distant checkup +.IP "\(bu" 4 +17 Time out connecting to the database : Temporary error when the connection to the database times out +.IP "\(bu" 4 +18 Member Sevice Unavailable: The \s-1EU\s0 database is unable to reach the requested member's database. +.IP "\(bu" 4 +19 The \s-1EU\s0 database is too busy. +.IP "\(bu" 4 +20 Connexion to the \s-1VIES\s0 database failed. +.IP "\(bu" 4 +21 The \s-1VIES\s0 interface failed to parse a stream. This error occurs unpredictabely, so you should retry your validation request. +.IP "\(bu" 4 +257 Invalid response, please contact the author of this module. : This normally only happens if this software doesn't recognize any valid pattern into the response document: this generally means that the database interface has been modified, and you'll make the author happy by submitting the returned response !!! +.IP "\(bu" 4 +500 The \s-1VIES\s0 server encountered an internal server error. +Error 500 : soap:Server \s-1TIMEOUT\s0 +Error 500 : soap:Server \s-1MS_UNAVAILABLE\s0 +.RE +.RS 4 +.Sp +If error_code > 16, you should temporarily accept the provided number, and periodically perform new checks until response is \s-1OK\s0 or error < 17 +If error_code > 256, you should temporarily accept the provided number, contact the author, and perform a new check when the software is updated. +.RE +.IP "\fBget_last_response\fR \- Returns the full last response" 4 +.IX Item "get_last_response - Returns the full last response" +.SH "SEE ALSO" +.IX Header "SEE ALSO" +LWP::UserAgent +.PP +\&\fIhttp://ec.europa.eu/taxation_customs/vies/faqvies.do\fR for the FAQs related to the \s-1VIES\s0 service. +.SH "FEEDBACK" +.IX Header "FEEDBACK" +If you find this module useful, or have any comments, suggestions or improvements, feel free to let me know. +.SH "AUTHOR" +.IX Header "AUTHOR" +Original author: Bernard Nauwelaerts +.PP +Maintainership since 2015: David Precious (\s-1BIGPRESH\s0) +.SH "CREDITS" +.IX Header "CREDITS" +Many thanks to the following people, actively involved in the development of this software by submitting patches, bug reports, new members regexps, \s-1VIES\s0 interface changes,... (sorted by last intervention) : +.IP "\(bu" 4 +Gregor Herrmann, Debian. +.IP "\(bu" 4 +Graham Knop. +.IP "\(bu" 4 +Bart Heupers, Netherlands. +.IP "\(bu" 4 +Martin H. Sluka, noris network \s-1AG,\s0 Germany. +.IP "\(bu" 4 +Simon Williams, \s-1UK2\s0 Limited, United Kingdom & Benoît Galy, Greenacres, France & Raluca Boboia, Evozon, Romania +.IP "\(bu" 4 +Dave O., POBox, U.S.A. +.IP "\(bu" 4 +Kaloyan Iliev, Digital Systems, Bulgaria. +.IP "\(bu" 4 +Tom Kirkpatrick, Virus Bulletin, United Kingdom. +.IP "\(bu" 4 +Andy Wardley, individual, United Kingdom. +.IP "\(bu" 4 +Robert Alloway, Service Centre, United Kingdom. +.IP "\(bu" 4 +Torsten Mueller, Archesoft, Germany +.SH "LICENSE" +.IX Header "LICENSE" +\&\s-1GPL.\s0 Enjoy! See \s-1COPYING\s0 for further information on the \s-1GPL.\s0 +.SH "DISCLAIMER" +.IX Header "DISCLAIMER" +See \fIhttp://ec.europa.eu/taxation_customs/vies/viesdisc.do\fR to known the limitations of the \s-1EU\s0 validation service. +.PP +.Vb 2 +\& This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +\& without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.Ve diff --git a/dev/db/potlu_db.newcompanyschema.pg.schema.sql b/dev/db/potlu_db.newcompanyschema.pg.schema.sql index 027a8213..b1faeca8 100644 --- a/dev/db/potlu_db.newcompanyschema.pg.schema.sql +++ b/dev/db/potlu_db.newcompanyschema.pg.schema.sql @@ -59,6 +59,15 @@ CREATE SEQUENCE %%NEWSCHEMA%%.staff_id_seq ALTER SEQUENCE %%NEWSCHEMA%%.staff_id_seq OWNED BY %%NEWSCHEMA%%.staff.id; +CREATE TABLE %%NEWSCHEMA%%.staffcontract ( + id integer NOT NULL, + id_staff integer, + startdate date, + monthhours numeric, + weekhours numeric, + id_staffgroup integer +); + CREATE TABLE %%NEWSCHEMA%%.staffgroups ( id integer NOT NULL, groupname text, @@ -74,14 +83,6 @@ CREATE SEQUENCE %%NEWSCHEMA%%.staffgroups_id_seq ALTER SEQUENCE %%NEWSCHEMA%%.staffgroups_id_seq OWNED BY %%NEWSCHEMA%%.staffgroups.id; -CREATE TABLE %%NEWSCHEMA%%.staffperiodbase ( - id integer NOT NULL, - id_staff integer, - startdate date, - monthhours numeric, - weekhours numeric -); - CREATE SEQUENCE %%NEWSCHEMA%%.staffperiodbase_id_seq START WITH 1 INCREMENT BY 1 @@ -89,7 +90,7 @@ CREATE SEQUENCE %%NEWSCHEMA%%.staffperiodbase_id_seq NO MAXVALUE CACHE 1; -ALTER SEQUENCE %%NEWSCHEMA%%.staffperiodbase_id_seq OWNED BY %%NEWSCHEMA%%.staffperiodbase.id; +ALTER SEQUENCE %%NEWSCHEMA%%.staffperiodbase_id_seq OWNED BY %%NEWSCHEMA%%.staffcontract.id; CREATE TABLE %%NEWSCHEMA%%.stafftimetracks ( id bigint NOT NULL, @@ -176,6 +177,50 @@ CREATE VIEW %%NEWSCHEMA%%.vw_reportperiodlist AS reportperiod.enddate FROM %%NEWSCHEMA%%.reportperiod; +CREATE VIEW %%NEWSCHEMA%%.vw_staffcontractdata AS + SELECT staffcontract.id, + staffcontract.id_staff, + staffcontract.startdate, + staffcontract.monthhours, + staffcontract.weekhours, + staffcontract.id_staffgroup + FROM %%NEWSCHEMA%%.staffcontract; + +CREATE VIEW %%NEWSCHEMA%%.vw_staffcontractlist AS + SELECT sc.id, + sc.id_staff, + sc.startdate, + sc.weekhours, + sc.monthhours, + sc.id_staffgroup, + sg.groupname, + sg.groupcolor + FROM (%%NEWSCHEMA%%.staffcontract sc + LEFT JOIN %%NEWSCHEMA%%.staffgroups sg ON ((sc.id_staffgroup = sg.id))); + +CREATE VIEW %%NEWSCHEMA%%.vw_staffdata AS + SELECT staff.id, + staff.staffnumber, + staff.surname, + staff.prename, + staff.job, + staff.birthdate, + staff.entrydate, + staff.leavedate + FROM %%NEWSCHEMA%%.staff; + +CREATE VIEW %%NEWSCHEMA%%.vw_staffgroupsdata AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM %%NEWSCHEMA%%.staffgroups; + +CREATE VIEW %%NEWSCHEMA%%.vw_staffgroupslist AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM %%NEWSCHEMA%%.staffgroups; + CREATE VIEW %%NEWSCHEMA%%.vw_stafflist AS SELECT staff.id, staff.staffnumber, @@ -475,27 +520,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start1, + END) AS mon_timestart1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end1, + END) AS mon_timeend1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start2, + END) AS mon_timestart2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end2, + END) AS mon_timeend2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_pause, + END) AS mon_timepause, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -520,27 +565,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start1, + END) AS tue_timestart1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end1, + END) AS tue_timeend1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start2, + END) AS tue_timestart2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end2, + END) AS tue_timeend2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_pause, + END) AS tue_timepause, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -565,27 +610,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start1, + END) AS wed_timestart1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end1, + END) AS wed_timeend1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start2, + END) AS wed_timestart2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end2, + END) AS wed_timeend2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_pause, + END) AS wed_timepause, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -610,27 +655,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start1, + END) AS thu_timestart1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end1, + END) AS thu_timeend1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start2, + END) AS thu_timestart2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end2, + END) AS thu_timeend2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_pause, + END) AS thu_timepause, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -655,27 +700,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start1, + END) AS fri_timestart1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end1, + END) AS fri_timeend1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start2, + END) AS fri_timestart2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end2, + END) AS fri_timeend2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_pause, + END) AS fri_timepause, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -700,27 +745,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start1, + END) AS sat_timestart1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end1, + END) AS sat_timeend1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start2, + END) AS sat_timestart2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end2, + END) AS sat_timeend2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_pause, + END) AS sat_timepause, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -745,27 +790,27 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start1, + END) AS sun_timestart1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end1, + END) AS sun_timeend1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start2, + END) AS sun_timestart2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end2, + END) AS sun_timeend2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_pause, + END) AS sun_timepause, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -809,7 +854,9 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplan_weekly AS CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplanlist AS SELECT st.id AS id_staff, ((st.surname || ' '::text) || st.prename) AS staffname, - (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS calweek, + (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS dspcalweek, + (sp_dwt.calweek)::integer AS calweek, + sp_dwt.calyear, sp_dwt.week_timetotal, sp_dwt.weekbegin AS weekstart, date((sp_dwt.weekbegin + '7 days'::interval)) AS weekend, @@ -932,31 +979,31 @@ CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplanlist AS ((to_number("left"(sp_dwt.week_timetotal, 2), '99'::text) * (60)::numeric) + to_number("right"(sp_dwt.week_timetotal, 2), '99'::text)) AS weekminutes, sp_dwt.mon_id, sp_dwt.weekbegin AS mon_date, - ((COALESCE(((to_char((sp_dwt.mon_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, + ((COALESCE(((to_char((sp_dwt.mon_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, sp_dwt.mon_timetotal, sp_dwt.tue_id, date((sp_dwt.weekbegin + '1 day'::interval)) AS tue_date, - ((COALESCE(((to_char((sp_dwt.tue_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, + ((COALESCE(((to_char((sp_dwt.tue_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, sp_dwt.tue_timetotal, sp_dwt.wed_id, date((sp_dwt.weekbegin + '2 days'::interval)) AS wed_date, - ((COALESCE(((to_char((sp_dwt.wed_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, + ((COALESCE(((to_char((sp_dwt.wed_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, sp_dwt.wed_timetotal, sp_dwt.thu_id, date((sp_dwt.weekbegin + '3 days'::interval)) AS thu_date, - ((COALESCE(((to_char((sp_dwt.thu_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, + ((COALESCE(((to_char((sp_dwt.thu_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, sp_dwt.thu_timetotal, sp_dwt.fri_id, date((sp_dwt.weekbegin + '4 days'::interval)) AS fri_date, - ((COALESCE(((to_char((sp_dwt.fri_start1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, + ((COALESCE(((to_char((sp_dwt.fri_timestart1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, sp_dwt.fri_timetotal, sp_dwt.sat_id, date((sp_dwt.weekbegin + '5 days'::interval)) AS sat_date, - ((COALESCE(((to_char((sp_dwt.sat_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, + ((COALESCE(((to_char((sp_dwt.sat_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, sp_dwt.sat_timetotal, sp_dwt.sun_id, date((sp_dwt.weekbegin + '6 days'::interval)) AS sun_date, - ((COALESCE(((to_char((sp_dwt.sun_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, + ((COALESCE(((to_char((sp_dwt.sun_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, sp_dwt.sun_timetotal FROM (%%NEWSCHEMA%%.vw_staffworkplan_weekly sp_dwt LEFT JOIN %%NEWSCHEMA%%.staff st ON ((sp_dwt.id_staff = st.id))) @@ -1091,9 +1138,9 @@ ALTER TABLE ONLY %%NEWSCHEMA%%.sites ALTER COLUMN id SET DEFAULT nextval('%%NEWS ALTER TABLE ONLY %%NEWSCHEMA%%.staff ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staff_id_seq'::regclass); -ALTER TABLE ONLY %%NEWSCHEMA%%.staffgroups ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staffgroups_id_seq'::regclass); +ALTER TABLE ONLY %%NEWSCHEMA%%.staffcontract ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staffperiodbase_id_seq'::regclass); -ALTER TABLE ONLY %%NEWSCHEMA%%.staffperiodbase ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staffperiodbase_id_seq'::regclass); +ALTER TABLE ONLY %%NEWSCHEMA%%.staffgroups ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.staffgroups_id_seq'::regclass); ALTER TABLE ONLY %%NEWSCHEMA%%.stafftimetracks ALTER COLUMN id SET DEFAULT nextval('%%NEWSCHEMA%%.stafftimetracks_id_seq'::regclass); @@ -1119,7 +1166,7 @@ ALTER TABLE ONLY %%NEWSCHEMA%%.staff ALTER TABLE ONLY %%NEWSCHEMA%%.staffgroups ADD CONSTRAINT staffgroups_pkey PRIMARY KEY (id); -ALTER TABLE ONLY %%NEWSCHEMA%%.staffperiodbase +ALTER TABLE ONLY %%NEWSCHEMA%%.staffcontract ADD CONSTRAINT staffperiodbase_pkey PRIMARY KEY (id); ALTER TABLE ONLY %%NEWSCHEMA%%.stafftimetracks @@ -1140,5 +1187,5 @@ ALTER TABLE ONLY %%NEWSCHEMA%%.workplans ALTER TABLE ONLY %%NEWSCHEMA%%.worktypes ADD CONSTRAINT worktypes_pkey PRIMARY KEY (id); -CREATE TRIGGER trg_upd_%%NEWSCHEMA%%_weekhours BEFORE UPDATE OF weekhours ON %%NEWSCHEMA%%.staffperiodbase FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); +CREATE TRIGGER trg_upd_%%NEWSCHEMA%%_weekhours BEFORE UPDATE OF weekhours ON %%NEWSCHEMA%%.staffcontract FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); diff --git a/dev/db/potlu_db.pg.data.sql b/dev/db/potlu_db.pg.data.sql index 3fd4ff07..89fb7ec5 100644 --- a/dev/db/potlu_db.pg.data.sql +++ b/dev/db/potlu_db.pg.data.sql @@ -40,23 +40,13 @@ INSERT INTO demo.timetrackuser (id, id_staff, stamp_in, stamp_out) VALUES (2, 1, INSERT INTO demo.timetrackuser (id, id_staff, stamp_in, stamp_out) VALUES (5, 1, '2019-10-04 17:05:00', '2019-10-05 01:04:00'); --- --- Data for Name: defaultweekworkplan; Type: TABLE DATA; Schema: portanova; Owner: - --- - - - --- --- Data for Name: defaultworkplan; Type: TABLE DATA; Schema: portanova; Owner: - --- - - - -- -- Data for Name: reportperiod; Type: TABLE DATA; Schema: portanova; Owner: - -- INSERT INTO portanova.reportperiod (id, periodname, startdate, enddate) VALUES (1, 'Période 1 2020', '2019-12-30', '2020-02-23'); +INSERT INTO portanova.reportperiod (id, periodname, startdate, enddate) VALUES (5, 'Periode X', '2019-11-25', '2020-04-05'); +INSERT INTO portanova.reportperiod (id, periodname, startdate, enddate) VALUES (6, 'TEST', '2019-11-25', '2020-01-05'); -- @@ -117,60 +107,63 @@ INSERT INTO portanova.staff (id, staffnumber, surname, prename, job, birthdate, -- --- Data for Name: staffgroups; Type: TABLE DATA; Schema: portanova; Owner: - --- - +-- Data for Name: staffcontract; Type: TABLE DATA; Schema: portanova; Owner: - +-- + +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (39, 39, '2015-07-01', 64.8750000000000000, 15, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (40, 40, '2011-10-01', 86.5000000000000000, 20, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (11, 11, '2000-01-01', 129.7500000000000000, 30, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (43, 43, '2000-01-01', 129.7500000000000000, 30, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (6, 6, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (10, 10, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (12, 12, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (13, 13, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (14, 14, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (17, 17, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (19, 19, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (25, 25, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (30, 30, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (31, 31, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (36, 36, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (37, 37, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (41, 41, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (42, 42, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (44, 44, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (45, 45, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (1, 1, '2015-06-22', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (2, 2, '2005-04-19', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (3, 3, '2007-08-14', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (4, 4, '2015-04-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (5, 5, '2015-03-10', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (7, 7, '2015-11-09', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (8, 8, '2016-02-13', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (9, 9, '2016-01-18', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (15, 15, '2014-11-15', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (16, 16, '2015-10-08', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (18, 18, '2016-05-30', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (20, 20, '2015-12-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (21, 21, '2005-01-08', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (22, 22, '2014-04-15', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (23, 23, '2013-01-07', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (24, 24, '2005-05-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (26, 26, '2008-07-10', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (27, 27, '2013-01-07', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (28, 28, '2012-10-03', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (29, 29, '2015-06-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (32, 32, '2006-10-23', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (33, 33, '1995-07-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (34, 34, '1992-03-15', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (35, 35, '2011-07-05', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (38, 38, '2010-10-04', 173.0000000000000000, 40, NULL); -- --- Data for Name: staffperiodbase; Type: TABLE DATA; Schema: portanova; Owner: - --- - -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (39, 39, '2015-07-01', 64.8750000000000000, 15); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (40, 40, '2011-10-01', 86.5000000000000000, 20); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (11, 11, '2000-01-01', 129.7500000000000000, 30); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (43, 43, '2000-01-01', 129.7500000000000000, 30); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (6, 6, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (10, 10, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (12, 12, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (13, 13, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (14, 14, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (17, 17, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (19, 19, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (25, 25, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (30, 30, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (31, 31, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (36, 36, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (37, 37, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (41, 41, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (42, 42, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (44, 44, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (45, 45, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (1, 1, '2015-06-22', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (2, 2, '2005-04-19', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (3, 3, '2007-08-14', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (4, 4, '2015-04-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (5, 5, '2015-03-10', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (7, 7, '2015-11-09', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (8, 8, '2016-02-13', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (9, 9, '2016-01-18', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (15, 15, '2014-11-15', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (16, 16, '2015-10-08', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (18, 18, '2016-05-30', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (20, 20, '2015-12-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (21, 21, '2005-01-08', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (22, 22, '2014-04-15', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (23, 23, '2013-01-07', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (24, 24, '2005-05-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (26, 26, '2008-07-10', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (27, 27, '2013-01-07', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (28, 28, '2012-10-03', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (29, 29, '2015-06-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (32, 32, '2006-10-23', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (33, 33, '1995-07-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (34, 34, '1992-03-15', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (35, 35, '2011-07-05', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (38, 38, '2010-10-04', 173.0000000000000000, 40); +-- Data for Name: staffgroups; Type: TABLE DATA; Schema: portanova; Owner: - +-- + +INSERT INTO portanova.staffgroups (id, groupname, groupcolor) VALUES (1, 'cuisine', NULL); +INSERT INTO portanova.staffgroups (id, groupname, groupcolor) VALUES (2, 'service', NULL); +INSERT INTO portanova.staffgroups (id, groupname, groupcolor) VALUES (3, 'caisse', NULL); -- @@ -195,8 +188,13 @@ INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, week -- Data for Name: staffworkplan; Type: TABLE DATA; Schema: portanova; Owner: - -- +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3118, 3, '2019-12-30', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (1817, 34, '2017-07-07', NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (1847, 37, '2017-07-15', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3119, 3, '2019-12-31', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3120, 3, '2020-01-01', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3121, 3, '2020-01-02', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3122, 3, '2020-01-03', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (2405, 20, '2017-06-17', NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (1767, 8, '2017-07-05', '10:30:00', '15:00:00', '18:00:00', '23:45:00', '01:00:00', NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (1768, 8, '2017-07-12', '10:30:00', '15:00:00', '18:00:00', '23:45:00', '01:00:00', NULL, NULL); @@ -1574,56 +1572,142 @@ INSERT INTO portanova.worktypes (id, worktype, isworktime, isfreetime, typecolor INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (1, 'superadmin', NULL, 'SuperAdmin'); INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (2, 'admin', NULL, 'Admin'); -INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (3, 'company', NULL, 'Entreprise'); INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (4, 'site', NULL, 'Site'); INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (5, 'user', true, 'Utilisateur'); +INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (3, 'manager', NULL, 'Gérant'); -- -- Data for Name: apps; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (7, 'staff', 'Employé(e)s', 'Employé(e)s', 1, 'group.svg', 4, 'schema'); INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (8, 'timetrackers', 'Pointeuses', 'Pointeuses', NULL, 'cube.svg', 7, 'schema'); INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (10, 'sites', 'Sites', 'Sites', NULL, 'cube.svg', 6, 'schema'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (11, 'workplans', 'Plans de travail', 'Plans (modèles)', 1, 'cube.svg', 8, 'schema'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (9, 'planning', 'Planning', 'POT', 1, 'cube.svg', 5, 'schema'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (4, 'profile', 'Profil', 'mes coordonnées', 1, 'user.svg', 9, 'global'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (6, 'companies', 'Entreprise', 'entreprise', 1, 'company.svg', 10, 'global'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (5, 'users', 'Utilisateurs', 'autres utilisateurs', 1, 'group.svg', 11, 'global'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (4, 'profile', 'Profil', 'mes coordonnées', 5, 'user.svg', 9, 'global'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (5, 'users', 'Utilisateurs', 'utilisateurs', 2, 'group.svg', 11, 'global'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (7, 'staff', 'Employé(e)s', 'employé(e)s', 3, 'group.svg', 4, 'schema'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (9, 'planning', 'Planning', 'POT', 3, 'poticon.svg', 5, 'schema'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (6, 'companies', 'Entreprise', 'entreprise', 2, 'cube.svg', 10, 'global'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (11, 'workplans', 'Plans de travail', 'plans (modèles)', 3, 'calendar.svg', 8, 'schema'); -- -- Data for Name: companies; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.companies (id, company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email) VALUES (1, 'DKS s.à r.l.', '4, rue Principale', '3770', 'Tétange', 'Luxembourg', NULL, NULL, NULL, 'portanova', NULL, NULL, NULL); +INSERT INTO public.companies (id, company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated) VALUES (1, 'DKS', '8b, rue du Moulin', '6914', 'Roodt-sur-Syre', 'Luxemburg', NULL, NULL, NULL, 'portanova', NULL, NULL, 'support@dks.lu', 's.à r.l.', NULL); -- -- Data for Name: maillayouts; Type: TABLE DATA; Schema: public; Owner: - -- +INSERT INTO public.maillayouts (id, layoutname, mailtemplate) VALUES (1, 'potbasic', ' + + + + + +
+ POT - Plan d''organisation de travail +
+
+ %%BODYCONTENT%% +
+
+
+ +'); -- -- Data for Name: mailtemplates; Type: TABLE DATA; Schema: public; Owner: - -- +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (1, 'user_registration', 'Bonjour %%prename%% %%surname%%,
+
+Merci pour votre création de compte sur pot.lu, +

+votre login: %%username%%
+votre mot de passe: %%password%% +
+Meilleurs salutations,
+
+POT Support Team', 'select prename,surname,username from users where id=''%%id%%'';', 'support@dks.lu', 'Confirmation requis pour votre création de compte sur pot.lu', 1); +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (2, 'user_forgotpasswd', 'Bonjour %%prename%% %%surname%%,

+ +vous avez demandé un nouveau mot de passe via pot.lu!
+nouveau mot de passe: %%newpassword%%

+
+Meilleurs salutations,
+
+POT Support Team + + + +', 'select prename,surname from users where id=''%%id%%'';', 'support@dks.lu', 'Nouveau mot de passe pour le site pot.lu', 1); +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (3, 'user_expiration_notice', 'Bonjour %%prename%% %%surname%%,
+
+Votre souscription au site pot.lu expire bientôt, +

+n''oublié pas à la prolonger! +Prolonger maintenant +
+Meilleurs salutations,
+
+pot.lu Support Team', 'select prename,surname from users where id=''%%id%%'';', 'support@dks.lu', 'Notice d''expiration de votre souscription sur pot.lu', 1); +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (4, 'user_invoice_paypal', 'Bonjour %%prename%% %%surname%%,
+
+En annexe vous trouvez la facture pour votre souscription au site pot.lu, +
+Vous avez Payé déjà via PayPal! + +Meilleurs salutations,
+
+pot.lu Support Team', 'select prename,surname from users where id=''%%id%%'';', 'support@dks.lu', 'Info facture pour votre souscription sur pot.lu', 1); +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (5, 'user_invoice', 'Bonjour %%prename%% %%surname%%,
+
+En annexe vous trouvez la facture pour votre souscription au site pot.lu, +
+ +Meilleurs salutations,
+
+POT Support Team', 'select prename,surname from users where id=''%%id%%'';', 'support@dks.lu', 'Facture concernant votre souscription sur pot.lu', 1); +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (6, 'user_verification', 'Bonjour %%prename%% %%surname%%,
+
+Le code pour valider votre e-mail est: +
+%%vcode%%
+
+entrez le code ici: %%siteurl%%/backoffice/validationcode.html +
+Méilleurs Salutations,
+
+pot.lu Support Team', 'select prename,surname,username from users where id=''%%id%%'';', 'support@dks.lu', 'Validation de votre Email pour le site pot.lu', 1); +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (7, 'user_newpassword', 'Bonjour %%prename%% %%surname%%,
+
+Nous avons crées / modifé votre compte sur le site pot.lu;
+
+Votre Login: %%username%%
+Mot de passe: %%newpassword%%

+
+méilleurs Salutations,
+
+pot.lu Support-Team
+', 'select prename,surname,username from users where id=''%%id%%'';', 'support@dks.lu', 'coordonnées d''accès de votre compte sur pot.lu', 1); -- -- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess) VALUES (1, '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-10-10 17:12:11.934747', NULL, 'ksaffran@dks.lu', NULL, NULL, NULL); - - --- --- Data for Name: members; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.members (id, surname, prename, phone, id_user, id_company, job) VALUES (1, 'Saffran', 'Kilian', NULL, 1, 1, NULL); +INSERT INTO public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company) VALUES (2, 'f7252754a4cb7391d966316351b3501bce81fee9bc0b71807ddf61281a27821e', '2019-12-20 11:03:08.757357', NULL, 'kilian@saffran.lu', NULL, NULL, '["portanova"]', '["5"]', 'Saffran', 'Kilian', '691504574', NULL, 1); +INSERT INTO public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company) VALUES (1, '228c27a646f18ce069bc2b8ef091a03c46cd51557e5b5ac90abc05c4f635b3ba', '2019-10-10 17:12:11.934747', NULL, 'kilian.saffran@gmail.com', NULL, '6tgfkew', '["portanova"]', '["2","5","3"]', 'Saffran', 'Kilian', '+352691504574', 'Gérant', 1); -- @@ -1635,17 +1719,26 @@ INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, cr INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (113, 'HaDg0Eh9nIk7lftrHDtQpaKiLWL66VoEWRKMmSLz', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '::1', '2019-12-09 11:33:13.202044'); INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (114, 'aSli1lR9B0ETjICf7IFjVxhphLd8dhRdZ2mRd4RE', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362', '::1', '2019-12-10 15:55:53.526432'); INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (122, 'Sp2D9CvtdjQHaxLPkEXgqSMSveIJwQde56I5y3oC', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '2001:7e8:cc73:de00:d970:312a:d5d:db83', '2019-12-12 07:06:51.913155'); -INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (123, 'klCMzztihKleI4E0zhnmNMrlL8sAUIj5TLHjb0si', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36', '::1', '2019-12-13 08:27:53.789037'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (124, 'NUTU0TkWd81oxH4ig52WCA3HzccA3bmHW5sMPCyT', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36', '::1', '2019-12-15 11:44:06.485589'); INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (93, '5P7159lXg8xY83Iu7eZC3hj3Oi6x29jXOhPKg0yn', 1, 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36', '::1', '2019-12-04 14:58:48.993651'); INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (98, '9UisAitYaoxdqtBaWUI37R04CiBlFxcp0STuCOZRU', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '::1', '2019-12-05 07:34:07.997426'); INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (99, 'v6wZ65qozoWn5P32q4wg16224TcOAM1VJnLFj1UJ', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '192.168.178.23', '2019-12-05 07:35:01.756219'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (160, 'pMEnznbOdbCeLbtKUwxgVbn2PNVzrF0HhvVHIWmL', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36', '::1', '2019-12-20 12:48:16.464228'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (161, 'fvhUhEhy8bRQnrZd1I0oVdAwntMj86Xdr5Yzz6Yy', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', '::1', '2019-12-22 09:58:14.675553'); -- --- Data for Name: useringroups; Type: TABLE DATA; Schema: public; Owner: - +-- Data for Name: zzold_members; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.useringroups (id, id_user, id_group) VALUES (1, 1, 1); +INSERT INTO public.zzold_members (id, surname, prename, phone, id_user, id_company, job) VALUES (1, 'Saffran', 'Kilian', NULL, 1, 1, NULL); + + +-- +-- Data for Name: zzold_useringroups; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.zzold_useringroups (id, id_user, id_group) VALUES (1, 1, 1); -- @@ -1669,25 +1762,11 @@ SELECT pg_catalog.setval('demo.stations_id_seq', 1, false); SELECT pg_catalog.setval('demo.timetrackuser_id_seq', 5, true); --- --- Name: defaultweekworkplan_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: - --- - -SELECT pg_catalog.setval('portanova.defaultweekworkplan_id_seq', 1, false); - - --- --- Name: defaultworkplan_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: - --- - -SELECT pg_catalog.setval('portanova.defaultworkplan_id_seq', 1, false); - - -- -- Name: reportperiod_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: - -- -SELECT pg_catalog.setval('portanova.reportperiod_id_seq', 1, true); +SELECT pg_catalog.setval('portanova.reportperiod_id_seq', 7, true); -- @@ -1708,7 +1787,7 @@ SELECT pg_catalog.setval('portanova.staff_id_seq', 45, true); -- Name: staffgroups_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: - -- -SELECT pg_catalog.setval('portanova.staffgroups_id_seq', 1, false); +SELECT pg_catalog.setval('portanova.staffgroups_id_seq', 3, true); -- @@ -1743,7 +1822,7 @@ SELECT pg_catalog.setval('portanova.staffvacancyyear_id_seq', 1, false); -- Name: staffworkplan_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: - -- -SELECT pg_catalog.setval('portanova.staffworkplan_id_seq', 3117, true); +SELECT pg_catalog.setval('portanova.staffworkplan_id_seq', 3122, true); -- @@ -1771,21 +1850,21 @@ SELECT pg_catalog.setval('public.apps_id_seq', 11, true); -- Name: companies_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.companies_id_seq', 1, true); +SELECT pg_catalog.setval('public.companies_id_seq', 24, true); -- -- Name: maillayouts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.maillayouts_id_seq', 1, false); +SELECT pg_catalog.setval('public.maillayouts_id_seq', 1, true); -- -- Name: mailtemplates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.mailtemplates_id_seq', 1, false); +SELECT pg_catalog.setval('public.mailtemplates_id_seq', 7, true); -- @@ -1799,7 +1878,7 @@ SELECT pg_catalog.setval('public.members_id_seq', 1, false); -- Name: sessions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.sessions_id_seq', 123, true); +SELECT pg_catalog.setval('public.sessions_id_seq', 161, true); -- @@ -1820,7 +1899,7 @@ SELECT pg_catalog.setval('public.useringroups_id_seq', 1, true); -- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.users_id_seq', 1, false); +SELECT pg_catalog.setval('public.users_id_seq', 2, true); -- diff --git a/dev/db/potlu_db.pg.full.sql b/dev/db/potlu_db.pg.full.sql index f92056c0..f07ddf3e 100644 --- a/dev/db/potlu_db.pg.full.sql +++ b/dev/db/potlu_db.pg.full.sql @@ -115,15 +115,12 @@ CREATE FUNCTION public.getsession(vidsession text, vremoteaddr text, vuseragent LANGUAGE plpgsql AS $$ BEGIN - return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se -join users us on (us.id=se.id_user) -left join useringroups uig on (us.id=uig.id_user) -left join usergroups aug on (aug.id=uig.id_group) -left join members mb on (mb.id_user=us.id) -left join companies co on (co.id=mb.id_company) -where se.idsession= vidsession -and se.remote_addr= vremoteaddr -and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id; + return QUERY select se.idsession,us.id,us.username,string_agg(distinct(ugrp.usergroup),',') as usergroups,json_array_elements_text(us.schemaaccess) as userschemata from sessions se +join users us on (us.id=se.id_user) +left join (SELECT users.id,json_array_elements_text(users.id_usergroups) AS id_usergroup FROM users) ugs on (us.id=ugs.id) +left join usergroups ugrp on (ugrp.id=ugs.id) +where se.idsession= vidsession and se.remote_addr= vremoteaddr and se.user_agent= vuseragent and +us.blocked is null group by se.id,us.id; END; $$; @@ -371,85 +368,6 @@ ALTER TABLE demo.timetrackuser_id_seq OWNER TO potlu_user; ALTER SEQUENCE demo.timetrackuser_id_seq OWNED BY demo.timetrackuser.id; --- --- Name: defaultweekworkplan; Type: TABLE; Schema: portanova; Owner: potlu_user --- - -CREATE TABLE portanova.defaultweekworkplan ( - id integer NOT NULL, - id_staff integer, - startdate date, - mon json, - tue json, - wed json, - thu json, - fri json, - sat json, - sun json -); - - -ALTER TABLE portanova.defaultweekworkplan OWNER TO potlu_user; - --- --- Name: defaultweekworkplan_id_seq; Type: SEQUENCE; Schema: portanova; Owner: potlu_user --- - -CREATE SEQUENCE portanova.defaultweekworkplan_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE portanova.defaultweekworkplan_id_seq OWNER TO potlu_user; - --- --- Name: defaultweekworkplan_id_seq; Type: SEQUENCE OWNED BY; Schema: portanova; Owner: potlu_user --- - -ALTER SEQUENCE portanova.defaultweekworkplan_id_seq OWNED BY portanova.defaultweekworkplan.id; - - --- --- Name: defaultworkplan; Type: TABLE; Schema: portanova; Owner: potlu_user --- - -CREATE TABLE portanova.defaultworkplan ( - id bigint NOT NULL, - id_staff integer, - daydate date, - plannedtimes json, - vacancytimes json, - presencetimes json -); - - -ALTER TABLE portanova.defaultworkplan OWNER TO potlu_user; - --- --- Name: defaultworkplan_id_seq; Type: SEQUENCE; Schema: portanova; Owner: potlu_user --- - -CREATE SEQUENCE portanova.defaultworkplan_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE portanova.defaultworkplan_id_seq OWNER TO potlu_user; - --- --- Name: defaultworkplan_id_seq; Type: SEQUENCE OWNED BY; Schema: portanova; Owner: potlu_user --- - -ALTER SEQUENCE portanova.defaultworkplan_id_seq OWNED BY portanova.defaultworkplan.id; - - -- -- Name: reportperiod; Type: TABLE; Schema: portanova; Owner: potlu_user -- @@ -568,6 +486,22 @@ ALTER TABLE portanova.staff_id_seq OWNER TO potlu_user; ALTER SEQUENCE portanova.staff_id_seq OWNED BY portanova.staff.id; +-- +-- Name: staffcontract; Type: TABLE; Schema: portanova; Owner: potlu_user +-- + +CREATE TABLE portanova.staffcontract ( + id integer NOT NULL, + id_staff integer, + startdate date, + monthhours numeric, + weekhours numeric, + id_staffgroup integer +); + + +ALTER TABLE portanova.staffcontract OWNER TO potlu_user; + -- -- Name: staffgroups; Type: TABLE; Schema: portanova; Owner: potlu_user -- @@ -603,21 +537,6 @@ ALTER TABLE portanova.staffgroups_id_seq OWNER TO potlu_user; ALTER SEQUENCE portanova.staffgroups_id_seq OWNED BY portanova.staffgroups.id; --- --- Name: staffperiodbase; Type: TABLE; Schema: portanova; Owner: potlu_user --- - -CREATE TABLE portanova.staffperiodbase ( - id integer NOT NULL, - id_staff integer, - startdate date, - monthhours numeric, - weekhours numeric -); - - -ALTER TABLE portanova.staffperiodbase OWNER TO potlu_user; - -- -- Name: staffperiodbase_id_seq; Type: SEQUENCE; Schema: portanova; Owner: potlu_user -- @@ -637,7 +556,7 @@ ALTER TABLE portanova.staffperiodbase_id_seq OWNER TO potlu_user; -- Name: staffperiodbase_id_seq; Type: SEQUENCE OWNED BY; Schema: portanova; Owner: potlu_user -- -ALTER SEQUENCE portanova.staffperiodbase_id_seq OWNED BY portanova.staffperiodbase.id; +ALTER SEQUENCE portanova.staffperiodbase_id_seq OWNED BY portanova.staffcontract.id; -- @@ -810,6 +729,85 @@ CREATE VIEW portanova.vw_reportperiodlist AS ALTER TABLE portanova.vw_reportperiodlist OWNER TO potlu_user; +-- +-- Name: vw_staffcontractdata; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffcontractdata AS + SELECT staffcontract.id, + staffcontract.id_staff, + staffcontract.startdate, + staffcontract.monthhours, + staffcontract.weekhours, + staffcontract.id_staffgroup + FROM portanova.staffcontract; + + +ALTER TABLE portanova.vw_staffcontractdata OWNER TO potlu_user; + +-- +-- Name: vw_staffcontractlist; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffcontractlist AS + SELECT sc.id, + sc.id_staff, + sc.startdate, + sc.weekhours, + sc.monthhours, + sc.id_staffgroup, + sg.groupname, + sg.groupcolor + FROM (portanova.staffcontract sc + LEFT JOIN portanova.staffgroups sg ON ((sc.id_staffgroup = sg.id))); + + +ALTER TABLE portanova.vw_staffcontractlist OWNER TO potlu_user; + +-- +-- Name: vw_staffdata; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffdata AS + SELECT staff.id, + staff.staffnumber, + staff.surname, + staff.prename, + staff.job, + staff.birthdate, + staff.entrydate, + staff.leavedate + FROM portanova.staff; + + +ALTER TABLE portanova.vw_staffdata OWNER TO potlu_user; + +-- +-- Name: vw_staffgroupsdata; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffgroupsdata AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM portanova.staffgroups; + + +ALTER TABLE portanova.vw_staffgroupsdata OWNER TO potlu_user; + +-- +-- Name: vw_staffgroupslist; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffgroupslist AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM portanova.staffgroups; + + +ALTER TABLE portanova.vw_staffgroupslist OWNER TO potlu_user; + -- -- Name: vw_stafflist; Type: VIEW; Schema: portanova; Owner: potlu_user -- @@ -1127,27 +1125,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start1, + END) AS mon_timestart1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end1, + END) AS mon_timeend1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start2, + END) AS mon_timestart2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end2, + END) AS mon_timeend2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_pause, + END) AS mon_timepause, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1172,27 +1170,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start1, + END) AS tue_timestart1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end1, + END) AS tue_timeend1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start2, + END) AS tue_timestart2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end2, + END) AS tue_timeend2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_pause, + END) AS tue_timepause, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1217,27 +1215,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start1, + END) AS wed_timestart1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end1, + END) AS wed_timeend1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start2, + END) AS wed_timestart2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end2, + END) AS wed_timeend2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_pause, + END) AS wed_timepause, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1262,27 +1260,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start1, + END) AS thu_timestart1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end1, + END) AS thu_timeend1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start2, + END) AS thu_timestart2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end2, + END) AS thu_timeend2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_pause, + END) AS thu_timepause, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1307,27 +1305,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start1, + END) AS fri_timestart1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end1, + END) AS fri_timeend1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start2, + END) AS fri_timestart2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end2, + END) AS fri_timeend2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_pause, + END) AS fri_timepause, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1352,27 +1350,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start1, + END) AS sat_timestart1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end1, + END) AS sat_timeend1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start2, + END) AS sat_timestart2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end2, + END) AS sat_timeend2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_pause, + END) AS sat_timepause, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1397,27 +1395,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start1, + END) AS sun_timestart1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end1, + END) AS sun_timeend1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start2, + END) AS sun_timestart2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end2, + END) AS sun_timeend2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_pause, + END) AS sun_timepause, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1468,7 +1466,9 @@ ALTER TABLE portanova.vw_staffworkplan_weekly OWNER TO potlu_user; CREATE VIEW portanova.vw_staffworkplanlist AS SELECT st.id AS id_staff, ((st.surname || ' '::text) || st.prename) AS staffname, - (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS calweek, + (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS dspcalweek, + (sp_dwt.calweek)::integer AS calweek, + sp_dwt.calyear, sp_dwt.week_timetotal, sp_dwt.weekbegin AS weekstart, date((sp_dwt.weekbegin + '7 days'::interval)) AS weekend, @@ -1591,31 +1591,31 @@ CREATE VIEW portanova.vw_staffworkplanlist AS ((to_number("left"(sp_dwt.week_timetotal, 2), '99'::text) * (60)::numeric) + to_number("right"(sp_dwt.week_timetotal, 2), '99'::text)) AS weekminutes, sp_dwt.mon_id, sp_dwt.weekbegin AS mon_date, - ((COALESCE(((to_char((sp_dwt.mon_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, + ((COALESCE(((to_char((sp_dwt.mon_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, sp_dwt.mon_timetotal, sp_dwt.tue_id, date((sp_dwt.weekbegin + '1 day'::interval)) AS tue_date, - ((COALESCE(((to_char((sp_dwt.tue_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, + ((COALESCE(((to_char((sp_dwt.tue_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, sp_dwt.tue_timetotal, sp_dwt.wed_id, date((sp_dwt.weekbegin + '2 days'::interval)) AS wed_date, - ((COALESCE(((to_char((sp_dwt.wed_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, + ((COALESCE(((to_char((sp_dwt.wed_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, sp_dwt.wed_timetotal, sp_dwt.thu_id, date((sp_dwt.weekbegin + '3 days'::interval)) AS thu_date, - ((COALESCE(((to_char((sp_dwt.thu_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, + ((COALESCE(((to_char((sp_dwt.thu_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, sp_dwt.thu_timetotal, sp_dwt.fri_id, date((sp_dwt.weekbegin + '4 days'::interval)) AS fri_date, - ((COALESCE(((to_char((sp_dwt.fri_start1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, + ((COALESCE(((to_char((sp_dwt.fri_timestart1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, sp_dwt.fri_timetotal, sp_dwt.sat_id, date((sp_dwt.weekbegin + '5 days'::interval)) AS sat_date, - ((COALESCE(((to_char((sp_dwt.sat_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, + ((COALESCE(((to_char((sp_dwt.sat_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, sp_dwt.sat_timetotal, sp_dwt.sun_id, date((sp_dwt.weekbegin + '6 days'::interval)) AS sun_date, - ((COALESCE(((to_char((sp_dwt.sun_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, + ((COALESCE(((to_char((sp_dwt.sun_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, sp_dwt.sun_timetotal FROM (portanova.vw_staffworkplan_weekly sp_dwt LEFT JOIN portanova.staff st ON ((sp_dwt.id_staff = st.id))) @@ -1865,7 +1865,9 @@ CREATE TABLE public.companies ( schemata text, validated boolean, schemata2 json, - email text + email text, + socialtype text, + vatvalidated boolean ); @@ -1968,10 +1970,10 @@ ALTER SEQUENCE public.mailtemplates_id_seq OWNED BY public.mailtemplates.id; -- --- Name: members; Type: TABLE; Schema: public; Owner: potlu_user +-- Name: zzold_members; Type: TABLE; Schema: public; Owner: potlu_user -- -CREATE TABLE public.members ( +CREATE TABLE public.zzold_members ( id integer NOT NULL, surname text, prename text, @@ -1982,7 +1984,7 @@ CREATE TABLE public.members ( ); -ALTER TABLE public.members OWNER TO potlu_user; +ALTER TABLE public.zzold_members OWNER TO potlu_user; -- -- Name: members_id_seq; Type: SEQUENCE; Schema: public; Owner: potlu_user @@ -2003,7 +2005,7 @@ ALTER TABLE public.members_id_seq OWNER TO potlu_user; -- Name: members_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: potlu_user -- -ALTER SEQUENCE public.members_id_seq OWNED BY public.members.id; +ALTER SEQUENCE public.members_id_seq OWNED BY public.zzold_members.id; -- @@ -2080,17 +2082,17 @@ ALTER SEQUENCE public.usergroups_id_seq OWNED BY public.usergroups.id; -- --- Name: useringroups; Type: TABLE; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups; Type: TABLE; Schema: public; Owner: potlu_user -- -CREATE TABLE public.useringroups ( +CREATE TABLE public.zzold_useringroups ( id integer NOT NULL, id_user bigint, id_group bigint ); -ALTER TABLE public.useringroups OWNER TO potlu_user; +ALTER TABLE public.zzold_useringroups OWNER TO potlu_user; -- -- Name: useringroups_id_seq; Type: SEQUENCE; Schema: public; Owner: potlu_user @@ -2111,7 +2113,7 @@ ALTER TABLE public.useringroups_id_seq OWNER TO potlu_user; -- Name: useringroups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: potlu_user -- -ALTER SEQUENCE public.useringroups_id_seq OWNED BY public.useringroups.id; +ALTER SEQUENCE public.useringroups_id_seq OWNED BY public.zzold_useringroups.id; -- @@ -2126,7 +2128,13 @@ CREATE TABLE public.users ( username text, regcode text, vcode text, - schemaaccess json + schemaaccess json, + id_usergroups json, + surname text, + prename text, + phone text, + job text, + id_company integer ); @@ -2155,10 +2163,10 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; -- --- Name: vw_companydata; Type: VIEW; Schema: public; Owner: potlu_user +-- Name: vw_companiesdata; Type: VIEW; Schema: public; Owner: potlu_user -- -CREATE VIEW public.vw_companydata AS +CREATE VIEW public.vw_companiesdata AS SELECT companies.id, companies.company, companies.address, @@ -2168,78 +2176,112 @@ CREATE VIEW public.vw_companydata AS companies.tradetype, companies.comregister, companies.vatnumber, - companies.schemata AS link, - companies.validated + companies.schemata, + companies.validated, + companies.schemata2, + companies.email, + companies.socialtype, + companies.vatvalidated FROM public.companies; -ALTER TABLE public.vw_companydata OWNER TO potlu_user; +ALTER TABLE public.vw_companiesdata OWNER TO potlu_user; -- --- Name: vw_companylist; Type: VIEW; Schema: public; Owner: potlu_user +-- Name: vw_companieslist; Type: VIEW; Schema: public; Owner: potlu_user -- -CREATE VIEW public.vw_companylist AS - SELECT co.id, - co.company, - co.address, - co.zip, - co.city, - co.country, - ((((((co.address || '\n'::text) || co.zip) || ' '::text) || co.city) || ' '::text) || co.country) AS dspaddress, - co.schemata - FROM public.companies co; +CREATE VIEW public.vw_companieslist AS + SELECT companies.id, + companies.company, + companies.address, + companies.zip, + companies.city, + companies.country, + companies.tradetype, + companies.comregister, + companies.vatnumber, + companies.schemata, + companies.validated, + companies.schemata2, + companies.email, + companies.socialtype, + companies.vatvalidated + FROM public.companies; + + +ALTER TABLE public.vw_companieslist OWNER TO potlu_user; + +-- +-- Name: vw_schemata; Type: VIEW; Schema: public; Owner: potlu_user +-- +CREATE VIEW public.vw_schemata AS + SELECT schemata.schema_name AS schemaname + FROM information_schema.schemata + WHERE ((schemata.schema_owner)::text = 'potlu_user'::text); -ALTER TABLE public.vw_companylist OWNER TO potlu_user; + +ALTER TABLE public.vw_schemata OWNER TO potlu_user; -- --- Name: vw_memberdata; Type: VIEW; Schema: public; Owner: potlu_user +-- Name: vw_usergroupslist; Type: VIEW; Schema: public; Owner: potlu_user -- -CREATE VIEW public.vw_memberdata AS - SELECT members.id, - members.surname, - members.prename, - members.phone, - members.id_user, - members.id_company, - members.job - FROM public.members; +CREATE VIEW public.vw_usergroupslist AS + SELECT usergroups.id, + usergroups.usergroup, + usergroups.isdefault, + usergroups.groupname + FROM public.usergroups; -ALTER TABLE public.vw_memberdata OWNER TO potlu_user; +ALTER TABLE public.vw_usergroupslist OWNER TO potlu_user; -- --- Name: vw_userdata; Type: VIEW; Schema: public; Owner: potlu_user +-- Name: vw_usersdata; Type: VIEW; Schema: public; Owner: potlu_user -- -CREATE VIEW public.vw_userdata AS +CREATE VIEW public.vw_usersdata AS SELECT users.id, - users.username + users.userpassword, + users.created, + users.blocked, + users.username, + users.regcode, + users.vcode, + users.schemaaccess, + users.id_usergroups, + users.surname, + users.prename, + users.phone, + users.job, + users.id_company FROM public.users; -ALTER TABLE public.vw_userdata OWNER TO potlu_user; +ALTER TABLE public.vw_usersdata OWNER TO potlu_user; -- --- Name: vw_userlist; Type: VIEW; Schema: public; Owner: potlu_user +-- Name: vw_userslist; Type: VIEW; Schema: public; Owner: potlu_user -- -CREATE VIEW public.vw_userlist AS +CREATE VIEW public.vw_userslist AS SELECT NULL::integer AS id, - NULL::integer AS id_member, + NULL::boolean AS blocked, NULL::text AS username, - NULL::text AS prename, + NULL::text AS schemaaccess, NULL::text AS surname, - NULL::boolean AS blocked, - NULL::text AS group_ids, + NULL::text AS prename, + NULL::text AS phone, + NULL::text AS job, NULL::integer AS id_company, - NULL::text AS company; + NULL::text AS company, + NULL::text AS usergroups; -ALTER TABLE public.vw_userlist OWNER TO potlu_user; +ALTER TABLE public.vw_userslist OWNER TO potlu_user; -- -- Name: staff id; Type: DEFAULT; Schema: demo; Owner: potlu_user @@ -2262,20 +2304,6 @@ ALTER TABLE ONLY demo.stations ALTER COLUMN id SET DEFAULT nextval('demo.station ALTER TABLE ONLY demo.timetrackuser ALTER COLUMN id SET DEFAULT nextval('demo.timetrackuser_id_seq'::regclass); --- --- Name: defaultweekworkplan id; Type: DEFAULT; Schema: portanova; Owner: potlu_user --- - -ALTER TABLE ONLY portanova.defaultweekworkplan ALTER COLUMN id SET DEFAULT nextval('portanova.defaultweekworkplan_id_seq'::regclass); - - --- --- Name: defaultworkplan id; Type: DEFAULT; Schema: portanova; Owner: potlu_user --- - -ALTER TABLE ONLY portanova.defaultworkplan ALTER COLUMN id SET DEFAULT nextval('portanova.defaultworkplan_id_seq'::regclass); - - -- -- Name: reportperiod id; Type: DEFAULT; Schema: portanova; Owner: potlu_user -- @@ -2298,17 +2326,17 @@ ALTER TABLE ONLY portanova.staff ALTER COLUMN id SET DEFAULT nextval('portanova. -- --- Name: staffgroups id; Type: DEFAULT; Schema: portanova; Owner: potlu_user +-- Name: staffcontract id; Type: DEFAULT; Schema: portanova; Owner: potlu_user -- -ALTER TABLE ONLY portanova.staffgroups ALTER COLUMN id SET DEFAULT nextval('portanova.staffgroups_id_seq'::regclass); +ALTER TABLE ONLY portanova.staffcontract ALTER COLUMN id SET DEFAULT nextval('portanova.staffperiodbase_id_seq'::regclass); -- --- Name: staffperiodbase id; Type: DEFAULT; Schema: portanova; Owner: potlu_user +-- Name: staffgroups id; Type: DEFAULT; Schema: portanova; Owner: potlu_user -- -ALTER TABLE ONLY portanova.staffperiodbase ALTER COLUMN id SET DEFAULT nextval('portanova.staffperiodbase_id_seq'::regclass); +ALTER TABLE ONLY portanova.staffgroups ALTER COLUMN id SET DEFAULT nextval('portanova.staffgroups_id_seq'::regclass); -- @@ -2382,38 +2410,38 @@ ALTER TABLE ONLY public.mailtemplates ALTER COLUMN id SET DEFAULT nextval('publi -- --- Name: members id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: sessions id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.members ALTER COLUMN id SET DEFAULT nextval('public.members_id_seq'::regclass); +ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); -- --- Name: sessions id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: usergroups id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); +ALTER TABLE ONLY public.usergroups ALTER COLUMN id SET DEFAULT nextval('public.usergroups_id_seq'::regclass); -- --- Name: usergroups id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: users id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.usergroups ALTER COLUMN id SET DEFAULT nextval('public.usergroups_id_seq'::regclass); +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- --- Name: useringroups id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: zzold_members id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.useringroups ALTER COLUMN id SET DEFAULT nextval('public.useringroups_id_seq'::regclass); +ALTER TABLE ONLY public.zzold_members ALTER COLUMN id SET DEFAULT nextval('public.members_id_seq'::regclass); -- --- Name: users id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); +ALTER TABLE ONLY public.zzold_useringroups ALTER COLUMN id SET DEFAULT nextval('public.useringroups_id_seq'::regclass); -- @@ -2446,28 +2474,14 @@ COPY demo.timetrackuser (id, id_staff, stamp_in, stamp_out) FROM stdin; \. --- --- Data for Name: defaultweekworkplan; Type: TABLE DATA; Schema: portanova; Owner: potlu_user --- - -COPY portanova.defaultweekworkplan (id, id_staff, startdate, mon, tue, wed, thu, fri, sat, sun) FROM stdin; -\. - - --- --- Data for Name: defaultworkplan; Type: TABLE DATA; Schema: portanova; Owner: potlu_user --- - -COPY portanova.defaultworkplan (id, id_staff, daydate, plannedtimes, vacancytimes, presencetimes) FROM stdin; -\. - - -- -- Data for Name: reportperiod; Type: TABLE DATA; Schema: portanova; Owner: potlu_user -- COPY portanova.reportperiod (id, periodname, startdate, enddate) FROM stdin; 1 Période 1 2020 2019-12-30 2020-02-23 +5 Periode X 2019-11-25 2020-04-05 +6 TEST 2019-11-25 2020-01-05 \. @@ -2533,63 +2547,66 @@ COPY portanova.staff (id, staffnumber, surname, prename, job, birthdate, entryda -- --- Data for Name: staffgroups; Type: TABLE DATA; Schema: portanova; Owner: potlu_user --- - -COPY portanova.staffgroups (id, groupname, groupcolor) FROM stdin; +-- Data for Name: staffcontract; Type: TABLE DATA; Schema: portanova; Owner: potlu_user +-- + +COPY portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) FROM stdin; +39 39 2015-07-01 64.8750000000000000 15 \N +40 40 2011-10-01 86.5000000000000000 20 \N +11 11 2000-01-01 129.7500000000000000 30 \N +43 43 2000-01-01 129.7500000000000000 30 \N +6 6 2000-01-01 173.0000000000000000 40 \N +10 10 2000-01-01 173.0000000000000000 40 \N +12 12 2000-01-01 173.0000000000000000 40 \N +13 13 2000-01-01 173.0000000000000000 40 \N +14 14 2000-01-01 173.0000000000000000 40 \N +17 17 2000-01-01 173.0000000000000000 40 \N +19 19 2000-01-01 173.0000000000000000 40 \N +25 25 2000-01-01 173.0000000000000000 40 \N +30 30 2000-01-01 173.0000000000000000 40 \N +31 31 2000-01-01 173.0000000000000000 40 \N +36 36 2000-01-01 173.0000000000000000 40 \N +37 37 2000-01-01 173.0000000000000000 40 \N +41 41 2000-01-01 173.0000000000000000 40 \N +42 42 2000-01-01 173.0000000000000000 40 \N +44 44 2000-01-01 173.0000000000000000 40 \N +45 45 2000-01-01 173.0000000000000000 40 \N +1 1 2015-06-22 173.0000000000000000 40 \N +2 2 2005-04-19 173.0000000000000000 40 \N +3 3 2007-08-14 173.0000000000000000 40 \N +4 4 2015-04-01 173.0000000000000000 40 \N +5 5 2015-03-10 173.0000000000000000 40 \N +7 7 2015-11-09 173.0000000000000000 40 \N +8 8 2016-02-13 173.0000000000000000 40 \N +9 9 2016-01-18 173.0000000000000000 40 \N +15 15 2014-11-15 173.0000000000000000 40 \N +16 16 2015-10-08 173.0000000000000000 40 \N +18 18 2016-05-30 173.0000000000000000 40 \N +20 20 2015-12-01 173.0000000000000000 40 \N +21 21 2005-01-08 173.0000000000000000 40 \N +22 22 2014-04-15 173.0000000000000000 40 \N +23 23 2013-01-07 173.0000000000000000 40 \N +24 24 2005-05-01 173.0000000000000000 40 \N +26 26 2008-07-10 173.0000000000000000 40 \N +27 27 2013-01-07 173.0000000000000000 40 \N +28 28 2012-10-03 173.0000000000000000 40 \N +29 29 2015-06-01 173.0000000000000000 40 \N +32 32 2006-10-23 173.0000000000000000 40 \N +33 33 1995-07-01 173.0000000000000000 40 \N +34 34 1992-03-15 173.0000000000000000 40 \N +35 35 2011-07-05 173.0000000000000000 40 \N +38 38 2010-10-04 173.0000000000000000 40 \N \. -- --- Data for Name: staffperiodbase; Type: TABLE DATA; Schema: portanova; Owner: potlu_user --- - -COPY portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) FROM stdin; -39 39 2015-07-01 64.8750000000000000 15 -40 40 2011-10-01 86.5000000000000000 20 -11 11 2000-01-01 129.7500000000000000 30 -43 43 2000-01-01 129.7500000000000000 30 -6 6 2000-01-01 173.0000000000000000 40 -10 10 2000-01-01 173.0000000000000000 40 -12 12 2000-01-01 173.0000000000000000 40 -13 13 2000-01-01 173.0000000000000000 40 -14 14 2000-01-01 173.0000000000000000 40 -17 17 2000-01-01 173.0000000000000000 40 -19 19 2000-01-01 173.0000000000000000 40 -25 25 2000-01-01 173.0000000000000000 40 -30 30 2000-01-01 173.0000000000000000 40 -31 31 2000-01-01 173.0000000000000000 40 -36 36 2000-01-01 173.0000000000000000 40 -37 37 2000-01-01 173.0000000000000000 40 -41 41 2000-01-01 173.0000000000000000 40 -42 42 2000-01-01 173.0000000000000000 40 -44 44 2000-01-01 173.0000000000000000 40 -45 45 2000-01-01 173.0000000000000000 40 -1 1 2015-06-22 173.0000000000000000 40 -2 2 2005-04-19 173.0000000000000000 40 -3 3 2007-08-14 173.0000000000000000 40 -4 4 2015-04-01 173.0000000000000000 40 -5 5 2015-03-10 173.0000000000000000 40 -7 7 2015-11-09 173.0000000000000000 40 -8 8 2016-02-13 173.0000000000000000 40 -9 9 2016-01-18 173.0000000000000000 40 -15 15 2014-11-15 173.0000000000000000 40 -16 16 2015-10-08 173.0000000000000000 40 -18 18 2016-05-30 173.0000000000000000 40 -20 20 2015-12-01 173.0000000000000000 40 -21 21 2005-01-08 173.0000000000000000 40 -22 22 2014-04-15 173.0000000000000000 40 -23 23 2013-01-07 173.0000000000000000 40 -24 24 2005-05-01 173.0000000000000000 40 -26 26 2008-07-10 173.0000000000000000 40 -27 27 2013-01-07 173.0000000000000000 40 -28 28 2012-10-03 173.0000000000000000 40 -29 29 2015-06-01 173.0000000000000000 40 -32 32 2006-10-23 173.0000000000000000 40 -33 33 1995-07-01 173.0000000000000000 40 -34 34 1992-03-15 173.0000000000000000 40 -35 35 2011-07-05 173.0000000000000000 40 -38 38 2010-10-04 173.0000000000000000 40 +-- Data for Name: staffgroups; Type: TABLE DATA; Schema: portanova; Owner: potlu_user +-- + +COPY portanova.staffgroups (id, groupname, groupcolor) FROM stdin; +1 cuisine \N +2 service \N +3 caisse \N \. @@ -2622,8 +2639,13 @@ COPY portanova.staffvacancyyear (id, id_staff, vyear, hours, days) FROM stdin; -- COPY portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) FROM stdin; +3118 3 2019-12-30 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N 1817 34 2017-07-07 \N \N \N \N \N \N \N 1847 37 2017-07-15 \N \N \N \N \N \N \N +3119 3 2019-12-31 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N +3120 3 2020-01-01 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N +3121 3 2020-01-02 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N +3122 3 2020-01-03 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N 2405 20 2017-06-17 \N \N \N \N \N \N \N 1767 8 2017-07-05 10:30:00 15:00:00 18:00:00 23:45:00 01:00:00 \N \N 1768 8 2017-07-12 10:30:00 15:00:00 18:00:00 23:45:00 01:00:00 \N \N @@ -4005,14 +4027,14 @@ COPY portanova.worktypes (id, worktype, isworktime, isfreetime, typecolor) FROM -- COPY public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) FROM stdin; -7 staff Employé(e)s Employé(e)s 1 group.svg 4 schema 8 timetrackers Pointeuses Pointeuses \N cube.svg 7 schema 10 sites Sites Sites \N cube.svg 6 schema -11 workplans Plans de travail Plans (modèles) 1 cube.svg 8 schema -9 planning Planning POT 1 cube.svg 5 schema -4 profile Profil mes coordonnées 1 user.svg 9 global -6 companies Entreprise entreprise 1 company.svg 10 global -5 users Utilisateurs autres utilisateurs 1 group.svg 11 global +4 profile Profil mes coordonnées 5 user.svg 9 global +5 users Utilisateurs utilisateurs 2 group.svg 11 global +7 staff Employé(e)s employé(e)s 3 group.svg 4 schema +9 planning Planning POT 3 poticon.svg 5 schema +6 companies Entreprise entreprise 2 cube.svg 10 global +11 workplans Plans de travail plans (modèles) 3 calendar.svg 8 schema \. @@ -4020,8 +4042,8 @@ COPY public.apps (id, app, description, name, id_usergroup, icon, sort, menutype -- Data for Name: companies; Type: TABLE DATA; Schema: public; Owner: potlu_user -- -COPY public.companies (id, company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email) FROM stdin; -1 DKS s.à r.l. 4, rue Principale 3770 Tétange Luxembourg \N \N \N portanova \N \N \N +COPY public.companies (id, company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated) FROM stdin; +1 DKS 8b, rue du Moulin 6914 Roodt-sur-Syre Luxemburg \N \N \N portanova \N \N support@dks.lu s.à r.l. \N \. @@ -4030,6 +4052,7 @@ COPY public.companies (id, company, address, zip, city, country, tradetype, comr -- COPY public.maillayouts (id, layoutname, mailtemplate) FROM stdin; +1 potbasic \r\n \r\n \r\n \r\n \r\n \r\n
\r\n POT - Plan d'organisation de travail\r\n
\r\n
\r\n %%BODYCONTENT%%\r\n
\r\n
\r\n
\r\n \r\n \. @@ -4038,15 +4061,13 @@ COPY public.maillayouts (id, layoutname, mailtemplate) FROM stdin; -- COPY public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) FROM stdin; -\. - - --- --- Data for Name: members; Type: TABLE DATA; Schema: public; Owner: potlu_user --- - -COPY public.members (id, surname, prename, phone, id_user, id_company, job) FROM stdin; -1 Saffran Kilian \N 1 1 \N +1 user_registration Bonjour %%prename%% %%surname%%,
\n
\nMerci pour votre création de compte sur pot.lu,\n

\nvotre login: %%username%%
\nvotre mot de passe: %%password%%\n
\nMeilleurs salutations,
\n
\nPOT Support Team select prename,surname,username from users where id='%%id%%'; support@dks.lu Confirmation requis pour votre création de compte sur pot.lu 1 +2 user_forgotpasswd Bonjour %%prename%% %%surname%%,

\n\nvous avez demandé un nouveau mot de passe via pot.lu!
\nnouveau mot de passe: %%newpassword%%

\n
\nMeilleurs salutations,
\n
\nPOT Support Team\n\n\n\n select prename,surname from users where id='%%id%%'; support@dks.lu Nouveau mot de passe pour le site pot.lu 1 +3 user_expiration_notice Bonjour %%prename%% %%surname%%,
\n
\nVotre souscription au site pot.lu expire bientôt,\n

\nn'oublié pas à la prolonger!\nProlonger maintenant\n
\nMeilleurs salutations,
\n
\npot.lu Support Team select prename,surname from users where id='%%id%%'; support@dks.lu Notice d'expiration de votre souscription sur pot.lu 1 +4 user_invoice_paypal Bonjour %%prename%% %%surname%%,
\n
\nEn annexe vous trouvez la facture pour votre souscription au site pot.lu,\n
\nVous avez Payé déjà via PayPal!\n\nMeilleurs salutations,
\n
\npot.lu Support Team select prename,surname from users where id='%%id%%'; support@dks.lu Info facture pour votre souscription sur pot.lu 1 +5 user_invoice Bonjour %%prename%% %%surname%%,
\n
\nEn annexe vous trouvez la facture pour votre souscription au site pot.lu,\n
\n\nMeilleurs salutations,
\n
\nPOT Support Team select prename,surname from users where id='%%id%%'; support@dks.lu Facture concernant votre souscription sur pot.lu 1 +6 user_verification Bonjour %%prename%% %%surname%%,
\r\n
\r\nLe code pour valider votre e-mail est:\r\n
\r\n%%vcode%%
\r\n
\r\nentrez le code ici: %%siteurl%%/backoffice/validationcode.html\r\n
\r\nMéilleurs Salutations,
\r\n
\r\npot.lu Support Team select prename,surname,username from users where id='%%id%%'; support@dks.lu Validation de votre Email pour le site pot.lu 1 +7 user_newpassword Bonjour %%prename%% %%surname%%,
\r\n
\r\nNous avons crées / modifé votre compte sur le site pot.lu;
\r\n
\r\nVotre Login: %%username%%
\r\nMot de passe: %%newpassword%%

\r\n
\r\nméilleurs Salutations,
\r\n
\r\npot.lu Support-Team
\r\n select prename,surname,username from users where id='%%id%%'; support@dks.lu coordonnées d'accès de votre compte sur pot.lu 1 \. @@ -4060,10 +4081,12 @@ COPY public.sessions (id, idsession, id_user, user_agent, remote_addr, created) 113 HaDg0Eh9nIk7lftrHDtQpaKiLWL66VoEWRKMmSLz 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 ::1 2019-12-09 11:33:13.202044 114 aSli1lR9B0ETjICf7IFjVxhphLd8dhRdZ2mRd4RE 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362 ::1 2019-12-10 15:55:53.526432 122 Sp2D9CvtdjQHaxLPkEXgqSMSveIJwQde56I5y3oC 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 2001:7e8:cc73:de00:d970:312a:d5d:db83 2019-12-12 07:06:51.913155 -123 klCMzztihKleI4E0zhnmNMrlL8sAUIj5TLHjb0si 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 ::1 2019-12-13 08:27:53.789037 +124 NUTU0TkWd81oxH4ig52WCA3HzccA3bmHW5sMPCyT 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 ::1 2019-12-15 11:44:06.485589 93 5P7159lXg8xY83Iu7eZC3hj3Oi6x29jXOhPKg0yn 1 Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36 ::1 2019-12-04 14:58:48.993651 98 9UisAitYaoxdqtBaWUI37R04CiBlFxcp0STuCOZRU 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 ::1 2019-12-05 07:34:07.997426 99 v6wZ65qozoWn5P32q4wg16224TcOAM1VJnLFj1UJ 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 192.168.178.23 2019-12-05 07:35:01.756219 +160 pMEnznbOdbCeLbtKUwxgVbn2PNVzrF0HhvVHIWmL 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 ::1 2019-12-20 12:48:16.464228 +161 fvhUhEhy8bRQnrZd1I0oVdAwntMj86Xdr5Yzz6Yy 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36 ::1 2019-12-22 09:58:14.675553 \. @@ -4074,27 +4097,37 @@ COPY public.sessions (id, idsession, id_user, user_agent, remote_addr, created) COPY public.usergroups (id, usergroup, isdefault, groupname) FROM stdin; 1 superadmin \N SuperAdmin 2 admin \N Admin -3 company \N Entreprise 4 site \N Site 5 user t Utilisateur +3 manager \N Gérant \. -- --- Data for Name: useringroups; Type: TABLE DATA; Schema: public; Owner: potlu_user +-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: potlu_user -- -COPY public.useringroups (id, id_user, id_group) FROM stdin; -1 1 1 +COPY public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company) FROM stdin; +2 f7252754a4cb7391d966316351b3501bce81fee9bc0b71807ddf61281a27821e 2019-12-20 11:03:08.757357 \N kilian@saffran.lu \N \N ["portanova"] ["5"] Saffran Kilian 691504574 \N 1 +1 228c27a646f18ce069bc2b8ef091a03c46cd51557e5b5ac90abc05c4f635b3ba 2019-10-10 17:12:11.934747 \N kilian.saffran@gmail.com \N 6tgfkew ["portanova"] ["2","5","3"] Saffran Kilian +352691504574 Gérant 1 \. -- --- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: potlu_user +-- Data for Name: zzold_members; Type: TABLE DATA; Schema: public; Owner: potlu_user +-- + +COPY public.zzold_members (id, surname, prename, phone, id_user, id_company, job) FROM stdin; +1 Saffran Kilian \N 1 1 \N +\. + + +-- +-- Data for Name: zzold_useringroups; Type: TABLE DATA; Schema: public; Owner: potlu_user -- -COPY public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess) FROM stdin; -1 0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-10-10 17:12:11.934747 \N ksaffran@dks.lu \N \N \N +COPY public.zzold_useringroups (id, id_user, id_group) FROM stdin; +1 1 1 \. @@ -4119,25 +4152,11 @@ SELECT pg_catalog.setval('demo.stations_id_seq', 1, false); SELECT pg_catalog.setval('demo.timetrackuser_id_seq', 5, true); --- --- Name: defaultweekworkplan_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: potlu_user --- - -SELECT pg_catalog.setval('portanova.defaultweekworkplan_id_seq', 1, false); - - --- --- Name: defaultworkplan_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: potlu_user --- - -SELECT pg_catalog.setval('portanova.defaultworkplan_id_seq', 1, false); - - -- -- Name: reportperiod_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: potlu_user -- -SELECT pg_catalog.setval('portanova.reportperiod_id_seq', 1, true); +SELECT pg_catalog.setval('portanova.reportperiod_id_seq', 7, true); -- @@ -4158,7 +4177,7 @@ SELECT pg_catalog.setval('portanova.staff_id_seq', 45, true); -- Name: staffgroups_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: potlu_user -- -SELECT pg_catalog.setval('portanova.staffgroups_id_seq', 1, false); +SELECT pg_catalog.setval('portanova.staffgroups_id_seq', 3, true); -- @@ -4193,7 +4212,7 @@ SELECT pg_catalog.setval('portanova.staffvacancyyear_id_seq', 1, false); -- Name: staffworkplan_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: potlu_user -- -SELECT pg_catalog.setval('portanova.staffworkplan_id_seq', 3117, true); +SELECT pg_catalog.setval('portanova.staffworkplan_id_seq', 3122, true); -- @@ -4221,21 +4240,21 @@ SELECT pg_catalog.setval('public.apps_id_seq', 11, true); -- Name: companies_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.companies_id_seq', 1, true); +SELECT pg_catalog.setval('public.companies_id_seq', 24, true); -- -- Name: maillayouts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.maillayouts_id_seq', 1, false); +SELECT pg_catalog.setval('public.maillayouts_id_seq', 1, true); -- -- Name: mailtemplates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.mailtemplates_id_seq', 1, false); +SELECT pg_catalog.setval('public.mailtemplates_id_seq', 7, true); -- @@ -4249,7 +4268,7 @@ SELECT pg_catalog.setval('public.members_id_seq', 1, false); -- Name: sessions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.sessions_id_seq', 123, true); +SELECT pg_catalog.setval('public.sessions_id_seq', 161, true); -- @@ -4270,7 +4289,7 @@ SELECT pg_catalog.setval('public.useringroups_id_seq', 1, true); -- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.users_id_seq', 1, false); +SELECT pg_catalog.setval('public.users_id_seq', 2, true); -- @@ -4297,22 +4316,6 @@ ALTER TABLE ONLY demo.timetrackuser ADD CONSTRAINT timetrackuser_pkey PRIMARY KEY (id); --- --- Name: defaultweekworkplan defaultweekworkplan_pkey; Type: CONSTRAINT; Schema: portanova; Owner: potlu_user --- - -ALTER TABLE ONLY portanova.defaultweekworkplan - ADD CONSTRAINT defaultweekworkplan_pkey PRIMARY KEY (id); - - --- --- Name: defaultworkplan defaultworkplan_pkey; Type: CONSTRAINT; Schema: portanova; Owner: potlu_user --- - -ALTER TABLE ONLY portanova.defaultworkplan - ADD CONSTRAINT defaultworkplan_pkey PRIMARY KEY (id); - - -- -- Name: reportperiod reportperiod_pkey; Type: CONSTRAINT; Schema: portanova; Owner: potlu_user -- @@ -4346,10 +4349,10 @@ ALTER TABLE ONLY portanova.staffgroups -- --- Name: staffperiodbase staffperiodbase_pkey; Type: CONSTRAINT; Schema: portanova; Owner: potlu_user +-- Name: staffcontract staffperiodbase_pkey; Type: CONSTRAINT; Schema: portanova; Owner: potlu_user -- -ALTER TABLE ONLY portanova.staffperiodbase +ALTER TABLE ONLY portanova.staffcontract ADD CONSTRAINT staffperiodbase_pkey PRIMARY KEY (id); @@ -4434,10 +4437,10 @@ ALTER TABLE ONLY public.mailtemplates -- --- Name: members members_pkey; Type: CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_members members_pkey; Type: CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.members +ALTER TABLE ONLY public.zzold_members ADD CONSTRAINT members_pkey PRIMARY KEY (id); @@ -4458,10 +4461,10 @@ ALTER TABLE ONLY public.usergroups -- --- Name: useringroups useringroups_pkey; Type: CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups useringroups_pkey; Type: CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_pkey PRIMARY KEY (id); @@ -4482,33 +4485,35 @@ ALTER TABLE ONLY public.sessions -- --- Name: vw_userlist _RETURN; Type: RULE; Schema: public; Owner: potlu_user +-- Name: vw_userslist _RETURN; Type: RULE; Schema: public; Owner: potlu_user -- -CREATE OR REPLACE VIEW public.vw_userlist AS +CREATE OR REPLACE VIEW public.vw_userslist AS SELECT us.id, - mb.id AS id_member, - COALESCE(us.username, ''::text) AS username, - mb.prename, - mb.surname, us.blocked, - string_agg(ug.groupname, ','::text) AS group_ids, - co.id AS id_company, - co.company - FROM ((((public.users us - LEFT JOIN public.members mb ON ((us.id = mb.id_user))) - LEFT JOIN public.useringroups uig ON ((us.id = uig.id_user))) - JOIN public.usergroups ug ON ((uig.id_group = ug.id))) - LEFT JOIN public.companies co ON ((mb.id_company = co.id))) - GROUP BY us.id, mb.id, co.id - ORDER BY mb.surname, mb.prename; + us.username, + json_array_elements_text(us.schemaaccess) AS schemaaccess, + us.surname, + us.prename, + us.phone, + us.job, + us.id_company, + co.company, + string_agg(ugrp.groupname, ','::text) AS usergroups + FROM (((public.users us + LEFT JOIN public.companies co ON ((us.id_company = co.id))) + LEFT JOIN ( SELECT users.id AS id_user, + (json_array_elements_text(users.id_usergroups))::integer AS id_usergroup + FROM public.users) ugs ON ((ugs.id_user = us.id))) + LEFT JOIN public.usergroups ugrp ON ((ugrp.id = ugs.id_usergroup))) + GROUP BY us.id, co.id; -- --- Name: staffperiodbase trg_upd_portanova_weekhours; Type: TRIGGER; Schema: portanova; Owner: potlu_user +-- Name: staffcontract trg_upd_portanova_weekhours; Type: TRIGGER; Schema: portanova; Owner: potlu_user -- -CREATE TRIGGER trg_upd_portanova_weekhours BEFORE UPDATE OF weekhours ON portanova.staffperiodbase FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); +CREATE TRIGGER trg_upd_portanova_weekhours BEFORE UPDATE OF weekhours ON portanova.staffcontract FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); -- @@ -4528,26 +4533,26 @@ ALTER TABLE ONLY public.mailtemplates -- --- Name: members members_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_members members_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.members +ALTER TABLE ONLY public.zzold_members ADD CONSTRAINT members_users_fkey FOREIGN KEY (id_user) REFERENCES public.users(id); -- --- Name: useringroups useringroups_idgroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups useringroups_idgroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_idgroup_fkey FOREIGN KEY (id_group) REFERENCES public.usergroups(id); -- --- Name: useringroups useringroups_iduser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups useringroups_iduser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_iduser_fkey FOREIGN KEY (id_user) REFERENCES public.users(id); diff --git a/dev/db/potlu_db.pg.schema.sql b/dev/db/potlu_db.pg.schema.sql index f6c8ed80..189b2465 100644 --- a/dev/db/potlu_db.pg.schema.sql +++ b/dev/db/potlu_db.pg.schema.sql @@ -103,15 +103,12 @@ CREATE FUNCTION public.getsession(vidsession text, vremoteaddr text, vuseragent LANGUAGE plpgsql AS $$ BEGIN - return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se -join users us on (us.id=se.id_user) -left join useringroups uig on (us.id=uig.id_user) -left join usergroups aug on (aug.id=uig.id_group) -left join members mb on (mb.id_user=us.id) -left join companies co on (co.id=mb.id_company) -where se.idsession= vidsession -and se.remote_addr= vremoteaddr -and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id; + return QUERY select se.idsession,us.id,us.username,string_agg(distinct(ugrp.usergroup),',') as usergroups,json_array_elements_text(us.schemaaccess) as userschemata from sessions se +join users us on (us.id=se.id_user) +left join (SELECT users.id,json_array_elements_text(users.id_usergroups) AS id_usergroup FROM users) ugs on (us.id=ugs.id) +left join usergroups ugrp on (ugrp.id=ugs.id) +where se.idsession= vidsession and se.remote_addr= vremoteaddr and se.user_agent= vuseragent and +us.blocked is null group by se.id,us.id; END; $$; @@ -331,77 +328,6 @@ CREATE SEQUENCE demo.timetrackuser_id_seq ALTER SEQUENCE demo.timetrackuser_id_seq OWNED BY demo.timetrackuser.id; --- --- Name: defaultweekworkplan; Type: TABLE; Schema: portanova; Owner: - --- - -CREATE TABLE portanova.defaultweekworkplan ( - id integer NOT NULL, - id_staff integer, - startdate date, - mon json, - tue json, - wed json, - thu json, - fri json, - sat json, - sun json -); - - --- --- Name: defaultweekworkplan_id_seq; Type: SEQUENCE; Schema: portanova; Owner: - --- - -CREATE SEQUENCE portanova.defaultweekworkplan_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: defaultweekworkplan_id_seq; Type: SEQUENCE OWNED BY; Schema: portanova; Owner: - --- - -ALTER SEQUENCE portanova.defaultweekworkplan_id_seq OWNED BY portanova.defaultweekworkplan.id; - - --- --- Name: defaultworkplan; Type: TABLE; Schema: portanova; Owner: - --- - -CREATE TABLE portanova.defaultworkplan ( - id bigint NOT NULL, - id_staff integer, - daydate date, - plannedtimes json, - vacancytimes json, - presencetimes json -); - - --- --- Name: defaultworkplan_id_seq; Type: SEQUENCE; Schema: portanova; Owner: - --- - -CREATE SEQUENCE portanova.defaultworkplan_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: defaultworkplan_id_seq; Type: SEQUENCE OWNED BY; Schema: portanova; Owner: - --- - -ALTER SEQUENCE portanova.defaultworkplan_id_seq OWNED BY portanova.defaultworkplan.id; - - -- -- Name: reportperiod; Type: TABLE; Schema: portanova; Owner: - -- @@ -508,6 +434,20 @@ CREATE SEQUENCE portanova.staff_id_seq ALTER SEQUENCE portanova.staff_id_seq OWNED BY portanova.staff.id; +-- +-- Name: staffcontract; Type: TABLE; Schema: portanova; Owner: - +-- + +CREATE TABLE portanova.staffcontract ( + id integer NOT NULL, + id_staff integer, + startdate date, + monthhours numeric, + weekhours numeric, + id_staffgroup integer +); + + -- -- Name: staffgroups; Type: TABLE; Schema: portanova; Owner: - -- @@ -539,19 +479,6 @@ CREATE SEQUENCE portanova.staffgroups_id_seq ALTER SEQUENCE portanova.staffgroups_id_seq OWNED BY portanova.staffgroups.id; --- --- Name: staffperiodbase; Type: TABLE; Schema: portanova; Owner: - --- - -CREATE TABLE portanova.staffperiodbase ( - id integer NOT NULL, - id_staff integer, - startdate date, - monthhours numeric, - weekhours numeric -); - - -- -- Name: staffperiodbase_id_seq; Type: SEQUENCE; Schema: portanova; Owner: - -- @@ -569,7 +496,7 @@ CREATE SEQUENCE portanova.staffperiodbase_id_seq -- Name: staffperiodbase_id_seq; Type: SEQUENCE OWNED BY; Schema: portanova; Owner: - -- -ALTER SEQUENCE portanova.staffperiodbase_id_seq OWNED BY portanova.staffperiodbase.id; +ALTER SEQUENCE portanova.staffperiodbase_id_seq OWNED BY portanova.staffcontract.id; -- @@ -724,6 +651,75 @@ CREATE VIEW portanova.vw_reportperiodlist AS FROM portanova.reportperiod; +-- +-- Name: vw_staffcontractdata; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffcontractdata AS + SELECT staffcontract.id, + staffcontract.id_staff, + staffcontract.startdate, + staffcontract.monthhours, + staffcontract.weekhours, + staffcontract.id_staffgroup + FROM portanova.staffcontract; + + +-- +-- Name: vw_staffcontractlist; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffcontractlist AS + SELECT sc.id, + sc.id_staff, + sc.startdate, + sc.weekhours, + sc.monthhours, + sc.id_staffgroup, + sg.groupname, + sg.groupcolor + FROM (portanova.staffcontract sc + LEFT JOIN portanova.staffgroups sg ON ((sc.id_staffgroup = sg.id))); + + +-- +-- Name: vw_staffdata; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffdata AS + SELECT staff.id, + staff.staffnumber, + staff.surname, + staff.prename, + staff.job, + staff.birthdate, + staff.entrydate, + staff.leavedate + FROM portanova.staff; + + +-- +-- Name: vw_staffgroupsdata; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffgroupsdata AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM portanova.staffgroups; + + +-- +-- Name: vw_staffgroupslist; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffgroupslist AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM portanova.staffgroups; + + -- -- Name: vw_stafflist; Type: VIEW; Schema: portanova; Owner: - -- @@ -1037,27 +1033,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start1, + END) AS mon_timestart1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end1, + END) AS mon_timeend1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start2, + END) AS mon_timestart2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end2, + END) AS mon_timeend2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_pause, + END) AS mon_timepause, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1082,27 +1078,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start1, + END) AS tue_timestart1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end1, + END) AS tue_timeend1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start2, + END) AS tue_timestart2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end2, + END) AS tue_timeend2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_pause, + END) AS tue_timepause, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1127,27 +1123,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start1, + END) AS wed_timestart1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end1, + END) AS wed_timeend1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start2, + END) AS wed_timestart2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end2, + END) AS wed_timeend2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_pause, + END) AS wed_timepause, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1172,27 +1168,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start1, + END) AS thu_timestart1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end1, + END) AS thu_timeend1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start2, + END) AS thu_timestart2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end2, + END) AS thu_timeend2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_pause, + END) AS thu_timepause, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1217,27 +1213,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start1, + END) AS fri_timestart1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end1, + END) AS fri_timeend1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start2, + END) AS fri_timestart2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end2, + END) AS fri_timeend2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_pause, + END) AS fri_timepause, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1262,27 +1258,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start1, + END) AS sat_timestart1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end1, + END) AS sat_timeend1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start2, + END) AS sat_timestart2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end2, + END) AS sat_timeend2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_pause, + END) AS sat_timepause, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1307,27 +1303,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start1, + END) AS sun_timestart1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end1, + END) AS sun_timeend1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start2, + END) AS sun_timestart2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end2, + END) AS sun_timeend2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_pause, + END) AS sun_timepause, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1376,7 +1372,9 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CREATE VIEW portanova.vw_staffworkplanlist AS SELECT st.id AS id_staff, ((st.surname || ' '::text) || st.prename) AS staffname, - (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS calweek, + (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS dspcalweek, + (sp_dwt.calweek)::integer AS calweek, + sp_dwt.calyear, sp_dwt.week_timetotal, sp_dwt.weekbegin AS weekstart, date((sp_dwt.weekbegin + '7 days'::interval)) AS weekend, @@ -1499,31 +1497,31 @@ CREATE VIEW portanova.vw_staffworkplanlist AS ((to_number("left"(sp_dwt.week_timetotal, 2), '99'::text) * (60)::numeric) + to_number("right"(sp_dwt.week_timetotal, 2), '99'::text)) AS weekminutes, sp_dwt.mon_id, sp_dwt.weekbegin AS mon_date, - ((COALESCE(((to_char((sp_dwt.mon_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, + ((COALESCE(((to_char((sp_dwt.mon_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, sp_dwt.mon_timetotal, sp_dwt.tue_id, date((sp_dwt.weekbegin + '1 day'::interval)) AS tue_date, - ((COALESCE(((to_char((sp_dwt.tue_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, + ((COALESCE(((to_char((sp_dwt.tue_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, sp_dwt.tue_timetotal, sp_dwt.wed_id, date((sp_dwt.weekbegin + '2 days'::interval)) AS wed_date, - ((COALESCE(((to_char((sp_dwt.wed_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, + ((COALESCE(((to_char((sp_dwt.wed_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, sp_dwt.wed_timetotal, sp_dwt.thu_id, date((sp_dwt.weekbegin + '3 days'::interval)) AS thu_date, - ((COALESCE(((to_char((sp_dwt.thu_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, + ((COALESCE(((to_char((sp_dwt.thu_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, sp_dwt.thu_timetotal, sp_dwt.fri_id, date((sp_dwt.weekbegin + '4 days'::interval)) AS fri_date, - ((COALESCE(((to_char((sp_dwt.fri_start1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, + ((COALESCE(((to_char((sp_dwt.fri_timestart1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, sp_dwt.fri_timetotal, sp_dwt.sat_id, date((sp_dwt.weekbegin + '5 days'::interval)) AS sat_date, - ((COALESCE(((to_char((sp_dwt.sat_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, + ((COALESCE(((to_char((sp_dwt.sat_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, sp_dwt.sat_timetotal, sp_dwt.sun_id, date((sp_dwt.weekbegin + '6 days'::interval)) AS sun_date, - ((COALESCE(((to_char((sp_dwt.sun_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, + ((COALESCE(((to_char((sp_dwt.sun_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, sp_dwt.sun_timetotal FROM (portanova.vw_staffworkplan_weekly sp_dwt LEFT JOIN portanova.staff st ON ((sp_dwt.id_staff = st.id))) @@ -1753,7 +1751,9 @@ CREATE TABLE public.companies ( schemata text, validated boolean, schemata2 json, - email text + email text, + socialtype text, + vatvalidated boolean ); @@ -1844,10 +1844,10 @@ ALTER SEQUENCE public.mailtemplates_id_seq OWNED BY public.mailtemplates.id; -- --- Name: members; Type: TABLE; Schema: public; Owner: - +-- Name: zzold_members; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.members ( +CREATE TABLE public.zzold_members ( id integer NOT NULL, surname text, prename text, @@ -1875,7 +1875,7 @@ CREATE SEQUENCE public.members_id_seq -- Name: members_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.members_id_seq OWNED BY public.members.id; +ALTER SEQUENCE public.members_id_seq OWNED BY public.zzold_members.id; -- @@ -1944,10 +1944,10 @@ ALTER SEQUENCE public.usergroups_id_seq OWNED BY public.usergroups.id; -- --- Name: useringroups; Type: TABLE; Schema: public; Owner: - +-- Name: zzold_useringroups; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.useringroups ( +CREATE TABLE public.zzold_useringroups ( id integer NOT NULL, id_user bigint, id_group bigint @@ -1971,7 +1971,7 @@ CREATE SEQUENCE public.useringroups_id_seq -- Name: useringroups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.useringroups_id_seq OWNED BY public.useringroups.id; +ALTER SEQUENCE public.useringroups_id_seq OWNED BY public.zzold_useringroups.id; -- @@ -1986,7 +1986,13 @@ CREATE TABLE public.users ( username text, regcode text, vcode text, - schemaaccess json + schemaaccess json, + id_usergroups json, + surname text, + prename text, + phone text, + job text, + id_company integer ); @@ -2011,10 +2017,10 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; -- --- Name: vw_companydata; Type: VIEW; Schema: public; Owner: - +-- Name: vw_companiesdata; Type: VIEW; Schema: public; Owner: - -- -CREATE VIEW public.vw_companydata AS +CREATE VIEW public.vw_companiesdata AS SELECT companies.id, companies.company, companies.address, @@ -2024,67 +2030,99 @@ CREATE VIEW public.vw_companydata AS companies.tradetype, companies.comregister, companies.vatnumber, - companies.schemata AS link, - companies.validated + companies.schemata, + companies.validated, + companies.schemata2, + companies.email, + companies.socialtype, + companies.vatvalidated FROM public.companies; -- --- Name: vw_companylist; Type: VIEW; Schema: public; Owner: - +-- Name: vw_companieslist; Type: VIEW; Schema: public; Owner: - -- -CREATE VIEW public.vw_companylist AS - SELECT co.id, - co.company, - co.address, - co.zip, - co.city, - co.country, - ((((((co.address || '\n'::text) || co.zip) || ' '::text) || co.city) || ' '::text) || co.country) AS dspaddress, - co.schemata - FROM public.companies co; +CREATE VIEW public.vw_companieslist AS + SELECT companies.id, + companies.company, + companies.address, + companies.zip, + companies.city, + companies.country, + companies.tradetype, + companies.comregister, + companies.vatnumber, + companies.schemata, + companies.validated, + companies.schemata2, + companies.email, + companies.socialtype, + companies.vatvalidated + FROM public.companies; -- --- Name: vw_memberdata; Type: VIEW; Schema: public; Owner: - +-- Name: vw_schemata; Type: VIEW; Schema: public; Owner: - -- -CREATE VIEW public.vw_memberdata AS - SELECT members.id, - members.surname, - members.prename, - members.phone, - members.id_user, - members.id_company, - members.job - FROM public.members; +CREATE VIEW public.vw_schemata AS + SELECT schemata.schema_name AS schemaname + FROM information_schema.schemata + WHERE ((schemata.schema_owner)::text = 'potlu_user'::text); -- --- Name: vw_userdata; Type: VIEW; Schema: public; Owner: - +-- Name: vw_usergroupslist; Type: VIEW; Schema: public; Owner: - -- -CREATE VIEW public.vw_userdata AS +CREATE VIEW public.vw_usergroupslist AS + SELECT usergroups.id, + usergroups.usergroup, + usergroups.isdefault, + usergroups.groupname + FROM public.usergroups; + + +-- +-- Name: vw_usersdata; Type: VIEW; Schema: public; Owner: - +-- + +CREATE VIEW public.vw_usersdata AS SELECT users.id, - users.username + users.userpassword, + users.created, + users.blocked, + users.username, + users.regcode, + users.vcode, + users.schemaaccess, + users.id_usergroups, + users.surname, + users.prename, + users.phone, + users.job, + users.id_company FROM public.users; -- --- Name: vw_userlist; Type: VIEW; Schema: public; Owner: - +-- Name: vw_userslist; Type: VIEW; Schema: public; Owner: - -- -CREATE VIEW public.vw_userlist AS +CREATE VIEW public.vw_userslist AS SELECT NULL::integer AS id, - NULL::integer AS id_member, + NULL::boolean AS blocked, NULL::text AS username, - NULL::text AS prename, + NULL::text AS schemaaccess, NULL::text AS surname, - NULL::boolean AS blocked, - NULL::text AS group_ids, + NULL::text AS prename, + NULL::text AS phone, + NULL::text AS job, NULL::integer AS id_company, - NULL::text AS company; + NULL::text AS company, + NULL::text AS usergroups; -- @@ -2108,20 +2146,6 @@ ALTER TABLE ONLY demo.stations ALTER COLUMN id SET DEFAULT nextval('demo.station ALTER TABLE ONLY demo.timetrackuser ALTER COLUMN id SET DEFAULT nextval('demo.timetrackuser_id_seq'::regclass); --- --- Name: defaultweekworkplan id; Type: DEFAULT; Schema: portanova; Owner: - --- - -ALTER TABLE ONLY portanova.defaultweekworkplan ALTER COLUMN id SET DEFAULT nextval('portanova.defaultweekworkplan_id_seq'::regclass); - - --- --- Name: defaultworkplan id; Type: DEFAULT; Schema: portanova; Owner: - --- - -ALTER TABLE ONLY portanova.defaultworkplan ALTER COLUMN id SET DEFAULT nextval('portanova.defaultworkplan_id_seq'::regclass); - - -- -- Name: reportperiod id; Type: DEFAULT; Schema: portanova; Owner: - -- @@ -2144,17 +2168,17 @@ ALTER TABLE ONLY portanova.staff ALTER COLUMN id SET DEFAULT nextval('portanova. -- --- Name: staffgroups id; Type: DEFAULT; Schema: portanova; Owner: - +-- Name: staffcontract id; Type: DEFAULT; Schema: portanova; Owner: - -- -ALTER TABLE ONLY portanova.staffgroups ALTER COLUMN id SET DEFAULT nextval('portanova.staffgroups_id_seq'::regclass); +ALTER TABLE ONLY portanova.staffcontract ALTER COLUMN id SET DEFAULT nextval('portanova.staffperiodbase_id_seq'::regclass); -- --- Name: staffperiodbase id; Type: DEFAULT; Schema: portanova; Owner: - +-- Name: staffgroups id; Type: DEFAULT; Schema: portanova; Owner: - -- -ALTER TABLE ONLY portanova.staffperiodbase ALTER COLUMN id SET DEFAULT nextval('portanova.staffperiodbase_id_seq'::regclass); +ALTER TABLE ONLY portanova.staffgroups ALTER COLUMN id SET DEFAULT nextval('portanova.staffgroups_id_seq'::regclass); -- @@ -2228,38 +2252,38 @@ ALTER TABLE ONLY public.mailtemplates ALTER COLUMN id SET DEFAULT nextval('publi -- --- Name: members id; Type: DEFAULT; Schema: public; Owner: - +-- Name: sessions id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.members ALTER COLUMN id SET DEFAULT nextval('public.members_id_seq'::regclass); +ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); -- --- Name: sessions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: usergroups id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); +ALTER TABLE ONLY public.usergroups ALTER COLUMN id SET DEFAULT nextval('public.usergroups_id_seq'::regclass); -- --- Name: usergroups id; Type: DEFAULT; Schema: public; Owner: - +-- Name: users id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.usergroups ALTER COLUMN id SET DEFAULT nextval('public.usergroups_id_seq'::regclass); +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- --- Name: useringroups id; Type: DEFAULT; Schema: public; Owner: - +-- Name: zzold_members id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.useringroups ALTER COLUMN id SET DEFAULT nextval('public.useringroups_id_seq'::regclass); +ALTER TABLE ONLY public.zzold_members ALTER COLUMN id SET DEFAULT nextval('public.members_id_seq'::regclass); -- --- Name: users id; Type: DEFAULT; Schema: public; Owner: - +-- Name: zzold_useringroups id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); +ALTER TABLE ONLY public.zzold_useringroups ALTER COLUMN id SET DEFAULT nextval('public.useringroups_id_seq'::regclass); -- @@ -2286,22 +2310,6 @@ ALTER TABLE ONLY demo.timetrackuser ADD CONSTRAINT timetrackuser_pkey PRIMARY KEY (id); --- --- Name: defaultweekworkplan defaultweekworkplan_pkey; Type: CONSTRAINT; Schema: portanova; Owner: - --- - -ALTER TABLE ONLY portanova.defaultweekworkplan - ADD CONSTRAINT defaultweekworkplan_pkey PRIMARY KEY (id); - - --- --- Name: defaultworkplan defaultworkplan_pkey; Type: CONSTRAINT; Schema: portanova; Owner: - --- - -ALTER TABLE ONLY portanova.defaultworkplan - ADD CONSTRAINT defaultworkplan_pkey PRIMARY KEY (id); - - -- -- Name: reportperiod reportperiod_pkey; Type: CONSTRAINT; Schema: portanova; Owner: - -- @@ -2335,10 +2343,10 @@ ALTER TABLE ONLY portanova.staffgroups -- --- Name: staffperiodbase staffperiodbase_pkey; Type: CONSTRAINT; Schema: portanova; Owner: - +-- Name: staffcontract staffperiodbase_pkey; Type: CONSTRAINT; Schema: portanova; Owner: - -- -ALTER TABLE ONLY portanova.staffperiodbase +ALTER TABLE ONLY portanova.staffcontract ADD CONSTRAINT staffperiodbase_pkey PRIMARY KEY (id); @@ -2423,10 +2431,10 @@ ALTER TABLE ONLY public.mailtemplates -- --- Name: members members_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_members members_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.members +ALTER TABLE ONLY public.zzold_members ADD CONSTRAINT members_pkey PRIMARY KEY (id); @@ -2447,10 +2455,10 @@ ALTER TABLE ONLY public.usergroups -- --- Name: useringroups useringroups_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_useringroups useringroups_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_pkey PRIMARY KEY (id); @@ -2471,33 +2479,35 @@ ALTER TABLE ONLY public.sessions -- --- Name: vw_userlist _RETURN; Type: RULE; Schema: public; Owner: - +-- Name: vw_userslist _RETURN; Type: RULE; Schema: public; Owner: - -- -CREATE OR REPLACE VIEW public.vw_userlist AS +CREATE OR REPLACE VIEW public.vw_userslist AS SELECT us.id, - mb.id AS id_member, - COALESCE(us.username, ''::text) AS username, - mb.prename, - mb.surname, us.blocked, - string_agg(ug.groupname, ','::text) AS group_ids, - co.id AS id_company, - co.company - FROM ((((public.users us - LEFT JOIN public.members mb ON ((us.id = mb.id_user))) - LEFT JOIN public.useringroups uig ON ((us.id = uig.id_user))) - JOIN public.usergroups ug ON ((uig.id_group = ug.id))) - LEFT JOIN public.companies co ON ((mb.id_company = co.id))) - GROUP BY us.id, mb.id, co.id - ORDER BY mb.surname, mb.prename; + us.username, + json_array_elements_text(us.schemaaccess) AS schemaaccess, + us.surname, + us.prename, + us.phone, + us.job, + us.id_company, + co.company, + string_agg(ugrp.groupname, ','::text) AS usergroups + FROM (((public.users us + LEFT JOIN public.companies co ON ((us.id_company = co.id))) + LEFT JOIN ( SELECT users.id AS id_user, + (json_array_elements_text(users.id_usergroups))::integer AS id_usergroup + FROM public.users) ugs ON ((ugs.id_user = us.id))) + LEFT JOIN public.usergroups ugrp ON ((ugrp.id = ugs.id_usergroup))) + GROUP BY us.id, co.id; -- --- Name: staffperiodbase trg_upd_portanova_weekhours; Type: TRIGGER; Schema: portanova; Owner: - +-- Name: staffcontract trg_upd_portanova_weekhours; Type: TRIGGER; Schema: portanova; Owner: - -- -CREATE TRIGGER trg_upd_portanova_weekhours BEFORE UPDATE OF weekhours ON portanova.staffperiodbase FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); +CREATE TRIGGER trg_upd_portanova_weekhours BEFORE UPDATE OF weekhours ON portanova.staffcontract FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); -- @@ -2517,26 +2527,26 @@ ALTER TABLE ONLY public.mailtemplates -- --- Name: members members_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_members members_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.members +ALTER TABLE ONLY public.zzold_members ADD CONSTRAINT members_users_fkey FOREIGN KEY (id_user) REFERENCES public.users(id); -- --- Name: useringroups useringroups_idgroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_useringroups useringroups_idgroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_idgroup_fkey FOREIGN KEY (id_group) REFERENCES public.usergroups(id); -- --- Name: useringroups useringroups_iduser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_useringroups useringroups_iduser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_iduser_fkey FOREIGN KEY (id_user) REFERENCES public.users(id); diff --git a/dev/db/potlu_db.portanova.pg.data.sql b/dev/db/potlu_db.portanova.pg.data.sql index e301a0d5..1394bab6 100644 --- a/dev/db/potlu_db.portanova.pg.data.sql +++ b/dev/db/potlu_db.portanova.pg.data.sql @@ -21,6 +21,8 @@ SET row_security = off; -- INSERT INTO portanova.reportperiod (id, periodname, startdate, enddate) VALUES (1, 'Période 1 2020', '2019-12-30', '2020-02-23'); +INSERT INTO portanova.reportperiod (id, periodname, startdate, enddate) VALUES (5, 'Periode X', '2019-11-25', '2020-04-05'); +INSERT INTO portanova.reportperiod (id, periodname, startdate, enddate) VALUES (6, 'TEST', '2019-11-25', '2020-01-05'); -- @@ -81,60 +83,63 @@ INSERT INTO portanova.staff (id, staffnumber, surname, prename, job, birthdate, -- --- Data for Name: staffgroups; Type: TABLE DATA; Schema: portanova; Owner: - +-- Data for Name: staffcontract; Type: TABLE DATA; Schema: portanova; Owner: - -- +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (39, 39, '2015-07-01', 64.8750000000000000, 15, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (40, 40, '2011-10-01', 86.5000000000000000, 20, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (11, 11, '2000-01-01', 129.7500000000000000, 30, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (43, 43, '2000-01-01', 129.7500000000000000, 30, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (6, 6, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (10, 10, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (12, 12, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (13, 13, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (14, 14, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (17, 17, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (19, 19, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (25, 25, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (30, 30, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (31, 31, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (36, 36, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (37, 37, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (41, 41, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (42, 42, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (44, 44, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (45, 45, '2000-01-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (1, 1, '2015-06-22', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (2, 2, '2005-04-19', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (3, 3, '2007-08-14', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (4, 4, '2015-04-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (5, 5, '2015-03-10', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (7, 7, '2015-11-09', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (8, 8, '2016-02-13', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (9, 9, '2016-01-18', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (15, 15, '2014-11-15', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (16, 16, '2015-10-08', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (18, 18, '2016-05-30', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (20, 20, '2015-12-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (21, 21, '2005-01-08', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (22, 22, '2014-04-15', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (23, 23, '2013-01-07', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (24, 24, '2005-05-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (26, 26, '2008-07-10', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (27, 27, '2013-01-07', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (28, 28, '2012-10-03', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (29, 29, '2015-06-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (32, 32, '2006-10-23', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (33, 33, '1995-07-01', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (34, 34, '1992-03-15', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (35, 35, '2011-07-05', 173.0000000000000000, 40, NULL); +INSERT INTO portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) VALUES (38, 38, '2010-10-04', 173.0000000000000000, 40, NULL); -- --- Data for Name: staffperiodbase; Type: TABLE DATA; Schema: portanova; Owner: - +-- Data for Name: staffgroups; Type: TABLE DATA; Schema: portanova; Owner: - -- -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (39, 39, '2015-07-01', 64.8750000000000000, 15); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (40, 40, '2011-10-01', 86.5000000000000000, 20); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (11, 11, '2000-01-01', 129.7500000000000000, 30); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (43, 43, '2000-01-01', 129.7500000000000000, 30); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (6, 6, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (10, 10, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (12, 12, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (13, 13, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (14, 14, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (17, 17, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (19, 19, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (25, 25, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (30, 30, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (31, 31, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (36, 36, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (37, 37, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (41, 41, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (42, 42, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (44, 44, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (45, 45, '2000-01-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (1, 1, '2015-06-22', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (2, 2, '2005-04-19', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (3, 3, '2007-08-14', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (4, 4, '2015-04-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (5, 5, '2015-03-10', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (7, 7, '2015-11-09', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (8, 8, '2016-02-13', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (9, 9, '2016-01-18', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (15, 15, '2014-11-15', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (16, 16, '2015-10-08', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (18, 18, '2016-05-30', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (20, 20, '2015-12-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (21, 21, '2005-01-08', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (22, 22, '2014-04-15', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (23, 23, '2013-01-07', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (24, 24, '2005-05-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (26, 26, '2008-07-10', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (27, 27, '2013-01-07', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (28, 28, '2012-10-03', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (29, 29, '2015-06-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (32, 32, '2006-10-23', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (33, 33, '1995-07-01', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (34, 34, '1992-03-15', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (35, 35, '2011-07-05', 173.0000000000000000, 40); -INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) VALUES (38, 38, '2010-10-04', 173.0000000000000000, 40); +INSERT INTO portanova.staffgroups (id, groupname, groupcolor) VALUES (1, 'cuisine', NULL); +INSERT INTO portanova.staffgroups (id, groupname, groupcolor) VALUES (2, 'service', NULL); +INSERT INTO portanova.staffgroups (id, groupname, groupcolor) VALUES (3, 'caisse', NULL); -- @@ -159,8 +164,13 @@ INSERT INTO portanova.staffperiodbase (id, id_staff, startdate, monthhours, week -- Data for Name: staffworkplan; Type: TABLE DATA; Schema: portanova; Owner: - -- +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3118, 3, '2019-12-30', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (1817, 34, '2017-07-07', NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (1847, 37, '2017-07-15', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3119, 3, '2019-12-31', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3120, 3, '2020-01-01', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3121, 3, '2020-01-02', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); +INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (3122, 3, '2020-01-03', '08:00:00', '12:00:00', '14:00:00', '18:00:00', '01:00:00', NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (2405, 20, '2017-06-17', NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (1767, 8, '2017-07-05', '10:30:00', '15:00:00', '18:00:00', '23:45:00', '01:00:00', NULL, NULL); INSERT INTO portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) VALUES (1768, 8, '2017-07-12', '10:30:00', '15:00:00', '18:00:00', '23:45:00', '01:00:00', NULL, NULL); @@ -1536,7 +1546,7 @@ INSERT INTO portanova.worktypes (id, worktype, isworktime, isfreetime, typecolor -- Name: reportperiod_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: - -- -SELECT pg_catalog.setval('portanova.reportperiod_id_seq', 1, true); +SELECT pg_catalog.setval('portanova.reportperiod_id_seq', 7, true); -- @@ -1557,7 +1567,7 @@ SELECT pg_catalog.setval('portanova.staff_id_seq', 45, true); -- Name: staffgroups_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: - -- -SELECT pg_catalog.setval('portanova.staffgroups_id_seq', 1, false); +SELECT pg_catalog.setval('portanova.staffgroups_id_seq', 3, true); -- @@ -1592,7 +1602,7 @@ SELECT pg_catalog.setval('portanova.staffvacancyyear_id_seq', 1, false); -- Name: staffworkplan_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: - -- -SELECT pg_catalog.setval('portanova.staffworkplan_id_seq', 3117, true); +SELECT pg_catalog.setval('portanova.staffworkplan_id_seq', 3122, true); -- diff --git a/dev/db/potlu_db.portanova.pg.full.sql b/dev/db/potlu_db.portanova.pg.full.sql index 704f0eaf..d53a114b 100644 --- a/dev/db/potlu_db.portanova.pg.full.sql +++ b/dev/db/potlu_db.portanova.pg.full.sql @@ -147,6 +147,22 @@ ALTER TABLE portanova.staff_id_seq OWNER TO potlu_user; ALTER SEQUENCE portanova.staff_id_seq OWNED BY portanova.staff.id; +-- +-- Name: staffcontract; Type: TABLE; Schema: portanova; Owner: potlu_user +-- + +CREATE TABLE portanova.staffcontract ( + id integer NOT NULL, + id_staff integer, + startdate date, + monthhours numeric, + weekhours numeric, + id_staffgroup integer +); + + +ALTER TABLE portanova.staffcontract OWNER TO potlu_user; + -- -- Name: staffgroups; Type: TABLE; Schema: portanova; Owner: potlu_user -- @@ -182,21 +198,6 @@ ALTER TABLE portanova.staffgroups_id_seq OWNER TO potlu_user; ALTER SEQUENCE portanova.staffgroups_id_seq OWNED BY portanova.staffgroups.id; --- --- Name: staffperiodbase; Type: TABLE; Schema: portanova; Owner: potlu_user --- - -CREATE TABLE portanova.staffperiodbase ( - id integer NOT NULL, - id_staff integer, - startdate date, - monthhours numeric, - weekhours numeric -); - - -ALTER TABLE portanova.staffperiodbase OWNER TO potlu_user; - -- -- Name: staffperiodbase_id_seq; Type: SEQUENCE; Schema: portanova; Owner: potlu_user -- @@ -216,7 +217,7 @@ ALTER TABLE portanova.staffperiodbase_id_seq OWNER TO potlu_user; -- Name: staffperiodbase_id_seq; Type: SEQUENCE OWNED BY; Schema: portanova; Owner: potlu_user -- -ALTER SEQUENCE portanova.staffperiodbase_id_seq OWNED BY portanova.staffperiodbase.id; +ALTER SEQUENCE portanova.staffperiodbase_id_seq OWNED BY portanova.staffcontract.id; -- @@ -389,6 +390,85 @@ CREATE VIEW portanova.vw_reportperiodlist AS ALTER TABLE portanova.vw_reportperiodlist OWNER TO potlu_user; +-- +-- Name: vw_staffcontractdata; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffcontractdata AS + SELECT staffcontract.id, + staffcontract.id_staff, + staffcontract.startdate, + staffcontract.monthhours, + staffcontract.weekhours, + staffcontract.id_staffgroup + FROM portanova.staffcontract; + + +ALTER TABLE portanova.vw_staffcontractdata OWNER TO potlu_user; + +-- +-- Name: vw_staffcontractlist; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffcontractlist AS + SELECT sc.id, + sc.id_staff, + sc.startdate, + sc.weekhours, + sc.monthhours, + sc.id_staffgroup, + sg.groupname, + sg.groupcolor + FROM (portanova.staffcontract sc + LEFT JOIN portanova.staffgroups sg ON ((sc.id_staffgroup = sg.id))); + + +ALTER TABLE portanova.vw_staffcontractlist OWNER TO potlu_user; + +-- +-- Name: vw_staffdata; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffdata AS + SELECT staff.id, + staff.staffnumber, + staff.surname, + staff.prename, + staff.job, + staff.birthdate, + staff.entrydate, + staff.leavedate + FROM portanova.staff; + + +ALTER TABLE portanova.vw_staffdata OWNER TO potlu_user; + +-- +-- Name: vw_staffgroupsdata; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffgroupsdata AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM portanova.staffgroups; + + +ALTER TABLE portanova.vw_staffgroupsdata OWNER TO potlu_user; + +-- +-- Name: vw_staffgroupslist; Type: VIEW; Schema: portanova; Owner: potlu_user +-- + +CREATE VIEW portanova.vw_staffgroupslist AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM portanova.staffgroups; + + +ALTER TABLE portanova.vw_staffgroupslist OWNER TO potlu_user; + -- -- Name: vw_stafflist; Type: VIEW; Schema: portanova; Owner: potlu_user -- @@ -706,27 +786,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start1, + END) AS mon_timestart1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end1, + END) AS mon_timeend1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start2, + END) AS mon_timestart2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end2, + END) AS mon_timeend2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_pause, + END) AS mon_timepause, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -751,27 +831,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start1, + END) AS tue_timestart1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end1, + END) AS tue_timeend1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start2, + END) AS tue_timestart2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end2, + END) AS tue_timeend2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_pause, + END) AS tue_timepause, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -796,27 +876,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start1, + END) AS wed_timestart1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end1, + END) AS wed_timeend1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start2, + END) AS wed_timestart2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end2, + END) AS wed_timeend2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_pause, + END) AS wed_timepause, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -841,27 +921,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start1, + END) AS thu_timestart1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end1, + END) AS thu_timeend1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start2, + END) AS thu_timestart2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end2, + END) AS thu_timeend2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_pause, + END) AS thu_timepause, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -886,27 +966,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start1, + END) AS fri_timestart1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end1, + END) AS fri_timeend1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start2, + END) AS fri_timestart2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end2, + END) AS fri_timeend2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_pause, + END) AS fri_timepause, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -931,27 +1011,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start1, + END) AS sat_timestart1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end1, + END) AS sat_timeend1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start2, + END) AS sat_timestart2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end2, + END) AS sat_timeend2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_pause, + END) AS sat_timepause, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -976,27 +1056,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start1, + END) AS sun_timestart1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end1, + END) AS sun_timeend1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start2, + END) AS sun_timestart2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end2, + END) AS sun_timeend2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_pause, + END) AS sun_timepause, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1047,7 +1127,9 @@ ALTER TABLE portanova.vw_staffworkplan_weekly OWNER TO potlu_user; CREATE VIEW portanova.vw_staffworkplanlist AS SELECT st.id AS id_staff, ((st.surname || ' '::text) || st.prename) AS staffname, - (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS calweek, + (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS dspcalweek, + (sp_dwt.calweek)::integer AS calweek, + sp_dwt.calyear, sp_dwt.week_timetotal, sp_dwt.weekbegin AS weekstart, date((sp_dwt.weekbegin + '7 days'::interval)) AS weekend, @@ -1170,31 +1252,31 @@ CREATE VIEW portanova.vw_staffworkplanlist AS ((to_number("left"(sp_dwt.week_timetotal, 2), '99'::text) * (60)::numeric) + to_number("right"(sp_dwt.week_timetotal, 2), '99'::text)) AS weekminutes, sp_dwt.mon_id, sp_dwt.weekbegin AS mon_date, - ((COALESCE(((to_char((sp_dwt.mon_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, + ((COALESCE(((to_char((sp_dwt.mon_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, sp_dwt.mon_timetotal, sp_dwt.tue_id, date((sp_dwt.weekbegin + '1 day'::interval)) AS tue_date, - ((COALESCE(((to_char((sp_dwt.tue_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, + ((COALESCE(((to_char((sp_dwt.tue_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, sp_dwt.tue_timetotal, sp_dwt.wed_id, date((sp_dwt.weekbegin + '2 days'::interval)) AS wed_date, - ((COALESCE(((to_char((sp_dwt.wed_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, + ((COALESCE(((to_char((sp_dwt.wed_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, sp_dwt.wed_timetotal, sp_dwt.thu_id, date((sp_dwt.weekbegin + '3 days'::interval)) AS thu_date, - ((COALESCE(((to_char((sp_dwt.thu_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, + ((COALESCE(((to_char((sp_dwt.thu_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, sp_dwt.thu_timetotal, sp_dwt.fri_id, date((sp_dwt.weekbegin + '4 days'::interval)) AS fri_date, - ((COALESCE(((to_char((sp_dwt.fri_start1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, + ((COALESCE(((to_char((sp_dwt.fri_timestart1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, sp_dwt.fri_timetotal, sp_dwt.sat_id, date((sp_dwt.weekbegin + '5 days'::interval)) AS sat_date, - ((COALESCE(((to_char((sp_dwt.sat_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, + ((COALESCE(((to_char((sp_dwt.sat_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, sp_dwt.sat_timetotal, sp_dwt.sun_id, date((sp_dwt.weekbegin + '6 days'::interval)) AS sun_date, - ((COALESCE(((to_char((sp_dwt.sun_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, + ((COALESCE(((to_char((sp_dwt.sun_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, sp_dwt.sun_timetotal FROM (portanova.vw_staffworkplan_weekly sp_dwt LEFT JOIN portanova.staff st ON ((sp_dwt.id_staff = st.id))) @@ -1409,17 +1491,17 @@ ALTER TABLE ONLY portanova.staff ALTER COLUMN id SET DEFAULT nextval('portanova. -- --- Name: staffgroups id; Type: DEFAULT; Schema: portanova; Owner: potlu_user +-- Name: staffcontract id; Type: DEFAULT; Schema: portanova; Owner: potlu_user -- -ALTER TABLE ONLY portanova.staffgroups ALTER COLUMN id SET DEFAULT nextval('portanova.staffgroups_id_seq'::regclass); +ALTER TABLE ONLY portanova.staffcontract ALTER COLUMN id SET DEFAULT nextval('portanova.staffperiodbase_id_seq'::regclass); -- --- Name: staffperiodbase id; Type: DEFAULT; Schema: portanova; Owner: potlu_user +-- Name: staffgroups id; Type: DEFAULT; Schema: portanova; Owner: potlu_user -- -ALTER TABLE ONLY portanova.staffperiodbase ALTER COLUMN id SET DEFAULT nextval('portanova.staffperiodbase_id_seq'::regclass); +ALTER TABLE ONLY portanova.staffgroups ALTER COLUMN id SET DEFAULT nextval('portanova.staffgroups_id_seq'::regclass); -- @@ -1470,6 +1552,8 @@ ALTER TABLE ONLY portanova.worktypes ALTER COLUMN id SET DEFAULT nextval('portan COPY portanova.reportperiod (id, periodname, startdate, enddate) FROM stdin; 1 Période 1 2020 2019-12-30 2020-02-23 +5 Periode X 2019-11-25 2020-04-05 +6 TEST 2019-11-25 2020-01-05 \. @@ -1535,63 +1619,66 @@ COPY portanova.staff (id, staffnumber, surname, prename, job, birthdate, entryda -- --- Data for Name: staffgroups; Type: TABLE DATA; Schema: portanova; Owner: potlu_user --- - -COPY portanova.staffgroups (id, groupname, groupcolor) FROM stdin; +-- Data for Name: staffcontract; Type: TABLE DATA; Schema: portanova; Owner: potlu_user +-- + +COPY portanova.staffcontract (id, id_staff, startdate, monthhours, weekhours, id_staffgroup) FROM stdin; +39 39 2015-07-01 64.8750000000000000 15 \N +40 40 2011-10-01 86.5000000000000000 20 \N +11 11 2000-01-01 129.7500000000000000 30 \N +43 43 2000-01-01 129.7500000000000000 30 \N +6 6 2000-01-01 173.0000000000000000 40 \N +10 10 2000-01-01 173.0000000000000000 40 \N +12 12 2000-01-01 173.0000000000000000 40 \N +13 13 2000-01-01 173.0000000000000000 40 \N +14 14 2000-01-01 173.0000000000000000 40 \N +17 17 2000-01-01 173.0000000000000000 40 \N +19 19 2000-01-01 173.0000000000000000 40 \N +25 25 2000-01-01 173.0000000000000000 40 \N +30 30 2000-01-01 173.0000000000000000 40 \N +31 31 2000-01-01 173.0000000000000000 40 \N +36 36 2000-01-01 173.0000000000000000 40 \N +37 37 2000-01-01 173.0000000000000000 40 \N +41 41 2000-01-01 173.0000000000000000 40 \N +42 42 2000-01-01 173.0000000000000000 40 \N +44 44 2000-01-01 173.0000000000000000 40 \N +45 45 2000-01-01 173.0000000000000000 40 \N +1 1 2015-06-22 173.0000000000000000 40 \N +2 2 2005-04-19 173.0000000000000000 40 \N +3 3 2007-08-14 173.0000000000000000 40 \N +4 4 2015-04-01 173.0000000000000000 40 \N +5 5 2015-03-10 173.0000000000000000 40 \N +7 7 2015-11-09 173.0000000000000000 40 \N +8 8 2016-02-13 173.0000000000000000 40 \N +9 9 2016-01-18 173.0000000000000000 40 \N +15 15 2014-11-15 173.0000000000000000 40 \N +16 16 2015-10-08 173.0000000000000000 40 \N +18 18 2016-05-30 173.0000000000000000 40 \N +20 20 2015-12-01 173.0000000000000000 40 \N +21 21 2005-01-08 173.0000000000000000 40 \N +22 22 2014-04-15 173.0000000000000000 40 \N +23 23 2013-01-07 173.0000000000000000 40 \N +24 24 2005-05-01 173.0000000000000000 40 \N +26 26 2008-07-10 173.0000000000000000 40 \N +27 27 2013-01-07 173.0000000000000000 40 \N +28 28 2012-10-03 173.0000000000000000 40 \N +29 29 2015-06-01 173.0000000000000000 40 \N +32 32 2006-10-23 173.0000000000000000 40 \N +33 33 1995-07-01 173.0000000000000000 40 \N +34 34 1992-03-15 173.0000000000000000 40 \N +35 35 2011-07-05 173.0000000000000000 40 \N +38 38 2010-10-04 173.0000000000000000 40 \N \. -- --- Data for Name: staffperiodbase; Type: TABLE DATA; Schema: portanova; Owner: potlu_user --- - -COPY portanova.staffperiodbase (id, id_staff, startdate, monthhours, weekhours) FROM stdin; -39 39 2015-07-01 64.8750000000000000 15 -40 40 2011-10-01 86.5000000000000000 20 -11 11 2000-01-01 129.7500000000000000 30 -43 43 2000-01-01 129.7500000000000000 30 -6 6 2000-01-01 173.0000000000000000 40 -10 10 2000-01-01 173.0000000000000000 40 -12 12 2000-01-01 173.0000000000000000 40 -13 13 2000-01-01 173.0000000000000000 40 -14 14 2000-01-01 173.0000000000000000 40 -17 17 2000-01-01 173.0000000000000000 40 -19 19 2000-01-01 173.0000000000000000 40 -25 25 2000-01-01 173.0000000000000000 40 -30 30 2000-01-01 173.0000000000000000 40 -31 31 2000-01-01 173.0000000000000000 40 -36 36 2000-01-01 173.0000000000000000 40 -37 37 2000-01-01 173.0000000000000000 40 -41 41 2000-01-01 173.0000000000000000 40 -42 42 2000-01-01 173.0000000000000000 40 -44 44 2000-01-01 173.0000000000000000 40 -45 45 2000-01-01 173.0000000000000000 40 -1 1 2015-06-22 173.0000000000000000 40 -2 2 2005-04-19 173.0000000000000000 40 -3 3 2007-08-14 173.0000000000000000 40 -4 4 2015-04-01 173.0000000000000000 40 -5 5 2015-03-10 173.0000000000000000 40 -7 7 2015-11-09 173.0000000000000000 40 -8 8 2016-02-13 173.0000000000000000 40 -9 9 2016-01-18 173.0000000000000000 40 -15 15 2014-11-15 173.0000000000000000 40 -16 16 2015-10-08 173.0000000000000000 40 -18 18 2016-05-30 173.0000000000000000 40 -20 20 2015-12-01 173.0000000000000000 40 -21 21 2005-01-08 173.0000000000000000 40 -22 22 2014-04-15 173.0000000000000000 40 -23 23 2013-01-07 173.0000000000000000 40 -24 24 2005-05-01 173.0000000000000000 40 -26 26 2008-07-10 173.0000000000000000 40 -27 27 2013-01-07 173.0000000000000000 40 -28 28 2012-10-03 173.0000000000000000 40 -29 29 2015-06-01 173.0000000000000000 40 -32 32 2006-10-23 173.0000000000000000 40 -33 33 1995-07-01 173.0000000000000000 40 -34 34 1992-03-15 173.0000000000000000 40 -35 35 2011-07-05 173.0000000000000000 40 -38 38 2010-10-04 173.0000000000000000 40 +-- Data for Name: staffgroups; Type: TABLE DATA; Schema: portanova; Owner: potlu_user +-- + +COPY portanova.staffgroups (id, groupname, groupcolor) FROM stdin; +1 cuisine \N +2 service \N +3 caisse \N \. @@ -1624,8 +1711,13 @@ COPY portanova.staffvacancyyear (id, id_staff, vyear, hours, days) FROM stdin; -- COPY portanova.staffworkplan (id, id_staff, daydate, timestart1, timeend1, timestart2, timeend2, timepause, vacancyhours, vacancytype) FROM stdin; +3118 3 2019-12-30 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N 1817 34 2017-07-07 \N \N \N \N \N \N \N 1847 37 2017-07-15 \N \N \N \N \N \N \N +3119 3 2019-12-31 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N +3120 3 2020-01-01 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N +3121 3 2020-01-02 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N +3122 3 2020-01-03 08:00:00 12:00:00 14:00:00 18:00:00 01:00:00 \N \N 2405 20 2017-06-17 \N \N \N \N \N \N \N 1767 8 2017-07-05 10:30:00 15:00:00 18:00:00 23:45:00 01:00:00 \N \N 1768 8 2017-07-12 10:30:00 15:00:00 18:00:00 23:45:00 01:00:00 \N \N @@ -3006,7 +3098,7 @@ COPY portanova.worktypes (id, worktype, isworktime, isfreetime, typecolor) FROM -- Name: reportperiod_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: potlu_user -- -SELECT pg_catalog.setval('portanova.reportperiod_id_seq', 1, true); +SELECT pg_catalog.setval('portanova.reportperiod_id_seq', 7, true); -- @@ -3027,7 +3119,7 @@ SELECT pg_catalog.setval('portanova.staff_id_seq', 45, true); -- Name: staffgroups_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: potlu_user -- -SELECT pg_catalog.setval('portanova.staffgroups_id_seq', 1, false); +SELECT pg_catalog.setval('portanova.staffgroups_id_seq', 3, true); -- @@ -3062,7 +3154,7 @@ SELECT pg_catalog.setval('portanova.staffvacancyyear_id_seq', 1, false); -- Name: staffworkplan_id_seq; Type: SEQUENCE SET; Schema: portanova; Owner: potlu_user -- -SELECT pg_catalog.setval('portanova.staffworkplan_id_seq', 3117, true); +SELECT pg_catalog.setval('portanova.staffworkplan_id_seq', 3122, true); -- @@ -3112,10 +3204,10 @@ ALTER TABLE ONLY portanova.staffgroups -- --- Name: staffperiodbase staffperiodbase_pkey; Type: CONSTRAINT; Schema: portanova; Owner: potlu_user +-- Name: staffcontract staffperiodbase_pkey; Type: CONSTRAINT; Schema: portanova; Owner: potlu_user -- -ALTER TABLE ONLY portanova.staffperiodbase +ALTER TABLE ONLY portanova.staffcontract ADD CONSTRAINT staffperiodbase_pkey PRIMARY KEY (id); @@ -3168,10 +3260,10 @@ ALTER TABLE ONLY portanova.worktypes -- --- Name: staffperiodbase trg_upd_portanova_weekhours; Type: TRIGGER; Schema: portanova; Owner: potlu_user +-- Name: staffcontract trg_upd_portanova_weekhours; Type: TRIGGER; Schema: portanova; Owner: potlu_user -- -CREATE TRIGGER trg_upd_portanova_weekhours BEFORE UPDATE OF weekhours ON portanova.staffperiodbase FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); +CREATE TRIGGER trg_upd_portanova_weekhours BEFORE UPDATE OF weekhours ON portanova.staffcontract FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); -- diff --git a/dev/db/potlu_db.portanova.pg.schema.sql b/dev/db/potlu_db.portanova.pg.schema.sql index 9c9512fa..b77847ab 100644 --- a/dev/db/potlu_db.portanova.pg.schema.sql +++ b/dev/db/potlu_db.portanova.pg.schema.sql @@ -133,6 +133,20 @@ CREATE SEQUENCE portanova.staff_id_seq ALTER SEQUENCE portanova.staff_id_seq OWNED BY portanova.staff.id; +-- +-- Name: staffcontract; Type: TABLE; Schema: portanova; Owner: - +-- + +CREATE TABLE portanova.staffcontract ( + id integer NOT NULL, + id_staff integer, + startdate date, + monthhours numeric, + weekhours numeric, + id_staffgroup integer +); + + -- -- Name: staffgroups; Type: TABLE; Schema: portanova; Owner: - -- @@ -164,19 +178,6 @@ CREATE SEQUENCE portanova.staffgroups_id_seq ALTER SEQUENCE portanova.staffgroups_id_seq OWNED BY portanova.staffgroups.id; --- --- Name: staffperiodbase; Type: TABLE; Schema: portanova; Owner: - --- - -CREATE TABLE portanova.staffperiodbase ( - id integer NOT NULL, - id_staff integer, - startdate date, - monthhours numeric, - weekhours numeric -); - - -- -- Name: staffperiodbase_id_seq; Type: SEQUENCE; Schema: portanova; Owner: - -- @@ -194,7 +195,7 @@ CREATE SEQUENCE portanova.staffperiodbase_id_seq -- Name: staffperiodbase_id_seq; Type: SEQUENCE OWNED BY; Schema: portanova; Owner: - -- -ALTER SEQUENCE portanova.staffperiodbase_id_seq OWNED BY portanova.staffperiodbase.id; +ALTER SEQUENCE portanova.staffperiodbase_id_seq OWNED BY portanova.staffcontract.id; -- @@ -349,6 +350,75 @@ CREATE VIEW portanova.vw_reportperiodlist AS FROM portanova.reportperiod; +-- +-- Name: vw_staffcontractdata; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffcontractdata AS + SELECT staffcontract.id, + staffcontract.id_staff, + staffcontract.startdate, + staffcontract.monthhours, + staffcontract.weekhours, + staffcontract.id_staffgroup + FROM portanova.staffcontract; + + +-- +-- Name: vw_staffcontractlist; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffcontractlist AS + SELECT sc.id, + sc.id_staff, + sc.startdate, + sc.weekhours, + sc.monthhours, + sc.id_staffgroup, + sg.groupname, + sg.groupcolor + FROM (portanova.staffcontract sc + LEFT JOIN portanova.staffgroups sg ON ((sc.id_staffgroup = sg.id))); + + +-- +-- Name: vw_staffdata; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffdata AS + SELECT staff.id, + staff.staffnumber, + staff.surname, + staff.prename, + staff.job, + staff.birthdate, + staff.entrydate, + staff.leavedate + FROM portanova.staff; + + +-- +-- Name: vw_staffgroupsdata; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffgroupsdata AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM portanova.staffgroups; + + +-- +-- Name: vw_staffgroupslist; Type: VIEW; Schema: portanova; Owner: - +-- + +CREATE VIEW portanova.vw_staffgroupslist AS + SELECT staffgroups.id, + staffgroups.groupname, + staffgroups.groupcolor + FROM portanova.staffgroups; + + -- -- Name: vw_stafflist; Type: VIEW; Schema: portanova; Owner: - -- @@ -662,27 +732,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start1, + END) AS mon_timestart1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end1, + END) AS mon_timeend1, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_start2, + END) AS mon_timestart2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_end2, + END) AS mon_timeend2, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS mon_pause, + END) AS mon_timepause, max( CASE WHEN (stw2.isodow = (1)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -707,27 +777,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start1, + END) AS tue_timestart1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end1, + END) AS tue_timeend1, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_start2, + END) AS tue_timestart2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_end2, + END) AS tue_timeend2, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS tue_pause, + END) AS tue_timepause, max( CASE WHEN (stw2.isodow = (2)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -752,27 +822,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start1, + END) AS wed_timestart1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end1, + END) AS wed_timeend1, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_start2, + END) AS wed_timestart2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_end2, + END) AS wed_timeend2, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS wed_pause, + END) AS wed_timepause, max( CASE WHEN (stw2.isodow = (3)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -797,27 +867,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start1, + END) AS thu_timestart1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end1, + END) AS thu_timeend1, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_start2, + END) AS thu_timestart2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_end2, + END) AS thu_timeend2, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS thu_pause, + END) AS thu_timepause, max( CASE WHEN (stw2.isodow = (4)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -842,27 +912,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start1, + END) AS fri_timestart1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end1, + END) AS fri_timeend1, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_start2, + END) AS fri_timestart2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_end2, + END) AS fri_timeend2, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS fri_pause, + END) AS fri_timepause, max( CASE WHEN (stw2.isodow = (5)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -887,27 +957,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start1, + END) AS sat_timestart1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end1, + END) AS sat_timeend1, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_start2, + END) AS sat_timestart2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_end2, + END) AS sat_timeend2, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sat_pause, + END) AS sat_timepause, max( CASE WHEN (stw2.isodow = (6)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -932,27 +1002,27 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start1, + END) AS sun_timestart1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend1)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end1, + END) AS sun_timeend1, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timestart2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_start2, + END) AS sun_timestart2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timeend2)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_end2, + END) AS sun_timeend2, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.timepause)::interval, 'HH24:MI'::text) ELSE NULL::text - END) AS sun_pause, + END) AS sun_timepause, max( CASE WHEN (stw2.isodow = (7)::double precision) THEN to_char((stw2.vacancyhours)::interval, 'HH24:MI'::text) @@ -1001,7 +1071,9 @@ CREATE VIEW portanova.vw_staffworkplan_weekly AS CREATE VIEW portanova.vw_staffworkplanlist AS SELECT st.id AS id_staff, ((st.surname || ' '::text) || st.prename) AS staffname, - (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS calweek, + (((((('Semaine '::text || sp_dwt.calweek) || '
('::text) || to_char((sp_dwt.weekbegin)::timestamp with time zone, 'DD.MM.YYYY'::text)) || ' - '::text) || to_char((date((sp_dwt.weekbegin + '7 days'::interval)))::timestamp with time zone, 'DD.MM.YYYY'::text)) || ')'::text) AS dspcalweek, + (sp_dwt.calweek)::integer AS calweek, + sp_dwt.calyear, sp_dwt.week_timetotal, sp_dwt.weekbegin AS weekstart, date((sp_dwt.weekbegin + '7 days'::interval)) AS weekend, @@ -1124,31 +1196,31 @@ CREATE VIEW portanova.vw_staffworkplanlist AS ((to_number("left"(sp_dwt.week_timetotal, 2), '99'::text) * (60)::numeric) + to_number("right"(sp_dwt.week_timetotal, 2), '99'::text)) AS weekminutes, sp_dwt.mon_id, sp_dwt.weekbegin AS mon_date, - ((COALESCE(((to_char((sp_dwt.mon_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, + ((COALESCE(((to_char((sp_dwt.mon_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.mon_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.mon_vacancytype) || ': '::text) || to_char((sp_dwt.mon_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspmontimes, sp_dwt.mon_timetotal, sp_dwt.tue_id, date((sp_dwt.weekbegin + '1 day'::interval)) AS tue_date, - ((COALESCE(((to_char((sp_dwt.tue_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, + ((COALESCE(((to_char((sp_dwt.tue_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.tue_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.tue_vacancytype) || ': '::text) || to_char((sp_dwt.tue_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dsptuetimes, sp_dwt.tue_timetotal, sp_dwt.wed_id, date((sp_dwt.weekbegin + '2 days'::interval)) AS wed_date, - ((COALESCE(((to_char((sp_dwt.wed_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, + ((COALESCE(((to_char((sp_dwt.wed_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.wed_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.wed_vacancytype) || ': '::text) || to_char((sp_dwt.wed_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspwedtimes, sp_dwt.wed_timetotal, sp_dwt.thu_id, date((sp_dwt.weekbegin + '3 days'::interval)) AS thu_date, - ((COALESCE(((to_char((sp_dwt.thu_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, + ((COALESCE(((to_char((sp_dwt.thu_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.thu_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.thu_vacancytype) || ': '::text) || to_char((sp_dwt.thu_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspthutimes, sp_dwt.thu_timetotal, sp_dwt.fri_id, date((sp_dwt.weekbegin + '4 days'::interval)) AS fri_date, - ((COALESCE(((to_char((sp_dwt.fri_start1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, + ((COALESCE(((to_char((sp_dwt.fri_timestart1)::interval, 'HH24:MI'::text) || ' -'::text) || to_char((sp_dwt.fri_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.fri_vacancytype) || ': '::text) || to_char((sp_dwt.fri_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspfritimes, sp_dwt.fri_timetotal, sp_dwt.sat_id, date((sp_dwt.weekbegin + '5 days'::interval)) AS sat_date, - ((COALESCE(((to_char((sp_dwt.sat_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, + ((COALESCE(((to_char((sp_dwt.sat_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sat_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sat_vacancytype) || ': '::text) || to_char((sp_dwt.sat_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsattimes, sp_dwt.sat_timetotal, sp_dwt.sun_id, date((sp_dwt.weekbegin + '6 days'::interval)) AS sun_date, - ((COALESCE(((to_char((sp_dwt.sun_start1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_end1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, + ((COALESCE(((to_char((sp_dwt.sun_timestart1)::interval, 'HH24:MI'::text) || ' - '::text) || to_char((sp_dwt.sun_timeend1)::interval, 'HH24:MI'::text)), ''::text) || COALESCE(((('
'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('
Congé '::text || sp_dwt.sun_vacancytype) || ': '::text) || to_char((sp_dwt.sun_vacancyhours)::interval, 'HH24:MI'::text)), ''::text)) AS dspsuntimes, sp_dwt.sun_timetotal FROM (portanova.vw_staffworkplan_weekly sp_dwt LEFT JOIN portanova.staff st ON ((sp_dwt.id_staff = st.id))) @@ -1347,17 +1419,17 @@ ALTER TABLE ONLY portanova.staff ALTER COLUMN id SET DEFAULT nextval('portanova. -- --- Name: staffgroups id; Type: DEFAULT; Schema: portanova; Owner: - +-- Name: staffcontract id; Type: DEFAULT; Schema: portanova; Owner: - -- -ALTER TABLE ONLY portanova.staffgroups ALTER COLUMN id SET DEFAULT nextval('portanova.staffgroups_id_seq'::regclass); +ALTER TABLE ONLY portanova.staffcontract ALTER COLUMN id SET DEFAULT nextval('portanova.staffperiodbase_id_seq'::regclass); -- --- Name: staffperiodbase id; Type: DEFAULT; Schema: portanova; Owner: - +-- Name: staffgroups id; Type: DEFAULT; Schema: portanova; Owner: - -- -ALTER TABLE ONLY portanova.staffperiodbase ALTER COLUMN id SET DEFAULT nextval('portanova.staffperiodbase_id_seq'::regclass); +ALTER TABLE ONLY portanova.staffgroups ALTER COLUMN id SET DEFAULT nextval('portanova.staffgroups_id_seq'::regclass); -- @@ -1435,10 +1507,10 @@ ALTER TABLE ONLY portanova.staffgroups -- --- Name: staffperiodbase staffperiodbase_pkey; Type: CONSTRAINT; Schema: portanova; Owner: - +-- Name: staffcontract staffperiodbase_pkey; Type: CONSTRAINT; Schema: portanova; Owner: - -- -ALTER TABLE ONLY portanova.staffperiodbase +ALTER TABLE ONLY portanova.staffcontract ADD CONSTRAINT staffperiodbase_pkey PRIMARY KEY (id); @@ -1491,10 +1563,10 @@ ALTER TABLE ONLY portanova.worktypes -- --- Name: staffperiodbase trg_upd_portanova_weekhours; Type: TRIGGER; Schema: portanova; Owner: - +-- Name: staffcontract trg_upd_portanova_weekhours; Type: TRIGGER; Schema: portanova; Owner: - -- -CREATE TRIGGER trg_upd_portanova_weekhours BEFORE UPDATE OF weekhours ON portanova.staffperiodbase FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); +CREATE TRIGGER trg_upd_portanova_weekhours BEFORE UPDATE OF weekhours ON portanova.staffcontract FOR EACH ROW EXECUTE PROCEDURE public.trg_update_monthhours(); -- diff --git a/dev/db/potlu_db.public.pg.data.sql b/dev/db/potlu_db.public.pg.data.sql index 5ab0266a..ce23147e 100644 --- a/dev/db/potlu_db.public.pg.data.sql +++ b/dev/db/potlu_db.public.pg.data.sql @@ -1,59 +1,77 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 11.5 (Debian 11.5-1+deb10u1) +-- Dumped by pg_dump version 11.5 (Debian 11.5-1+deb10u1) +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- -- Data for Name: usergroups; Type: TABLE DATA; Schema: public; Owner: - -- INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (1, 'superadmin', NULL, 'SuperAdmin'); INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (2, 'admin', NULL, 'Admin'); -INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (3, 'company', NULL, 'Entreprise'); INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (4, 'site', NULL, 'Site'); INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (5, 'user', true, 'Utilisateur'); +INSERT INTO public.usergroups (id, usergroup, isdefault, groupname) VALUES (3, 'manager', NULL, 'Gérant'); -- -- Data for Name: apps; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (7, 'staff', 'Employé(e)s', 'Employé(e)s', 1, 'group.svg', 4, 'schema'); INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (8, 'timetrackers', 'Pointeuses', 'Pointeuses', NULL, 'cube.svg', 7, 'schema'); INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (10, 'sites', 'Sites', 'Sites', NULL, 'cube.svg', 6, 'schema'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (11, 'workplans', 'Plans de travail', 'Plans (modèles)', 1, 'cube.svg', 8, 'schema'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (9, 'planning', 'Planning', 'POT', 1, 'cube.svg', 5, 'schema'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (4, 'profile', 'Profil', 'mes coordonnées', 1, 'user.svg', 9, 'global'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (6, 'companies', 'Entreprise', 'entreprise', 1, 'company.svg', 10, 'global'); -INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (5, 'users', 'Utilisateurs', 'autres utilisateurs', 1, 'group.svg', 11, 'global'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (4, 'profile', 'Profil', 'mes coordonnées', 5, 'user.svg', 9, 'global'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (5, 'users', 'Utilisateurs', 'utilisateurs', 2, 'group.svg', 11, 'global'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (7, 'staff', 'Employé(e)s', 'employé(e)s', 3, 'group.svg', 4, 'schema'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (9, 'planning', 'Planning', 'POT', 3, 'poticon.svg', 5, 'schema'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (6, 'companies', 'Entreprise', 'entreprise', 2, 'cube.svg', 10, 'global'); +INSERT INTO public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) VALUES (11, 'workplans', 'Plans de travail', 'plans (modèles)', 3, 'calendar.svg', 8, 'schema'); -- -- Data for Name: companies; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.companies (id, company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated) VALUES (1, 'DKS', '4, rue Principale', '3770', 'Tétange', 'Luxembourg', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 's.à r.l.', true); +INSERT INTO public.companies (id, company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated) VALUES (1, 'DKS', '8b, rue du Moulin', '6914', 'Roodt-sur-Syre', 'Luxemburg', NULL, NULL, NULL, 'portanova', NULL, NULL, 'support@dks.lu', 's.à r.l.', NULL); -- -- Data for Name: maillayouts; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.maillayouts (id, layoutname, mailtemplate) VALUES (1, 'potbasic', ' - - - - - -
- POT - Plan d''organisation de travail -
-
- %%BODYCONTENT%% -
-
-
- +INSERT INTO public.maillayouts (id, layoutname, mailtemplate) VALUES (1, 'potbasic', ' + + + + + +
+ POT - Plan d''organisation de travail +
+
+ %%BODYCONTENT%% +
+
+
+ '); @@ -110,28 +128,67 @@ En annexe vous trouvez la facture pour votre souscription au site pot.lu, Meilleurs salutations,

POT Support Team', 'select prename,surname from users where id=''%%id%%'';', 'support@dks.lu', 'Facture concernant votre souscription sur pot.lu', 1); +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (6, 'user_verification', 'Bonjour %%prename%% %%surname%%,
+
+Le code pour valider votre e-mail est: +
+%%vcode%%
+
+entrez le code ici: %%siteurl%%/backoffice/validationcode.html +
+Méilleurs Salutations,
+
+pot.lu Support Team', 'select prename,surname,username from users where id=''%%id%%'';', 'support@dks.lu', 'Validation de votre Email pour le site pot.lu', 1); +INSERT INTO public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, mailsubject, id_maillayout) VALUES (7, 'user_newpassword', 'Bonjour %%prename%% %%surname%%,
+
+Nous avons crées / modifé votre compte sur le site pot.lu;
+
+Votre Login: %%username%%
+Mot de passe: %%newpassword%%

+
+méilleurs Salutations,
+
+pot.lu Support-Team
+', 'select prename,surname,username from users where id=''%%id%%'';', 'support@dks.lu', 'coordonnées d''accès de votre compte sur pot.lu', 1); -- -- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess) VALUES (1, '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec', '2019-10-10 17:12:11.934747', NULL, 'ksaffran@dks.lu', NULL, NULL, NULL); +INSERT INTO public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company) VALUES (2, 'f7252754a4cb7391d966316351b3501bce81fee9bc0b71807ddf61281a27821e', '2019-12-20 11:03:08.757357', NULL, 'kilian@saffran.lu', NULL, NULL, '["portanova"]', '["5"]', 'Saffran', 'Kilian', '691504574', NULL, 1); +INSERT INTO public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company) VALUES (1, '228c27a646f18ce069bc2b8ef091a03c46cd51557e5b5ac90abc05c4f635b3ba', '2019-10-10 17:12:11.934747', NULL, 'kilian.saffran@gmail.com', NULL, '6tgfkew', '["portanova"]', '["2","5","3"]', 'Saffran', 'Kilian', '+352691504574', 'Gérant', 1); -- --- Data for Name: members; Type: TABLE DATA; Schema: public; Owner: - +-- Data for Name: sessions; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.members (id, surname, prename, phone, id_user, id_company, job) VALUES (1, 'Saffran', 'Kilian', NULL, 1, 1, NULL); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (111, 'uWpnqxhEFJt2MZxMoLSz4ZAZoc3ZJnu3aKhq8oVD', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '2001:7e8:cc73:de00:213c:73ba:ffa7:842b', '2019-12-05 19:16:43.969105'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (112, 'mUmGFzD4kPLyhHfJO9TDOGfCtsVAEefRYrotRRo1', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '2001:7e8:cc73:de00:7946:65e2:f587:8b74', '2019-12-06 07:02:23.094765'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (113, 'HaDg0Eh9nIk7lftrHDtQpaKiLWL66VoEWRKMmSLz', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '::1', '2019-12-09 11:33:13.202044'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (114, 'aSli1lR9B0ETjICf7IFjVxhphLd8dhRdZ2mRd4RE', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362', '::1', '2019-12-10 15:55:53.526432'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (122, 'Sp2D9CvtdjQHaxLPkEXgqSMSveIJwQde56I5y3oC', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '2001:7e8:cc73:de00:d970:312a:d5d:db83', '2019-12-12 07:06:51.913155'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (124, 'NUTU0TkWd81oxH4ig52WCA3HzccA3bmHW5sMPCyT', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36', '::1', '2019-12-15 11:44:06.485589'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (93, '5P7159lXg8xY83Iu7eZC3hj3Oi6x29jXOhPKg0yn', 1, 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36', '::1', '2019-12-04 14:58:48.993651'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (98, '9UisAitYaoxdqtBaWUI37R04CiBlFxcp0STuCOZRU', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '::1', '2019-12-05 07:34:07.997426'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (99, 'v6wZ65qozoWn5P32q4wg16224TcOAM1VJnLFj1UJ', 1, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', '192.168.178.23', '2019-12-05 07:35:01.756219'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (160, 'pMEnznbOdbCeLbtKUwxgVbn2PNVzrF0HhvVHIWmL', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36', '::1', '2019-12-20 12:48:16.464228'); +INSERT INTO public.sessions (id, idsession, id_user, user_agent, remote_addr, created) VALUES (161, 'fvhUhEhy8bRQnrZd1I0oVdAwntMj86Xdr5Yzz6Yy', 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', '::1', '2019-12-22 09:58:14.675553'); + + +-- +-- Data for Name: zzold_members; Type: TABLE DATA; Schema: public; Owner: - +-- +INSERT INTO public.zzold_members (id, surname, prename, phone, id_user, id_company, job) VALUES (1, 'Saffran', 'Kilian', NULL, 1, 1, NULL); -- --- Data for Name: useringroups; Type: TABLE DATA; Schema: public; Owner: - +-- Data for Name: zzold_useringroups; Type: TABLE DATA; Schema: public; Owner: - -- -INSERT INTO public.useringroups (id, id_user, id_group) VALUES (1, 1, 1); +INSERT INTO public.zzold_useringroups (id, id_user, id_group) VALUES (1, 1, 1); -- @@ -145,7 +202,7 @@ SELECT pg_catalog.setval('public.apps_id_seq', 11, true); -- Name: companies_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.companies_id_seq', 1, true); +SELECT pg_catalog.setval('public.companies_id_seq', 24, true); -- @@ -159,7 +216,7 @@ SELECT pg_catalog.setval('public.maillayouts_id_seq', 1, true); -- Name: mailtemplates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.mailtemplates_id_seq', 5, true); +SELECT pg_catalog.setval('public.mailtemplates_id_seq', 7, true); -- @@ -173,7 +230,7 @@ SELECT pg_catalog.setval('public.members_id_seq', 1, false); -- Name: sessions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.sessions_id_seq', 124, true); +SELECT pg_catalog.setval('public.sessions_id_seq', 161, true); -- @@ -194,7 +251,7 @@ SELECT pg_catalog.setval('public.useringroups_id_seq', 1, true); -- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - -- -SELECT pg_catalog.setval('public.users_id_seq', 1, false); +SELECT pg_catalog.setval('public.users_id_seq', 2, true); -- diff --git a/dev/db/potlu_db.public.pg.full.sql b/dev/db/potlu_db.public.pg.full.sql index cb9314eb..c3750ed6 100644 --- a/dev/db/potlu_db.public.pg.full.sql +++ b/dev/db/potlu_db.public.pg.full.sql @@ -113,15 +113,12 @@ CREATE FUNCTION public.getsession(vidsession text, vremoteaddr text, vuseragent LANGUAGE plpgsql AS $$ BEGIN - return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se -join users us on (us.id=se.id_user) -left join useringroups uig on (us.id=uig.id_user) -left join usergroups aug on (aug.id=uig.id_group) -left join members mb on (mb.id_user=us.id) -left join companies co on (co.id=mb.id_company) -where se.idsession= vidsession -and se.remote_addr= vremoteaddr -and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id; + return QUERY select se.idsession,us.id,us.username,string_agg(distinct(ugrp.usergroup),',') as usergroups,json_array_elements_text(us.schemaaccess) as userschemata from sessions se +join users us on (us.id=se.id_user) +left join (SELECT users.id,json_array_elements_text(users.id_usergroups) AS id_usergroup FROM users) ugs on (us.id=ugs.id) +left join usergroups ugrp on (ugrp.id=ugs.id) +where se.idsession= vidsession and se.remote_addr= vremoteaddr and se.user_agent= vuseragent and +us.blocked is null group by se.id,us.id; END; $$; @@ -415,10 +412,10 @@ ALTER SEQUENCE public.mailtemplates_id_seq OWNED BY public.mailtemplates.id; -- --- Name: members; Type: TABLE; Schema: public; Owner: potlu_user +-- Name: zzold_members; Type: TABLE; Schema: public; Owner: potlu_user -- -CREATE TABLE public.members ( +CREATE TABLE public.zzold_members ( id integer NOT NULL, surname text, prename text, @@ -429,7 +426,7 @@ CREATE TABLE public.members ( ); -ALTER TABLE public.members OWNER TO potlu_user; +ALTER TABLE public.zzold_members OWNER TO potlu_user; -- -- Name: members_id_seq; Type: SEQUENCE; Schema: public; Owner: potlu_user @@ -450,7 +447,7 @@ ALTER TABLE public.members_id_seq OWNER TO potlu_user; -- Name: members_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: potlu_user -- -ALTER SEQUENCE public.members_id_seq OWNED BY public.members.id; +ALTER SEQUENCE public.members_id_seq OWNED BY public.zzold_members.id; -- @@ -527,17 +524,17 @@ ALTER SEQUENCE public.usergroups_id_seq OWNED BY public.usergroups.id; -- --- Name: useringroups; Type: TABLE; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups; Type: TABLE; Schema: public; Owner: potlu_user -- -CREATE TABLE public.useringroups ( +CREATE TABLE public.zzold_useringroups ( id integer NOT NULL, id_user bigint, id_group bigint ); -ALTER TABLE public.useringroups OWNER TO potlu_user; +ALTER TABLE public.zzold_useringroups OWNER TO potlu_user; -- -- Name: useringroups_id_seq; Type: SEQUENCE; Schema: public; Owner: potlu_user @@ -558,7 +555,7 @@ ALTER TABLE public.useringroups_id_seq OWNER TO potlu_user; -- Name: useringroups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: potlu_user -- -ALTER SEQUENCE public.useringroups_id_seq OWNED BY public.useringroups.id; +ALTER SEQUENCE public.useringroups_id_seq OWNED BY public.zzold_useringroups.id; -- @@ -573,7 +570,13 @@ CREATE TABLE public.users ( username text, regcode text, vcode text, - schemaaccess json + schemaaccess json, + id_usergroups json, + surname text, + prename text, + phone text, + job text, + id_company integer ); @@ -652,52 +655,75 @@ CREATE VIEW public.vw_companieslist AS ALTER TABLE public.vw_companieslist OWNER TO potlu_user; -- --- Name: vw_memberdata; Type: VIEW; Schema: public; Owner: potlu_user +-- Name: vw_schemata; Type: VIEW; Schema: public; Owner: potlu_user -- -CREATE VIEW public.vw_memberdata AS - SELECT members.id, - members.surname, - members.prename, - members.phone, - members.id_user, - members.id_company, - members.job - FROM public.members; +CREATE VIEW public.vw_schemata AS + SELECT schemata.schema_name AS schemaname + FROM information_schema.schemata + WHERE ((schemata.schema_owner)::text = 'potlu_user'::text); -ALTER TABLE public.vw_memberdata OWNER TO potlu_user; +ALTER TABLE public.vw_schemata OWNER TO potlu_user; -- --- Name: vw_userdata; Type: VIEW; Schema: public; Owner: potlu_user +-- Name: vw_usergroupslist; Type: VIEW; Schema: public; Owner: potlu_user -- -CREATE VIEW public.vw_userdata AS +CREATE VIEW public.vw_usergroupslist AS + SELECT usergroups.id, + usergroups.usergroup, + usergroups.isdefault, + usergroups.groupname + FROM public.usergroups; + + +ALTER TABLE public.vw_usergroupslist OWNER TO potlu_user; + +-- +-- Name: vw_usersdata; Type: VIEW; Schema: public; Owner: potlu_user +-- + +CREATE VIEW public.vw_usersdata AS SELECT users.id, - users.username + users.userpassword, + users.created, + users.blocked, + users.username, + users.regcode, + users.vcode, + users.schemaaccess, + users.id_usergroups, + users.surname, + users.prename, + users.phone, + users.job, + users.id_company FROM public.users; -ALTER TABLE public.vw_userdata OWNER TO potlu_user; +ALTER TABLE public.vw_usersdata OWNER TO potlu_user; -- --- Name: vw_userlist; Type: VIEW; Schema: public; Owner: potlu_user +-- Name: vw_userslist; Type: VIEW; Schema: public; Owner: potlu_user -- -CREATE VIEW public.vw_userlist AS +CREATE VIEW public.vw_userslist AS SELECT NULL::integer AS id, - NULL::integer AS id_member, + NULL::boolean AS blocked, NULL::text AS username, - NULL::text AS prename, + NULL::text AS schemaaccess, NULL::text AS surname, - NULL::boolean AS blocked, - NULL::text AS group_ids, + NULL::text AS prename, + NULL::text AS phone, + NULL::text AS job, NULL::integer AS id_company, - NULL::text AS company; + NULL::text AS company, + NULL::text AS usergroups; -ALTER TABLE public.vw_userlist OWNER TO potlu_user; +ALTER TABLE public.vw_userslist OWNER TO potlu_user; -- -- Name: apps id; Type: DEFAULT; Schema: public; Owner: potlu_user @@ -728,38 +754,38 @@ ALTER TABLE ONLY public.mailtemplates ALTER COLUMN id SET DEFAULT nextval('publi -- --- Name: members id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: sessions id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.members ALTER COLUMN id SET DEFAULT nextval('public.members_id_seq'::regclass); +ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); -- --- Name: sessions id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: usergroups id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); +ALTER TABLE ONLY public.usergroups ALTER COLUMN id SET DEFAULT nextval('public.usergroups_id_seq'::regclass); -- --- Name: usergroups id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: users id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.usergroups ALTER COLUMN id SET DEFAULT nextval('public.usergroups_id_seq'::regclass); +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- --- Name: useringroups id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: zzold_members id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.useringroups ALTER COLUMN id SET DEFAULT nextval('public.useringroups_id_seq'::regclass); +ALTER TABLE ONLY public.zzold_members ALTER COLUMN id SET DEFAULT nextval('public.members_id_seq'::regclass); -- --- Name: users id; Type: DEFAULT; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups id; Type: DEFAULT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); +ALTER TABLE ONLY public.zzold_useringroups ALTER COLUMN id SET DEFAULT nextval('public.useringroups_id_seq'::regclass); -- @@ -767,14 +793,14 @@ ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_ -- COPY public.apps (id, app, description, name, id_usergroup, icon, sort, menutype) FROM stdin; -7 staff Employé(e)s Employé(e)s 1 group.svg 4 schema 8 timetrackers Pointeuses Pointeuses \N cube.svg 7 schema 10 sites Sites Sites \N cube.svg 6 schema -11 workplans Plans de travail Plans (modèles) 1 cube.svg 8 schema -9 planning Planning POT 1 cube.svg 5 schema -4 profile Profil mes coordonnées 1 user.svg 9 global -6 companies Entreprise entreprise 1 company.svg 10 global -5 users Utilisateurs autres utilisateurs 1 group.svg 11 global +4 profile Profil mes coordonnées 5 user.svg 9 global +5 users Utilisateurs utilisateurs 2 group.svg 11 global +7 staff Employé(e)s employé(e)s 3 group.svg 4 schema +9 planning Planning POT 3 poticon.svg 5 schema +6 companies Entreprise entreprise 2 cube.svg 10 global +11 workplans Plans de travail plans (modèles) 3 calendar.svg 8 schema \. @@ -783,7 +809,7 @@ COPY public.apps (id, app, description, name, id_usergroup, icon, sort, menutype -- COPY public.companies (id, company, address, zip, city, country, tradetype, comregister, vatnumber, schemata, validated, schemata2, email, socialtype, vatvalidated) FROM stdin; -1 DKS s.à r.l. 4, rue Principale 3770 Tétange Luxembourg \N \N \N portanova \N \N \N \N \N +1 DKS 8b, rue du Moulin 6914 Roodt-sur-Syre Luxemburg \N \N \N portanova \N \N support@dks.lu s.à r.l. \N \. @@ -806,15 +832,8 @@ COPY public.mailtemplates (id, templatename, emailtext, emaildatasql, mailfrom, 3 user_expiration_notice Bonjour %%prename%% %%surname%%,
\n
\nVotre souscription au site pot.lu expire bientôt,\n

\nn'oublié pas à la prolonger!\nProlonger maintenant\n
\nMeilleurs salutations,
\n
\npot.lu Support Team select prename,surname from users where id='%%id%%'; support@dks.lu Notice d'expiration de votre souscription sur pot.lu 1 4 user_invoice_paypal Bonjour %%prename%% %%surname%%,
\n
\nEn annexe vous trouvez la facture pour votre souscription au site pot.lu,\n
\nVous avez Payé déjà via PayPal!\n\nMeilleurs salutations,
\n
\npot.lu Support Team select prename,surname from users where id='%%id%%'; support@dks.lu Info facture pour votre souscription sur pot.lu 1 5 user_invoice Bonjour %%prename%% %%surname%%,
\n
\nEn annexe vous trouvez la facture pour votre souscription au site pot.lu,\n
\n\nMeilleurs salutations,
\n
\nPOT Support Team select prename,surname from users where id='%%id%%'; support@dks.lu Facture concernant votre souscription sur pot.lu 1 -\. - - --- --- Data for Name: members; Type: TABLE DATA; Schema: public; Owner: potlu_user --- - -COPY public.members (id, surname, prename, phone, id_user, id_company, job) FROM stdin; -1 Saffran Kilian \N 1 1 \N +6 user_verification Bonjour %%prename%% %%surname%%,
\r\n
\r\nLe code pour valider votre e-mail est:\r\n
\r\n%%vcode%%
\r\n
\r\nentrez le code ici: %%siteurl%%/backoffice/validationcode.html\r\n
\r\nMéilleurs Salutations,
\r\n
\r\npot.lu Support Team select prename,surname,username from users where id='%%id%%'; support@dks.lu Validation de votre Email pour le site pot.lu 1 +7 user_newpassword Bonjour %%prename%% %%surname%%,
\r\n
\r\nNous avons crées / modifé votre compte sur le site pot.lu;
\r\n
\r\nVotre Login: %%username%%
\r\nMot de passe: %%newpassword%%

\r\n
\r\nméilleurs Salutations,
\r\n
\r\npot.lu Support-Team
\r\n select prename,surname,username from users where id='%%id%%'; support@dks.lu coordonnées d'accès de votre compte sur pot.lu 1 \. @@ -828,11 +847,12 @@ COPY public.sessions (id, idsession, id_user, user_agent, remote_addr, created) 113 HaDg0Eh9nIk7lftrHDtQpaKiLWL66VoEWRKMmSLz 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 ::1 2019-12-09 11:33:13.202044 114 aSli1lR9B0ETjICf7IFjVxhphLd8dhRdZ2mRd4RE 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362 ::1 2019-12-10 15:55:53.526432 122 Sp2D9CvtdjQHaxLPkEXgqSMSveIJwQde56I5y3oC 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 2001:7e8:cc73:de00:d970:312a:d5d:db83 2019-12-12 07:06:51.913155 -123 klCMzztihKleI4E0zhnmNMrlL8sAUIj5TLHjb0si 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 ::1 2019-12-13 08:27:53.789037 124 NUTU0TkWd81oxH4ig52WCA3HzccA3bmHW5sMPCyT 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 ::1 2019-12-15 11:44:06.485589 93 5P7159lXg8xY83Iu7eZC3hj3Oi6x29jXOhPKg0yn 1 Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36 ::1 2019-12-04 14:58:48.993651 98 9UisAitYaoxdqtBaWUI37R04CiBlFxcp0STuCOZRU 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 ::1 2019-12-05 07:34:07.997426 99 v6wZ65qozoWn5P32q4wg16224TcOAM1VJnLFj1UJ 1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 192.168.178.23 2019-12-05 07:35:01.756219 +160 pMEnznbOdbCeLbtKUwxgVbn2PNVzrF0HhvVHIWmL 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 ::1 2019-12-20 12:48:16.464228 +161 fvhUhEhy8bRQnrZd1I0oVdAwntMj86Xdr5Yzz6Yy 1 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36 ::1 2019-12-22 09:58:14.675553 \. @@ -843,27 +863,37 @@ COPY public.sessions (id, idsession, id_user, user_agent, remote_addr, created) COPY public.usergroups (id, usergroup, isdefault, groupname) FROM stdin; 1 superadmin \N SuperAdmin 2 admin \N Admin -3 company \N Entreprise 4 site \N Site 5 user t Utilisateur +3 manager \N Gérant \. -- --- Data for Name: useringroups; Type: TABLE DATA; Schema: public; Owner: potlu_user +-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: potlu_user -- -COPY public.useringroups (id, id_user, id_group) FROM stdin; -1 1 1 +COPY public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess, id_usergroups, surname, prename, phone, job, id_company) FROM stdin; +2 f7252754a4cb7391d966316351b3501bce81fee9bc0b71807ddf61281a27821e 2019-12-20 11:03:08.757357 \N kilian@saffran.lu \N \N ["portanova"] ["5"] Saffran Kilian 691504574 \N 1 +1 228c27a646f18ce069bc2b8ef091a03c46cd51557e5b5ac90abc05c4f635b3ba 2019-10-10 17:12:11.934747 \N kilian.saffran@gmail.com \N 6tgfkew ["portanova"] ["2","5","3"] Saffran Kilian +352691504574 Gérant 1 \. -- --- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: potlu_user +-- Data for Name: zzold_members; Type: TABLE DATA; Schema: public; Owner: potlu_user +-- + +COPY public.zzold_members (id, surname, prename, phone, id_user, id_company, job) FROM stdin; +1 Saffran Kilian \N 1 1 \N +\. + + +-- +-- Data for Name: zzold_useringroups; Type: TABLE DATA; Schema: public; Owner: potlu_user -- -COPY public.users (id, userpassword, created, blocked, username, regcode, vcode, schemaaccess) FROM stdin; -1 0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec 2019-10-10 17:12:11.934747 \N ksaffran@dks.lu \N \N \N +COPY public.zzold_useringroups (id, id_user, id_group) FROM stdin; +1 1 1 \. @@ -878,7 +908,7 @@ SELECT pg_catalog.setval('public.apps_id_seq', 11, true); -- Name: companies_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.companies_id_seq', 1, true); +SELECT pg_catalog.setval('public.companies_id_seq', 24, true); -- @@ -892,7 +922,7 @@ SELECT pg_catalog.setval('public.maillayouts_id_seq', 1, true); -- Name: mailtemplates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.mailtemplates_id_seq', 5, true); +SELECT pg_catalog.setval('public.mailtemplates_id_seq', 7, true); -- @@ -906,7 +936,7 @@ SELECT pg_catalog.setval('public.members_id_seq', 1, false); -- Name: sessions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.sessions_id_seq', 124, true); +SELECT pg_catalog.setval('public.sessions_id_seq', 161, true); -- @@ -927,7 +957,7 @@ SELECT pg_catalog.setval('public.useringroups_id_seq', 1, true); -- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: potlu_user -- -SELECT pg_catalog.setval('public.users_id_seq', 1, false); +SELECT pg_catalog.setval('public.users_id_seq', 2, true); -- @@ -963,10 +993,10 @@ ALTER TABLE ONLY public.mailtemplates -- --- Name: members members_pkey; Type: CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_members members_pkey; Type: CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.members +ALTER TABLE ONLY public.zzold_members ADD CONSTRAINT members_pkey PRIMARY KEY (id); @@ -987,10 +1017,10 @@ ALTER TABLE ONLY public.usergroups -- --- Name: useringroups useringroups_pkey; Type: CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups useringroups_pkey; Type: CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_pkey PRIMARY KEY (id); @@ -1011,26 +1041,28 @@ ALTER TABLE ONLY public.sessions -- --- Name: vw_userlist _RETURN; Type: RULE; Schema: public; Owner: potlu_user +-- Name: vw_userslist _RETURN; Type: RULE; Schema: public; Owner: potlu_user -- -CREATE OR REPLACE VIEW public.vw_userlist AS +CREATE OR REPLACE VIEW public.vw_userslist AS SELECT us.id, - mb.id AS id_member, - COALESCE(us.username, ''::text) AS username, - mb.prename, - mb.surname, us.blocked, - string_agg(ug.groupname, ','::text) AS group_ids, - co.id AS id_company, - co.company - FROM ((((public.users us - LEFT JOIN public.members mb ON ((us.id = mb.id_user))) - LEFT JOIN public.useringroups uig ON ((us.id = uig.id_user))) - JOIN public.usergroups ug ON ((uig.id_group = ug.id))) - LEFT JOIN public.companies co ON ((mb.id_company = co.id))) - GROUP BY us.id, mb.id, co.id - ORDER BY mb.surname, mb.prename; + us.username, + json_array_elements_text(us.schemaaccess) AS schemaaccess, + us.surname, + us.prename, + us.phone, + us.job, + us.id_company, + co.company, + string_agg(ugrp.groupname, ','::text) AS usergroups + FROM (((public.users us + LEFT JOIN public.companies co ON ((us.id_company = co.id))) + LEFT JOIN ( SELECT users.id AS id_user, + (json_array_elements_text(users.id_usergroups))::integer AS id_usergroup + FROM public.users) ugs ON ((ugs.id_user = us.id))) + LEFT JOIN public.usergroups ugrp ON ((ugrp.id = ugs.id_usergroup))) + GROUP BY us.id, co.id; -- @@ -1050,26 +1082,26 @@ ALTER TABLE ONLY public.mailtemplates -- --- Name: members members_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_members members_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.members +ALTER TABLE ONLY public.zzold_members ADD CONSTRAINT members_users_fkey FOREIGN KEY (id_user) REFERENCES public.users(id); -- --- Name: useringroups useringroups_idgroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups useringroups_idgroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_idgroup_fkey FOREIGN KEY (id_group) REFERENCES public.usergroups(id); -- --- Name: useringroups useringroups_iduser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user +-- Name: zzold_useringroups useringroups_iduser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: potlu_user -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_iduser_fkey FOREIGN KEY (id_user) REFERENCES public.users(id); diff --git a/dev/db/potlu_db.public.pg.install.schema.sql b/dev/db/potlu_db.public.pg.install.schema.sql index c022c8ed..f2c7e24b 100644 --- a/dev/db/potlu_db.public.pg.install.schema.sql +++ b/dev/db/potlu_db.public.pg.install.schema.sql @@ -1,37 +1,37 @@ CREATE FUNCTION public.checklogin(vusername text, vpassword text, vremoteaddr text, vuseragent text) RETURNS text LANGUAGE plpgsql - AS $$ -declare - iduser int4; - newidsession text := null; -begin - select id into iduser from public.users where lower(username)=lower(vusername) and userpassword = vpassword and "blocked" is null; - if (iduser is not null) then - delete from public.sessions where id_user= iduser and remote_addr= vremoteaddr and user_agent= vuseragent; - insert into public.sessions (id_user,idsession,remote_addr,user_agent) VALUES( iduser,public.random_string(40), vremoteaddr,vuseragent) returning idsession into newidsession; - end if; - return newidsession; -end; + AS $$ +declare + iduser int4; + newidsession text := null; +begin + select id into iduser from public.users where lower(username)=lower(vusername) and userpassword = vpassword and "blocked" is null; + if (iduser is not null) then + delete from public.sessions where id_user= iduser and remote_addr= vremoteaddr and user_agent= vuseragent; + insert into public.sessions (id_user,idsession,remote_addr,user_agent) VALUES( iduser,public.random_string(40), vremoteaddr,vuseragent) returning idsession into newidsession; + end if; + return newidsession; +end; $$; CREATE FUNCTION public.getdates(startdate date, days integer) RETURNS SETOF date LANGUAGE plpgsql - AS $$ - BEGIN - return QUERY select date(startdate + s*'1day'::interval) as daydate from generate_series(0,days-1) s ; - END; + 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; + 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 @@ -46,18 +46,18 @@ $$; CREATE FUNCTION public.getsession(vidsession text, vremoteaddr text, vuseragent text) RETURNS TABLE(idsession text, id integer, username text, usergroups text, userschemata text) LANGUAGE plpgsql - AS $$ - BEGIN - return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se -join users us on (us.id=se.id_user) -left join useringroups uig on (us.id=uig.id_user) -left join usergroups aug on (aug.id=uig.id_group) -left join members mb on (mb.id_user=us.id) -left join companies co on (co.id=mb.id_company) -where se.idsession= vidsession -and se.remote_addr= vremoteaddr -and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id; - END; + AS $$ + BEGIN + return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se +join users us on (us.id=se.id_user) +left join useringroups uig on (us.id=uig.id_user) +left join usergroups aug on (aug.id=uig.id_group) +left join members mb on (mb.id_user=us.id) +left join companies co on (co.id=mb.id_company) +where se.idsession= vidsession +and se.remote_addr= vremoteaddr +and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id; + END; $$; CREATE FUNCTION public.getsundays(vyear integer) RETURNS SETOF date @@ -82,14 +82,14 @@ $$; CREATE FUNCTION public.random_string(vlength integer) RETURNS text LANGUAGE plpgsql - AS $$ -declare - randstr text := null; -BEGIN -SELECT string_agg (substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', ceil (random() * 62)::integer, 1), '') into randstr -FROM generate_series(1, vlength); -return randstr; -end; + AS $$ +declare + randstr text := null; +BEGIN +SELECT string_agg (substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', ceil (random() * 62)::integer, 1), '') into randstr +FROM generate_series(1, vlength); +return randstr; +end; $$; CREATE FUNCTION public.trg_update_basemonthhours() RETURNS trigger diff --git a/dev/db/potlu_db.public.pg.schema.sql b/dev/db/potlu_db.public.pg.schema.sql index 037a9de0..d36ecb5d 100644 --- a/dev/db/potlu_db.public.pg.schema.sql +++ b/dev/db/potlu_db.public.pg.schema.sql @@ -103,15 +103,12 @@ CREATE FUNCTION public.getsession(vidsession text, vremoteaddr text, vuseragent LANGUAGE plpgsql AS $$ BEGIN - return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se -join users us on (us.id=se.id_user) -left join useringroups uig on (us.id=uig.id_user) -left join usergroups aug on (aug.id=uig.id_group) -left join members mb on (mb.id_user=us.id) -left join companies co on (co.id=mb.id_company) -where se.idsession= vidsession -and se.remote_addr= vremoteaddr -and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id; + return QUERY select se.idsession,us.id,us.username,string_agg(distinct(ugrp.usergroup),',') as usergroups,json_array_elements_text(us.schemaaccess) as userschemata from sessions se +join users us on (us.id=se.id_user) +left join (SELECT users.id,json_array_elements_text(users.id_usergroups) AS id_usergroup FROM users) ugs on (us.id=ugs.id) +left join usergroups ugrp on (ugrp.id=ugs.id) +where se.idsession= vidsession and se.remote_addr= vremoteaddr and se.user_agent= vuseragent and +us.blocked is null group by se.id,us.id; END; $$; @@ -373,10 +370,10 @@ ALTER SEQUENCE public.mailtemplates_id_seq OWNED BY public.mailtemplates.id; -- --- Name: members; Type: TABLE; Schema: public; Owner: - +-- Name: zzold_members; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.members ( +CREATE TABLE public.zzold_members ( id integer NOT NULL, surname text, prename text, @@ -404,7 +401,7 @@ CREATE SEQUENCE public.members_id_seq -- Name: members_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.members_id_seq OWNED BY public.members.id; +ALTER SEQUENCE public.members_id_seq OWNED BY public.zzold_members.id; -- @@ -473,10 +470,10 @@ ALTER SEQUENCE public.usergroups_id_seq OWNED BY public.usergroups.id; -- --- Name: useringroups; Type: TABLE; Schema: public; Owner: - +-- Name: zzold_useringroups; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.useringroups ( +CREATE TABLE public.zzold_useringroups ( id integer NOT NULL, id_user bigint, id_group bigint @@ -500,7 +497,7 @@ CREATE SEQUENCE public.useringroups_id_seq -- Name: useringroups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.useringroups_id_seq OWNED BY public.useringroups.id; +ALTER SEQUENCE public.useringroups_id_seq OWNED BY public.zzold_useringroups.id; -- @@ -515,7 +512,13 @@ CREATE TABLE public.users ( username text, regcode text, vcode text, - schemaaccess json + schemaaccess json, + id_usergroups json, + surname text, + prename text, + phone text, + job text, + id_company integer ); @@ -586,45 +589,66 @@ CREATE VIEW public.vw_companieslist AS -- --- Name: vw_memberdata; Type: VIEW; Schema: public; Owner: - +-- Name: vw_schemata; Type: VIEW; Schema: public; Owner: - +-- + +CREATE VIEW public.vw_schemata AS + SELECT schemata.schema_name AS schemaname + FROM information_schema.schemata + WHERE ((schemata.schema_owner)::text = 'potlu_user'::text); + + +-- +-- Name: vw_usergroupslist; Type: VIEW; Schema: public; Owner: - -- -CREATE VIEW public.vw_memberdata AS - SELECT members.id, - members.surname, - members.prename, - members.phone, - members.id_user, - members.id_company, - members.job - FROM public.members; +CREATE VIEW public.vw_usergroupslist AS + SELECT usergroups.id, + usergroups.usergroup, + usergroups.isdefault, + usergroups.groupname + FROM public.usergroups; -- --- Name: vw_userdata; Type: VIEW; Schema: public; Owner: - +-- Name: vw_usersdata; Type: VIEW; Schema: public; Owner: - -- -CREATE VIEW public.vw_userdata AS +CREATE VIEW public.vw_usersdata AS SELECT users.id, - users.username + users.userpassword, + users.created, + users.blocked, + users.username, + users.regcode, + users.vcode, + users.schemaaccess, + users.id_usergroups, + users.surname, + users.prename, + users.phone, + users.job, + users.id_company FROM public.users; -- --- Name: vw_userlist; Type: VIEW; Schema: public; Owner: - +-- Name: vw_userslist; Type: VIEW; Schema: public; Owner: - -- -CREATE VIEW public.vw_userlist AS +CREATE VIEW public.vw_userslist AS SELECT NULL::integer AS id, - NULL::integer AS id_member, + NULL::boolean AS blocked, NULL::text AS username, - NULL::text AS prename, + NULL::text AS schemaaccess, NULL::text AS surname, - NULL::boolean AS blocked, - NULL::text AS group_ids, + NULL::text AS prename, + NULL::text AS phone, + NULL::text AS job, NULL::integer AS id_company, - NULL::text AS company; + NULL::text AS company, + NULL::text AS usergroups; -- @@ -656,38 +680,38 @@ ALTER TABLE ONLY public.mailtemplates ALTER COLUMN id SET DEFAULT nextval('publi -- --- Name: members id; Type: DEFAULT; Schema: public; Owner: - +-- Name: sessions id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.members ALTER COLUMN id SET DEFAULT nextval('public.members_id_seq'::regclass); +ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); -- --- Name: sessions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: usergroups id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); +ALTER TABLE ONLY public.usergroups ALTER COLUMN id SET DEFAULT nextval('public.usergroups_id_seq'::regclass); -- --- Name: usergroups id; Type: DEFAULT; Schema: public; Owner: - +-- Name: users id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.usergroups ALTER COLUMN id SET DEFAULT nextval('public.usergroups_id_seq'::regclass); +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- --- Name: useringroups id; Type: DEFAULT; Schema: public; Owner: - +-- Name: zzold_members id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.useringroups ALTER COLUMN id SET DEFAULT nextval('public.useringroups_id_seq'::regclass); +ALTER TABLE ONLY public.zzold_members ALTER COLUMN id SET DEFAULT nextval('public.members_id_seq'::regclass); -- --- Name: users id; Type: DEFAULT; Schema: public; Owner: - +-- Name: zzold_useringroups id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); +ALTER TABLE ONLY public.zzold_useringroups ALTER COLUMN id SET DEFAULT nextval('public.useringroups_id_seq'::regclass); -- @@ -723,10 +747,10 @@ ALTER TABLE ONLY public.mailtemplates -- --- Name: members members_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_members members_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.members +ALTER TABLE ONLY public.zzold_members ADD CONSTRAINT members_pkey PRIMARY KEY (id); @@ -747,10 +771,10 @@ ALTER TABLE ONLY public.usergroups -- --- Name: useringroups useringroups_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_useringroups useringroups_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_pkey PRIMARY KEY (id); @@ -771,26 +795,28 @@ ALTER TABLE ONLY public.sessions -- --- Name: vw_userlist _RETURN; Type: RULE; Schema: public; Owner: - +-- Name: vw_userslist _RETURN; Type: RULE; Schema: public; Owner: - -- -CREATE OR REPLACE VIEW public.vw_userlist AS +CREATE OR REPLACE VIEW public.vw_userslist AS SELECT us.id, - mb.id AS id_member, - COALESCE(us.username, ''::text) AS username, - mb.prename, - mb.surname, us.blocked, - string_agg(ug.groupname, ','::text) AS group_ids, - co.id AS id_company, - co.company - FROM ((((public.users us - LEFT JOIN public.members mb ON ((us.id = mb.id_user))) - LEFT JOIN public.useringroups uig ON ((us.id = uig.id_user))) - JOIN public.usergroups ug ON ((uig.id_group = ug.id))) - LEFT JOIN public.companies co ON ((mb.id_company = co.id))) - GROUP BY us.id, mb.id, co.id - ORDER BY mb.surname, mb.prename; + us.username, + json_array_elements_text(us.schemaaccess) AS schemaaccess, + us.surname, + us.prename, + us.phone, + us.job, + us.id_company, + co.company, + string_agg(ugrp.groupname, ','::text) AS usergroups + FROM (((public.users us + LEFT JOIN public.companies co ON ((us.id_company = co.id))) + LEFT JOIN ( SELECT users.id AS id_user, + (json_array_elements_text(users.id_usergroups))::integer AS id_usergroup + FROM public.users) ugs ON ((ugs.id_user = us.id))) + LEFT JOIN public.usergroups ugrp ON ((ugrp.id = ugs.id_usergroup))) + GROUP BY us.id, co.id; -- @@ -810,26 +836,26 @@ ALTER TABLE ONLY public.mailtemplates -- --- Name: members members_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_members members_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.members +ALTER TABLE ONLY public.zzold_members ADD CONSTRAINT members_users_fkey FOREIGN KEY (id_user) REFERENCES public.users(id); -- --- Name: useringroups useringroups_idgroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_useringroups useringroups_idgroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_idgroup_fkey FOREIGN KEY (id_group) REFERENCES public.usergroups(id); -- --- Name: useringroups useringroups_iduser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: zzold_useringroups useringroups_iduser_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.useringroups +ALTER TABLE ONLY public.zzold_useringroups ADD CONSTRAINT useringroups_iduser_fkey FOREIGN KEY (id_user) REFERENCES public.users(id); -- 2.39.5