");
23 |
--------------------------------------------------------------------------------
/src/php/ajax/install.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | /*
21 | * The purpose of this file is to answer XMLHttpRequests from the installation pages.
22 | * These will be the validation of database parameters and the creation of users.
23 | * Data will be given as POST from the form fields.
24 | */
25 |
26 |
--------------------------------------------------------------------------------
/src/php/pages/install_head.php:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
21 | Pharmacy Duty Roster
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/css/saturday_list.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Martin Mandelkow
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU Affero General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU Affero General Public License for more details.
13 |
14 | You should have received a copy of the GNU Affero General Public License
15 | along with this program. If not, see .
16 | */
17 | /*
18 | Created on : 24.08.2018, 20:58:57
19 | Author : Martin Mandelkow
20 | */
21 |
22 | table#saturdayList tr td span.absent {
23 | color: red;
24 | text-decoration: underline;
25 | }
26 | table#saturdayList tr.saturday-list-row-holiday {
27 | font-style: italic;
28 | }
29 |
--------------------------------------------------------------------------------
/src/sql/employees.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS `employees` (
2 | `primary_key` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 | `last_name` varchar(35) COLLATE utf8mb4_unicode_ci NOT NULL,
4 | `first_name` varchar(35) COLLATE utf8mb4_unicode_ci NOT NULL,
5 | `profession` set('Apotheker','PI','PTA','PKA','Praktikant','Ernährungsberater','Kosmetiker','Zugehfrau') COLLATE utf8mb4_unicode_ci NOT NULL,
6 | `working_week_hours` float NOT NULL DEFAULT 40,
7 | `holidays` tinyint(11) NOT NULL DEFAULT 28,
8 | `lunch_break_minutes` tinyint(11) NOT NULL DEFAULT 30,
9 | `goods_receipt` tinyint(1) DEFAULT NULL,
10 | `compounding` tinyint(1) DEFAULT NULL,
11 | `branch` tinyint(3) unsigned NULL DEFAULT NULL,
12 | `start_of_employment` date DEFAULT NULL,
13 | `end_of_employment` date DEFAULT NULL,
14 | `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
15 | PRIMARY KEY (`primary_key`),
16 | CONSTRAINT `employees_ibfk_1` FOREIGN KEY (`branch`) REFERENCES `branch`(`branch_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
17 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
18 |
--------------------------------------------------------------------------------
/src/php/pages/overtime-overview.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | require_once '../../../default.php';
21 |
22 | require PDR_FILE_SYSTEM_APPLICATION_PATH . 'head.php';
23 | require PDR_FILE_SYSTEM_APPLICATION_PATH . 'src/php/pages/menu.php';
24 |
25 | $table = PDR\Output\HTML\OvertimeHtmlBuilder::buildOverviewTable();
26 | echo $table;
27 |
--------------------------------------------------------------------------------
/src/sql/users.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS `users` (
2 | `primary_key` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
3 | `employee_key` int(10) unsigned NULL,
4 | `user_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
5 | `email` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
6 | `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
7 | `status` set('deleted','blocked','inactive','active') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'inactive',
8 | `failed_login_attempts` tinyint(3) unsigned NOT NULL DEFAULT 0,
9 | `failed_login_attempt_time` timestamp NULL DEFAULT NULL,
10 | `receive_emails_on_changed_roster` tinyint(1) NOT NULL DEFAULT 0,
11 | `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
12 | `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
13 | PRIMARY KEY (`primary_key`),
14 | UNIQUE KEY `user_name` (`user_name`),
15 | UNIQUE KEY `email` (`email`),
16 | CONSTRAINT `users_ibfk_1` FOREIGN KEY (`employee_key`) REFERENCES `employees` (`primary_key`) ON DELETE RESTRICT ON UPDATE RESTRICT
17 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
18 |
--------------------------------------------------------------------------------
/src/php/gettext.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | /*
21 | * This file is meant to be used by JavaScript. It will take a GET parameter string_to_translate and return the translated string.
22 | */
23 | require_once '../../default.php';
24 |
25 | //TODO: support for ngettext might be added.
26 | $string_to_translate = filter_input(INPUT_GET, 'string_to_translate', FILTER_SANITIZE_SPECIAL_CHARS);
27 | $translated_string = gettext($string_to_translate);
28 | echo $translated_string;
29 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | /*
20 | * Unfortunately we had a "301 Moved Permanently" to "tag-out.php" set on the old index.php
21 | * Therefore we have to keep that file there and make another redirect.
22 | * Some browsers might still take their users to the page "src/php/pages/roster-day-read.php"
23 | */
24 |
25 | header("HTTP/1.1 307 Temporary Redirect");
26 | header("Location: src/php/pages/menu-tiles.php");
27 | exit();
28 | ?>
29 |
--------------------------------------------------------------------------------
/src/php/background_maintenance.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | /**
21 | * The purpose of this file is to be called in the background to do stuff once in a while.
22 | * It is called upon login() of any user for example.
23 | * It is the responsibility of the classes to check if there is work to do and how much.
24 | */
25 | chdir(dirname(__DIR__, 2));
26 | require_once 'bootstrap.php';
27 | new update_database();
28 | new maintenance();
29 | //new auto_upgrader();
30 |
--------------------------------------------------------------------------------
/src/css/install_style.css:
--------------------------------------------------------------------------------
1 | @charset "utf-8";
2 | /*
3 | Copyright (C) 2017 Martin Mandelkow
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 | */
18 | /*
19 | Created on : 02.11.2017, 22:13:29
20 | Author : Mandelkow
21 | */
22 |
23 | .install-info-postive{
24 | color: green;
25 | margin-left: 2em;
26 | }
27 | .install-info-negative{
28 | color: red;
29 | margin-left: 2em;
30 | }
31 |
32 | pre.install-cli {
33 | overflow: auto;
34 | padding: 1em;
35 | color: black;
36 | background-color: #F5F5F5;
37 | border: 1px solid #000000;
38 | border-radius: 3px;
39 | }
40 | div#errorMessageDiv{
41 | color: red;
42 | }
43 |
--------------------------------------------------------------------------------
/src/css/principle-roster-employee.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2019 Martin Mandelkow
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU Affero General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU Affero General Public License for more details.
13 |
14 | You should have received a copy of the GNU Affero General Public License
15 | along with this program. If not, see .
16 | */
17 | /*
18 | Created on : 12.04.2019, 22:58:42
19 | Author : Martin Mandelkow
20 | */
21 |
22 | form.change-principle-roster-employee-form {
23 | border: 5px solid #BDE682;
24 | margin-bottom: 1em;
25 | padding: 1em 1em 1em 1em;
26 | }
27 | form.change-principle-roster-employee-form:last-child {
28 | margin-bottom: 0em;
29 | }
30 | div.principle-roster-alternation-container {
31 | border: 2px solid #73AC22;
32 | margin-bottom: 1em;
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/css/roster-day-edit.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Martin Mandelkow
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU Affero General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU Affero General Public License for more details.
13 |
14 | You should have received a copy of the GNU Affero General Public License
15 | along with this program. If not, see .
16 | */
17 | /*
18 | Created on : 25.07.2018, 10:57:02
19 | Author : Martin Mandelkow
20 | */
21 |
22 | div#taskRotationSelectDiv {
23 | background-color: #ECE7E8;
24 | float: left;
25 | padding-top: 0.5em;
26 | padding-bottom: 2em;
27 | padding-left: 1em;
28 | padding-right: 1em;
29 | margin: 1em;
30 | }
31 | div.image-group-container {
32 | float: right;
33 | }
34 |
35 | div.user-dialog-container > div.warning > span > button > img{
36 | height: 2em;
37 | vertical-align: middle;
38 | }
39 |
--------------------------------------------------------------------------------
/src/php/3rdparty/icalendar/examples/recurringdate.php:
--------------------------------------------------------------------------------
1 |
7 | * @copyright Copyright (C) 2006 - 2017 by Dan Cogliano
8 | * @license GNU GPLv3
9 | * @link http://icalendar.org/php-library.html
10 | */
11 |
12 | /**
13 | * Recurring Date Example
14 | *
15 | * Recurring date examples with RRULE property
16 | *
17 | */
18 |
19 | require_once("../zapcallib.php");
20 |
21 | $examples =
22 | array(
23 | array(
24 | "name" => "Abraham Lincon's birthday",
25 | "date" => "2015-02-12",
26 | "rule" => "FREQ=YEARLY;INTERVAL=1;BYMONTH=2;BYMONTHDAY=12"
27 | ),
28 |
29 | array(
30 | "name" => "Start of U.S. Supreme Court Session (1st Monday in October)",
31 | "date" => "2015-10-01",
32 | "rule" => "FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYDAY=1MO"
33 | )
34 | );
35 |
36 | // Use maxdate to limit # of infinitely repeating events
37 | $maxdate = strtotime("2021-01-01");
38 |
39 | foreach($examples as $example)
40 | {
41 | echo $example["name"] . ":\n";
42 | $rd = new ZCRecurringDate($example["rule"],strtotime($example["date"]));
43 | $dates = $rd->getDates($maxdate);
44 | foreach($dates as $d)
45 | {
46 | echo " " . date('l, F j, Y ',$d) . "\n";
47 | }
48 | echo "\n";
49 | }
50 |
--------------------------------------------------------------------------------
/default.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 | require_once 'bootstrap.php';
20 |
21 | /*
22 | * session management
23 | */
24 | $session = new sessions;
25 |
26 | /*
27 | * Guess the navigator (=browser) language from HTTP_ACCEPT_LANGUAGE:
28 | * This is used in the head.php
29 | */
30 | $navigator_language = "de-DE"; //default language
31 | if (filter_has_var(INPUT_SERVER, 'HTTP_ACCEPT_LANGUAGE')) {
32 | $navigator_languages = preg_split('/[,;]/', filter_input(INPUT_SERVER, 'HTTP_ACCEPT_LANGUAGE', FILTER_SANITIZE_SPECIAL_CHARS));
33 | $navigator_language = $navigator_languages[0]; //ignore the other options
34 | }
35 |
--------------------------------------------------------------------------------
/pep.sh:
--------------------------------------------------------------------------------
1 | #Dieses Script soll die Daten aus dem PEP-Modul von Asys in die Datenbank 'Apotheke' einfügen.
2 |
3 | date #Das PHP-Script leitet den Output in die Datei "tmp/pep.log" um. Dort können wir dann sehen, welcher Eintrag zu welchem Datum gehört.
4 |
5 | #Das Passwort und die sonstigen Datanbank-Daten werden von php an dieses Script übergeben.
6 | database_user="$1"
7 | database_password="$2"
8 | database_name="$3"
9 | if [ "$database_user" != "" ] && [ "$database_password" != "" ] && [ "$database_name" != "" ]
10 | then
11 | echo "Alle Daten vorhanden."
12 | else
13 | echo "Es fehlen Zugangsdaten zur Datenbank."
14 | exit 1
15 | fi
16 |
17 |
18 | #Neueste Input Datei vom PEP-Modul:
19 | pepdatei="tmp/pep.txt"
20 | for asydatei in `ls -t upload/I*.asy`
21 | do
22 | #Das Datum muss gedreht werden von 31.12.2015 auf 2015-12-31. Anschließend werden nur die Spalten Datum, Zeit, Anzahl und Mandant genutzt. Umsatzzahlen gehen uns nichts an.
23 | sed -e 's/\([0-9]\{2\}\)\.\([0-9]\{2\}\)\.\([0-9]\{4\}\)/\3-\2-\1/' $asydatei | cut -d\; -f 1,2,4,6 > $pepdatei
24 | #Jetzt können wir die Daten in die Datenbank eintragen.
25 | mysqlimport \
26 | --ignore-lines=0 \
27 | --fields-terminated-by=\; \
28 | --columns='Datum,Zeit,Anzahl,Mandant' \
29 | --local -u "$database_user" -p"$database_password" "$database_name" \
30 | $pepdatei \
31 | && rm $pepdatei && rm $asydatei
32 | done
33 |
34 | php pep.php
35 |
--------------------------------------------------------------------------------
/src/php/3rdparty/PHPMailer/Exception.php:
--------------------------------------------------------------------------------
1 |
9 | * @author Jim Jagielski (jimjag)
10 | * @author Andy Prevost (codeworxtech)
11 | * @author Brent R. Matzelle (original founder)
12 | * @copyright 2012 - 2017 Marcus Bointon
13 | * @copyright 2010 - 2012 Jim Jagielski
14 | * @copyright 2004 - 2009 Andy Prevost
15 | * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
16 | * @note This program is distributed in the hope that it will be useful - WITHOUT
17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 | * FITNESS FOR A PARTICULAR PURPOSE.
19 | */
20 |
21 | namespace PHPMailer\PHPMailer;
22 |
23 | /**
24 | * PHPMailer exception handler.
25 | *
26 | * @author Marcus Bointon
27 | */
28 | class Exception extends \Exception
29 | {
30 | /**
31 | * Prettify error message output.
32 | *
33 | * @return string
34 | */
35 | public function errorMessage()
36 | {
37 | return '' . htmlspecialchars($this->getMessage()) . " \n";
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/src/php/fragments/fragment.saturdayRotationTeamsAddEmployee.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | require_once '../../../default.php';
20 | $network_of_branch_offices = new \PDR\Pharmacy\NetworkOfBranchOffices();
21 | $branch_id = user_input::get_variable_from_any_input('mandant', FILTER_SANITIZE_NUMBER_INT, $network_of_branch_offices->get_main_branch_id());
22 | $team_id = user_input::get_variable_from_any_input('team_id', FILTER_SANITIZE_NUMBER_INT, 0);
23 |
24 | $saturday_rotation = new saturday_rotation($branch_id);
25 | $html_string = $saturday_rotation->buildSaturdayRotationTeamsAddEmployee($team_id, $branch_id, $session);
26 |
27 | echo $html_string;
28 |
--------------------------------------------------------------------------------
/config/default_config.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | /* Die Konfiguration könnte über die Datei default.php eingelesen werden. */
21 | $config = array(
22 | 'database_name' => "Apotheke", //Name der MySQL-Datenbank
23 | 'database_user' => "apotheke", //Name des Datenbankbenutzers
24 | 'application_name' => "Dienstplan Apotheke", //Für den Title des HTML HEAD
25 | 'LC_TIME' => "de_DE.utf8",
26 | 'mb_internal_encoding' => "UTF-8",
27 | 'error_reporting' => E_ALL,
28 | 'hide_disapproved' => false
29 | );
30 |
31 |
32 | //Diese Datei kann später mit folgendem Befehl neu geschrieben werden:
33 | // file_put_contents('config/config.php', '
7 | * @copyright Copyright (C) 2006 - 2017 by Dan Cogliano
8 | * @license GNU GPLv3
9 | * @link http://icalendar.org/php-library.html
10 | */
11 |
12 | /**
13 | * Parse iCalendar Example
14 | *
15 | * Enter an ics filename or URL on the command line,
16 | * or leave blank to parse the default file.
17 | *
18 | */
19 |
20 | require_once("../zapcallib.php");
21 |
22 | $icalfile = count($argv) > 1 ? $argv[1] : "abrahamlincoln.ics";
23 | $icalfeed = file_get_contents($icalfile);
24 |
25 | // create the ical object
26 | $icalobj = new ZCiCal($icalfeed);
27 |
28 | echo "Number of events found: " . $icalobj->countEvents() . "\n";
29 |
30 | $ecount = 0;
31 |
32 | // read back icalendar data that was just parsed
33 | if(isset($icalobj->tree->child))
34 | {
35 | foreach($icalobj->tree->child as $node)
36 | {
37 | if($node->getName() == "VEVENT")
38 | {
39 | $ecount++;
40 | echo "Event $ecount:\n";
41 | foreach($node->data as $key => $value)
42 | {
43 | if(is_array($value))
44 | {
45 | for($i = 0; $i < count($value); $i++)
46 | {
47 | $p = $value[$i]->getParameters();
48 | echo " $key: " . $value[$i]->getValues() . "\n";
49 | }
50 | }
51 | else
52 | {
53 | echo " $key: " . $value->getValues() . "\n";
54 | }
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/php/classes/PDR/DateTime/DateTimeUtility.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 |
22 | namespace PDR\DateTime;
23 |
24 | /**
25 | * Description of DateTimeUtility
26 | *
27 | * @author Mandelkow
28 | */
29 | abstract class DateTimeUtility {
30 |
31 | /**
32 | * Convert time string to hours using DateTime class
33 | *
34 | * @param string $timeString
35 | * @return float time in hours
36 | */
37 | public static function timeFromTextToFloat(string $timeString) {
38 | $time = \DateTime::createFromFormat('H:i:s', $timeString);
39 | $hour = (float) $time->format('H');
40 | $minute = (float) $time->format('i');
41 | $second = (float) $time->format('s');
42 | $time_float = $hour + $minute / 60 + $second / 3600;
43 | return $time_float;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/php/pages/install_page_intro.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Introduction to PDR
7 |
8 |
9 |
Introduction
10 |
11 |
Welcome to PDR!
12 |
13 |
Pharmacy Duty Roster (PDR) is a web application designed to streamline and manage duty schedules for pharmacies effectively. It provides an alternative to traditional methods like excel sheets, offering user-friendly features while covering all necessary aspects of duty roster management.
14 |
15 |
PDR, initiated in 2015, aims to continuously improve based on user feedback. Your requests and wishes are valued contributions to its development, and it strives to meet your expectations.
16 |
17 |
These installation pages will guide you through the installation process of PDR. For more detailed instructions, please refer to the installation guide.
18 |
19 |
Please make sure to have at least PHP version 8.0 installed.
20 |
21 |
22 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/js/unsaved-changes-prompt.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Mandelkow
3 | *
4 | * Dienstplan Apotheke
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | // Variable to track if changes have been made.
21 | let changesMadeInForm = false;
22 |
23 | // Function to enable the unsaved changes prompt.
24 | function enableUnsavedChangesPrompt(formElement) {
25 | // Add an event listener to the window to display the confirmation message.
26 | window.addEventListener('beforeunload', function (e) {
27 | if (changesMadeInForm) {
28 | e.returnValue = "You have unsaved changes. Are you sure you want to leave?";
29 | }
30 | });
31 |
32 | // Add an event listener for form submission to reset the changesMade variable.
33 | var form = formElement;
34 | if (form) {
35 | form.addEventListener('submit', function () {
36 | console.log("I saw some submit");
37 | changesMadeInForm = false;
38 | });
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/php/basic_access_authentication.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 | const PDR_HTTP_401_UNAUTHORIZED_RESPONSE_TEXT = "
Unauthorized
This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
";
20 | if (!isset($_SERVER['PHP_AUTH_USER'])) {
21 | header('WWW-Authenticate: Basic realm="PDR"');
22 | header('HTTP/1.0 401 Unauthorized');
23 | die(PDR_HTTP_401_UNAUTHORIZED_RESPONSE_TEXT);
24 | } else {
25 | $login_success = $session->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], FALSE);
26 | if (TRUE !== $login_success) {
27 | header('WWW-Authenticate: Basic realm="PDR"');
28 | header('HTTP/1.0 401 Unauthorized');
29 | die(PDR_HTTP_401_UNAUTHORIZED_RESPONSE_TEXT);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/php/fragments/fragment.saturdayRotationTeamsAddTeam.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | require_once '../../../default.php';
20 | $network_of_branch_offices = new \PDR\Pharmacy\NetworkOfBranchOffices();
21 | $branch_id = user_input::get_variable_from_any_input('mandant', FILTER_SANITIZE_NUMBER_INT, $network_of_branch_offices->get_main_branch_id());
22 | $team_id = user_input::get_variable_from_any_input('team_id', FILTER_SANITIZE_NUMBER_INT, 0);
23 | $saturday_date_string = user_input::get_variable_from_any_input('saturday_date_string', FILTER_SANITIZE_NUMBER_INT, (new DateTime("this saturday"))->format('Y-m-d'));
24 | $saturday_date_object = new DateTime($saturday_date_string);
25 |
26 | $saturday_rotation = new saturday_rotation($branch_id);
27 | $html_string = $saturday_rotation->buildSaturdayRotationTeamsAddTeam($team_id, $branch_id, $saturday_date_object, $session);
28 |
29 | echo $html_string;
30 |
--------------------------------------------------------------------------------
/src/php/fragments/fragment.add_roster_input_row.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 | require_once '../../../default.php';
20 | $Roster = array();
21 | $day_iterator = user_input::get_variable_from_any_input('day_iterator', FILTER_SANITIZE_NUMBER_INT);
22 | $roster_row_iterator = user_input::get_variable_from_any_input('roster_row_iterator', FILTER_SANITIZE_NUMBER_INT);
23 | $network_of_branch_offices = new \PDR\Pharmacy\NetworkOfBranchOffices;
24 | $maximum_number_of_rows = user_input::get_variable_from_any_input('maximum_number_of_rows', FILTER_SANITIZE_NUMBER_INT);
25 | $branch_id = user_input::get_variable_from_any_input('branch_id', FILTER_SANITIZE_NUMBER_INT, $network_of_branch_offices->get_main_branch_id());
26 |
27 | $html_string = build_html_roster_views::build_roster_input_row($Roster, $day_iterator, $roster_row_iterator, $maximum_number_of_rows, $branch_id, array('add_select_employee'));
28 | echo $html_string;
29 |
--------------------------------------------------------------------------------
/src/php/pages/remaining-vacation-overview.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | require_once '../../../default.php';
21 | $year = user_input::get_variable_from_any_input('year', FILTER_SANITIZE_NUMBER_INT, date('Y'));
22 | \PDR\Utility\GeneralUtility::createCookie('year', $year, 1);
23 | if (isset($_POST) && !empty($_POST)) {
24 | // POST data has been submitted; PRG
25 | $location = PDR_HTTP_SERVER_APPLICATION_PATH . 'src/php/pages/remaining-vacation-overview.php' . "?year=$year";
26 | header('Location:' . $location);
27 | die("
");
28 | }
29 |
30 | require PDR_FILE_SYSTEM_APPLICATION_PATH . 'head.php';
31 | require PDR_FILE_SYSTEM_APPLICATION_PATH . 'src/php/pages/menu.php';
32 |
33 | echo \form_element_builder::build_html_select_year($year);
34 |
35 | $vacationPageBuilder = new \PDR\Output\HTML\vacationPageBuilder;
36 | $table = $vacationPageBuilder->build_overview_table($year);
37 | echo $table;
38 |
--------------------------------------------------------------------------------
/src/php/classes/PDR/Roster/OvertimeCollection.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 |
22 | namespace PDR\Roster;
23 |
24 | /**
25 | * Description of OvertimeCollection
26 | *
27 | * @author Mandelkow
28 | * @implements \IteratorAggregate
29 | */
30 | class OvertimeCollection implements \IteratorAggregate, \Countable {
31 |
32 | private array $listOfOvertimes = array();
33 |
34 | public function addOvertime(\PDR\Roster\Overtime $overtime): void {
35 | $this->listOfOvertimes[] = $overtime;
36 | }
37 |
38 | /**
39 | * Implement the IteratorAggregate interface
40 | *
41 | * @return \ArrayIterator<\PDR\Roster\Overtime>
42 | */
43 | public function getIterator(): \ArrayIterator {
44 | return new \ArrayIterator($this->listOfOvertimes);
45 | }
46 |
47 | /**
48 | * Implement the Countable interface
49 | * @return int
50 | */
51 | public function count(): int {
52 | return count($this->listOfOvertimes);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/php/backup-database.php:
--------------------------------------------------------------------------------
1 | .
18 | */
19 |
20 | require_once '../../default.php';
21 |
22 | $sql_query = "SELECT TABLE_NAME FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = :database_name";
23 | $result = database_wrapper::instance()->run($sql_query, array('database_name' => $config['database_name']));
24 | while ($row = $result->fetch(PDO::FETCH_OBJ)) {
25 | $Table_names[] = $row->TABLE_NAME;
26 | }
27 |
28 | foreach ($Table_names as $key => $table_name) {
29 | //This script lies within /src/php/ so therefore we have to move up by two levels:
30 | $dirname = str_replace('\\', '/', __DIR__);
31 | //$dir_above1 = substr($dirname, 0, strrpos($dirname, '/'));
32 | $dir_above2 = dirname(dirname($dirname));
33 |
34 | $backup_file = $dir_above2 . "/tmp/$table_name.sql";
35 | $file_name = iconv("UTF-8", "ISO-8859-1", $backup_file); //This is necessary for Microsoft Windows to recognise special chars.
36 |
37 | $sql_query = "SELECT * INTO OUTFILE :file_name FROM :table_name";
38 | $result = database_wrapper::instance()->run($sql_query, array('file_name' => $file_name, 'table_name' => $table_name));
39 | }
40 |
--------------------------------------------------------------------------------
/src/css/emergency_service.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Martin Mandelkow
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU Affero General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU Affero General Public License for more details.
13 |
14 | You should have received a copy of the GNU Affero General Public License
15 | along with this program. If not, see .
16 | */
17 | /*
18 | Created on : 02.08.2018, 22:46:40
19 | Author : Martin Mandelkow
20 | */
21 |
22 | table#emergencyServiceTable {
23 | clear: left;
24 | }
25 | table#emergencyServiceTable tr th {
26 | border-bottom: solid black 3px;
27 | }
28 | table#emergencyServiceTable tr td {
29 | border-left: none;
30 | border-right: none;
31 | border-bottom: none;
32 | }
33 |
34 | table#emergencyServiceTable td.saturday {
35 | font-weight: bold;
36 | }
37 | table#emergencyServiceTable td.sunday {
38 | font-style: italic;
39 | font-weight: bold;
40 | }
41 | table#emergencyServiceTable td.holiday {
42 | font-weight: normal;
43 | text-decoration: underline;
44 | }
45 |
46 | /**
47 | * Make the third column invisible on the screen:
48 | */
49 | @media screen {
50 | table#emergencyServiceTable th.replacement-td {
51 | display: none;
52 | }
53 | table#emergencyServiceTable td.replacement-td {
54 | border: none;
55 | }
56 | @media print {
57 | table#emergencyServiceTable td.replacement-td {
58 | width: 10em;
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/src/php/classes/class.general_calculations.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see .
18 | */
19 |
20 | /**
21 | * Description of class
22 | *
23 | * @author Martin Mandelkow
24 | */
25 | abstract class general_calculations {
26 |
27 | /**
28 | * Get the first day of the week.
29 | *
30 | * We aim for the monday of the given week.
31 | * Be aware though, that strtotime('Monday this week') on a sunday will return the monday, which follows the sunday.
32 | * This is desired for this application.
33 | * If this is not acceptable for you please consider:
34 | * https://gist.github.com/stecman/0203410aa4da0ef01ea9
35 | *
36 | * @param $date_sql string
37 | * @return $first_day_of_week_sql string
38 | *
39 | */
40 | public static function get_first_day_of_week($date_sql = NULL) {
41 |
42 | if (NULL === $date_sql) {
43 | $date_sql = date('Y-m-d');
44 | }
45 | $date_unix = strtotime('Monday this week', strtotime($date_sql));
46 | $first_day_of_week_sql = date('Y-m-d', $date_unix);
47 | return $first_day_of_week_sql;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/php/pages/about.php:
--------------------------------------------------------------------------------
1 | .
17 | */
18 | require '../../../default.php';
19 | require PDR_FILE_SYSTEM_APPLICATION_PATH . 'head.php';
20 | require PDR_FILE_SYSTEM_APPLICATION_PATH . 'src/php/pages/menu.php';
21 | ?>
22 |
23 |
30 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
31 |
32 | = gettext('Pharmacy Duty Roster') ?> uses PHPMailer from the authors: Marcus Bointon, Jim Jagielski, Andy Prevostand and Brent R. Matzelle
33 |
34 | Also, find a list of included artwork.
35 |
36 |