Bugzilla – Attachment 83806 Details for
Bug 20640
Allow migrating a request between backends
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20640: Add backend migration support to ILL
Bug-20640-Add-backend-migration-support-to-ILL.patch (text/plain), 7.26 KB, created by
Katrin Fischer
on 2019-01-11 16:19:13 UTC
(
hide
)
Description:
Bug 20640: Add backend migration support to ILL
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-01-11 16:19:13 UTC
Size:
7.26 KB
patch
obsolete
>From fdd9f0761f17d70dfad80c06c646122d4b9474cf Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 27 Apr 2018 08:48:53 +0100 >Subject: [PATCH] Bug 20640: Add backend migration support to ILL > >- Add core methods required to support the migration of ILL requests >between backends. > >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > Koha/Illrequest.pm | 16 ++++++++ > ill/ill-requests.pl | 45 +++++++++++++++++++--- > .../prog/en/modules/ill/ill-requests.tt | 28 +++++++++++++- > 3 files changed, 82 insertions(+), 7 deletions(-) > >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index 0fa4e49661..f9b49955ee 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -527,6 +527,22 @@ sub mark_completed { > }; > } > >+=head2 backend_migrate >+ >+Migrate a request from one backend to another. >+ >+=cut >+ >+sub backend_migrate { >+ my ( $self, $params ) = @_; >+ >+ my $response = $self->_backend->migrate({ >+ request => $self, >+ other => $params, >+ }); >+ return $self->expandTemplate($response); >+} >+ > =head2 backend_confirm > > Confirm a request. The backend handles setting of mandatory fields in the commit stage: >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index 28e8cc634f..0a29785147 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -86,6 +86,28 @@ if ( $backends_available ) { > ); > handle_commit_maybe($backend_result, $request); > >+ } elsif ( $op eq 'migrate' ) { >+ # We're in the process of migrating a request >+ my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $backend_result; >+ if ( $params->{backend} ) { >+ my $new_request = Koha::Illrequest->new->load_backend( $params->{backend} ); >+ $backend_result = $new_request->backend_migrate($params); >+ $template->param( >+ whole => $backend_result, >+ request => $new_request >+ ); >+ } >+ else { >+ $request = Koha::Illrequests->find( $params->{illrequest_id} ); >+ $backend_result = $request->backend_migrate($params); >+ $template->param( >+ whole => $backend_result, >+ request => $request >+ ); >+ } >+ handle_commit_maybe( $backend_result, $request ); >+ > } elsif ( $op eq 'confirm' ) { > # Backend 'confirm' method > # confirm requires a specific request, so first, find it. >@@ -287,16 +309,29 @@ output_html_with_http_headers( $cgi, $cookie, $template->output ); > > sub handle_commit_maybe { > my ( $backend_result, $request ) = @_; >+ > # We need to special case 'commit' > if ( $backend_result->{stage} eq 'commit' ) { > if ( $backend_result->{next} eq 'illview' ) { >+ > # Redirect to a view of the newly created request >- print $cgi->redirect( >- '/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id='. >- $request->id >- ); >+ print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl' >+ . '?method=illview' >+ . '&illrequest_id=' >+ . $request->id ); > exit; >- } else { >+ } >+ elsif ( $backend_result->{next} eq 'emigrate' ) { >+ >+ # Redirect to a view of the newly created request >+ print $cgi->redirect( '/cgi-bin/koha/ill/ill-requests.pl' >+ . '?method=migrate' >+ . '&stage=emigrate' >+ . '&illrequest_id=' >+ . $request->id ); >+ exit; >+ } >+ else { > # Redirect to a requests list view > redirect_to_list(); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >index a004540065..5f707fee52 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >@@ -509,8 +509,32 @@ > Edit request > </a> > [% FOREACH action IN request.available_actions %] >- [% IF action.method != 0 %] >- <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | html %]&illrequest_id=[% request.illrequest_id | html %]"> >+ [% IF action.method == 'migrate' %] >+ [% IF backends.size > 2 %] >+ <div class="dropdown btn-group"> >+ <button class="btn btn-sm btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> >+ <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span> >+ </button> >+ <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown"> >+ [% FOREACH backend IN backends %] >+ [% IF backend != request.backend %] >+ <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&illrequest_id=[% request.illrequest_id | uri %]&backend=[% backend | uri %]">[% backend | html %]</a></li> >+ [% END %] >+ [% END %] >+ </ul> >+ </div> >+ [% ELSIF backends.size == 2 %] >+ [% FOREACH backend IN backends %] >+ [% IF backend != request.backend %] >+ <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&illrequest_id=[% request.illrequest_id | uri %]"> >+ <span class="fa [% action.ui_method_icon | html %]"></span> >+ [% action.ui_method_name | html %] >+ </a> >+ [% END %] >+ [% END %] >+ [% END %] >+ [% ELSIF action.method != 0 %] >+ <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&illrequest_id=[% request.illrequest_id | uri %]"> > <span class="fa [% action.ui_method_icon | html %]"></span> > [% action.ui_method_name | html %] > </a> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20640
:
74903
|
75430
|
75431
|
78525
|
79508
|
79571
|
79597
|
80900
|
81826
|
81827
|
83777
|
83778
|
83779
|
83797
|
83798
|
83799
|
83800
|
83801
|
83803
|
83805
| 83806 |
83807
|
83808
|
83809
|
83810