diff --git a/changelog.md b/changelog.md index ea3d8ed5..fc70c46e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # Changelog -## Unreleased +## 6.1.6 (2024-07-18) +* Fix for multi-day packages where the last line has no end time * Fix wrongful error after clearing cache ## 6.1.5 (2024-07-16) diff --git a/package-lock.json b/package-lock.json index 033cd467..c68dfc64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "recras-wordpress-plugin", - "version": "6.1.5", + "version": "6.1.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "recras-wordpress-plugin", - "version": "6.1.5", + "version": "6.1.6", "license": "MIT", "devDependencies": { "po2json": "1.0.0-beta-3" diff --git a/package.json b/package.json index 258ca632..b026f778 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "recras-wordpress-plugin", - "version": "6.1.5", + "version": "6.1.6", "description": "Recras WordPress plugin", "main": "index.js", "directories": { diff --git a/readme.txt b/readme.txt index 0da0668c..662a099d 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: zanderz Tags: recras, recreation, reservation, booking, voucher Tested up to: 6.6 -Stable tag: 6.1.5 +Stable tag: 6.1.6 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -80,6 +80,10 @@ No. "Must use" plugins don't appear in the update notifications nor show their u == Changelog == += 6.1.6 = +* Fix for multi-day packages where the last line has no end time +* Fix wrongful error after clearing cache + = 6.1.5 = * Fix programme of multi-day package diff --git a/recras-wordpress-plugin.php b/recras-wordpress-plugin.php index 160d465e..1d85a4fd 100644 --- a/recras-wordpress-plugin.php +++ b/recras-wordpress-plugin.php @@ -2,7 +2,7 @@ /* Plugin Name: Recras WordPress Plugin Plugin URI: https://www.recras.nl/ -Version: 6.1.5 +Version: 6.1.6 Description: Easily integrate your Recras data into your own site Requires at least: 6.4 Requires PHP: 7.3.0 diff --git a/src/Arrangement.php b/src/Arrangement.php index 19c88aff..2841516c 100644 --- a/src/Arrangement.php +++ b/src/Arrangement.php @@ -185,7 +185,14 @@ public static function generateProgramme(array $lines, string $startTime = '00:0 $startDatetime = $startDatetime->add(new \DateInterval($firstInProgramme->duration)); // Whether a package is multi-day can depend on the start time (i.e. a 4-hour package starting at 22:00) - $progEnd = end($programme); + $progEnd = $firstInProgramme; + $lastEnd = null; + foreach ($programme as $line) { + if ($line->end > $lastEnd) { + $progEnd = $line; + } + } + $endDatetime = new \DateTime($startTime); $endDatetime->add(new \DateInterval($progEnd->begin)); $endDatetime->add(new \DateInterval($progEnd->duration));