Bug 22893: Do not crash if contributors.yaml does not exist
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 13 May 2019 00:22:54 +0000 (19:22 -0500)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 14 May 2019 18:16:37 +0000 (18:16 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

about.pl
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt

index 62d15ed..0a7300c 100755 (executable)
--- a/about.pl
+++ b/about.pl
@@ -531,7 +531,10 @@ if ( defined C4::Context->config('docdir') ) {
 }
 
 ## Contributors
-my $contributors = LoadFile("$docdir"."/contributors.yaml");
+my $contributors =
+  -e "$docdir" . "/contributors.yaml"
+  ? LoadFile( "$docdir" . "/contributors.yaml" )
+  : {};
 my @people = map {
     {
         name => $_,
index b908428..3921698 100644 (file)
             </ul>
 
             <h2>Koha development team</h2>
-            <ul class="columns-4">
-                [% FOREACH contributor IN contributors %]
-                <li>[% INCLUDE person p=contributor %][% INCLUDE contributions p=contributor %]</li>
-                [% END %]
-            </ul>
+            [% IF contributors.size %]
+                <ul class="columns-4">
+                    [% FOREACH contributor IN contributors %]
+                    <li>[% INCLUDE person p=contributor %][% INCLUDE contributions p=contributor %]</li>
+                    [% END %]
+                </ul>
+            [% ELSE %]
+                <div class="dialog alert">
+                    Could not read the contributors.yaml file. Please make sure &lt;docdir&gt; is correctly defined in koha-conf.xml.
+                </div>
+            [% END %]
             <hr>
 
             <h2>Contributing companies and institutions</h2>