Commit graph

154 commits

Author SHA1 Message Date
0bbcfeda0e replace syslog with warns
As discussed with Chris Nighswonger on #koha, this patch
removes the calls to syslog and replaces them with warns
so that error messages generated by the labels code
are sent to the Apache error log.  This avoids splitting
this sort of logging across multiple files and is consistent
with current practice in most of the rest of Koha.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2009-09-05 21:43:12 -04:00
Chris Nighswonger
6066b79817 [38/40] Misc bugfixs 2009-09-01 15:57:46 -04:00
Chris Nighswonger
9b56b1ead9 [35/40] Work on C4::Labels tests and various bugfixs resulting
This patch also moves the Labels tests into their own sub directory.

Due to a squash mistake this patch also includes the following:

Fixing up POD for C4::Labels modules

Also a minor bugfix and code refactoring.
2009-09-01 15:54:01 -04:00
Chris Nighswonger
537880591a [3/40] Work on C4::Labels::Profile module and tests 2009-09-01 15:47:52 -04:00
Chris Nighswonger
1c39484c4b [2/40] Work on C4::Labels::Template and associated tests
This commit also contains some work on C4::Labels::Layout as well
2009-09-01 15:47:32 -04:00
Chris Nighswonger
f4d46222e8 [1/40] Work on C4::Labels::Layout module and tests
NOTE: This patch is the first of 40 which almost completely re-factor the
label creator code into a hopefully more scalable form. The new format is
a move in direction of OO handling labels, batches, templates, layouts, and
profiles as objects thus permitting easier implementation of features and
enhancements. It should be possible to export label data in any format one
might choose with the simple addition of a script similar to those included
which produce pdf, csv, and xml format.

One of the larger improvements is a change in workflow that results in template,
layout, and start label selection occurring just before export.

There are also various bugfixes and smaller interface improvements woven into it.

It should be noted that this patch series removes the patron card creator feature
for the present. This feature was only partially completed. A completed variation
will be submitted as a separate patch series to follow in the near future.

The following bugs and enhancements are fixed by this series of patches:

2944 Search to add items to a label batch broken
2061 labels_conf DB values: NULL vs. 0
2511 CSV format string is not cleared when unselected in the label layout editor
2515 Re-factor C4::Labels::DrawSpineText
2823 Label Generator not generating barcodes
3171 Problem due to internationalization in label-create-template.tmpl in de-DE and possibly others
3180 Active settings for label settings should be set at print time only

This work was sponsored by Foundations Bible College & Seminary, Dunn, NC USA
2009-09-01 15:15:45 -04:00
ae5b76c89b bug 2157: add ability to 'clean' staged record batches
batches, it is now possible to 'clean' a batch by
removing all bib and item records staged in the batch.  This
has the effect of helping to reduce database space used
by old import batches as well as removing staged records
from the cataloging reservoir search.  Note that 'cleaning'
a batch affects only the copies of the records that were staged;
if the batch was committed, cleaning the batch does not
affect any bibs and items that were committed into the catalog.

Also note that once you clean a committed batch of records, it is
impossible to undo the previous commit operation.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2009-08-10 20:34:55 -04:00
Joe Atzberger
51e8fc2cb6 bug 3435: AddReturn overhaul.
Required for SIP checkin implementation, but also for internal correctness.
AddReturn had too many things going on, with no guarantee of data being
available for the later calls.  At some point we started tacking on all the
branch transfer logic without testing edge cases.  In particular, $borrower
is not checked to be sure it is defined, considering the item may not have been
checked out so no borrower would be associated.  That means that CircControl
of "PatronLibrary" would be inaccurate, Circ Alerts will be totally confused
(untargeted), and the Fix... subs would fail.

Note that *many* errors are still present in _FixAccountForLostAndReturned, including
those where comments are added, such that it might behave strangely even with $borrower.

Renamed the internal subs with leading underscore, per convention.  Changed
the arguments to be scalars when only scalars are needed, not entire objects.
Added depth to WrongBranch message that includes Rightbranch.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-07-30 11:06:50 -04:00
Galen Charlton
2d880c73d1 removing disused C4::Serials functions
The following functions are no longer in use:

* old_newsubscription
* old_modsubscription
* old_getserials

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-09 09:31:12 -05:00
Galen Charlton
ecdf595208 bug 3314: remove disused scripts and API functions
The distributedto column of the subscription table is
no longer used, having been replaced by the serials
routing list table.  This patch removes two C4::Serials
functions and a script and template, none of which were
reachable by current code:

