# use CGI::Carp qw/fatalsToBrowser/;
use File::Basename;
use JSON::PP;
-
+use Data::Dumper;
use dksconfig qw/$sitecfg/;
use dksdb;
# $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})){
}
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};
}
}
}
+ 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};
$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";
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);
+ }
}
}
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 = <SCA>){
- $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 = <SCA>){
+ $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;$d<scalar(@schemaddl);$d++){
$self->dbexec($schemaddl[$d]);
}
}
+ return $ret;
}
1;
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;
return $ret;
}
+
sub validateaccount(){
my $self = shift;
my $data = shift;
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,
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
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,
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,
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)
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)
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)
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)
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)
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)
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)
CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplanlist AS
SELECT st.id AS id_staff,
((st.surname || ' '::text) || st.prename) AS staffname,
- (((((('Semaine '::text || sp_dwt.calweek) || '<br/>('::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) || '<br/>('::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,
((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(((('<br/>'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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)))
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);
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
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();
#END - iFrame - Modules
$template->process($skl,$vars) || die "Template process failed: ", $template->error(), "\n";
-
+# print "/*".Dumper($vars)."*/";
# if ($vars->{page} =~ /\.tt/){
# print '<pre >'.Dumper($p)."<pre>";
# }
getAllSchemata: function(){\r
var x = choice["company"]["schemata"];\r
\r
- console.log(x.getValue(true));//.getValue(true));\r
+ //console.log(x.getValue(true));//.getValue(true));\r
return x.getValue(true);\r
},\r
+ reloadframe: function(){\r
+ console.log("reloadframe");\r
+ document.getElementById("moduleframe").contentWindow.location.reload();\r
+ },\r
logout: function() {\r
req.reqdata("POST", location.href, { "logout": "1" }, admin.reloadpage);\r
\r
choices : []\r
});\r
getschemata();\r
+ choice["company"]["schemata"].passedElement.element.addEventListener('change',function(){admin.reloadframe();});\r
});\r
\r
function getschemata(){\r
- req.reqdata("POST","db.cgi",{"get":"companieslist"},fillschematalist);\r
+ req.reqdata("POST","index.cgi",{"fn":"getschemaaccess"},fillschematalist);\r
}\r
\r
function fillschematalist(data){\r
console.log(data);\r
- fillselectlist(choice["company"]["schemata"],data.sqldata,'schemata','company');\r
+ fillselectlist(choice["company"]["schemata"],data,'schemata','company');\r
\r
return false;\r
}\r
flds["fn"] ="saveform";
flds["schemata"]=schemata;
console.log(flds);
+ delete flds["null"];
if (aftercallback){
req.reqdata("POST","index.cgi",flds,aftercallback);
formsaved({});
}
function fillformbydataclass2(dataclass,choices,data){
- //console.log(data);
+ console.log(data);
var frm = document.querySelectorAll('.data_'+ dataclass);
if (data){
for (var f in frm){
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]);
},
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!');
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 = [];
}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){
--- /dev/null
+<div id="dlgdataload" class="w3-modal">
+
+ <div class="w3-modal-content w3-animate-top w3-card-4">
+ <header class="w3-container">
+ <h2 id="dlgdataload_title"></h2>
+ </header>
+ <div class="w3-container">
+ <div class="w3-container" id="dlgdataload_text">Attentez s.v.p.!</div>
+ <div class="container w3-padding">
+ <progress class="w3-progress w3-block" indeterminate></progress>
+ </div>
+ </div>
+ <footer class="w3-container w3-right-align w3-padding-16">
+ <!--<button class="w3-button w3-blue-grey w3-margin-right w3-border" onclick="document.getElementById('dlgdataload').style.display='none'; return false;">OK</button> -->
+ </footer>
+ </div>
+</div>
+<script>
+
+function showdataloaddlg(title,message){
+ document.getElementById('dlgdataload_title').innerHTML=title;
+ document.getElementById('dlgdataload_text').innerHTML=message;
+ document.getElementById('dlgdataload').style.display='block';
+ return false;
+}
+
+function closedataloaddlg(){
+ document.getElementById('dlgdataload_title').innerHTML='';
+ document.getElementById('dlgdataload_text').innerHTML='';
+ document.getElementById('dlgdataload').style.display='none';
+ return false;
+}
+
+function setloadtext(msg){
+ document.getElementById('dlgdataload_text').innerHTML=msg;
+}
+</script>
\ No newline at end of file
--- /dev/null
+<div id="dlgmessage" class="w3-modal">
+
+ <div class="w3-modal-content w3-animate-top w3-card-4">
+ <header class="w3-container">
+ <span onclick="document.getElementById('dlgmessage').style.display='none'; return false;"
+ class="w3-button w3-display-topright">×</span>
+ <h2 id="dlgmessage_title"></h2>
+ </header>
+ <div class="w3-container">
+ <div id="dlgmessage_text"></div>
+ </div>
+ <footer class="w3-container w3-right-align w3-padding-16">
+ <button class="w3-button w3-blue-grey w3-margin-right w3-border" onclick="document.getElementById('dlgmessage').style.display='none'; return false;">OK</button>
+ </footer>
+ </div>
+</div>
+<script>
+
+function showmessagedlg(title,message){
+ document.getElementById('dlgmessage_title').innerHTML=title;
+ document.getElementById('dlgmessage_text').innerHTML=message;
+ document.getElementById('dlgmessage').style.display='block';
+ return false;
+}
+</script>
\ No newline at end of file
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;
},
afterdeletecallback: function(data){
companies.gettbldata();
+ module.viewpanel('tbl_' + companies.name);
}
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",
- });
+
}
<div class="w3-top w3-theme-light w3-border-bottom">
<div class="w3-bar">
<button class="w3-bar-item w3-button w3-border w3-blue-grey w3-hover-text-white" onclick="module.viewpanel('tbl_reportperiod');">Periodes</button>
- <!-- <button class="w3-bar-item w3-button w3-border w3-blue-grey w3-hover-text-white" onclick="module.viewpanel('tbl_staffworkplan');">Plans</button> -->
+ <!-- -->
[% INCLUDE "module/$module/widgets/reportperiod/tbar_reportperiod.tt" %]
[% INCLUDE "module/$module/widgets/staffworkplan/tbar_staffworkplan.tt" %]
</div>
[% INCLUDE "module/$module/widgets/staffworkplan/frm_staffworkplan.tt" %]
</div>
[% INCLUDE block/dlgdeleterow.tt %]
+[% INCLUDE block/dlgmessage.tt %]
+[% INCLUDE block/dlgdataload.tt %]
[% INCLUDE "module/$module/widgets/reportperiod/dlg_reportperiod.tt" %]
<script src="widgets/reportperiod/reportperiod.js"></script>
<script src="widgets/staffworkplan/staffworkplan.js"></script>
[% PROCESS macro/fields.tt %]
-<div id="dlg_reportperiod" class="dialog w3-modal">
+<div id="dlg_reportperiod" class="w3-modal">
<div class="w3-modal-content w3-animate-top w3-card-4">
<header class="w3-container">
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();
<h3>Plan de travail</h3>
<div class="w3-row-padding">
<div class="w3-container">
-
+ <div class="w3-container">
[% fieldmultiselectbox('id_staff','staffworkplan','Employé(es)','','','') %]
[% fielddatebox('dates','staffworkplan','Date(s)','','','') %]
[% fielddatebox('daterange','staffworkplan','Période','w3-half','','') %]
- [% fieldmultiselectbox('weekdays','display','Jours','','','') %]
- <div class="container">
+ </div>
+ [% #fieldmultiselectbox('weekdays','display','Jours','','','') %]
+ <div class="w3-container">
[% fieldselectbox('id_workplan','staffworkplan','Modèle','w3-third','','','') %]
</div>
[% FOREACH tt IN wd %]
</div>
</div>
<div class="w3-container w3-fifth">
- [% 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é','','','') %]
</div>
</div>
//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,
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);
var vfields = document.getElementsByClassName("dayvacancy");
for (var i=0;i<vfields.length;i++){
//console.log(vfields[i]);
- vfields[i].addEventListener('change', function(event){staffworkplan.setvacancytime(event,this.id);});
+ vfields[i].addEventListener('change', function(event){staffworkplan.setvacancyhours(event,this.id);});
//
}
},
],
columns: [
//{ title: "Nom", field: "staffname",headerFilter: "input",width:205},
- { title: "Semaine", field:"calweek",formatter: "html",width:205},
+ { title: "Semaine", field:"dspcalweek",formatter: "html",width:205},
{ title: "Total<br/>Semaine", field:"week_timetotal", bottomCalc:staffworkplan.periodtimesum},
{ title: "Lundi",
columns: [
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);
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]);
}
},
}
},
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)!<br/>";
+ }
+ if (wpdata["staffworkplan_dates"] == "" && wpdata["staffworkplan_daterange"] == ""){
+ datamsg += "pas de date(s) définie(s)!<br/>";
+ }
+ 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)!<br/>"
+ }
+ if (datamsg != ""){
+ showmessagedlg("Configuration incomplète!",'<div class="w3-panel w3-text-red">'+ datamsg+'</div>');
+ return false;
+ }
+ var allrows=[];
+ showdataloaddlg('','<div class="w3-xxlarge">Attendez s.v.p.!</div>');
+ for (var s=0;s<wpdata["staffworkplan_id_staff"].length;s++){
+ var wpdates = wpdata["staffworkplan_dates"].split(", ");
+ for (var d=0;d<wpdates.length;d++){
+ var row = null;
+ var dw= new Date(wpdates[d]).getDay();
+ if (wpdata["staffworkplan_"+ jscalcdays[dw] +"_timetotal"] != ""){
+ row = {"ident_staffworkplan_id_staff":wpdata["staffworkplan_id_staff"][s],"ident_staffworkplan_daydate":wpdates[d]};
+ for (var i in wpdata){
+
+ if (i.startsWith("staffworkplan_"+ jscalcdays[dw])){
+ var elname = i.replace(jscalcdays[dw] + "_",'');
+ row[elname] = wpdata[i];
+ }
+ }
+ delete row["staffworkplan_timetotal"];
+ }
+
+ if (row){
+ allrows.push(row);
+ }
+ }
+ if (wpdata["staffworkplan_daterange"] != ""){
+ var wpdaterange = wpdata["staffworkplan_daterange"].split(" au ");
+ var cdate = moment(wpdaterange[0]);
+ var edate = moment(wpdaterange[1]);
+ while (cdate.isSameOrBefore(edate)){
+ var row = null;
+ var dw= new Date(cdate.format('YYYY-MM-DD')).getDay();
+ if (wpdata["staffworkplan_"+ jscalcdays[dw] +"_timetotal"] != ""){
+ row = {"ident_staffworkplan_id_staff":wpdata["staffworkplan_id_staff"][s],"ident_staffworkplan_daydate":cdate.format('YYYY-MM-DD')};
+ for (var i in wpdata){
+
+ if (i.startsWith("staffworkplan_"+ jscalcdays[dw])){
+ var elname = i.replace(jscalcdays[dw] + "_",'');
+ row[elname] = wpdata[i];
+ }
+ }
+ delete row["staffworkplan_timetotal"];
+ }
+ if (row){
+ allrows.push(row);
+ }
+ cdate.add(1, 'days');
+ }
+ }
+
+ }
+ console.log("End save!");
+ //console.log(allrows)
+ for (var r in allrows){
+ allrows[r]["upsert"] = "1";
+ allrows[r]["schemata"] = schemata;
+ console.log(allrows[r]);
+ req.reqdata("POST","db.cgi",allrows[r],staffworkplan.workplansaved);
+ }
+ setTimeout("staffworkplan.workplanlastsaved()","1000");
+ //closedataloaddlg();
+ return false;
},
getstaff: function(){
req.reqdata("POST","db.cgi",{"get":"stafflist","schemata":schemata},staffworkplan.fillstaff);
},
setworkplan: function(data){
if (data && data.sqldata){
- console.log(data.sqldata[0]);
+ //console.log(data.sqldata[0]);
var wpdata = data.sqldata[0];
delete wpdata["id"];
fillformbydataclass("staffworkplan",data.sqldata[0],false);
}
}
},
- setvacancytime: function(ev,id){
- console.log("Vacancy: " + id);
+ setvacancyhours: function(ev,id){
+ //console.log("Vacancy: " + id);
wday = id.substring(0,3);
if (ev.detail.value == ""){
- document.getElementById(wday + "_vacancytime")._flatpickr.clear();
- } else if (document.getElementById(wday + "_vacancytime").value == ""){
- document.getElementById(wday + "_vacancytime")._flatpickr.setDate(document.getElementById(wday + "_timetotal").value);
+ document.getElementById(wday + "_vacancyhours")._flatpickr.clear();
+ } else if (document.getElementById(wday + "_vacancyhours").value == ""){
+ document.getElementById(wday + "_vacancyhours")._flatpickr.setDate(document.getElementById(wday + "_timetotal").value);
}
},
checktime: function(id){
wday=id.substring(0,3);
- console.log("timefield: " + wday +"=>" + id + " changed");
+ //console.log("timefield: " + wday +"=>" + id + " changed");
var mt1 = 0;
var mt2 = 0;
var mtp = 0;
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<values.length;i++){
calc= calc + parseInt(data[i].weekminutes)
}
return timecalc.MinutesToTime(calc);
+ },
+ workplansaved: function(data){
+ console.log(data);
+ return false;
+ },
+ workplanlastsaved: function(data){
+ staffworkplan.loadtbldata();
+ module.viewpanel('tbl_staffworkplan');
+ closedataloaddlg();
+ return false;
}
}
<button class="w3-bar-item w3-button w3-border w3-right w3-blue-grey" onclick="staffworkplan.add();"><img src="[% abspath%]img/icons/plus_white.svg" style="height: 24px;"/></button>
</div>
<div class="toolbar" id="tbar_frm_staffworkplan" style="display: none;">
+ <button class="w3-bar-item w3-button w3-border w3-blue-grey w3-hover-text-white" onclick="module.viewpanel('tbl_staffworkplan');">retour vers le Plan</button>
</div>
\ No newline at end of file
console.log("Current Schema:" + schemata);
staff.inittable();
+ staffcontract.inittable();
module.viewpanel("tbl_staff");
}
[% INCLUDE "module/$module/widgets/staff/tbl_staff.tt" %]
[% INCLUDE "module/$module/widgets/staff/frm_staff.tt" %]
</div>
+[% INCLUDE "module/$module/widgets/staffcontract/dlg_staffcontract.tt" %]
[% INCLUDE block/dlgdeleterow.tt %]
-<script src="widgets/staff/staff.js"></script>
\ No newline at end of file
+<script src="widgets/staff/staff.js"></script>
+<script src="widgets/staffcontract/staffcontract.js"></script>
\ No newline at end of file
</form>
</div>
- <div class="w3-container w3-padding-24 w3-card w3-margin w3-margin-bottom">
- <h3>Données contractuelles</h3>
- <div class="w3-bar">
-
- <button class="w3-bar-item w3-button w3-border w3-right w3-red" onclick="staff.remove_periodbase();"><img src="[% abspath%]img/icons/remove_white.svg" style="height: 24px;"/></button>
- <button class="w3-bar-item w3-button w3-border w3-right w3-blue-grey" onclick="staff.edit_periodbase();"><img src="[% abspath%]img/icons/edit_white.svg" style="height: 24px;"/></button>
- <button class="w3-bar-item w3-button w3-border w3-right w3-blue-grey" onclick="staff.add_periodbase();"><img src="[% abspath%]img/icons/plus_white.svg" style="height: 24px;"/></button>
- </div>
- <div id="tbl_staffperiodbase" >
-
- </div>
- </div>
+ [% INCLUDE "module/$module/widgets/staffcontract/tbl_staffcontract.tt" %]
</div>
\ No newline at end of file
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();
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);
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);
//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);
}
},
--- /dev/null
+[% PROCESS macro/fields.tt %]
+<div id="dlg_staffcontract" class="w3-modal">
+
+ <div class="w3-modal-content w3-animate-top w3-card-4">
+ <header class="w3-container">
+ <span onclick="document.getElementById('dlg_staffcontract').style.display='none'; return false;"
+ class="w3-button w3-display-topright">×</span>
+ <h3 id="dlgstaffcontract_title">Données contractuelles</h3>
+ </header>
+ <div class="w3-container">
+ <form id="frm_staffcontract">
+ [% 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','','','') %]
+ </form>
+ </div>
+ <footer class="w3-container w3-right-align w3-padding-16">
+ <button class="w3-button w3-theme-light w3-margin-right w3-border" onclick="document.getElementById('dlg_staffcontract').style.display='none'; return false;">Annuler</button>
+ <button class="w3-button w3-blue-grey w3-margin-right w3-border" onclick="saveform('staffcontract',staffcontract.afterstaffcontractsaved);">sauvegarder</button>
+ </footer>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+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
--- /dev/null
+<div class="subtoolbar" >
+<div class="w3-bar">
+
+ <button class="w3-bar-item w3-button w3-border w3-right w3-red" onclick="staffcontract.remove();"><img src="[% abspath%]img/icons/remove_white.svg" style="height: 24px;"/></button>
+ <button class="w3-bar-item w3-button w3-border w3-right w3-blue-grey" onclick="staffcontract.edit();"><img src="[% abspath%]img/icons/edit_white.svg" style="height: 24px;"/></button>
+ <button class="w3-bar-item w3-button w3-border w3-right w3-blue-grey" onclick="staffcontract.add();"><img src="[% abspath%]img/icons/plus_white.svg" style="height: 24px;"/></button>
+ </div>
+ </div>
\ No newline at end of file
--- /dev/null
+<div class="w3-container w3-padding-24 w3-card w3-margin w3-margin-bottom">
+ <h3>Données contractuelles</h3>
+ [% INCLUDE "module/$module/widgets/staffcontract/tbar_staffcontract.tt" %]
+ <div id="tbl_staffcontract" >
+
+ </div>
+ </div>
\ No newline at end of file
[% INCLUDE "module/$module/widgets/users/tbl_users.tt" %]
</div>
[% INCLUDE block/dlgdeleterow.tt %]
+[% INCLUDE block/dlgmessage.tt %]
[% INCLUDE "module/$module/widgets/users/dlg_users.tt" %]
<script src="widgets/users/users.js"></script>
</form>
</div>
<footer class="w3-container w3-right-align w3-padding-16">
- <button class="w3-button w3-orange w3-border" onclick="users.sendnewpassword(); return false;">envoyer nouveau mot de passe</button>
+ <button class="w3-button w3-orange w3-border" id="btnnewpasswd" onclick="users.sendnewpassword(); return false;">Envoyer mot de passe</button>
<button class="w3-button w3-theme-light w3-border" onclick="document.getElementById('dlg_users').style.display='none'; return false;">annuler</button>
<button class="w3-button w3-blue-grey w3-margin w3-right-align" onclick="users.validateform();">sauvegarder</button>
</footer>
//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(){
{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"},
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();
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= '<div class="panel w3-red">inserez un email valide s.v.p.!</div>';
}
<img src="[% abspath %]img/icons/[% ap.icon %]" style="width: 24px;"> [% ap.name %]
</a>
[% END %]
- <a href="javascript:admin.logout();" class="w3-bar-item w3-button w3-dark-grey w3-hover-black">Logout</a>
+ <a href="javascript:admin.logout();" class="w3-bar-item w3-button w3-dark-grey w3-hover-black"><img src="[% abspath %]img/icons/logout_white.svg" style="width: 24px;"> Logout</a>
</div>
</nav>
<div class="w3-overlay w3-hide-large w3-animate-opacity" id="myOverlay" onclick="w3_close()" style="cursor:pointer" title="close side menu"></div>
--- /dev/null
+.\" 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 <bpgn@cpan.org>
+.PP
+Maintainership since 2015: David Precious (\s-1BIGPRESH\s0) <davidp@preshweb.co.uk>
+.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
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,
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
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,
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,
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)
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)
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)
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)
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)
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)
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)
CREATE VIEW %%NEWSCHEMA%%.vw_staffworkplanlist AS
SELECT st.id AS id_staff,
((st.surname || ' '::text) || st.prename) AS staffname,
- (((((('Semaine '::text || sp_dwt.calweek) || '<br/>('::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) || '<br/>('::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,
((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(((('<br/>'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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)))
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);
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
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();
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');
--
--
--- 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);
--
-- 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);
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', '<html>\r
+ <head>\r
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">\r
+ <style>\r
+ body,html {\r
+ margin: 0;\r
+ background-color: #fff;\r
+ }\r
+ </style>\r
+ </head>\r
+ <body bgcolor="#607d8b">\r
+ <div class="maincontainer" align="left" style="padding-top: 5px; width: auto; background-color: #607d8b!important; color: #fff;">\r
+ POT - Plan d''organisation de travail</span>\r
+ <div style="background-color: #fff; color: #000">\r
+ <div class="mailcontent" align="left" style="padding: 10px; color: #000;">\r
+ %%BODYCONTENT%%\r
+ </div>\r
+ </div>\r
+ </div>\r
+ </body>\r
+</html>');
--
-- 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%%,<br/>
+<br/>
+Merci pour votre création de compte sur pot.lu,
+<br/><br/>
+votre login: <strong>%%username%%</strong><br/>
+votre mot de passe: <strong>%%password%%</strong>
+<br/>
+Meilleurs salutations,<br/>
+<br/>
+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%%,<br/><br/>
+
+vous avez demandé un nouveau mot de passe via pot.lu!<br/>
+nouveau mot de passe: <strong>%%newpassword%%</strong><br/><br/>
+<br/>
+Meilleurs salutations,<br/>
+<br/>
+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%%,<br/>
+<br/>
+Votre souscription au site pot.lu expire bientôt,
+<br/><br/>
+n''oublié pas à la prolonger!
+<a href="%%siteurl%%/profile/application">Prolonger maintenant</a>
+<br/>
+Meilleurs salutations,<br/>
+<br/>
+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%%,<br/>
+<br/>
+En annexe vous trouvez la facture pour votre souscription au site pot.lu,
+<br/>
+<b>Vous avez Payé déjà via PayPal!</b>
+
+Meilleurs salutations,<br/>
+<br/>
+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%%,<br/>
+<br/>
+En annexe vous trouvez la facture pour votre souscription au site pot.lu,
+<br/>
+
+Meilleurs salutations,<br/>
+<br/>
+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%%,<br/>\r
+<br/>\r
+Le code pour valider votre e-mail est:\r
+<br/>\r
+<strong>%%vcode%%</strong><br/>\r
+<br/>\r
+entrez le code ici: <a href="%%siteurl%%/backoffice/validationcode.html">%%siteurl%%/backoffice/validationcode.html</a>\r
+<br/>\r
+Méilleurs Salutations,<br/>\r
+<br/>\r
+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%%,<br/>\r
+<br/>\r
+Nous avons crées / modifé votre compte sur le site pot.lu;<br/>\r
+<br/>\r
+Votre Login: <i>%%username%%</i><br/>\r
+Mot de passe: <strong style="font-family: Courier New,Courier,Lucida Sans Typewriter,Lucida Typewriter,monospace;">%%newpassword%%</strong><br/><br/>\r
+<br/>\r
+méilleurs Salutations,<br/>\r
+<br/>\r
+pot.lu Support-Team<br>\r
+', '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);
--
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);
--
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);
--
-- 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);
--
-- 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);
--
-- 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);
--
-- 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);
--
-- 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);
--
LANGUAGE plpgsql
AS $$\r
BEGIN\r
- return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se \r
-join users us on (us.id=se.id_user) \r
-left join useringroups uig on (us.id=uig.id_user)\r
-left join usergroups aug on (aug.id=uig.id_group)\r
-left join members mb on (mb.id_user=us.id)\r
-left join companies co on (co.id=mb.id_company)\r
-where se.idsession= vidsession\r
-and se.remote_addr= vremoteaddr\r
-and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id;\r
+ 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;\r
END; \r
$$;
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
--
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
--
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
--
-- 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;
--
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
--
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)
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)
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)
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)
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)
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)
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)
CREATE VIEW portanova.vw_staffworkplanlist AS
SELECT st.id AS id_staff,
((st.surname || ' '::text) || st.prename) AS staffname,
- (((((('Semaine '::text || sp_dwt.calweek) || '<br/>('::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) || '<br/>('::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,
((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(((('<br/>'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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)))
schemata text,
validated boolean,
schemata2 json,
- email text
+ email text,
+ socialtype text,
+ vatvalidated boolean
);
--
--- 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,
);
-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
-- 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;
--
--
--- 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
-- 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;
--
username text,
regcode text,
vcode text,
- schemaaccess json
+ schemaaccess json,
+ id_usergroups json,
+ surname text,
+ prename text,
+ phone text,
+ job text,
+ id_company integer
);
--
--- 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,
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
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
--
--
--- 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);
--
--
--- 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);
--
\.
---
--- 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
\.
--
--- 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
\.
--
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
--
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
\.
-- 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
\.
--
COPY public.maillayouts (id, layoutname, mailtemplate) FROM stdin;
+1 potbasic <html>\r\n <head>\r\n <meta http-equiv="content-type" content="text/html; charset=UTF-8">\r\n <style>\r\n body,html {\r\n margin: 0;\r\n background-color: #fff;\r\n }\r\n </style>\r\n </head>\r\n <body bgcolor="#607d8b">\r\n <div class="maincontainer" align="left" style="padding-top: 5px; width: auto; background-color: #607d8b!important; color: #fff;">\r\n POT - Plan d'organisation de travail</span>\r\n <div style="background-color: #fff; color: #000">\r\n <div class="mailcontent" align="left" style="padding: 10px; color: #000;">\r\n %%BODYCONTENT%%\r\n </div>\r\n </div>\r\n </div>\r\n </body>\r\n</html>
\.
--
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%%,<br/>\n<br/>\nMerci pour votre création de compte sur pot.lu,\n<br/><br/>\nvotre login: <strong>%%username%%</strong><br/>\nvotre mot de passe: <strong>%%password%%</strong>\n<br/>\nMeilleurs salutations,<br/>\n<br/>\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%%,<br/><br/>\n\nvous avez demandé un nouveau mot de passe via pot.lu!<br/>\nnouveau mot de passe: <strong>%%newpassword%%</strong><br/><br/>\n<br/>\nMeilleurs salutations,<br/>\n<br/>\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%%,<br/>\n<br/>\nVotre souscription au site pot.lu expire bientôt,\n<br/><br/>\nn'oublié pas à la prolonger!\n<a href="%%siteurl%%/profile/application">Prolonger maintenant</a>\n<br/>\nMeilleurs salutations,<br/>\n<br/>\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%%,<br/>\n<br/>\nEn annexe vous trouvez la facture pour votre souscription au site pot.lu,\n<br/>\n<b>Vous avez Payé déjà via PayPal!</b>\n\nMeilleurs salutations,<br/>\n<br/>\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%%,<br/>\n<br/>\nEn annexe vous trouvez la facture pour votre souscription au site pot.lu,\n<br/>\n\nMeilleurs salutations,<br/>\n<br/>\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%%,<br/>\r\n<br/>\r\nLe code pour valider votre e-mail est:\r\n<br/>\r\n<strong>%%vcode%%</strong><br/>\r\n<br/>\r\nentrez le code ici: <a href="%%siteurl%%/backoffice/validationcode.html">%%siteurl%%/backoffice/validationcode.html</a>\r\n<br/>\r\nMéilleurs Salutations,<br/>\r\n<br/>\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%%,<br/>\r\n<br/>\r\nNous avons crées / modifé votre compte sur le site pot.lu;<br/>\r\n<br/>\r\nVotre Login: <i>%%username%%</i><br/>\r\nMot de passe: <strong style="font-family: Courier New,Courier,Lucida Sans Typewriter,Lucida Typewriter,monospace;">%%newpassword%%</strong><br/><br/>\r\n<br/>\r\nméilleurs Salutations,<br/>\r\n<br/>\r\npot.lu Support-Team<br>\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
\.
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
\.
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
\.
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);
--
-- 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);
--
-- 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);
--
-- 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);
--
-- 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);
--
-- 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);
--
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
--
--
--- 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);
--
--- 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);
--
--- 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);
--
--- 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();
--
--
--- 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);
LANGUAGE plpgsql
AS $$\r
BEGIN\r
- return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se \r
-join users us on (us.id=se.id_user) \r
-left join useringroups uig on (us.id=uig.id_user)\r
-left join usergroups aug on (aug.id=uig.id_group)\r
-left join members mb on (mb.id_user=us.id)\r
-left join companies co on (co.id=mb.id_company)\r
-where se.idsession= vidsession\r
-and se.remote_addr= vremoteaddr\r
-and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id;\r
+ 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;\r
END; \r
$$;
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: -
--
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: -
--
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: -
--
-- 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;
--
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: -
--
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)
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)
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)
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)
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)
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)
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)
CREATE VIEW portanova.vw_staffworkplanlist AS
SELECT st.id AS id_staff,
((st.surname || ' '::text) || st.prename) AS staffname,
- (((((('Semaine '::text || sp_dwt.calweek) || '<br/>('::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) || '<br/>('::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,
((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(((('<br/>'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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)))
schemata text,
validated boolean,
schemata2 json,
- email text
+ email text,
+ socialtype text,
+ vatvalidated boolean
);
--
--- 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,
-- 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;
--
--
--- 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
-- 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;
--
username text,
regcode text,
vcode text,
- schemaaccess json
+ schemaaccess json,
+ id_usergroups json,
+ surname text,
+ prename text,
+ phone text,
+ job text,
+ id_company integer
);
--
--- 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,
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;
--
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: -
--
--
--- 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);
--
--
--- 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);
--
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: -
--
--
--- 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);
--
--- 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);
--
--- 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);
--
--- 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();
--
--
--- 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);
--
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');
--
--
--- 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);
--
-- 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);
-- 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);
--
-- 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);
--
-- 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);
--
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
--
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
--
-- 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;
--
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
--
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)
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)
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)
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)
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)
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)
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)
CREATE VIEW portanova.vw_staffworkplanlist AS
SELECT st.id AS id_staff,
((st.surname || ' '::text) || st.prename) AS staffname,
- (((((('Semaine '::text || sp_dwt.calweek) || '<br/>('::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) || '<br/>('::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,
((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(((('<br/>'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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)))
--
--- 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);
--
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
\.
--
--- 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
\.
--
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
-- 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);
--
-- 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);
--
-- 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);
--
--
--- 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);
--
--- 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();
--
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: -
--
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: -
--
-- 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;
--
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: -
--
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)
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)
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)
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)
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)
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)
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)
CREATE VIEW portanova.vw_staffworkplanlist AS
SELECT st.id AS id_staff,
((st.surname || ' '::text) || st.prename) AS staffname,
- (((((('Semaine '::text || sp_dwt.calweek) || '<br/>('::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) || '<br/>('::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,
((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(((('<br/>'::text || to_char((sp_dwt.mon_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.mon_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.mon_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.tue_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.tue_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.wed_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.wed_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.thu_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.thu_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.fri_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.fri_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sat_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sat_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_start2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_end2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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(((('<br/>'::text || to_char((sp_dwt.sun_timestart2)::interval, 'HH24:MI'::text)) || ' - '::text) || to_char((sp_dwt.sun_timeend2)::interval, 'HH24:MI'::text)), ''::text)) || COALESCE(((('<br/>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)))
--
--- 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);
--
--
--- 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);
--
--- 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();
--
+--
+-- 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', '<html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <style>
- body,html {
- margin: 0;
- background-color: #fff;
- }
- </style>
- </head>
- <body bgcolor="#607d8b">
- <div class="maincontainer" align="left" style="padding-top: 5px; width: auto; background-color: #607d8b!important; color: #fff;">
- POT - Plan d''organisation de travail</span>
- <div style="background-color: #fff; color: #000">
- <div class="mailcontent" align="left" style="padding: 10px; color: #000;">
- %%BODYCONTENT%%
- </div>
- </div>
- </div>
- </body>
+INSERT INTO public.maillayouts (id, layoutname, mailtemplate) VALUES (1, 'potbasic', '<html>\r
+ <head>\r
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">\r
+ <style>\r
+ body,html {\r
+ margin: 0;\r
+ background-color: #fff;\r
+ }\r
+ </style>\r
+ </head>\r
+ <body bgcolor="#607d8b">\r
+ <div class="maincontainer" align="left" style="padding-top: 5px; width: auto; background-color: #607d8b!important; color: #fff;">\r
+ POT - Plan d''organisation de travail</span>\r
+ <div style="background-color: #fff; color: #000">\r
+ <div class="mailcontent" align="left" style="padding: 10px; color: #000;">\r
+ %%BODYCONTENT%%\r
+ </div>\r
+ </div>\r
+ </div>\r
+ </body>\r
</html>');
Meilleurs salutations,<br/>
<br/>
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%%,<br/>\r
+<br/>\r
+Le code pour valider votre e-mail est:\r
+<br/>\r
+<strong>%%vcode%%</strong><br/>\r
+<br/>\r
+entrez le code ici: <a href="%%siteurl%%/backoffice/validationcode.html">%%siteurl%%/backoffice/validationcode.html</a>\r
+<br/>\r
+Méilleurs Salutations,<br/>\r
+<br/>\r
+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%%,<br/>\r
+<br/>\r
+Nous avons crées / modifé votre compte sur le site pot.lu;<br/>\r
+<br/>\r
+Votre Login: <i>%%username%%</i><br/>\r
+Mot de passe: <strong style="font-family: Courier New,Courier,Lucida Sans Typewriter,Lucida Typewriter,monospace;">%%newpassword%%</strong><br/><br/>\r
+<br/>\r
+méilleurs Salutations,<br/>\r
+<br/>\r
+pot.lu Support-Team<br>\r
+', '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);
--
-- 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: 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);
--
-- 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);
--
-- 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);
--
LANGUAGE plpgsql
AS $$\r
BEGIN\r
- return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se \r
-join users us on (us.id=se.id_user) \r
-left join useringroups uig on (us.id=uig.id_user)\r
-left join usergroups aug on (aug.id=uig.id_group)\r
-left join members mb on (mb.id_user=us.id)\r
-left join companies co on (co.id=mb.id_company)\r
-where se.idsession= vidsession\r
-and se.remote_addr= vremoteaddr\r
-and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id;\r
+ 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;\r
END; \r
$$;
--
--- 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,
);
-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
-- 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;
--
--
--- 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
-- 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;
--
username text,
regcode text,
vcode text,
- schemaaccess json
+ schemaaccess json,
+ id_usergroups json,
+ surname text,
+ prename text,
+ phone text,
+ job text,
+ id_company integer
);
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
--
--- 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);
--
--
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
\.
--
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
\.
3 user_expiration_notice Bonjour %%prename%% %%surname%%,<br/>\n<br/>\nVotre souscription au site pot.lu expire bientôt,\n<br/><br/>\nn'oublié pas à la prolonger!\n<a href="%%siteurl%%/profile/application">Prolonger maintenant</a>\n<br/>\nMeilleurs salutations,<br/>\n<br/>\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%%,<br/>\n<br/>\nEn annexe vous trouvez la facture pour votre souscription au site pot.lu,\n<br/>\n<b>Vous avez Payé déjà via PayPal!</b>\n\nMeilleurs salutations,<br/>\n<br/>\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%%,<br/>\n<br/>\nEn annexe vous trouvez la facture pour votre souscription au site pot.lu,\n<br/>\n\nMeilleurs salutations,<br/>\n<br/>\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%%,<br/>\r\n<br/>\r\nLe code pour valider votre e-mail est:\r\n<br/>\r\n<strong>%%vcode%%</strong><br/>\r\n<br/>\r\nentrez le code ici: <a href="%%siteurl%%/backoffice/validationcode.html">%%siteurl%%/backoffice/validationcode.html</a>\r\n<br/>\r\nMéilleurs Salutations,<br/>\r\n<br/>\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%%,<br/>\r\n<br/>\r\nNous avons crées / modifé votre compte sur le site pot.lu;<br/>\r\n<br/>\r\nVotre Login: <i>%%username%%</i><br/>\r\nMot de passe: <strong style="font-family: Courier New,Courier,Lucida Sans Typewriter,Lucida Typewriter,monospace;">%%newpassword%%</strong><br/><br/>\r\n<br/>\r\nméilleurs Salutations,<br/>\r\n<br/>\r\npot.lu Support-Team<br>\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
\.
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
\.
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
\.
-- 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: 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);
--
-- 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);
--
-- 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);
--
--
--- 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);
--
--- 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);
--
--- 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: 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);
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 $$\r
+declare \r
+ iduser int4;\r
+ newidsession text := null; \r
+begin\r
+ select id into iduser from public.users where lower(username)=lower(vusername) and userpassword = vpassword and "blocked" is null;\r
+ if (iduser is not null) then\r
+ delete from public.sessions where id_user= iduser and remote_addr= vremoteaddr and user_agent= vuseragent;\r
+ insert into public.sessions (id_user,idsession,remote_addr,user_agent) VALUES( iduser,public.random_string(40), vremoteaddr,vuseragent) returning idsession into newidsession;\r
+ end if;\r
+ return newidsession;\r
+end;\r
$$;
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 $$\r
+ BEGIN\r
+ return QUERY select date(startdate + s*'1day'::interval) as daydate from generate_series(0,days-1) s ;\r
+ END; \r
$$;
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 $$\r
+ declare \r
+ ret text;\r
+ begin\r
+ select string_agg(to_char(getdates,'YYYY-MM-DD'),',') into ret from getdates(startdate,days); \r
+ return ret;\r
+ END; \r
$$;
CREATE FUNCTION public.getmondays(vyear integer) RETURNS SETOF date
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 $$\r
+ BEGIN\r
+ return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se \r
+join users us on (us.id=se.id_user) \r
+left join useringroups uig on (us.id=uig.id_user)\r
+left join usergroups aug on (aug.id=uig.id_group)\r
+left join members mb on (mb.id_user=us.id)\r
+left join companies co on (co.id=mb.id_company)\r
+where se.idsession= vidsession\r
+and se.remote_addr= vremoteaddr\r
+and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id;\r
+ END; \r
$$;
CREATE FUNCTION public.getsundays(vyear integer) RETURNS SETOF date
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 $$\r
+declare\r
+ randstr text := null;\r
+BEGIN\r
+SELECT string_agg (substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', ceil (random() * 62)::integer, 1), '') into randstr\r
+FROM generate_series(1, vlength);\r
+return randstr;\r
+end;\r
$$;
CREATE FUNCTION public.trg_update_basemonthhours() RETURNS trigger
LANGUAGE plpgsql
AS $$\r
BEGIN\r
- return QUERY select se.idsession,us.id,us.username,string_agg(distinct(aug.usergroup),',') as usergroups ,co.schemata as userschemata from sessions se \r
-join users us on (us.id=se.id_user) \r
-left join useringroups uig on (us.id=uig.id_user)\r
-left join usergroups aug on (aug.id=uig.id_group)\r
-left join members mb on (mb.id_user=us.id)\r
-left join companies co on (co.id=mb.id_company)\r
-where se.idsession= vidsession\r
-and se.remote_addr= vremoteaddr\r
-and se.user_agent= vuseragent and us.blocked is null group by se.id,us.id,mb.id,co.id;\r
+ 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;\r
END; \r
$$;
--
--- 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,
-- 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;
--
--
--- 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
-- 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;
--
username text,
regcode text,
vcode text,
- schemaaccess json
+ schemaaccess json,
+ id_usergroups json,
+ surname text,
+ prename text,
+ phone text,
+ job text,
+ id_company integer
);
--
--- 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;
--
--
--- 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);
--
--
--- 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);
--
--- 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);
--
--- 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: 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);