| Line 52... |
Line 52... |
| 52 |
my $FTS = shift;
|
52 |
my $FTS = shift;
|
| Line 53... |
Line 53... |
| 53 |
|
53 |
|
| Line 54... |
Line 54... |
| 54 |
my $dbh = WebDB::connect ();
|
54 |
my $dbh = WebDB::connect ();
|
| - |
|
55 |
|
| - |
|
56 |
if (findConflict ($RCid, [$FTS->{date}, $FTS->{start_time}, $FTS->{end_time}], "personal")) {
|
| - |
|
57 |
my $samesame;
|
| - |
|
58 |
if ($FTS->{$DBFields[0]} ne "NEW") {
|
| Line -... |
Line 59... |
| - |
|
59 |
($samesame) = $dbh->selectrow_array ("select count(*) from shift where id = ? and date = ? and start_time = ? and end_time = ?", undef, $FTS->{id}, $FTS->{date}, $FTS->{start_time}, $FTS->{end_time});
|
| 55 |
|
60 |
}
|
| 56 |
if (findConflict ($RCid, [$FTS->{date}, $FTS->{start_time}, $FTS->{end_time}], "personal")) {
|
- |
|
| 57 |
|
61 |
|
| - |
|
62 |
if (!$samesame) {
|
| 58 |
error ("You already have a shift that conflicts with that time.");
|
63 |
error ("You already have a shift that conflicts with that time.");
|
| - |
|
64 |
return;
|
| 59 |
|
65 |
}
|
| 60 |
return;
|
66 |
}
|
| 61 |
}
|
67 |
|
| 62 |
if ($FTS->{$DBFields[0]} eq "NEW") {
|
68 |
if ($FTS->{$DBFields[0]} eq "NEW") {
|
| 63 |
$dbh->do (
|
69 |
$dbh->do (
|
| 64 |
"INSERT INTO $DBTable
|
70 |
"INSERT INTO $DBTable
|
| 65 |
(dept,role,type,date,location,start_time,end_time,note,assignee_id)
|
71 |
(dept,role,type,date,location,start_time,end_time,note,assignee_id)
|
| 66 |
VALUES(?,?,?,?,?,?,?,?,?)",
|
72 |
VALUES(?,?,?,?,?,?,?,?,?)",
|
| 67 |
undef,
|
73 |
undef,
|
| 68 |
"PER", $FTS->{role}, "personal", $FTS->{date}, $FTS->{location}, $FTS->{start_time}, $FTS->{end_time}, $FTS->{note}, $RCid);
|
74 |
"PER", $FTS->{role}, "personal", $FTS->{date}, $FTS->{location}, $FTS->{start_time}, $FTS->{end_time}, $FTS->{note}, $RCid);
|
| 69 |
($FTS->{id}) = $dbh-> selectrow_array ("select max(id) from $DBTable where dept = ? and role = ? and type = ? and date = ? and location = ? and start_time = ? and end_time = ? and note = ? and assignee_id = ?", undef, "PER", $FTS->{role}, "personal", $FTS->{date}, $FTS->{location}, $FTS->{start_time}, $FTS->{end_time}, $FTS->{note}, $RCid);
|
75 |
($FTS->{id}) = $dbh->selectrow_array ("select max(id) from $DBTable where dept = ? and role = ? and type = ? and date = ? and location = ? and start_time = ? and end_time = ? and note = ? and assignee_id = ?", undef, "PER", $FTS->{role}, "personal", $FTS->{date}, $FTS->{location}, $FTS->{start_time}, $FTS->{end_time}, $FTS->{note}, $RCid);
|
| 70 |
logit ($RCid, "$username created personal time ($FTS->{id}, $FTS->{role}, $FTS->{date}, $FTS->{location}, $FTS->{start_time}, $FTS->{end_time})");
|
76 |
logit ($RCid, "$username created personal time ($FTS->{id}, $FTS->{date}, $FTS->{start_time}, $FTS->{end_time})");
|
| 71 |
} else {
|
77 |
} else {
|
| 72 |
$dbh->do (
|
78 |
$dbh->do (
|
| 73 |
"REPLACE INTO $DBTable
|
79 |
"REPLACE INTO $DBTable
|
| 74 |
(id,dept,role,type,date,location,start_time,end_time,note,assignee_id)
|
80 |
(id,dept,role,type,date,location,start_time,end_time,note,assignee_id)
|
| 75 |
VALUES(?,?,?,?,?,?,?,?,?,?)",
|
81 |
VALUES(?,?,?,?,?,?,?,?,?,?)",
|
| 76 |
undef,
|
82 |
undef,
|
| Line 77... |
Line 83... |
| 77 |
$FTS->{id}, "PER", $FTS->{role}, "personal", $FTS->{date}, $FTS->{location}, $FTS->{start_time}, $FTS->{end_time}, $FTS->{note}, $RCid);
|
83 |
$FTS->{id}, "PER", $FTS->{role}, "personal", $FTS->{date}, $FTS->{location}, $FTS->{start_time}, $FTS->{end_time}, $FTS->{note}, $RCid);
|
| 78 |
logit ($RCid, "$username updated personal time ($FTS->{id}, $FTS->{role}, $FTS->{date}, $FTS->{location}, $FTS->{start_time}, $FTS->{end_time})");
|
84 |
logit ($RCid, "$username updated personal time ($FTS->{id}, $FTS->{date}, $FTS->{start_time}, $FTS->{end_time})");
|
| 79 |
}
|
85 |
}
|
| Line 289... |
Line 295... |
| 289 |
my $type = $fieldType{$name} // "button";
|
295 |
my $type = $fieldType{$name} // "button";
|
| Line 290... |
Line 296... |
| 290 |
|
296 |
|
| 291 |
if ($type eq "button") {
|
297 |
if ($type eq "button") {
|
| 292 |
if ($name eq "Cancel") {
|
298 |
if ($name eq "Cancel") {
|
| 293 |
if ($context eq "POSTSAVE") {
|
299 |
if ($context eq "POSTSAVE") {
|
| 294 |
return $h->input ({ type=>"button", value => $value ne '' ? $value : "Cancel" , onClick=>"window.location.href = \"/\"; return false;" });
|
300 |
return $h->input ({ type=>"button", value => $value ne '' ? $value : "Cancel" , onClick=>"window.location.href = '$homeURL'; return false;" });
|
| 295 |
} else {
|
301 |
} else {
|
| 296 |
return $h->input ({ type=>"button", value => $value ne '' ? $value : "Cancel" , onClick=>"history.back(); return false;" })
|
302 |
return $h->input ({ type=>"button", value => $value ne '' ? $value : "Cancel" , onClick=>"history.back(); return false;" })
|
| 297 |
}
|
303 |
}
|
| 298 |
} else {
|
304 |
} else {
|