Bugzilla – Attachment 166955 Details for
Bug 31330
Branchcode used for routing preview can be wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31330: Routing preview - Use the library from the selected issue
Bug-31330-Routing-preview---Use-the-library-from-t.patch (text/plain), 10.85 KB, created by
Jonathan Druart
on 2024-05-21 09:44:44 UTC
(
hide
)
Description:
Bug 31330: Routing preview - Use the library from the selected issue
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-05-21 09:44:44 UTC
Size:
10.85 KB
patch
obsolete
>From b68fd5d3da633e33ed842a713e90055add0d90ad Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Aug 2022 15:22:30 +0200 >Subject: [PATCH] Bug 31330: Routing preview - Use the library from the > selected issue > >--- > .../modules/serials/routing-preview-slip.tt | 3 ++- > .../en/modules/serials/routing-preview.tt | 9 ++++--- > .../prog/en/modules/serials/routing.tt | 10 +++---- > serials/routing-preview.pl | 25 ++++++++--------- > serials/routing.pl | 27 ++++--------------- > 5 files changed, 30 insertions(+), 44 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview-slip.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview-slip.tt >index bf7ad526d92..9e0e2e0d881 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview-slip.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview-slip.tt >@@ -1,5 +1,6 @@ > [% USE Koha %] > [% USE raw %] >+[% USE KohaDates %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Routing slip preview › Serials › Koha</title> >@@ -17,7 +18,7 @@ > <td colspan="2"><h3>[% libraryname | html %]</h3></td> > </tr> > <tr> >- <td colspan="2"><strong>Title:</strong> [% title | html %]<br />[% issue | html %]</td> >+ <td colspan="2"><strong>Title:</strong> [% title | html %]<br />[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</td> > </tr> > <tr> > <td><strong>Name</strong></td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview.tt >index 783cd17d679..0567da88eef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview.tt >@@ -1,5 +1,6 @@ > [% USE raw %] > [% SET footerjs = 1 %] >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Preview routing list › Serials › Koha</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -34,7 +35,7 @@ > > <fieldset class="rows"> > <ol> >- <li><span class="label">Issue:</span>[% issue | html %]</li> >+ <li><span class="label">Issue:</span>[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</li> > <li><span class="label">List member:</span><table style="clear:none;margin:0;"> > <tr><th>Name</th></tr> > [% FOREACH memberloo IN memberloop %] >@@ -49,7 +50,7 @@ > <form method="post" action="routing-preview.pl"> > [% INCLUDE 'csrf-token.inc' %] > <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" /> >- <input type="hidden" id="issue_escaped" name="issue_escaped" value="[% issue_escaped | html %]" /> >+ <input type="hidden" id="serialid" name="serialid" value="[% serial.serialid | html %]" /> > <input type="hidden" name="op" value="cud-save_and_preview" /> > <input id="save_and_preview" type="submit" class="btn btn-primary" value="Save and preview routing slip" /> > </form> >@@ -57,7 +58,7 @@ > <form method="post" action="routing-preview.pl"> > [% INCLUDE 'csrf-token.inc' %] > <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" /> >- <input type="hidden" id="issue_escaped" name="issue_escaped" value="[% issue_escaped | html %]" /> >+ <input type="hidden" id="serialid" name="serialid" value="[% serial.serialid | html %]" /> > <input type="hidden" name="op" value="cud-edit" /> > <input type="submit" class="btn btn-primary" value="Edit" /> > </form> >@@ -65,7 +66,7 @@ > <form method="post" action="routing-preview.pl"> > [% INCLUDE 'csrf-token.inc' %] > <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" /> >- <input type="hidden" id="issue_escaped" name="issue_escaped" value="[% issue_escaped | html %]" /> >+ <input type="hidden" id="serialid" name="serialid" value="[% serial.serialid | html %]" /> > <input type="hidden" name="op" value="cud-delete" /> > <input type="submit" class="btn btn-primary" value="Delete" /> > </form> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt >index 0100346ed94..6b9fc8f8cda 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt >@@ -51,12 +51,12 @@ > <fieldset class="rows"> > <ol> > <li><label for="date_selected">Issue: </label> >-<select name="date_selected" id="date_selected"> >- [% FOREACH date IN dates %] >- [% IF ( date.selected ) %] >- <option value="[% date.serialseq | html %] ([% date.publisheddate | html %])" selected="selected">[% date.serialseq | html %] ([% date.publisheddate | $KohaDates %])</option> >+<select name="serialid" id="serialid"> >+ [% FOREACH serial IN serials %] >+ [% IF ( serial.serialid == serialid ) %] >+ <option value="[% serial.serialid | html %]" selected="selected">[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</option> > [% ELSE %] >- <option value="[% date.serialseq | html %] ([% date.publisheddate | html %])">[% date.serialseq | html %] ([% date.publisheddate | $KohaDates %])</option> >+ <option value="[% serial.serialid | html %]">[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</option> > [% END %] > [% END %] > </select> [% issue | html %]</li> >diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl >index aa44f7e28b6..0c5ed4907e3 100755 >--- a/serials/routing-preview.pl >+++ b/serials/routing-preview.pl >@@ -26,15 +26,15 @@ use C4::Output qw( output_html_with_http_headers ); > use C4::Reserves qw( AddReserve ModReserve ); > use C4::Context; > use C4::Serials qw( delroutingmember getroutinglist GetSubscription GetSerials check_routing ); >-use URI::Escape; > > use Koha::Biblios; > use Koha::Libraries; > use Koha::Patrons; >+use Koha::Serial::Items; > > my $query = CGI->new; > my $subscriptionid = $query->param('subscriptionid'); >-my $issue = $query->param('issue'); >+my $serialid = $query->param('serialid'); > my $routingid; > my $op = $query->param('op') || q{}; > my $dbh = C4::Context->dbh; >@@ -50,6 +50,7 @@ if($op eq 'cud-edit'){ > print $query->redirect("routing.pl?subscriptionid=$subscriptionid"); > } > >+my $serial = Koha::Serials->find($serialid); > my @routinglist = getroutinglist($subscriptionid); > my $subs = GetSubscription($subscriptionid); > my ($tmp ,@serials) = GetSerials($subscriptionid); >@@ -61,12 +62,13 @@ if($op eq 'cud-save_and_preview'){ > my $biblionumber = $subs->{'bibnum'}; > > my $biblio = Koha::Biblios->find( $biblionumber ); >- my $items = $biblio->items->search_ordered; >- my $branch = >- $items->count >- ? $items->next->holding_branch->branchcode >- : $subs->{branchcode}; >- $library = Koha::Libraries->find($branch); >+ my $branchcode = $subs->{branchcode}; >+ my $serialitem = Koha::Serial::Items->search( { serialid => $serialid } )->next; >+ if ( $serialitem ) { >+ my $item = Koha::Items->find($serialitem->itemnumber); >+ $branchcode = $item->holdingbranch || $branchcode; >+ } >+ $library = Koha::Libraries->find($branchcode); > > if (C4::Context->preference('RoutingListAddReserves')){ > >@@ -82,12 +84,12 @@ if($op eq 'cud-save_and_preview'){ > rank => $routing->{ranking}, > biblionumber => $biblionumber, > borrowernumber => $routing->{borrowernumber}, >- branchcode => $branch >+ branchcode => $branchcode, > }); > } else { > AddReserve( > { >- branchcode => $branch, >+ branchcode => $branchcode, > borrowernumber => $routing->{borrowernumber}, > biblionumber => $biblionumber, > priority => $routing->{ranking}, >@@ -134,8 +136,7 @@ $routingnotes =~ s/\n/\<br \/\>/g; > > $template->param( > title => $subs->{'bibliotitle'}, >- issue => $issue, >- issue_escaped => URI::Escape::uri_escape_utf8($issue), >+ serial => $serial, > subscriptionid => $subscriptionid, > memberloop => $memberloop, > routingnotes => $routingnotes, >diff --git a/serials/routing.pl b/serials/routing.pl >index b8cd66e8800..1cec6335931 100755 >--- a/serials/routing.pl >+++ b/serials/routing.pl >@@ -36,8 +36,6 @@ use C4::Context; > use C4::Serials qw( GetSubscription delroutingmember addroutingmember getroutinglist GetSerials GetLatestSerials check_routing ); > use Koha::Patrons; > >-use URI::Escape; >- > my $query = CGI->new; > my $subscriptionid = $query->param('subscriptionid'); > my $serialseq = $query->param('serialseq'); >@@ -45,8 +43,7 @@ my $routingid = $query->param('routingid'); > my $borrowernumbers = $query->param('borrowernumbers'); > my $notes = $query->param('notes'); > my $op = $query->param('op') || q{}; >-my $date_selected = $query->param('date_selected'); >-$date_selected ||= q{}; >+my $serialid = $query->param('serialid'); > my $dbh = C4::Context->dbh; > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -81,28 +78,13 @@ if ( $op eq 'cud-add_new_recipients' ) { > if($op eq 'cud-save'){ > my $sth = $dbh->prepare('UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?'); > $sth->execute($notes,$subscriptionid); >- my $urldate = URI::Escape::uri_escape_utf8($date_selected); >- print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$urldate"); >+ print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&serialid=$serialid"); > } > > my @routinglist = getroutinglist($subscriptionid); > > my ($count,@serials) = GetSerials($subscriptionid); >-my $serialdates = GetLatestSerials($subscriptionid,$count); >- >-my $dates = []; >-foreach my $dateseq (@{$serialdates}) { >- my $d = {}; >- $d->{publisheddate} = $dateseq->{publisheddate}; >- $d->{serialseq} = $dateseq->{serialseq}; >- $d->{serialid} = $dateseq->{serialid}; >- if($date_selected eq $dateseq->{serialid}){ >- $d->{selected} = ' selected'; >- } else { >- $d->{selected} = q{}; >- } >- push @{$dates}, $d; >-} >+my $serials = GetLatestSerials($subscriptionid,$count); > > my $member_loop = []; > for my $routing ( @routinglist ) { >@@ -125,10 +107,11 @@ for my $routing ( @routinglist ) { > > $template->param( > title => $subs->{bibliotitle}, >+ serialid => $serialid, > subscriptionid => $subscriptionid, > memberloop => $member_loop, > op => $op eq 'new', >- dates => $dates, >+ serials => $serials, > routingnotes => $serials[0]->{'routingnotes'}, > hasRouting => check_routing($subscriptionid), > (uc(C4::Context->preference("marcflavour"))) => 1 >-- >2.34.1
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 31330
:
138912
| 166955 |
166956