From 04dd31fa074ef0d17edbd32bd41cb2434e066521 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Thu, 20 Jun 2002 18:17:51 +0000 Subject: [PATCH] 47 files to go, 47 files to go, take one down, pass it around... 46 files to go. --- News | 23 +++ acqui.simple/z3950-daemon-launch.sh | 36 ++++ acqui.simple/z3950-daemon-shell.sh | 38 ++++ t/Input.t | 55 ++++++ t/format.t | 37 ++++ t/koha.t | 29 ++- t/output.t | 282 ++++++++++++++++++++++++++++ t/require.t | 7 + 8 files changed, 506 insertions(+), 1 deletion(-) create mode 100644 News create mode 100755 acqui.simple/z3950-daemon-launch.sh create mode 100755 acqui.simple/z3950-daemon-shell.sh create mode 100644 t/Input.t create mode 100644 t/format.t create mode 100644 t/output.t create mode 100644 t/require.t diff --git a/News b/News new file mode 100644 index 0000000000..be6a6217c2 --- /dev/null +++ b/News @@ -0,0 +1,23 @@ +Here Ive tried to collect all the bugfixes and stable new features added +since 1.1.1 + +* Keyword, Title and Author searches sped up. +* Bugfix for borrower insert script. +* Bugfix for writing off fines. +* Budget breakdown in acquisitions is created on the fly (as opposed to written to an include) +* Lots of tidy ups in the search module +* Fixed display of reserves, on members and detail screens +* Bugfix for manual invoices +* Bugfix for catalogue maintenance +* Tidied up decimal places for item costs +* Bugfix to update group script +* New Feature - Can restrict a keyword search to a dewey number +* New Feature - Modify a borrower who is a guarantor causes relevant changes to be made to all their guarntees +* Bug fix for combined author and title search (wasnt picking up series title) +* Bugfix for reserve handling and charges +* New Feature - Class search +* New Feature - Dewey search +* New Feature - Deleting borrowers checks their accounts for reserves, issues and fines +* New Feature - translation script translator/ +* New Feature - Reading record, can be sorted by title or author, or date +* New Feature - Simple acquisitions module diff --git a/acqui.simple/z3950-daemon-launch.sh b/acqui.simple/z3950-daemon-launch.sh new file mode 100755 index 0000000000..0e6fab8672 --- /dev/null +++ b/acqui.simple/z3950-daemon-launch.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# Script to start Koha background Z39.50 search daemon + +# Part of the Koha Library Mgmt System - www.koha.org +# Licensed under the GPL + +#---------------------------- +# Call this script during system startup, such as from rc.local + +# Bugs/To Do: +# Needs SysV-type start/stop options + +#---------------------------- +# User ID to run the daemon as. Don't use "root" +RunAsUser=apache + +KohaDir=/usr/local/www/koha/htdocs/cgi-bin/koha/acqui.simple +export KohaDir + +#---------------------------- +if [ ! -d $KohaDir ] +then + echo ERROR: Cannot find Koha directory $KohaDir + exit 1 +fi + +KohaZ3950Shell=$KohaDir/z3950-daemon-shell.sh + +if [ ! -x $KohaZ3950Shell ] +then + echo ERROR: Cannot find Koha Z39.50 daemon launcher $KohaZ3950Shell + exit 1 +fi + +su -s /bin/sh -c '$KohaZ3950Shell &' - $RunAsUser & diff --git a/acqui.simple/z3950-daemon-shell.sh b/acqui.simple/z3950-daemon-shell.sh new file mode 100755 index 0000000000..b51710c1a3 --- /dev/null +++ b/acqui.simple/z3950-daemon-shell.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# Script to start Koha background Z39.50 search daemon + +# Part of the Koha Library Mgmt System - www.koha.org +# Licensed under the GPL + +#---------------------------- +# Do NOT run this script directly from system startup- +# Call z3950-daemon-launch.sh instead + +#---------------------------- + +KohaDir=/usr/local/www/koha/htdocs/cgi-bin/koha/acqui.simple +KohaModuleDir=/usr/local/koha/modules +LogDir=/var/log/koha + +#---------------------------- +LOGFILE=$LogDir/z3950-daemon-`date +%Y%m%d-%H%M`.log + +touch $LOGFILE +if [ ! -w $LOGFILE ] +then + echo ERROR: Cannot write to log file $LOGFILE + exit 1 +fi + +KohaZ3950Script=$KohaDir/processz3950queue +if [ ! -x $KohaZ3950Script ] +then + echo ERROR: Cannot find Koha Z39.50 daemon script $KohaZ3950Script + exit 1 +fi + +PERL5LIB=$KohaModuleDir +export PERL5LIB + +exec $KohaDir/processz3950queue >>$LOGFILE 2>&1 diff --git a/t/Input.t b/t/Input.t new file mode 100644 index 0000000000..8570220303 --- /dev/null +++ b/t/Input.t @@ -0,0 +1,55 @@ +# $Id$ + +#use strict; + +BEGIN { $| = 1; print "1..13\n"; } +END {print "not ok 1\n" unless $loaded;} +use C4::Input; +$loaded = 1; +print "ok 1\n"; + +my $TestCount=1; + +#----------------- +# Test ISBN validation + +my $isbn; + +# Good numbers +foreach $isbn ('0836213092','087784805X','087784805x','1878685899') { + PrintNextTestResult ( &checkvalidisbn($isbn), "Good ISBN: $isbn" ) +} + +# Bad numbers +foreach $isbn ('0836213192','087784804X','087784806x','1878685898', + '', ' ', 'abc', '1234567890123') { + PrintNextTestResult ( ! &checkvalidisbn($isbn), "Bad ISBN: $isbn" ) +} + + + +#----------------------- +sub PrintNextTestResult { + # modifies global var $TestCount + my ($ThisTestResult, $TestComment )=@_; + + $TestCount++; + + if ( $ThisTestResult ) { + print "ok $TestCount\n"; + } else { + print STDERR "\nTest failed: $TestComment\n"; + print "not ok $TestCount\n"; + } + +} # sub PrintNextTestResult + +#----------------------- +# $Log$ +# Revision 1.2 2002/06/20 18:18:06 tonnesen +# 47 files to go, 47 files to go, take one down, pass it around... +# 46 files to go. +# +# Revision 1.1.2.1 2002/06/20 15:19:34 amillar +# Test valid ISBN numbers in Input.pm +# diff --git a/t/format.t b/t/format.t new file mode 100644 index 0000000000..6204df2df9 --- /dev/null +++ b/t/format.t @@ -0,0 +1,37 @@ +BEGIN { $| = 1; print "1..5\n"; } +END {print "not ok 1\n" unless $loaded;} +use C4::Format; +$loaded = 1; +print "ok 1\n"; + +# +# ensure &startint returns a reasonable value +# + +# try right formatting +if (" foo" eq fmtstr('','foo','R5')) { + print "ok 2\n"; +} else { + print "not ok 2\n"; +} + +# try left formatting +if ("foo " eq fmtstr('','foo','L5')) { + print "ok 3\n"; +} else { + print "not ok 3\n"; +} + +# try centering with even spacing +if (" foo " eq fmtstr('','foo','C5')) { + print "ok 4\n"; +} else { + print "not ok 4\n"; +} + +# try centering with uneven spacing +if ("foo " eq fmtstr('','foo','C4')) { + print "ok 5\n"; +} else { + print "not ok 5\n"; +} diff --git a/t/koha.t b/t/koha.t index b0b7e925c0..69fe981aca 100644 --- a/t/koha.t +++ b/t/koha.t @@ -1,9 +1,12 @@ -BEGIN { $| = 1; print "1..2\n"; } +BEGIN { $| = 1; print "1..6\n"; } END {print "not ok 1\n" unless $loaded;} use C4::Koha; $loaded = 1; print "ok 1\n"; +# +# test that &slashifyDate returns correct (non-US) date +# $date = "01/01/2002"; $newdate = &slashifyDate("2002-01-01"); @@ -12,3 +15,27 @@ if ($date eq $newdate) { } else { print "not ok 2\n"; } + +# +# Check that &fixEthnicity returns correct values +# +if ('Maori' eq fixEthnicity('maori')) { + print "ok 3\n"; +} else { + print "not ok 3\n"; +} +if ('European/Pakeha' eq fixEthnicity('european')) { + print "ok 4\n"; +} else { + print "not ok 4\n"; +} +if ('Pacific Islander' eq fixEthnicity('pi')) { + print "ok 5\n"; +} else { + print "not ok 5\n"; +} +if ('Asian' eq fixEthnicity('asian')) { + print "ok 6\n"; +} else { + print "not ok 6\n"; +} diff --git a/t/output.t b/t/output.t new file mode 100644 index 0000000000..059c2c6788 --- /dev/null +++ b/t/output.t @@ -0,0 +1,282 @@ +BEGIN { $| = 1; print "1..25\n"; } +END {print "not ok 1\n" unless $loaded;} +use C4::Output; +$loaded = 1; +print "ok 1\n"; + +# +# ensure &startpage returns correct value +# +if ("\n" eq startpage()) { + print "ok 2\n"; +} else { + print "not ok 2\n"; +} + +# +# Check that &gotopage returns proper value +# +if ("" eq gotopage('foo')) { + print "ok 3\n"; +} else { + print "not ok 3\n"; +} + +# +# skipping &startmenu for now +# + +# +# skipping &endmenu for now + +# +# ensure &mktablehdr returns a proper value +# + +if ("\n" eq mktablehdr()) { + print "ok 4\n"; +} else { + print "not ok 4\n"; +} + +# +# ensure &mktablerow returns a proper value +# +# 1 row, no background image +if ("\n" eq + mktablerow(1,'red','text')) { + print "ok 5\n"; +} else { + print "not ok 5\n"; +} +# 1 row, background image +if ("\n" eq + mktablerow(1,'red','text','foo.jpg')) { + print "ok 6\n"; +} else { + print "not ok 6\n"; +} +#2 rows, no background image +if ("\n" eq + mktablerow(2,'red','text','text')) { + print "ok 7\n"; +} else { + print "not ok 7\n"; +} + +# 2 rows, background image +if ("\n" eq + mktablerow(2,'red','text','text', 'foo.jpg')) { + print "ok 8\n"; +} else { + print "not ok 8\n"; +} + +# +# ensure mktableft returns the proper value +# + +if ("
text
text
texttext
texttext
\n" eq mktableft()) { + print "ok 9\n"; +} else { + print "not ok 9\n"; +} + + +# +# skipping mkform for now +# + +# +# skipping mkform3 for now +# + +# +# skipping mkform2 for now +# + +# +# ensure endpage returns the proper value +# + +if ("\n" eq endpage()) { + print "ok 10\n"; +} else { + print "not ok 10\n"; +} + + +# +# ensure mklink returns the right value +# + +if ("foo" eq mklink('foo.html', 'foo')) { + print "ok 11\n"; +} else { + print "not ok 11\n"; +} + +# +# ensure mkheadr returns the proper value +# + +if ("foo
" eq mkheadr(1,'foo')) { + print "ok 12\n"; +} else { + print "not ok 12\n"; +} + +if ("foo" eq mkheadr(2,'foo')) { + print "ok 13\n"; +} else { + print "not ok 13\n"; +} + +if ("foo

