From 42721e95726559b4a601240bb5b0fe4e5d755b2a Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 27 Nov 2019 23:43:21 +0100 Subject: Added Schedule parsing and replaced old Fahrplan importer Resolves #553 (Change Frab Import from xCal to XML) Resolves #538 (Feature Request: Multi Frab Import) --- resources/lang/de_DE/additional.po | 33 ++++++++++++++++++++++ resources/lang/de_DE/default.po | 57 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) (limited to 'resources/lang/de_DE') diff --git a/resources/lang/de_DE/additional.po b/resources/lang/de_DE/additional.po index 00eb90b3..ffbd7792 100644 --- a/resources/lang/de_DE/additional.po +++ b/resources/lang/de_DE/additional.po @@ -34,3 +34,36 @@ msgstr "Deine Passwörter stimmen nicht überein." msgid "validation.password_confirmation.required" msgstr "Du musst dein Passwort bestätigen." + +msgid "schedule.import" +msgstr "Programm importieren" + +msgid "schedule.import.request-error" +msgstr "Das Programm konnte nicht abgerufen werden." + +msgid "schedule.import.read-error" +msgstr "Das Programm konnte nicht gelesen werden." + +msgid "schedule.import.invalid-shift-type" +msgstr "Der Schichttyp konnte nicht gefunden werden." + +msgid "schedule.import.success" +msgstr "Das Programm wurde erfolgreich importiert." + +msgid "validation.schedule-url.required" +msgstr "Bitte gib eine Programm URL an." + +msgid "validation.schedule-url.url" +msgstr "Die Programm URL muss eine URL sein." + +msgid "validation.shift-type.required" +msgstr "Der Schichttyp ist erforderlich." + +msgid "validation.shift-type.int" +msgstr "Der Schichttyp muss eine Zahl sein." + +msgid "validation.minutes-before.int" +msgstr "Die Minuten vor dem Talk müssen eine Zahl sein." + +msgid "validation.minutes-after.int" +msgstr "Die Minuten nach dem Talk müssen eine Zahl sein." diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index d5a6c59e..d5f30f22 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -2806,3 +2806,60 @@ msgstr "" #~ msgid "auth.no-nickname" #~ msgstr "Gib bitte einen Nick an." + +msgid "form.load_schedule" +msgstr "Programm laden" + +msgid "form.import" +msgstr "Importieren" + +msgid "schedule.import.title" +msgstr "Programm importieren" + +msgid "schedule.import.text" +msgstr "Dieser Import erstellt Räume and erstellt, aktualisiert und löscht Schichten anhand des schedule.xml exportes." + +msgid "schedule.import.load.title" +msgstr "Programm importieren: Vorschau" + +msgid "schedule.import.load.info" +msgstr "Importiere \"%s\" (Version \"%s\")" + +msgid "schedule.url" +msgstr "Programm URL (schedule.xml)" + +msgid "schedule.shift-type" +msgstr "Schichttyp" + +msgid "schedule.minutes-before" +msgstr "Minuten vor Talk beginn hinzufügen" + +msgid "schedule.minutes-after" +msgstr "Minuten nach Talk ende hinzufügen" + +msgid "schedule.import.rooms.add" +msgstr "Neue Räume" + +msgid "schedule.import.shifts.add" +msgstr "Neue Schichten" + +msgid "schedule.import.shifts.update" +msgstr "Zu aktualisierende Schichten" + +msgid "schedule.import.shifts.delete" +msgstr "Zu löschende Schichten" + +msgid "schedule.import.rooms.name" +msgstr "Name" + +msgid "schedule.import.shift.dates" +msgstr "Zeit" + +msgid "schedule.import.shift.type" +msgstr "Typ" + +msgid "schedule.import.shift.title" +msgstr "Titel" + +msgid "schedule.import.shift.room" +msgstr "Raum" -- cgit v1.2.3-70-g09d2 From 064a1750279be244f86cf24f29749b391b11f1dd Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 1 Dec 2019 22:10:10 +0100 Subject: Renamed GuzzleServiceProvider to HttpClientServiceProvider, fixed translation and import error --- config/app.php | 2 +- includes/pages/schedule/ImportSchedule.php | 3 ++- resources/lang/de_DE/default.po | 2 +- src/Http/GuzzleServiceProvider.php | 25 ------------------- src/Http/HttpClientServiceProvider.php | 25 +++++++++++++++++++ tests/Unit/Http/GuzzleServiceProviderTest.php | 29 ----------------------- tests/Unit/Http/HttpClientServiceProviderTest.php | 29 +++++++++++++++++++++++ 7 files changed, 58 insertions(+), 57 deletions(-) delete mode 100644 src/Http/GuzzleServiceProvider.php create mode 100644 src/Http/HttpClientServiceProvider.php delete mode 100644 tests/Unit/Http/GuzzleServiceProviderTest.php create mode 100644 tests/Unit/Http/HttpClientServiceProviderTest.php (limited to 'resources/lang/de_DE') diff --git a/config/app.php b/config/app.php index e1001900..8ede567e 100644 --- a/config/app.php +++ b/config/app.php @@ -31,7 +31,7 @@ return [ // Additional services \Engelsystem\Helpers\VersionServiceProvider::class, \Engelsystem\Mail\MailerServiceProvider::class, - \Engelsystem\Http\GuzzleServiceProvider::class, + \Engelsystem\Http\HttpClientServiceProvider::class, ], // Application middleware diff --git a/includes/pages/schedule/ImportSchedule.php b/includes/pages/schedule/ImportSchedule.php index 8bc769d4..136f1816 100644 --- a/includes/pages/schedule/ImportSchedule.php +++ b/includes/pages/schedule/ImportSchedule.php @@ -451,13 +451,14 @@ class ImportSchedule extends BaseController $guid = $shift->guid; $shift = $this->loadShift($shift->shift_id); $event = $scheduleEvents[$guid]; + $room = $rooms->where('name', $event->getRoom()->getName())->first(); if ( $shift->title != $event->getTitle() || $shift->shift_type_id != $shiftType || Carbon::createFromTimestamp($shift->start) != $event->getDate() || Carbon::createFromTimestamp($shift->end) != $event->getEndDate() - || $shift->room_id != $rooms->where('name', $event->getRoom()->getName())->first()->id + || $shift->room_id != ($room->id ?? '') || $shift->url != $event->getUrl() ) { $changeEvents[$guid] = $event; diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index d5f30f22..7f017f13 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -2817,7 +2817,7 @@ msgid "schedule.import.title" msgstr "Programm importieren" msgid "schedule.import.text" -msgstr "Dieser Import erstellt Räume and erstellt, aktualisiert und löscht Schichten anhand des schedule.xml exportes." +msgstr "Dieser Import erstellt Räume und erstellt, aktualisiert und löscht Schichten anhand des schedule.xml exportes." msgid "schedule.import.load.title" msgstr "Programm importieren: Vorschau" diff --git a/src/Http/GuzzleServiceProvider.php b/src/Http/GuzzleServiceProvider.php deleted file mode 100644 index f81a91f5..00000000 --- a/src/Http/GuzzleServiceProvider.php +++ /dev/null @@ -1,25 +0,0 @@ -app->when(GuzzleClient::class) - ->needs('$config') - ->give( - function () { - return [ - // No exception on >= 400 responses - 'http_errors' => false, - // Wait max n seconds for a response - 'timeout' => 2.0, - ]; - } - ); - } -} diff --git a/src/Http/HttpClientServiceProvider.php b/src/Http/HttpClientServiceProvider.php new file mode 100644 index 00000000..113af713 --- /dev/null +++ b/src/Http/HttpClientServiceProvider.php @@ -0,0 +1,25 @@ +app->when(GuzzleClient::class) + ->needs('$config') + ->give( + function () { + return [ + // No exception on >= 400 responses + 'http_errors' => false, + // Wait max n seconds for a response + 'timeout' => 2.0, + ]; + } + ); + } +} diff --git a/tests/Unit/Http/GuzzleServiceProviderTest.php b/tests/Unit/Http/GuzzleServiceProviderTest.php deleted file mode 100644 index 4d3c938b..00000000 --- a/tests/Unit/Http/GuzzleServiceProviderTest.php +++ /dev/null @@ -1,29 +0,0 @@ -register(); - - /** @var GuzzleClient $guzzle */ - $guzzle = $app->make(GuzzleClient::class); - $config = $guzzle->getConfig(); - - $this->assertFalse($config['http_errors']); - $this->assertArrayHasKey('timeout', $config); - } -} diff --git a/tests/Unit/Http/HttpClientServiceProviderTest.php b/tests/Unit/Http/HttpClientServiceProviderTest.php new file mode 100644 index 00000000..7dfc0a3e --- /dev/null +++ b/tests/Unit/Http/HttpClientServiceProviderTest.php @@ -0,0 +1,29 @@ +register(); + + /** @var GuzzleClient $guzzle */ + $guzzle = $app->make(GuzzleClient::class); + $config = $guzzle->getConfig(); + + $this->assertFalse($config['http_errors']); + $this->assertArrayHasKey('timeout', $config); + } +} -- cgit v1.2.3-70-g09d2