Bug 21742: Fix YouTube variable propagation
authorNick Clemens <nick@bywatersolutions.com>
Wed, 31 Oct 2018 12:18:58 +0000 (12:18 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 26 Nov 2018 06:33:09 +0000 (07:33 +0100)
The loop to find all media has an $isyoutube variable. This was declared
outside the loop and never reset. Once a YouTube video was encountered
all subsequent videos were considered as YouTube. This patch reduces the
scope of the variable and resets per loop.

To test:
1 - Enable HTML5Media and HTML5MediaYouTube
2 - Add 856$u to record for a youtube vido and a pdf (sample record
        attached to bug)
3 - View the record, the Play media tab has two video boxes
4 - Play the second, it fails
5 - Apply patch
6 - View record, Play media should include only one video link

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8ceba54c8dcfd9b598375b8af432c0111ec63d04)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit ec7e569d55575f26ba481684ff157c8ec3985002)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

C4/HTML5Media.pm

index 1ac22f1..c77e8a4 100644 (file)
@@ -50,8 +50,8 @@ sub gethtml5media {
     my @HTML5MediaExtensions = split( /\|/, C4::Context->preference("HTML5MediaExtensions") );
     my $HTML5MediaYouTube    = C4::Context->preference("HTML5MediaYouTube");
     my $marcflavour          = C4::Context->preference("marcflavour");
-    my $isyoutube            = 0;
     foreach my $HTML5Media_field (@HTML5Media_fields) {
+    my $isyoutube            = 0;
         my %HTML5Media;
         # protocol
         if ( $HTML5Media_field->indicator(1) eq '1' ) {