Koha/circ/transferstoreceive.pl
Aleisha 1edb8cbeee Bug 16530: Adding a circ sidebar navigation menu and circSidebar syspref to activate/deactivate
Edit: Fast cataloging link should now show on all pages, removed offline circulation links
Edit 2: Creates the syspref to activate or deactivate the sidebar
Edit 3: Fixing merge conflicts, using Koha::BiblioFrameworks to find FA
framework and adding sidebar to on-site checkouts

This adds a sidebar to
circ/branchoverdues.tt
circ/circulation.tt (I also fixed up some of the indentation in this file to make it easier to see where the divs started and ended)
circ/renew.tt
circ/returns.tt
circ/selectbranchprinter.tt
circ/transferstoreceive.tt
circ/view_holdsqueue.tt
circ/waitingreserves.tt
circ/branchtransfers.tt
circ/on-site_checkouts.tt

To test:
1) Confirm syspref CircSidebar is activated
2) Go to all of the above pages and confirm the sidebar menu shows up
3) Confirm fast cataloguing link and transfer link are there
4) Trigger any error messages you can possibly think of (i.e. on renew.pl: barcode does not exist). Confirm that this does not mess up the layout of the page
5) Go to a user account page, Check out tab. (Since this is a circ/circulation.pl page). Ensure the circ nav sidebar doesn't show up (confirm it looks as it usually does)
6) Deactivate circSidebar
7) Confirm pages all look normal

Sponsored-by: Catalyst IT

Signed-off-by: Jan Kissig <jkissig@th-wildau.de>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2017-03-03 18:34:36 +00:00

135 lines
4.9 KiB
Perl
Executable file

#!/usr/bin/perl
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use strict;
use warnings;
use CGI qw ( -utf8 );
use C4::Context;
use C4::Output;
use C4::Auth;
use C4::Biblio;
use C4::Circulation;
use C4::Members;
use Date::Calc qw(
Today
Add_Delta_Days
Date_to_Days
);
use C4::Koha;
use C4::Reserves;
use Koha::Libraries;
use Koha::DateUtils;
use Koha::BiblioFrameworks;
my $input = new CGI;
my $itemnumber = $input->param('itemnumber');
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
{
template_name => "circ/transferstoreceive.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => { circulate => "circulate_remaining_permissions" },
debug => 1,
}
);
# set the userenv branch
my $default = C4::Context->userenv->{'branch'};
# get the all the branches for reference
my $libraries = Koha::Libraries->search({}, { order_by => 'branchname' });
my @branchesloop;
my $latetransfers;
while ( my $library = $libraries->next ) {
my @transferloop;
my %branchloop;
my @gettransfers =
GetTransfersFromTo( $library->branchcode, $default );
if (@gettransfers) {
$branchloop{'branchname'} = $library->branchname;
$branchloop{'branchcode'} = $library->branchcode;
foreach my $num (@gettransfers) {
my %getransf;
my ( $sent_year, $sent_month, $sent_day ) = split "-",
$num->{'datesent'};
$sent_day = ( split " ", $sent_day )[0];
( $sent_year, $sent_month, $sent_day ) =
Add_Delta_Days( $sent_year, $sent_month, $sent_day,
C4::Context->preference('TransfersMaxDaysWarning'));
my $calcDate = Date_to_Days( $sent_year, $sent_month, $sent_day );
my $today = Date_to_Days(&Today);
my $diff = $today - $calcDate;
if ($today > $calcDate) {
$latetransfers = 1;
$getransf{'messcompa'} = 1;
$getransf{'diff'} = $diff;
}
my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} );
my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $gettitle->{'itype'} : $gettitle->{'itemtype'} );
$getransf{'datetransfer'} = $num->{'datesent'};
$getransf{'itemtype'} = $itemtypeinfo ->{'description'};
foreach (qw(title author biblionumber itemnumber barcode homebranch holdingbranch itemcallnumber)) {
$getransf{$_} = $gettitle->{$_};
}
my $record = GetMarcBiblio($gettitle->{'biblionumber'});
$getransf{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($gettitle->{'biblionumber'}));
# we check if we have a reserv for this transfer
my @checkreserv = GetReservesFromItemnumber($num->{'itemnumber'});
if ( $checkreserv[0] ) {
my $getborrower = C4::Members::GetMember( borrowernumber => $checkreserv[1] );
$getransf{'borrowernum'} = $getborrower->{'borrowernumber'};
$getransf{'borrowername'} = $getborrower->{'surname'};
$getransf{'borrowerfirstname'} = $getborrower->{'firstname'};
$getransf{'borrowermail'} = $getborrower->{'email'} if $getborrower->{'email'};
$getransf{'borrowerphone'} = $getborrower->{'phone'};
}
push( @transferloop, \%getransf );
}
# If we have a return of reservloop we put it in the branchloop sequence
$branchloop{'reserv'} = \@transferloop;
}
push( @branchesloop, \%branchloop ) if %branchloop;
}
$template->param(
branchesloop => \@branchesloop,
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
TransfersMaxDaysWarning => C4::Context->preference('TransfersMaxDaysWarning'),
latetransfers => $latetransfers ? 1 : 0,
);
# Checking if there is a Fast Cataloging Framework
$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' );
# Checking if the transfer page needs to be displayed
$template->param( display_transfer => 1 ) if ( ($flags->{'superlibrarian'} == 1) || (C4::Context->preference("IndependentBranches") == 0) );
output_html_with_http_headers $input, $cookie, $template->output;