Includes:
Bug 29697: (follow-up) Use flag embed_items
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch moves C4::Biblio::GetMarcAuthors to
Koha::Biblio->get_authors_from_MARC. This is so the method can be
used in templates and notices.
To test:
1. Find a record that has an author in the added entry field (700-720).
2. Add the record to the cart and a list.
3. View your cart and click 'more details'. Confirm authors show as
normal.
4. Click 'send' and confirm the email sent shows the authors as normal.
5. Go to the list you added the record to and click 'send list'. Confirm
the email sent shows the authors as normal.
xslt)
6. Log in to the OPAC. Find the record and add it to the cart and a list
7. View the cart and click 'more details'. Confirm authors show as
normal.
8. Click 'send' and confirm the email sent shows the authors as normal.
9. Go to the list you added the record to and click 'send list'.
Confirm the email sent shows the authors as normal.
10. Confirm tests pass:
- t/Biblio.t
- t/db_dependent/Koha/Biblio.t
Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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>
This patch moves C4::Biblio::GetMarcNotes to
Koha::Biblio->get_marc_notes. This is so get_marc_notes can be
used in templates and notices.
To test:
1. Find a record that has a note (3xx for UNIMARC, 5xx for MARC21).
Confirm the notes still show as normal under the Descriptions tab.
2. Add the record to the cart.
3. View your cart and click 'more details'. Confirm notes show as
normal.
4. Log in to the OPAC. Find the record and add it to the cart
5. View the cart and click 'more details'. Confirm notes show as
normal.
6. View the record detail page and confirm the notes show as normal
under the Title Notes tab.
7. Confirm tests pass:
- t/Biblio.t
- t/db_dependent/Koha/Biblio.t
Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Removed my from variables in test
Undid stray line deletions
Undid adding 1; to test file
Fix CSS replace command
Update license
Fix spelling
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
add authority type in the form to create the missing authority.
when authority was found, the 600$9 field have the authid.
Testing scenario (Creating an authority record for a failed automatic link) :
1 - In your system preferences set:
AutoCreateAuthorities: Don't generate
BiblioAddsAuthorities: Allow
2 - Go to the Cataloging -> New record (koha/cataloguing/addbiblio.pl)
Ensure you are using the basic editor
3 - Click the "Link authorities automatically" button.
A message should appear, telling the user "No authority link was changed."
4 - Add random informations in field 600$a of the biblio record.
5 - Click the "Link authorities automatically" button.
the message box should now show "600 - No matching authority found.".
the 9 subfield is red
Above the 9 subfield is a red X with a blue plus next to it
Hover on the plus, see it is titled 'Create authority'
6 - Click the 'Create authority' link
7 - A new authroity form pops up, the info from the cataloging editor is prefilled
Click the 100 field heading to expand and confirm info is transferred
8 - Fill in necessary fields and save the new authority
9 - The cataloging screen now has the 9 subfield populated and is green
10 - Click "Link authorities automatically" again
Dialog says "No authority link was changed"
11 - In another tab go to System preferences and set AutoCreateAuthorities to 'Generate'
12 - Add random information to the 650 field
13 - Click 'Link authorities' button
14 - Dialog says:650 - No matching authority found. A new authority was created automatically.
15 - The subfield 9 is green and has the id of the new authority record
16 - In another tab search authorities and find an existing subject heading
17 - Add a new 650 with the info from the existing record
18 - Click 'Link authorities'
19 - The new field is correctly linked to existing authority
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=12299
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
We removed the single occurrence of this subroutine in the previous
patch
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
- Remove SplitKohaField
- Avoid using Stash in templates
- Improved display of part fields
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Test plan:
1) Ensure the COinS span tag is still included on this pages. You need
to look into html source and search for span tag with class 'Z3988',
which has COinS string in title.
Staff client:
catalogue -> ISBDdetail
catalogue -> MARCdetail
catalogue -> detail
virtualshelves -> shelves
OPAC (you should have COinSinOPACResults system preference enabled):
opac detail
opac search
opac shelves
2) Run tests:
prove t/Biblio.t t/db_dependent/Biblio.t t/db_dependent/Koha/Biblio.t
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tested with all 9 current patches. Works as advertised, including
OPACURLOpenInNewWindow. If a record has no items, no OpenURL link
is displayed. All the suggested tests pass. I did not test with
XSLT turned off.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Before patches we did 47 tests or none, we should plan the same number
of tests now
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 fixtures are in a subroutine that is never called, it can be removed
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Change parameters to a hashref.
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Looks good to me.
Two calls in migration_tools/22_to_30 still in old style.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The test files do not need to return 1
Patch generated with:
perl -p -i -e "s/^1;\n//xsm" t/**/*.t
Test plan:
git grep '^1;$' t/**/*.t
should not return any results
NOTE: does not fix C4/SIP/t, nor xt tests.
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Is 'instantiations' even a word?
Use a Test::DBIx::Class defaults instead.
Save your keyboard and prevent horrible bugs from emerging from rampant code duplication.
This change doesn't seem to have any impact on the speed of executing those tests.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
subroutines should not take $dbh in parameter.
C4::Biblio::TransformMarcToKoha has it and does not use it.
Test plan:
Look at the patch and confirm that all occurrences of
TransformMarcToKoha have been modified.
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
Tests in t/ should always pass for building the Debian packages
for Koha. But we've started using Test::DBIx::Class for writing
mocked tests, and that lib is not (yet) packaged fro Debian 7+.
This means build is failing. Devs and jenkins use the lib from CPAN.
This patch makes the tests skip if the lib is absent.
To test:
- Install Test::DBIx::Class
$ sudo cpanm Test::DBIx::Class
- Run the tests:
$ prove t/
=> SUCCESS: Tests pass
- Uninstall Test::DBIx::Class
$ sudo cpan -U Test::DBIx::Class
- Run the tests:
$ prove t/
=> SUCCESS: Tests still pass (those needing the lib are skipped)
- Sign off :-D
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. All test pass successful
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Note that it already passed before
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Running
$ prove t/Biblio.t
fails because of us now using DBIx to retrieve sysprefs. Then our mocked DBI is not "supported" by DBIx hence a warning that makes our test fail (there is one more warning now).
The cool thing about this, is that it actually helped spot a situation where GetMarcBiblio is doing wrong things because is not checking its parameters are undefined, so we have the chance to fix it.
This patch makes GetMarcBiblio return undef if no biblionumber is passed, and
also raises a conveniently carped warning. This change is tested in t/Biblio.t with new tests.
To test:
- In current master, run
$ prove t/Biblio.t
=> FAIL: a test detects a wrong warning count and fails.
- Apply the patch and run
$ prove t/Biblio.t
=> SUCCESS: Tests now pass, and there are 2 new ones.
- Sign off :-D
Regards
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch makes t/Biblio.t mock the DB connexion setting
a void one. All tests in this file currently call the C4::Biblio
functions with invalid (absent) parameters, so they are expected to
raise warnings and return undef values.
If someone writes mocked tests for the rest of the functionality,
it is expected to mock the DB calls to match the desired scenario.
To test:
- Turn of MySQL
- Run
$ prove t/Biblio.t
=> FAIL: Tests fail because of missing MySQL server
- Apply the patch
- Run
$ prove t/Biblio.t
=> SUCCESS: Tests now pass
- Start MySQL
- Run
$ prove t/Biblio.t
=> SUCCESS: Tests still pass
- Sign off
Regards
Tomas
Sponsored-by: The will to procrastinate
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Sponsored-by: Wanting the darn packages to build
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Sponsored-by: Not wanting to read in my maths book
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This patch adds an unit test on C4::Biblio::UpdateTotalIssues method
call on non existing record
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
I can't comment on the correctness of the test other than to say it ran
successfully.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Improves CLI script, works as described.
Note: A small improvement would be to output the problematic biblionumber.
To test:
- Run
$ prove t/Biblio.t
=> Warnings printed to STDOUT
- Apply patch
- Run
$ prove t/Biblio.t
=> No warnings
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No more warnings. No koha-qa errors
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Intermittently problems in the calling environment
cause a C4::Biblio routine to be called with an undefined
MARC::Record object. This results in the process
dying and returning to the end user a low level
message such as 'cannot call method x on an undefined
object'.
For exported subroutines taking a MARC::Record object,
check that object is defined otherwise return a logical
return value and log a stack trace to the error log.
A couple of cases were checking but dying, this may have
unwelcome results in a persistent environment so croak has
been downgraded to carp
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Adds lots of checks for $record in various places, should
not affect behaviour.
Passed all tests and QA script, including new unit tests.
Tested adding and saving a new record.
Also tested detail and result pages without XSLT.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Some minor changes to get the test suite working a bit better:
I removed a superfluous method from t/lib/KohaTest.pm.
I made each barcode for the items added in KohaTest.pm unique so that they would actually get inserted.
Then, I removed t/override_context_prefs.pm. If you need that functionality, you're a database
dependent test and should be a module in t/lib.
So, I deleted all of the trivial .t tests that just 'use'd their modules and had no other
tests and replaced them with lib/KohaTest/*pm modules that do a little bit more checking
on those modules.
I removed the references to override_context_prefs.pm in all of the other .t modules.
They all pass now with no override_context_prefs.pm module.
The database_depenedent.pl test script still does not pass entirely. There's a problem with the zebra index
not being reset each time that the tables are truncated. I'll get to that.
no functional or documentation changes here.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Many of the tests were failing or putting warnings
because a valid systempreferences table is
usaully absent by the time 'make test' is run.
Fortunately, only a few modules try to invoke
C4::Context->preference during module initialization,
so added to the test suite override_context_prefs.pm,
which replaces preference() with a sub to return
testing values for three variables: 'dateformat',
'marcflavour', and 'LibraryName'.
Also fixed bug in t/Boolean.t
With this patch and the patch to move the DB-dependent
tests off to the side for the moment, 'make test'
now runs cleanly, at least on Debian.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Input.t was replaced because it tested a now obsolete function.
Input.pm has that function commented out.
Several files were renamed to match their counterparts or
correct misspellingz.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>