C4::Serials::GetDistributedTo()
C4::Serials::SetDistributedTo()
koha-tmpl/intranet-tmpl/prog/en/modules/serials/distributedto.tmpl
serials/distributedto.pl

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-08 17:03:05 -05:00
Galen Charlton
c53c9ff8c6 bug 3303: removed references to news_channels*
Removed routines in C4/NewsChannels.pm that refered
to missing database tables news_channels and news_channel_categories.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-07 20:09:18 -05:00
Galen Charlton
456e2a65b3 bug 3302: removed disused references to opac_electronic
Removed routines in C4/NewsChannels.pm that refer to
a missing opac_electronic table.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-07 20:09:17 -05:00
Joe Atzberger
82f362673c Allow option to preserve Extended Attributes on patron import update.
Essentially, this patch provides the option to overwrite only matching
Extended Attributes, instead of all of them, treating the ext. fields more
like normal fields.

Several functions added to Members::Attributes with corresponding tests.

[ LL ref. 342 ]

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-05-28 06:50:39 -05:00
Chris Nighswonger
e72a02e08b Bug 2500 Tweaking DDCN Split for Hyphenated Volumn Numbers
Presently 252.051 T147 v.1-2 is split as

252.051
T147
v.1
-2

This patch corrects the algorithm so that it splits as

252.051
T147
v.1-2

It also updates Labels_split_ddcn.t to include this particular case.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-05-27 10:45:36 -05:00
Galen Charlton
d8bd2345ed bug 3120: tweak DDCN call number splitting for labels
Allow a call number of the form MP3-CD F PARKER to be split as

MP3-CD
F
PARKER

instead of

MP
3
-CD
F
PARKER

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-05-21 08:01:41 -05:00
Galen Charlton
3f49ad62c8 bug 3236: remove disused scripts and a function
Removed opac/opac-dictionary.pl and catalogue/dictionary.pl,
which were not in use and not linked to from any active
template files.  According to Henri, the functionality that
these scripts implemented hasn't been working since 2.2.

Also removed C4::Search::findseealso(), which was used
only by the two scripts.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-05-20 08:37:58 -05:00
Galen Charlton
b244cac492 bug 3120: tweak splitting of Dewey call number
If a call number prefix contains a hyphen, try not to
split on the hyphen.  For example, rather than
splitting the call number 'CD-ROM 787.87 EAS'
like this:

CD
-ROM
787.87
EAS

it should be

CD-ROM
787.87
EAS

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-05-11 07:47:09 -05:00
Galen Charlton
2e08f626f5 remove incomplete bib bulk editing code
Per discussion I had with Henri, removing experimental
bulk editing from the staff search results code, as
feature is incomplete and can be dangerous if
one tries to use it on a large search result
set.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-04-06 10:53:50 -05:00
Joe Atzberger
657371808a DDCN callnumber splitting with test.
Similar to previous patch for LCCN splitting, this patch incorporates
changes to split_ddcn and supplies a test file for verifying proper
operation.  Note that the only previously documented example for intended
operation is included as one of the tests.

This regexps are created to be rather forgiving.  For example, the function
will not choke if two spaces were included where the "spec" (such as it is)
expects one.  Obviously this is because for CN splitting purposes, it doesn't
matter, we're not going to ever split in the middle of whitespace.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-04-03 18:47:48 -05:00
Joshua Ferraro
69c74c06ae Move Amazon.pm to External/ directory
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-03-27 17:23:49 -05:00
Joe Atzberger
a3ae0a5628 Test for LCCN splitting.
This test establishes what LCCN splitting is required to do
to be considered successful.  See Bug 2691.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-03-11 08:37:27 -05:00
Joe Atzberger
abe306c2df Allow LDAP test to bail if LDAP disabled.
Also added more feedback and the ability to override KOHA_CONF
"useldapserver" value with ENV variable KOHA_USELDAPSERVER.

This patch should be considered for inclusion to 3.0 stable branch
because it prevents unnecessary failure of test battery.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-03-05 09:49:10 -06:00
John Beppu
ed3c0545da Tests for New Modules
- KohaTest::Category
- KohaTest::ItemCirculationAlertPreference
- KohaTest::ItemType
- KohaTest::Message

