Bugzilla – Attachment 138912 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.22 KB, created by
Jonathan Druart
on 2022-08-09 13:23:28 UTC
(
hide
)
Description:
Bug 31330: Routing preview - Use the library from the selected issue
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-08-09 13:23:28 UTC
Size:
10.22 KB
patch
obsolete
>From 97c1f06d6725b17cbf67c0c7ed143aa9ba56dd60 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 | 11 ++++---- > .../prog/en/modules/serials/routing.tt | 10 +++---- > serials/routing-preview.pl | 25 ++++++++--------- > serials/routing.pl | 27 ++++--------------- > 5 files changed, 31 insertions(+), 45 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 2d229d01802..5706fa19709 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 9338c4fa445..0d2b817fb65 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,4 +1,5 @@ > [% SET footerjs = 1 %] >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Preview routing list › Serials › Koha</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -36,10 +37,10 @@ > > <form method="post" action="routing-preview.pl"> > <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 %]" /> > <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 %] >@@ -71,11 +72,11 @@ > $(document).ready(function(){ > $("#save_and_preview").on("click",function(e){ > e.preventDefault(); >- print_slip( $("#subscriptionid").val(), $("#issue_escaped").val() ); >+ print_slip( $("#subscriptionid").val(), $("#serialid").val() ); > }); > }); >- function print_slip(subscriptionid,issue){ >- var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue; >+ function print_slip(subscriptionid,serialid){ >+ var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&serialid='+serialid; > window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes'); > window.location.href='subscription-detail.pl?subscriptionid=' + subscriptionid; > } >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 74e36cc475e..d12ec856b4c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt >@@ -59,12 +59,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 462ad307bc5..61e0e9db4a7 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 $ok = $query->param('ok'); > my $edit = $query->param('edit'); >@@ -52,6 +52,7 @@ if($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); >@@ -63,12 +64,13 @@ if($ok){ > 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')){ > # get existing reserves ..... >@@ -90,12 +92,12 @@ if($ok){ > 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}, >@@ -136,8 +138,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 2e3122d3b5b..447d46693c9 100755 >--- a/serials/routing.pl >+++ b/serials/routing.pl >@@ -35,8 +35,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'); >@@ -44,8 +42,7 @@ my $routingid = $query->param('routingid'); > my $borrowernumber = $query->param('borrowernumber'); > 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( >@@ -72,28 +69,13 @@ if($op eq 'add'){ > if($op eq '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 ) { >@@ -116,10 +98,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.25.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