Note that a few isbn tests were identical.
Tidied the three moved subtests here.
Test plan:
Run t/db_dependent/Koha.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
We are using Test::Deep in different tests, but from t/db_dependent/Koha.t the tests are skippted if the module is not installed.
We must assume the module is installed
Test plan:
prove t/db_dependent/Koha.t
should return green in ktd
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
and some more...
There are lot of inconsistencies in our ->search calls. We could
simplify some of them, but not in this patch. Here we want to prevent
regressions as much as possible and so don't add unecessary changes.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.
That way we will need to explicitely define the subroutine we want to
use from a module.
This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests
And a lot of other manual changes.
export.pl is a dirty script that can be found on bug 17600.
"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;
The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules
Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).
EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.
@EXPORT and @EXPORT_OK are the two main variables used during export operation.
@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.
@EXPORT_OK does export of symbols on demand basis.
"""
If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
- use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
.pm must not have -x
.t must have -x
.pl must have -x
Test plan:
Apply only the first patch, run the tests and confirm that the failures
make sense
Apply this patch and confirm that the test now returns green
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Tests in Koha.t failed due GetDailyQuote tests. This patch
removes these tests since we test quotes in Quotes.t instead.
To test prove t/db_dependent/Koha.t
Sponsored-by: Koha-Suomi Oy
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
The C4::Koha::getitemtypeinfo subroutine did the almost same job as
GetItemTypes. On top of that it returned the imageurl value processed by
C4::Koha::getitemtypeimagelocation.
This value is only used from the 2 [opac-]shelves.pl scripts. Then it's
better not retrieve it only when we need it.
Test plan:
Play with the different scripts touched by this patch and focus on item
types. The same description as prior to this patch must be displayed.
Note that sometimes it is not the translated description which is
displayed, but that should be fixed on another bug report. Indeed we do
not expect this patch to change any behaviors.
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tests in db_dependent may expect a Koha database, but should not rely on
hardcoded categories, currencies, branch codes, etc.
This patch fixes a bunch of those. But this is a continuous project. We also
need QA to closely watch new edits.
Accounts.t: hardcoded category PT replaced
Acquisition/OrderFromSubscription.t: hardcoded USD
Acquisition/StandingOrders.t: same
ArticleRequests.t: create itemtype, branch and category for testing
AuthorisedValues.t: remove $dbh, add two test branches
AuthoritiesMarc.t: add hardcoded GEOGR_NAME authtype
Bookseller.t: add test currency
Koha.t: add test itemtype instead of hardcoded BK
UsageStats.t: add test branch and category
Test plan:
Run the adjusted tests.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
All tests successful (see comment #9)
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
At this point the subroutine is no longer in used.
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lari Taskula <lari.taskula@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4::Koha::GetItemTypesByCategory can be easily replaced with
Koha::ItemTypes->search({ searchcategory => ? });
So let's replace it where it is used.
Test plan:
Make sure this patch does not break the test plan of bug 10937
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
The C4::Koha::GetFrameworksLoop retrieves biblio frameworks and returns
them ordered by the description (frameworktext). If a parameter is
passed, a selected flag is set. The selection of the options should be
done on the template side.
These 2 calls can be replaced with
Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
Test plan:
1/ Go on a Labeled MARC biblio view (catalogue/labeledMARCdetail.pl)
You should see a dropdown list with the biblio frameworks. The framework
of the record should be selected by default
2/ Create a sql report using the biblio_framework parameter, something
like:
SELECT COUNT(*) FROM biblio WHERE frameworkcode=<<framework|biblio_framework>>
Save and execute the report.
You should get a dropdown list with the framework list.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Both dropdowns Ok
No errors
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
The subroutine C4::Koha::GetAuthorisedValueByCode returned the
description (staff or opac) for a given authorised value.
Note that we may need a unique key to ->find instead of ->search.
Test plan:
- Checkin an item that cannot be checked in because it's lost, the
message should display the AV description
- Generate a letter with borrowers.streettype equals an ROADTYPE AV, the
description should be displayed.
- Edit a patron attribute type, the AV dropdown list should be
displayed
- Create the PA_CLASS AV category (see bug 7154) and make sure it
behaves as before when editing a patron
- The checkout list should display descriptions for LOC, LOST and
DAMAGED
Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This subroutine was only used in one script and its job is the same as
GetAuthorisedValueByCode.
It's better to use the AuthorisedValues TT plugin to retrieve AV
descriptions.
Test plan:
Edit a patron with sort1 and/or sort2 defined.
On the patron details page (members/moremember.pl) you should see the
sort1 and/or sort2 info displayed.
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
From C4::Koha::GetAuthorisedValues
# TODO: the "selected" feature should be replaced by a utility function
# somewhere else, it doesn't belong in here. For starters it makes
# caching much more complicated. Or just let the UI logic handle it, it's
# what it's for.
Indeed, it's not a job for a subroutine, the template should take care of that.
Note that a perf gain could be won with this patch \o/
Test plan:
- Edit an itemtype and check the value of the "Search category" dropdown list
- Edit a patron attribute type and check the value of the "Class" dropdown list
- Detail for a catalogue record, the Status column should be correctly
populated if items are damaged and/or lost
- Item details for a catalogue record, the lost, damaged and withdrawn
value should be correctly displayed
- Edit a patron, the "street type" should be correctly selected
- Create a patron attribute type linked to an authorised value list.
- Edit a patron, set a value for this attribute, edit it again. The
correct value should be selected.
- Search for subscriptions. The 'Location' dropdown list should behave
correctly (select the entry you have choosen before, etc.)
- Edit a subscription, the location dropdown list should select the
correct value.
- Edit and view a suggestion with a 'reason for suggestion' set (you
should have at least 1 OPAC_SUG AV defined)
Followed test plan, works as expected
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This subroutine does not make sense anymore (Koha::DateUtils should be
used) and is no longer used.
It can be removed safely.
Test plan:
git grep slashifyDate
should not return any results
prove t/Koha.t
and
prove t/db_dependent/Koha.t
should return green
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
slashifyDate removed, all test pass successfully
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
Test plan:
prove t/db_dependent/Koha.t
should return green
git grep AddAuthorisedValue
should not return any results
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This subroutine is no longer in used and can be remove.
Test plan:
git grep GetKohaImageurlFromAuthorisedValues
should not return any results.
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
See comment #3
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
- "Item" and not "Document" is the word used throughout Koha.
- Moved the updates to an atomic update
- changed searchcategory from varchar(20) to (80)
- cleanup
This allows to group certain item types in a category, to be displayed (and searched) as such in OPAC's advanced search. For example, you can group Reserve 2h and Reserve 12h into a Reserve category. The 2 and 12h types won't appear anymore.
This also allows to simply prevent an item type from displaying as a search option.
TEST PLAN
------------------
0) Back up database, so you can reset and retest easily. ;)
1) Apply the patch
2) Run Koha QA tool.
3) prove -v t/db_dependent/Koha.t
-- all tests should pass.
4) run ./installer/data/mysql/updatedatabase.pl to add the
two columns to itemtypes
-- Does a meaningful message get printed?
Are the columns added?
"DESCRIBE itemtypes;" should list hideinopac and searchcategory.
5) You need to add a category to group your item types:
a) In Intranet/Koha Admin/Authorized values,
select DOCTYPECAT in the 'Show category:' dropdown
i) If you do not have a DOCTYPECAT category, create one.
b) Click button "New authorized value for DOCTYPECAT"
c) Enter
Authorized value: HARDWARE
Description : Hardware
Description (OPAC): Hardware
6) Group your items under that new category
a) In Intranet/Koha Admin/Item types, choose (at least)
two item types and for each:
- Click action/Edit on the right column
- Third row (below Description) is the Search category list box, select Hardware
- click Save changes at the bottom
7) Select at least one item to be hidden in the OPAC search
a) In Intranet/Koha Admin/Item types (again), choose a different item type:
- Click action/Edit
- Click the checkbox "Hide in OPAC" below the list of icons.
8) Go test your modifications
a) Go to OPAC/Adv search.
b) Validate that all items modified above (hidden or grouped) do not appear in Item type list
c) Validate that new item type Hardware does appear instead.
d) Select item Hardware, start Search.
) Validate returned items are the of the two types that were grouped into the Hardware category in step 4.
Sponsored-by: Vanier college
Signed-off-by: Nick <nick@quecheelibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
By adding quotes 3 and 25 from the sample data, this test can
pass without having the sample quote data loaded.
TEST PLAN
---------
1) Ensure there is no quote id=3 or that it is NOT
Abraham Lincoln.
2) prove t/db_dependent/Koha.t
-- this should fail the daily quote test.
3) apply patch
4) prove t/db_dependent/Koha.t
-- this should *NOT* fail the daily quote test.
5) run koha qa test tools
Followed test plan 1)-4). Without patch, daily quote test failed. With patch, test passed OK.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described, leaves actual data unchanged.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
to test:
1. Apply the patch
2. Run the test, prove t/db_dependent/Koha.t
3. Check that it pass
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This patch adds regression tests to verify the sort
order when fetching authorised values in either staff
or OPAC mode.
This patch also wraps the Koha.t tests in a transaction, and
better handles skipping tests if Test::Deep is not installed.
To test:
[1] Verify that prove -v t/db_dependent/Koha.t passes
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tests pass with all patches applied.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Koha::DateUtils::dt_from_string() and DateTime->now() are
not equivalent -- they don't handle timezones in the same
way.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
In t/db_dependent/Koha.t, the test "Got a quote based on today's
date" is failing :
$prove t/db_dependent/Koha.t :
t/db_dependent/Koha.t .. 1/6
# Failed test 'Got a quote based on today's date.'
# at t/db_dependent/Koha.t line 126.
# Compared $data->{"source"}
# got : 'Herbert Hoover'
# expect : 'Abraham Lincoln'
# Be sure to run this test on a clean install of sample data.
# Looks like you failed 1 test of 4.
Looks like the wrong quote is returned by GetDailyQuote().
I'm using a databased created with the English sample SQL datas.
I think I found the cause :
The test "Got a random quote." calls GetDailyQuote('random'=>1) which
changes the quote timestamp to now. When then testing GetDailyQuote(),
this quote (which may not be the one created by test) is the most
recent quote.
This patch moves the "Got a random quote." test after "Got a quote
based on today's date" to solve the problem.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Prior to this patch, C4::VirtualShelves::Page did not make sure that
the itemtype images that it chose when displaying itemtype images for
biblio-level itemtypes were for the correct interface, so
even on the OPAC the Intranet icons were requested. On standard
installations, intranet-tmpl is not available to the OPAC.
To test:
1) Set noItemTypeImages to "Show" and item-level_items to "biblio record"
2) Create a list and add an item with the default item type (942$c in
MARC21) set to something with an itemtype image associated with it.
3) View the list in the OPAC.
4) If you are an a standard install, the itemtype image will be a broken
link. If on a dev install, you can confirm with Firebug or the like
that the image is pulled from /intranet-tmpl.
5) Apply patch.
6) Run `prove t/db_dependent/Koha.t` to confirm that the behavior of the
routine used to retrieve the image URL is correct. (Note that you
must have an item type with the code 'BK')
7) Refresh the list, noting that the display is now correct/the image is
pulled from opac-tmpl.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
It works as expected. All tests in Koha.t passed.
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
modified: Koha.t
$ prove -v ./Koha.t
1..5
ok 1 - use C4::Koha;
ok 2 - use C4::Members;
1..6
ok 1 - Insert data in database
ok 2 - GetAuthorisedValueByCode
ok 3 - GetKohaImageurlFromAuthorisedValues
ok 4 - lost and paid works
ok 5 - Child area works
ok 6 - Withdrawn works
ok 3 - Authorized Values Tests
1..4
ok 1 - C4::Koha->can('GetDailyQuote')
ok 2 - Got a quote based on id.
ok 3 - Got a random quote.
ok 4 - Got a quote based on today's date.
ok 4 - Daily Quotes Test
1..7
ok 1 - slashifyDate
ok 2 - xml_escape() returns empty string on undef input
ok 3 - xml_escape() works as expected
ok 4 - ... and does not change input in place
ok 5 - _isbn_cleanup removes hyphens
ok 6 - _isbn_cleanup removes parenthetical
ok 7 - _isbn_cleanup converts ISBN-13 to ISBN-10
ok 5 - Date and ISBN tests
ok
All tests successful.
Files=1, Tests=5, 1 wallclock secs ( 0.02 usr 0.01 sys + 0.48 cusr 0.06 csys = 0.57 CPU)
Result: PASS
http://bugs.koha-community.org/show_bug.cgi?id=5327
Removed SearchMembers() and replaced with more generic Search()
Amended Search() to try cardnumber first
Replaced SearchMembers() calls with Search()
Replaced SELECT with Search() where appropriate
C4::SQLHelper:
- added support for '' key for search filter.
- when passing an array to filter, join with OR (rather than AND)
- added support for key => [val1, val2] in filter
- did not document - there was no input documentation to start with,
and SQLHelper should be replaced with something better anyway
Signed-off-by: Liz Rea <lrea@nekls.org>
(again - testing merge issue)
The functionality of the patch seems to be maintained with Biblibre's changes.
I tested the following:
Extended attribute searching: works
3 part name searching: works
2 part name searching: works
1 part name searching: works
From:
mainpage.pl
members-home.pl
Patron search limited by branch: Works
Patron search limited by patron category: works
Ordering by cardnumber instead of surname: works
The "Check Out" field in the masthead.
Circ Autocomplete is not reliably functional at this time, but the problem appears to predate this patch.
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>