Skip to content

Commit

Permalink
ACQUI-137: Fix group visibility when no groups created
Browse files Browse the repository at this point in the history
Currently the form to add a ledger crashes if no library groups exist on the system. This patch amends the controller utils method to add the dummy library group with all available brnaches to bypass this
  • Loading branch information
mblenk committed Apr 2, 2024
1 parent c43b790 commit 6a75df3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
16 changes: 15 additions & 1 deletion Koha/Plugin/Acquire/Controllers/ControllerUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,21 @@ sub add_lib_group_data {

foreach my $id (@ids) {
my $lib_group = Koha::Library::Groups->find( { id => $id } );
push( @lib_groups, $lib_group->unblessed );
push( @lib_groups, $lib_group->unblessed ) if $lib_group;
}

if(scalar(@lib_groups) == 0) {
my @branches = Koha::Libraries->search()->as_list;
my $lib_group = {
title => 'All branches',
id => 1,
};
my @libraries;
foreach my $branch (@branches) {
push( @libraries, $branch->unblessed );
}
$lib_group->{libraries} = \@libraries;
push( @lib_groups, $lib_group );
}

$data->{lib_groups} = \@lib_groups;
Expand Down
18 changes: 17 additions & 1 deletion Koha/Plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,20 @@ etc/apache2/sites-available/kohadev.conf
RewriteRule ^/cgi-bin/koha/acqui/.*$ /acquisitions [PT]
```

If needed then chmod +x acquisitions.pl
If needed then chmod +x acquisitions.pl

# Production apache config
etc/apache2/sites-available/kohadev.conf
```
ScriptAlias /acquisitions "/var/lib/koha/INSTANCE/plugins/Koha/Plugin/Acquire/views/acquisitions.pl"
Alias /plugin “/var/lib/koha/INSTANCE/plugins"
```

/etc/apache2/apache2.conf
```
<Directory /var/lib/koha/INSTANCE/plugins>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
```

0 comments on commit 6a75df3

Please sign in to comment.