Bug 22893: Do not crash if contributors.yaml does not exist

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>
This commit is contained in:
Jonathan Druart 2019-05-12 19:22:54 -05:00 committed by Nick Clemens
parent b90bbc1259
commit d4b503aa14
2 changed files with 15 additions and 6 deletions

View file

@ -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 => $_,

View file

@ -469,11 +469,17 @@
</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>