Browse Source

Bug 28909: Allow illview to use backend template

This commit allows illview to use an intranet template supplied by the backend, as
per other stages. The template must be named illview.inc

Test plan:
- Apply the patch
- Install FreeForm backend (https://github.com/PTFS-Europe/koha-ill-freeform)
- Create a request
- On the resulting "Manage ILL request" note the display is normal
- Create a new file in the FreeForm backend directory: /intra-includes/illview.inc
  with the following content:

  [% BLOCK backend_jsinclude %]
  <script>(function() { alert("Working!"); })()</script>
  [% END %]

- Restart Plack if enabled
- Reload the page
=> TEST: Observe that the alert specified in the template is displayed

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
22.11.x
Andrew Isherwood 3 years ago
committed by Tomas Cohen Arazi
parent
commit
80e179edd7
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 17
      Koha/Illrequest.pm
  2. 6
      ill/ill-requests.pl
  3. 1
      koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt
  4. 7
      t/db_dependent/Illrequests.t

17
Koha/Illrequest.pm

@ -712,6 +712,23 @@ sub mark_completed {
}; };
} }
=head2 backend_illview
View and manage an ILL request
=cut
sub backend_illview {
my ( $self, $params ) = @_;
my $response = $self->_backend_capability('illview',{
request => $self,
other => $params,
});
return $self->expandTemplate($response) if $response;
return $response;
}
=head2 backend_migrate =head2 backend_migrate
Migrate a request from one backend to another. Migrate a request from one backend to another.

6
ill/ill-requests.pl

@ -97,6 +97,12 @@ if ( $backends_available ) {
( tran_success => $params->{tran_success} ) : () ), ( tran_success => $params->{tran_success} ) : () ),
); );
my $backend_result = $request->backend_illview($params);
$template->param(
whole => $backend_result,
) if $backend_result;
} elsif ( $op eq 'create' ) { } elsif ( $op eq 'create' ) {
# We're in the process of creating a request # We're in the process of creating a request
my $request = Koha::Illrequest->new->load_backend( $params->{backend} ); my $request = Koha::Illrequest->new->load_backend( $params->{backend} );

1
koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt

@ -484,6 +484,7 @@
</div> </div>
[% ELSIF query_type == 'illview' %] [% ELSIF query_type == 'illview' %]
[% PROCESS $whole.template %]
[% req_status = request.status %] [% req_status = request.status %]
[% IF error %] [% IF error %]

7
t/db_dependent/Illrequests.t

@ -636,7 +636,7 @@ subtest 'Backend testing (mocks)' => sub {
subtest 'Backend core methods' => sub { subtest 'Backend core methods' => sub {
plan tests => 18; plan tests => 19;
$schema->storage->txn_begin; $schema->storage->txn_begin;
@ -774,6 +774,11 @@ subtest 'Backend core methods' => sub {
}, },
"Backend cancel: arbitrary stage."); "Backend cancel: arbitrary stage.");
# backend_illview
$backend->set_series('illview', { stage => '', method => 'illview' });
is_deeply($illrq->backend_illview({test => 1}), 0,
"Backend illview optional method.");
# backend_update_status # backend_update_status
$backend->set_series('update_status', { stage => 'bar', method => 'update_status' }); $backend->set_series('update_status', { stage => 'bar', method => 'update_status' });
is_deeply($illrq->backend_update_status({test => 1}), is_deeply($illrq->backend_update_status({test => 1}),

Loading…
Cancel
Save