Bugzilla – Attachment 20620 Details for
Bug 10781
Remove C4::ILSDI::Utility
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug_10781: Removed ILSDI::Utility
bug10781-Removed-ILSDIUtility.patch (text/plain), 6.57 KB, created by
Srdjan Jankovic
on 2013-08-26 00:23:15 UTC
(
hide
)
Description:
bug_10781: Removed ILSDI::Utility
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2013-08-26 00:23:15 UTC
Size:
6.57 KB
patch
obsolete
>From 0723b55d32176960dd5241fffcd8505b32867c73 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Fri, 23 Aug 2013 19:59:17 +1200 >Subject: [PATCH] bug_10781: Removed ILSDI::Utility > >Test: >This should be a noop. Regression testing required: >/cgi-bin/koha/ilsdi.pl functioanality, in particuler: >GetAvailability - ?service=Describe&verb=GetAvailability >AuthenticatePatron - ?service=Describe&verb=AuthenticatePatron > >ILS-DI syspref must be turned on >--- > C4/ILSDI/Services.pm | 40 ++++++++++++++++++- > C4/ILSDI/Utility.pm | 107 --------------------------------------------------- > t/ILSDI_Utility.t | 14 ------- > 3 files changed, 38 insertions(+), 123 deletions(-) > delete mode 100644 C4/ILSDI/Utility.pm > delete mode 100755 t/ILSDI_Utility.t > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index dd43743..2eec0ac 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -29,11 +29,11 @@ use C4::Biblio; > use C4::Reserves qw(AddReserve CancelReserve GetReservesFromBiblionumber GetReservesFromBorrowernumber CanBookBeReserved CanItemBeReserved); > use C4::Context; > use C4::AuthoritiesMarc; >-use C4::ILSDI::Utility; > use XML::Simple; > use HTML::Entities; > use CGI; > use DateTime; >+use Data::Dumper; > > =head1 NAME > >@@ -114,7 +114,7 @@ sub GetAvailability { > > foreach my $id ( split( / /, $cgi->param('id') ) ) { > if ( $cgi->param('id_type') eq "item" ) { >- my ( $biblionumber, $status, $msg, $location ) = Availability($id); >+ my ( $biblionumber, $status, $msg, $location ) = _availability($id); > > $out .= " <dlf:record>\n"; > $out .= " <dlf:bibliographic id=\"" . ( $biblionumber || $id ) . "\" />\n"; >@@ -767,4 +767,40 @@ sub CancelHold { > return { code => 'Canceled' }; > } > >+=head2 _availability >+ >+Returns, for an itemnumber, an array containing availability information. >+ >+ my ($biblionumber, $status, $msg, $location) = _availability($id); >+ >+=cut >+ >+sub _availability { >+ my ($itemnumber) = @_; >+ my $item = GetItem( $itemnumber, undef, undef ); >+ >+ if ( not $item->{'itemnumber'} ) { >+ return ( undef, 'unknown', 'Error: could not retrieve availability for this ID', undef ); >+ } >+ >+ my $biblionumber = $item->{'biblioitemnumber'}; >+ my $location = GetBranchName( $item->{'holdingbranch'} ); >+ >+ if ( $item->{'notforloan'} ) { >+ return ( $biblionumber, 'not available', 'Not for loan', $location ); >+ } elsif ( $item->{'onloan'} ) { >+ return ( $biblionumber, 'not available', 'Checked out', $location ); >+ } elsif ( $item->{'itemlost'} ) { >+ return ( $biblionumber, 'not available', 'Item lost', $location ); >+ } elsif ( $item->{'wthdrawn'} ) { >+ return ( $biblionumber, 'not available', 'Item withdrawn', $location ); >+ } elsif ( $item->{'damaged'} ) { >+ return ( $biblionumber, 'not available', 'Item damaged', $location ); >+ } else { >+ return ( $biblionumber, 'available', undef, $location ); >+ } >+ >+ die Data::Dumper::Dumper($item); >+} >+ > 1; >diff --git a/C4/ILSDI/Utility.pm b/C4/ILSDI/Utility.pm >deleted file mode 100644 >index b8c1457..0000000 >--- a/C4/ILSDI/Utility.pm >+++ /dev/null >@@ -1,107 +0,0 @@ >-package C4::ILSDI::Utility; >- >-# Copyright 2009 SARL Biblibre >-# Copyright 2011 software.coop and MJ Ray >-# >-# 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 2 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >- >-use strict; >-use warnings; >- >-use C4::Members; >-use C4::Items; >-use C4::Circulation; >-use C4::Biblio; >-use C4::Reserves qw(GetReservesFromBorrowernumber CanBookBeReserved); >-use C4::Context; >-use C4::Branch qw/GetBranchName/; >-use Digest::MD5 qw(md5_base64); >- >-use vars qw($VERSION @ISA @EXPORT); >- >-BEGIN { >- >- # set the version for version checking >- $VERSION = 3.07.00.049; >- require Exporter; >- @ISA = qw(Exporter); >- @EXPORT = qw( >- &BorrowerExists &Availability >- ); >-} >- >-=head1 NAME >- >-C4::ILS-DI::Utility - ILS-DI Utilities >- >-=cut >- >-=head2 BorrowerExists >- >-Checks, for a given userid and password, if the borrower exists. >- >- if ( BorrowerExists($userid, $password) ) { >- # Do stuff >- } >- >-=cut >- >-sub BorrowerExists { >- my ( $userid, $password ) = @_; >- $password = md5_base64($password); >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("SELECT COUNT(*) FROM borrowers WHERE userid =? and password=? "); >- $sth->execute( $userid, $password ); >- return $sth->fetchrow; >-} >- >-=head2 Availability >- >-Returns, for an itemnumber, an array containing availability information. >- >- my ($biblionumber, $status, $msg, $location) = Availability($id); >- >-=cut >- >-sub Availability { >- my ($itemnumber) = @_; >- my $item = GetItem( $itemnumber, undef, undef ); >- >- if ( not $item->{'itemnumber'} ) { >- return ( undef, 'unknown', 'Error: could not retrieve availability for this ID', undef ); >- } >- >- my $biblionumber = $item->{'biblioitemnumber'}; >- my $location = GetBranchName( $item->{'holdingbranch'} ); >- >- if ( $item->{'notforloan'} ) { >- return ( $biblionumber, 'not available', 'Not for loan', $location ); >- } elsif ( $item->{'onloan'} ) { >- return ( $biblionumber, 'not available', 'Checked out', $location ); >- } elsif ( $item->{'itemlost'} ) { >- return ( $biblionumber, 'not available', 'Item lost', $location ); >- } elsif ( $item->{'wthdrawn'} ) { >- return ( $biblionumber, 'not available', 'Item withdrawn', $location ); >- } elsif ( $item->{'damaged'} ) { >- return ( $biblionumber, 'not available', 'Item damaged', $location ); >- } else { >- return ( $biblionumber, 'available', undef, $location ); >- } >- >- die Data::Dumper::Dumper($item); >-} >- >-1; >diff --git a/t/ILSDI_Utility.t b/t/ILSDI_Utility.t >deleted file mode 100755 >index c06209b..0000000 >--- a/t/ILSDI_Utility.t >+++ /dev/null >@@ -1,14 +0,0 @@ >-#!/usr/bin/perl >-# >-# This Koha test module is a stub! >-# Add more tests here!!! >- >-use strict; >-use warnings; >- >-use Test::More tests => 1; >- >-BEGIN { >- use_ok('C4::ILSDI::Utility'); >-} >- >-- >1.8.1.2
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 10781
:
20620
|
21688
|
22402
|
22725