Signed-off-by: Daniel Sweeney <daniel.sweeney@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-02-04 13:58:22 -06:00
Joe Atzberger
a581f7203c Bug 2842: ->regexp('syspref') failed for users of iso dateformat.
Sticky due date and patron import were the two areas affected.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-01-06 20:24:46 -06:00
Joe Atzberger
4e50585926 Dates expanding to expose some time (HH:MM:SS) granularity.
t/Dates.t is essentially restored from its previous state with
the revision that it now does not use C4::Context or check syspref
for the default date format.  Instead it sets the C4::Dates default
directly, taking cue from command line argument or ENV.  ISO format
revised to accept "T" separator and "Z" (zulu) terminator. POD
expanded and corrected.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-01-06 20:24:40 -06:00
Andrew Moore
0b1c856e4b Bug 2505: adding warnings to C4/Biblio.pm
I added 'use warnings' to C4::Biblio and made a handful of changes to
reduce the number of warnings emitted.

One notable spot is the change in the regex in
C4::Biblio::GetNoZebraIndexes. I have replaced the parens with a character
class. The parens change the way 'split' works, making it return elements
for each delimiter. We did not want those elements returned, and they
only resulted in "'' => undef" being added to the final hash. They also
resulted in two "undefined" warnings for each pass through the loop. I've
included a simple test for this function.

There may be a few warnings still emitted in spots, but either I haven't
seen them yet, or I have chosen to not fix them yet because they require
too much change.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-01-05 16:16:38 -06:00
Joe Atzberger
9dbd65da27 barcodedecode() did not always return barcode
This patch amends the function to return barcode, in particular when
filter is not defined.  It also adds an optional 2nd argument to
allow the filter to be specified by caller, enabling testing.

Non-DB-dependent test script included.  Note: T-prefix style
barcode filter is not documented, and drops the first nonzero
digit after the T.  This seems mistaken, but is not corrected here
to avoid any surprises.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-01-05 15:55:14 -06:00
Allen Reinmeyer
3fca370fba Test suite: C4::Members::GetMemberDetails
Tests for C4::Members::GetMemberDetails.  Validates both calls
using either borrowernumber or cardnumber.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-12-29 13:01:06 -06:00
Allen Reinmeyer
bcf4246dae Test suite: C4::Members::GetMember
Tests the functionality of C4::Members::GetMember.  Tests exist
for every way that GetMember could be called on to search for an
existing member.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-12-29 13:01:05 -06:00
Andrew Moore
69a2b414ae test suite: C4::ImportBatch
Here are some tests for functions in C4::ImportBatch.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-12-22 11:43:07 -06:00
Andrew Moore
db8cfa37e3 bug 2824: improving error messages from test suite errors
This patch adds two warning messages to places in the test suite that
may fail. I don't think it changes any functionality, but it sure makes
it easier to figure out what has gone wrong.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-12-17 09:12:17 -06:00
Galen Charlton
45214cb1d5 add calls to clear_syspref_cache()
temporary until mutator for sysprefs created

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-12-11 09:49:13 -06:00
Galen Charlton
5f18793461 bug 2758: don't confirm checkout if fine balance is 0
Fixes problem where if the IssuingInProcess preference is ON,
the operator is always required to confirm a checkout if
the patron has had any fine transactions at all, even if
the patron's balance is 0.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-12-02 16:44:20 -06:00
Galen Charlton
da13a339bb moved Test_CSV_Various.t to xt/author
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-11-17 10:19:43 -06:00
Joe Atzberger
93725f8ae4 Results of CSV module analysis, testing various CSV modules and configs.
The upshot is that despite appearances, whe should NEVER use Text::CSV::Unicode
or any CSV module in non-binary mode.  Text::CSV works in binary mode
by using Text::CSV_XS, so the behavior is the same for both (in binary).

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-11-17 09:51:24 -06:00
Joe Atzberger
fa8603bf9d Bug 2587 followup, updated test.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-09-26 09:10:39 -05:00
Galen Charlton
69781fbe8b bug 2582 [1/2]: don't set issuedate during renewal
Changed so that issues.issuedate is never modified
during a renewal, since that column records the original
date of the loan.  Changed the name and interpretation
of the $issuedate parameter of AddRenewal() to
$lastreneweddate, allowing (e.g.) offline circulation
to set the date of the renewal without changing the
issue date.

As a result of the original bug, issues.issuedate can be
set to NULL for loans that were renewed via the OPAC,
self checkout, or the staff interface when explicitly
renewing a loan.  Loans that were renewed by checking
the item out to the same patron will have the issue date
changed to the date of the last renewal.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-09-04 20:11:25 -05:00
Joe Atzberger
85324a6f7c Documentation update (test-single not single-test)
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-09-02 18:19:02 -05:00
Joe Atzberger
aa4c6ff62f Fines fixes: apparent problems with fines prevent processing.
CalcFine returned values that mismatched expectations in fines.pl.

