From ac5aae6dd4b346f65882073b54242fa93430f621 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 28 Aug 2013 11:48:16 -0300 Subject: [PATCH] Bug 10609: Use branch name rather than branch code in serials-collection.pl (3.12.x) This is the 3.12.x compatible version of the patch for 10609. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer Serial collection page now displays the branch description instead of the branchcode. Signed-off-by: Tomas Cohen Arazi --- C4/Serials.pm | 23 +++++++++++-------- .../en/modules/serials/serials-collection.tt | 4 ++-- serials/serials-collection.pl | 6 +++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 58c38389df..64184127f7 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -369,6 +369,7 @@ sub GetFullSubscription { aqbooksellers.name as aqbooksellername, biblio.title as bibliotitle, subscription.branchcode AS branchcode, + branches.branchname AS branchname, subscription.subscriptionid AS subscriptionid |; if ( C4::Context->preference('IndependantBranches') && C4::Context->userenv @@ -378,15 +379,19 @@ sub GetFullSubscription { , ((subscription.branchcode <>\"" . C4::Context->userenv->{'branch'} . "\") and subscription.branchcode <>\"\" and subscription.branchcode IS NOT NULL) as cannotedit "; } $query .= qq| - FROM serial - LEFT JOIN subscription ON - (serial.subscriptionid=subscription.subscriptionid ) - LEFT JOIN aqbooksellers on subscription.aqbooksellerid=aqbooksellers.id - LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber - WHERE serial.subscriptionid = ? - ORDER BY year DESC, - IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate) DESC, - serial.subscriptionid + FROM serial + LEFT JOIN subscription ON + ( serial.subscriptionid = subscription.subscriptionid ) + LEFT JOIN aqbooksellers ON + ( subscription.aqbooksellerid = aqbooksellers.id ) + LEFT JOIN biblio ON + ( biblio.biblionumber = subscription.biblionumber ) + LEFT JOIN branches ON + ( subscription.branchcode = branches.branchcode ) + WHERE serial.subscriptionid = ? + ORDER BY year DESC, + IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate) DESC, + serial.subscriptionid |; $debug and warn "GetFullSubscription query: $query"; my $sth = $dbh->prepare($query); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index b833795463..71ba9129c6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -175,7 +175,7 @@ $(document).ready(function() { [% IF ( subscription.numberpattern7 ) %] None of the above [% END %] - [% subscription.branchcode %] + [% subscription.branchname %] [% subscription.callnumber %] [% subscription.notes %] [% UNLESS subscription.closed %] @@ -311,7 +311,7 @@ $(document).ready(function() { [% serial.notes %] - [% serial.branchcode %] + [% serial.branchname %] [% IF ( routing ) %] diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl index 742849414c..a0b7cf56fd 100755 --- a/serials/serials-collection.pl +++ b/serials/serials-collection.pl @@ -23,6 +23,7 @@ use strict; use warnings; use CGI; use C4::Auth; +use C4::Branch qw/GetBranchName/; use C4::Koha; use C4::Dates qw/format_date/; use C4::Serials; @@ -114,6 +115,11 @@ if (@subscriptionid){ $subs->{ "status" . $subs->{'status'} } = 1; $subs->{startdate} = format_date( $subs->{startdate} ); $subs->{histstartdate} = format_date( $subs->{histstartdate} ); + + if ( defined $subs->{ branchcode } ) { + $subs->{ branchname } = GetBranchName( $subs->{ branchcode } ); + } + if ( !defined $subs->{enddate} || $subs->{enddate} eq '0000-00-00' ) { $subs->{enddate} = ''; } -- 2.39.5