From ab165a7f9e7c857da1a725f016f0c200d7a2a155 Mon Sep 17 00:00:00 2001
From: Cornelius <cornelius.amzar@bsz-bw.de>
Date: Thu, 15 Oct 2020 22:25:59 +0200
Subject: [PATCH] Better implementation of getPlayingTimes in MarcAdvancedTrait
 (#1751)

---
 .../src/VuFind/RecordDriver/MarcAdvancedTrait.php     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/module/VuFind/src/VuFind/RecordDriver/MarcAdvancedTrait.php b/module/VuFind/src/VuFind/RecordDriver/MarcAdvancedTrait.php
index f45d40024bf..c3e2aa700fa 100644
--- a/module/VuFind/src/VuFind/RecordDriver/MarcAdvancedTrait.php
+++ b/module/VuFind/src/VuFind/RecordDriver/MarcAdvancedTrait.php
@@ -291,12 +291,13 @@ trait MarcAdvancedTrait
         $times = $this->getFieldArray('306', ['a'], false);
 
         // Format the times to include colons ("HH:MM:SS" format).
-        for ($x = 0; $x < count($times); $x++) {
-            $times[$x] = substr($times[$x], 0, 2) . ':' .
-                substr($times[$x], 2, 2) . ':' .
-                substr($times[$x], 4, 2);
+        foreach ($times as $x => $time) {
+            if (!preg_match('/\d\d:\d\d:\d\d/', $time)) {
+                $times[$x] = substr($time, 0, 2) . ':' .
+                    substr($time, 2, 2) . ':' .
+                    substr($time, 4, 2);
+            }
         }
-
         return $times;
     }
 
-- 
GitLab