Bugzilla – Attachment 40906 Details for
Bug 14428
Remove C4::Input
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14428: Remove C4::Input
Bug-14428-Remove-C4Input.patch (text/plain), 7.72 KB, created by
Mark Tompsett
on 2015-07-10 05:19:31 UTC
(
hide
)
Description:
Bug 14428: Remove C4::Input
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-07-10 05:19:31 UTC
Size:
7.72 KB
patch
obsolete
>From b2d0f59bfc63d1163762a241594d13b91cdbb6a0 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 10 Jul 2015 01:08:29 -0400 >Subject: [PATCH] Bug 14428: Remove C4::Input > >Jonathan Druart agreed that C4::Input is vestigial code that should be removed. >Here is how I checked. First I found where C4::Input was used. Then, I checked >what functions are in the package: just checkdigit. Then, I confirmed that >checkdigit is not used at all in any acquisition, administration, or member >related perl scripts. Lastly, I took a look at our supposed test file for the >package. It was painfully sparse. > >As such, this patch removes the test file and the package file, and removes >C4::Input references from these six files: >- acqui/addorderiso2709.pl >- acqui/basketgroup.pl >- acqui/neworderempty.pl >- acqui/uncertainprice.pl >- admin/aqplan.pl >- members/memberentry.pl >NOTE: neworderempty had 3 lines of it?! Didn't anyone see that?! > >Here is the output of what I did to confirm this correction: > >mtompset@debian:~/kohaclone$ git reset --hard origin/master >HEAD is now at 6e9086f Bug 3206: (QA followup) missing comma on sysprefs.sql >mtompset@debian:~/kohaclone$ git grep C4::Input >C4/Input.pm:package C4::Input; #assumes C4/Input >C4/Input.pm:C4::Input - Miscellaneous sanity checks >C4/Input.pm: use C4::Input; >acqui/addorderiso2709.pl:use C4::Input; >acqui/basketgroup.pl:use C4::Input; >acqui/neworderempty.pl:use C4::Input; >acqui/neworderempty.pl:use C4::Input; >acqui/neworderempty.pl:use C4::Input; >acqui/uncertainprice.pl:use C4::Input; >admin/aqplan.pl:use C4::Input; >members/memberentry.pl:use C4::Input; >t/Input.t: use_ok('C4::Input'); >mtompset@debian:~/kohaclone$ grep sub C4/Input.pm >sub checkdigit ($;$) { > my $temp2 = substr($infl,$i,1); > if ($rem eq substr($infl,8,1)) { >} # sub checkdigit >mtompset@debian:~/kohaclone$ grep checkdigit `find acqui -type f` >mtompset@debian:~/kohaclone$ grep checkdigit `find admin -type f` >mtompset@debian:~/kohaclone$ grep checkdigit `find members -type f` >mtompset@debian:~/kohaclone$ cat t/Input.t > >use strict; >use warnings; > >use Test::More tests => 1; > >BEGIN { > use_ok('C4::Input'); >} > >Apply this patch, and the output of git grep C4::Input will be empty. >Run koha qa test tools (kind of overkill) >--- > C4/Input.pm | 122 ----------------------------------------------- > acqui/addorderiso2709.pl | 1 - > acqui/basketgroup.pl | 1 - > acqui/neworderempty.pl | 3 -- > acqui/uncertainprice.pl | 1 - > admin/aqplan.pl | 1 - > members/memberentry.pl | 1 - > t/Input.t | 14 ------ > 8 files changed, 144 deletions(-) > delete mode 100644 C4/Input.pm > delete mode 100755 t/Input.t > >diff --git a/C4/Input.pm b/C4/Input.pm >deleted file mode 100644 >index 3ce28c9..0000000 >--- a/C4/Input.pm >+++ /dev/null >@@ -1,122 +0,0 @@ >-package C4::Input; #assumes C4/Input >- >- >-# 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; >- >-require Exporter; >-use C4::Context; >-use CGI qw ( -utf8 ); >- >-use vars qw($VERSION @ISA @EXPORT); >- >-# set the version for version checking >-$VERSION = 3.07.00.049; >- >-=head1 NAME >- >-C4::Input - Miscellaneous sanity checks >- >-=head1 SYNOPSIS >- >- use C4::Input; >- >-=head1 DESCRIPTION >- >-This module provides functions to see whether a given library card >-number or ISBN is valid. >- >-=head1 FUNCTIONS >- >-=over 2 >- >-=cut >- >-@ISA = qw(Exporter); >-@EXPORT = qw( >- &checkdigit >-); >- >-=item checkdigit >- >- $valid = &checkdigit($cardnumber $nounique); >- >-Takes a card number, computes its check digit, and compares it to the >-checkdigit at the end of C<$cardnumber>. Returns a true value iff >-C<$cardnumber> has a valid check digit. >- >-=cut >- >-#' >-sub checkdigit ($;$) { >- >- my ($infl, $nounique) = @_; >- $infl = uc $infl; >- >- # Check to make sure the cardnumber is unique >- >- #FIXME: We should make the error for a nonunique cardnumber >- #different from the one where the checkdigit on the number is >- #not correct >- >- unless ( $nounique ) >- { >- my $query=qq{SELECT * FROM borrowers WHERE cardnumber=?}; >- my $sth=C4::Context->prepare($query); >- $sth->execute($infl); >- my %results = $sth->fetchrow_hashref(); >- if ( $sth->rows != 0 ) >- { >- return 0; >- } >- } >- if (C4::Context->preference("checkdigit") eq "none") { >- return 1; >- } >- >- my @weightings = (8,4,6,3,5,2,1); >- my $sum; >- foreach my $i (1..7) { >- my $temp1 = $weightings[$i-1]; >- my $temp2 = substr($infl,$i,1); >- $sum += $temp1 * $temp2; >- } >- my $rem = ($sum%11); >- if ($rem == 10) { >- $rem = "X"; >- } >- if ($rem eq substr($infl,8,1)) { >- return 1; >- } >- return 0; >-} # sub checkdigit >- >-END { } # module clean-up code here (global destructor) >- >-1; >-__END__ >- >-=back >- >-=head1 AUTHOR >- >-Koha Development Team <http://koha-community.org/> >- >-=cut >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index 1c0086b..b809fb9 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -28,7 +28,6 @@ use YAML qw/Load/; > > use C4::Context; > use C4::Auth; >-use C4::Input; > use C4::Output; > use C4::ImportBatch; > use C4::Matcher; >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index 2e622b9..b2ed7db 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -47,7 +47,6 @@ use strict; > use warnings; > use Carp; > >-use C4::Input; > use C4::Auth; > use C4::Output; > use CGI qw ( -utf8 ); >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 020c91f..4a37815 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -70,11 +70,9 @@ use warnings; > use strict; > use CGI qw ( -utf8 ); > use C4::Context; >-use C4::Input; > > use C4::Auth; > use C4::Budgets; >-use C4::Input; > > use C4::Acquisition; > use C4::Contract; >@@ -82,7 +80,6 @@ use C4::Suggestions; # GetSuggestion > use C4::Biblio; # GetBiblioData GetMarcPrice > use C4::Items; #PrepareItemRecord > use C4::Output; >-use C4::Input; > use C4::Koha; > use C4::Branch; # GetBranches > use C4::Members; >diff --git a/acqui/uncertainprice.pl b/acqui/uncertainprice.pl >index 6213357..f3848c1 100755 >--- a/acqui/uncertainprice.pl >+++ b/acqui/uncertainprice.pl >@@ -46,7 +46,6 @@ The bookseller who we want to display the orders of. > use strict; > use warnings; > >-use C4::Input; > use C4::Auth; > use C4::Output; > use CGI qw ( -utf8 ); >diff --git a/admin/aqplan.pl b/admin/aqplan.pl >index f55acc2..2c46cbe 100755 >--- a/admin/aqplan.pl >+++ b/admin/aqplan.pl >@@ -35,7 +35,6 @@ use C4::Context; > use C4::Output; > use C4::Koha; > use C4::Auth; >-use C4::Input; > use C4::Debug; > > my $input = new CGI; >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 514bdd8..5e2ff91 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -36,7 +36,6 @@ use C4::Members::Attributes; > use C4::Members::AttributeTypes; > use C4::Koha; > use C4::Dates qw/format_date format_date_in_iso/; >-use C4::Input; > use C4::Log; > use C4::Letters; > use C4::Branch; # GetBranches >diff --git a/t/Input.t b/t/Input.t >deleted file mode 100755 >index e23f591..0000000 >--- a/t/Input.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::Input'); >-} >- >-- >2.1.4
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 14428
:
40906
|
40907
|
40913