" eq mkheadr(3,'foo')) { + print "ok 14\n"; +} else { + print "not ok 14\n"; +} + +# +# test ¢er and &endcenter +# + +if ("

\n" eq center()) { + print "ok 15\n"; +} else { + print "not ok15\n"; +} + +if ("
\n" eq endcenter()) { + print "ok 16\n"; +} else { + print "not ok 16\n"; +} + +# +# ensure bold returns proper value +# + +if ("foo" eq bold('foo')) { + print "ok 17\n"; +} else { + print "not ok\n"; +} + +# +# ensure &mkformnotable returns a valid value +# + +@inputHidden = qw(hidden hiddenname hiddenvalue); +@inputRadio = qw(radio radioname radiovalue); +@inputText = qw(text textname textvalue); +@inputTextarea = qw(textarea textareaname textareavalue); +@inputSubmit = qw(submit submitname submitvalue); +@inputReset = qw(reset resetname resetvalue); + +# 1 input; hidden +@inputs = (\@inputHidden); +$return ="
\n"; +$return .= "\n"; +$return .= "
"; + +if ($return eq mkformnotable('actionurl', @inputs)) { + print "ok 18\n"; +} else { + print "not ok 18\n"; +} + +# 1 input; radio +@inputs = (\@inputRadio); +$return ="
\n"; +$return .= "radiovalue\n"; +$return .= "
"; + +if ($return eq mkformnotable('actionurl', @inputs)) { + print "ok 19\n"; +} else { + print "not ok 19\n"; +} + +# 1 input; text +@inputs = (\@inputText); +$return = "
\n"; +$return .= "\n"; +$return .= "
"; + +if ($return eq mkformnotable('actionurl', @inputs)) { + print "ok 20\n"; +} else { + print "not ok 20\n"; +} + + +# 1 input; textarea +@inputs = (\@inputTextarea); +$return = "
\n"; +$return .= "\n"; +$return .= "
"; + +if ($return eq mkformnotable('actionurl', @inputs)) { + print "ok 21\n"; +} else { + print "not ok 21\n"; +} + +# 1 input; submit +@inputs = (\@inputSubmit); +$return = "
\n"; +$return .= "\n"; +$return .= "
"; + +if ($return eq mkformnotable('actionurl', @inputs)) { + print "ok 22\n"; +} else { + print "not ok 22\n"; +} + +# 1 input; reset +@inputs = (\@inputReset); +$return = "
\n"; +$return .= "\n"; +$return .= "
"; + +if ($return eq mkformnotable('actionurl', @inputs)) { + print "ok 23\n"; +} else { + print "not ok 23\n"; +} + +# 2 inputs; hidden and submit +@inputs = (\@inputHidden, \@inputSubmit); +$return = "
\n"; +$return .= "\n"; +$return .= "\n"; +$return .= "
"; + +if ($return eq mkformnotable('actionurl', @inputs)) { + print "ok 24\n"; +} else { + print "not ok 24\n"; +} + + +# 3 inputs; text, submit, and reset +@inputs = (\@inputText, \@inputSubmit, \@inputReset); +$return = "
\n"; +$return .= "\n"; +$return .= "\n"; +$return .= "\n"; +$return .= "
"; + +if ($return eq mkformnotable('actionurl', @inputs)) { + print "ok 25\n"; +} else { + print "not ok 25\n"; +} + + + + + diff --git a/t/require.t b/t/require.t new file mode 100644 index 0000000000..98f429d7d8 --- /dev/null +++ b/t/require.t @@ -0,0 +1,7 @@ +BEGIN { $| = 1; print "1..4\n"; } + +my $i = 1; +eval { require Date::Manip; } || print "not "; print "ok ",$i++,"\n"; +eval { require DBI; } || print "not "; print "ok ",$i++,"\n"; +eval { require Set::Scalar; } || print "not "; print "ok ",$i++,"\n"; +eval { require DBD::mysql; } || print "not "; print "ok ",$i++,"\n"; -- 2.39.2