From 356973126195f72a5eca54b62045ed86f79952c1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 7 Jan 2021 15:23:17 +0100 Subject: [PATCH] Bug 26701: Remove unused C4/SIP scripts Those scripts are not known to be used, we can remove them from the Koha codebase. Test plan: Confirm that the scripts removed by this patch are not used anywhere from Koha. Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- C4/SIP/acstest.py | 42 -------------------- C4/SIP/example_institution_dump.sh | 16 -------- C4/SIP/interactive_item_dump.pl | 44 --------------------- C4/SIP/interactive_patron_check_password.pl | 26 ------------ C4/SIP/interactive_patron_dump.pl | 18 --------- C4/SIP/interactive_renew_all_dump.pl | 22 ----------- C4/SIP/test.txt | 27 ------------- C4/SIP/xmlparse.pl | 31 --------------- 8 files changed, 226 deletions(-) delete mode 100644 C4/SIP/acstest.py delete mode 100755 C4/SIP/example_institution_dump.sh delete mode 100755 C4/SIP/interactive_item_dump.pl delete mode 100755 C4/SIP/interactive_patron_check_password.pl delete mode 100755 C4/SIP/interactive_patron_dump.pl delete mode 100755 C4/SIP/interactive_renew_all_dump.pl delete mode 100644 C4/SIP/test.txt delete mode 100755 C4/SIP/xmlparse.pl diff --git a/C4/SIP/acstest.py b/C4/SIP/acstest.py deleted file mode 100644 index 02eb4bd272..0000000000 --- a/C4/SIP/acstest.py +++ /dev/null @@ -1,42 +0,0 @@ -import operator -import socket -from time import strftime; - -def SipSocket(host='localhost', port=5300): - so = socket.socket() - so.connect((host, port)) - return so - -def login(so, uname='scclient', passwd='clientpwd', locn='The basement', - seqno=0): - port = so.getpeername()[1] - if port == 5300: - resp = send(so, '9300CN%s|CO%s|CP%s|' % (uname, passwd, locn), seqno) - print "Received", repr(resp) - print "Verified: ", verify(resp) - else: - raise "Logging in is only support for the raw transport on port 5300" - -def send(so, msg, seqno=0): - if seqno: - msg += 'AY' + str(seqno)[0] + 'AZ' - msg += ('%04X' % calculate_cksum(msg)) - msg += '\r' - print 'Sending', repr(msg) - so.send(msg) - resp = so.recv(1000) - return resp, verify(resp) - -def calculate_cksum(msg): - return (-reduce(operator.add, map(ord, msg)) & 0xFFFF) - -def sipdate(): - return(strftime("%Y%m%d %H%M%S")) - -def verify(msg): - if msg[-1] == '\r': msg = msg[:-2] - if msg[-6:-4] == 'AZ': - cksum = calculate_cksum(msg[:-4]) - return (msg[-4:] == ('%04X' % cksum)) - # If there's no checksum, then the message is ok - return True diff --git a/C4/SIP/example_institution_dump.sh b/C4/SIP/example_institution_dump.sh deleted file mode 100755 index 549b2f0bfa..0000000000 --- a/C4/SIP/example_institution_dump.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -perl -I ./ -e ' -use Data::Dumper; -use C4::SIP::ILS; -use C4::SIP::Sip::Configuration; -my $code = "MAIN"; -my $conf = C4::SIP::Sip::Configuration->new("SIPconfig.xml"); -my $ils = C4::SIP::ILS->new($conf->{institutions}->{$code}); -print "XML for $code: ", Dumper($conf->{institutions}->{$code}), "\n"; -print "ILS for $code: ", Dumper($ils), "\n"; -print "\$ils->checkout_ok(): ", ($ils->checkout_ok() ? "Y" : "N"), "\n"; -print "\$ils->checkin_ok() : ", ($ils->checkin_ok() ? "Y" : "N"), "\n"; -print "\$ils->offline_ok() : ", ($ils->offline_ok() ? "Y" : "N"), "\n"; -print "\n"; -' diff --git a/C4/SIP/interactive_item_dump.pl b/C4/SIP/interactive_item_dump.pl deleted file mode 100755 index 5636a219ff..0000000000 --- a/C4/SIP/interactive_item_dump.pl +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/perl -# - -use warnings; -use strict; - -use C4::SIP::ILS::Item; -use Data::Dumper; - -my $compare = (@ARGV) ? shift : 0; -while (1) { - print "Enter item barcode: "; - my $in = <>; - defined($in) or last; - chomp($in); - last unless $in; - my $item = C4::SIP::ILS::Item->new($in); - unless ($item) { - print "No item ($in)"; - next; - } - for (qw(marc marcxml)) { # Letting it just in case but should not longer be useful - $item->{$_} = 'suppressed...'; - } - my $queue = $item->hold_queue(); - print "Item ($in): ", Dumper($item); - print "hold_queue: ", Dumper($queue); - my $holdernumber; - if ($queue and scalar(@$queue)) { - $holdernumber = $queue->[0]->{borrowernumber}; - print "first borrowernumber: $holdernumber\n"; - } - if ($compare) { - print "Enter patron barcode: "; - my $barcode = <>; - defined($barcode) or next; - chomp($barcode); - next unless $barcode; - my $x = ILS::Item::_barcode_to_borrowernumber($barcode) || 'UNDEF'; - print " converts to: $x\n"; - printf " compares as: %s\n", - ($item->barcode_is_borrowernumber($barcode,$holdernumber) ? 'TRUE' : 'FALSE'); - } -} diff --git a/C4/SIP/interactive_patron_check_password.pl b/C4/SIP/interactive_patron_check_password.pl deleted file mode 100755 index 88e5426a7a..0000000000 --- a/C4/SIP/interactive_patron_check_password.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl -# - -use warnings; -use strict; - -use C4::SIP::ILS::Patron; -use C4::SIP::Sip qw(sipbool); -use Data::Dumper; - -while (1) { - print "Enter patron barcode: "; - my $in = <>; - defined($in) or last; - chomp($in); - last unless $in; - my $patron = C4::SIP::ILS::Patron->new($in); - print Dumper($patron); - $patron or next; - print "Enter patron password: "; - $in = <>; - chomp($in); - print "Raw password is: " . $patron->{password}, "\n"; - print " check_password: " . $patron->check_password($in), "\n"; - print " sipbool: " . sipbool($patron->check_password($in)), "\n"; -} diff --git a/C4/SIP/interactive_patron_dump.pl b/C4/SIP/interactive_patron_dump.pl deleted file mode 100755 index afc3bcc55d..0000000000 --- a/C4/SIP/interactive_patron_dump.pl +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/perl -# - -use warnings; -use strict; - -use C4::SIP::ILS::Patron; -use Data::Dumper; - -while (1) { - print "Enter patron barcode: "; - my $in = <>; - defined($in) or last; - chomp($in); - last unless $in; - my $patron = C4::SIP::ILS::Patron->new($in); - print "Patron ($in):\n", Dumper($patron); -} diff --git a/C4/SIP/interactive_renew_all_dump.pl b/C4/SIP/interactive_renew_all_dump.pl deleted file mode 100755 index df7a59264c..0000000000 --- a/C4/SIP/interactive_renew_all_dump.pl +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl -# - -use warnings; -use strict; - -use C4::SIP::ILS::Transaction::RenewAll; -use Data::Dumper; - -while (1) { - print "Enter patron barcode: "; - my $in = <>; - defined($in) or last; - chomp($in); - last unless $in; - my $patron = ILS::Patron->new($in); - print "Patron before: \n " . Dumper($patron); - my $action = C4::SIP::ILS::Transaction::RenewAll->new(); - $action->do_renew_all(); - print "\n\nTransaction::RenewAll: " . Dumper($action); - print "\n", "=" x 35, "\n"; -} diff --git a/C4/SIP/test.txt b/C4/SIP/test.txt deleted file mode 100644 index c70e7dd88e..0000000000 --- a/C4/SIP/test.txt +++ /dev/null @@ -1,27 +0,0 @@ -97AZFEF5 -2300120071003 084235AOkohalibrary|AArch|ACkoha|ADkoha| - -2300120060101 084236AOUWOLS|AAmjandkilde|ACterminal password|ADuser password| -2300120060101 084237AOUWOLS|AAdjfiander|ACterminal password|ADuser password| -9300CNLoginUserID|COLoginPassword|CPLocationCode| -11YN20060329 203000 AOUWOLS|AAdjfiander|AB1565921879|AC| -09Y20060102 08423620060113 084235APUnder the bed|AOUWOLS|AB1565921879|ACterminal password| -01N20060102 084238AOUWOLS|ALHe's a jerk|AAdjfiander|ACterminal password| - -2520060102 084238AOUWOLS|AAdjfiander|ACterminal password|AD6789| -9910302.00 - -3520060110 084237AOkohalibrary|AArch|ADkoha| -1720060110 215612AOUWOLS|AB1565921879| - -patron information: -6300020060329 201700Y AOkohalibrary|AArch|ACkoha|ADkoha| - -15+20060415 110158BW20060815 110158|BSTaylor|BY2|AOUWOLS|AAdjfiander|AB1565921879| -15-20060415 110158AOUWOLS|AAdjfiander|AB1565921879| -29NN20060415 110158 AOUWOLS|AAdjfiander|AD6789|AB1565921879| -6520060415 110158AOUWOLS|AAdjfiander|AD6789| - -working: - -9300CNkoha|COkoha|CPkohalibrary| diff --git a/C4/SIP/xmlparse.pl b/C4/SIP/xmlparse.pl deleted file mode 100755 index 0d8460f382..0000000000 --- a/C4/SIP/xmlparse.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl -# -# This file reads a SIPServer xml-format configuration file and dumps it -# to stdout. Just to see what the structures look like. -# -# The 'new XML::Simple' option must agree exactly with the configuration -# in Sip::Configuration.pm -# -use strict; -use warnings; -use English; - -use XML::Simple qw(:strict); -use Data::Dumper; - -my $parser = XML::Simple->new( KeyAttr => { login => '+id', - institution => '+id', - service => '+port', }, - GroupTags => { listeners => 'service', - accounts => 'login', - institutions => 'institution', }, - ForceArray=> [ 'service', - 'login', - 'institution' ], - ValueAttr => { 'error-detect' => 'enabled', - 'min_servers' => 'value', - 'max_servers' => 'value'} ); - -my $ref = $parser->XMLin(@ARGV ? shift : 'SIPconfig.xml'); - -print Dumper($ref); -- 2.39.5