fines.pl refactored: added debugging, prevent needless recreation of
Calendar objects by storing them in hash by branch.
Still outstanding problems with fines, including the output of a field
that has no other references in Koha (so is always undef) and the
incorrect description of FinesMode.

Calendar exported "new" erroneously.  I also cleaned up the queries to
avoid needlessly compiling additional statement handles.

Please test and consider application to 3.0 maintenance.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-29 20:31:41 -05:00
Galen Charlton
cf8625c876 bug 2466: regression test
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-28 09:22:57 -05:00
Jesse Weaver
9389ef50ee Fix itemtype image problem in moremember.pl
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-22 11:15:25 -05:00
Andrew Moore
fee8c60dc7 bug 2503: tests for C4::Circulation
I'm adding some tests for C4::Circulation methods that I'm altering
to allow the offline circulation tool to use C4::Circulation to upload
its data. These test a bit of the old functionality and try to show
that the new functionality does what I think it does.

C4::Circ::Addissue to tests issuedate
 these also test AddRenewal.
tests for C4::Circ::MarkIssueReturned

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-20 17:05:24 -05:00
Andrew Moore
daa2a04223 Bug 2524: improving the submitted test reports
switching from 'prove' to 'perl' to run the test scripts when we're preparing
them to be submitted to smolder. Prove adds an additional summary at the end
of the test run which confuses the TAP parser in smolder. It thinks that an
additional test has been run, and it fails it.

Then, I added a '-' before the command in the Makefile. THat's so that even
if 'perl' returns a failing code (because some tess failed), the rest of the
rules are run and a report gets submitted. Othewise, only passing reports
get sent.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-18 07:17:34 -05:00
Andrew Moore
481929bd5e bug 2525: fixing tests for misc/cronjobs/longoverdue.pl
This patch fixes the tests so that they include the new required parameters for longoverdues.pl.

This patch also doesn't include a test script that accidently got in the last one.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-18 07:17:25 -05:00
Andrew Moore
dff4d760f6 Bug 2524: Adding script to submit test reports to smolder server
This patch adds a target in the t/Makefile and a script in t/smolder_smoke_signal
to submit the results of test runs to a smolder server. It will allow users to submit
their own test results to a central location by running "make submit" from the t/
directory.

Smolder is a web-based application that aggregates and presents the output of
tests. We have an instance running at:
http://arwen.metavore.com:8000/app/public_projects/smoke_reports/1

More information about using smolder for Koha is available at:
http://wiki.koha.org/doku.php?id=en:development:smoke_reports

I intend to have the test suite run each night automatically and the results
sent to the smolder server. This will help us keep track of the current state
of the the code and possibly catch bugs introduced by changes. I encourge others
to submit their own test results if they want, especially if they are on an unusual
platform or are with a non-standard configuration.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-18 07:16:35 -05:00
Joshua Ferraro
569f54a9e2 Temporary fix for bug 2483: t/Barcodes.t has database dependent tests in it
Moving Barcodes.t to db_dependent to avoid failure of make test
2008-08-09 06:49:21 -05:00
Andrew Moore
7350505f9c Bug 1953: updating bad unit test for C4::Items::GetItemsForInventory
The tests I wrote for C4::Items::GetItemsForInventory confused the differences
between biblionumber and itemnumber. That wasn't uncovered on my limited test
database, but I uncovered it later.

This fixes that problem by populating a $self->{'items'} list with details of any items
added by KohaTest::add_biblios. Then, tests can probe there for the details of items
they should expect to find when searching.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-07-31 23:01:52 -05:00
Andrew Moore
4a4850b3cc Bug 1953 [1/6]: adding test module for C4::Koha::displayServers
This test suite tests the several different ways that we can call C4::Koha::displayServers.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-07-30 03:45:18 -05:00
Andrew Moore
8b679f8d81 Bug 1953: refactoring C4::Koha::get_itemtypeinfos_of to eliminate potential SQL injection
C4::Koha::get_itemtypeinfos_of was not using plceholders, opening itself up to
potential SQL injection attacks. This patch refactors it to use placeholders to
bind parameters.
I also had to extend C4::koha::get_infos_of to allow us to pass bind parameters into it.
I'm including a test module for C4::Koha::get_itemtypeinfos_of.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-07-27 06:11:18 -05:00
Andrew Moore
22d9133268 Bug 1953 [2/3]: refactoring SQL in C4::Items::GetItemsForInventory to use placeholders
The SQL in C4::Items::GetItemsForInventory wasn't using placeholders and
bind parameters, possibly leaving itself open ot SQL injection attacks. This
patch changes that.
I've also incliuded a test module for C4::items::GetItemsForInventory.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-07-27 06:10:53 -05:00