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>
We are using Koha::Logger when it makes sense to keep the info,
otherwise we simply remove it
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 28572: Replace missing occurrence in misc/admin/koha-preferences
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
To test:
1 - Enable OverDrive and RecordedBooks (you can put anything in the
prefs)
2 - Search on the opac - verify you get results (or search error) on
first page of results'
3 - Go to second page of results - OD and RB are not searched
4 - Apply patch
5 - Verify nothing has changed
If you have valid credentials:
1 - Enable RB prefs
2 - Sign in with an account that has an email matching your registered
account for recordedbooks
3 - Confirm you RB account loads on opac-user.pl
Otherwise:
Read the patches, verify it all makes sense
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This patch adds an "IN" option to the AmazonLocale setting, allowing
Indian libraries to use their Amazon Affiliate ID in Koha's links to
Amazon.
To test, apply the patch and run updatedatabase.
- Go to Administration -> System preferences -> Enhanced content.
- Enable the OPACAmazonCoverImages preference.
- Enter a dummy ID in the AmazonAssocTag preference.
- Confirm that you can select "Indian" for the AmazonLocale preference.
- Select "Indian" and save.
- Open a record in the OPAC and confirm that the cover image links to
Amazon.in and includes the ID you entered in AmazonAssocTag.
- Do the same with a record in the staff client.
Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Easy change, should be able to verify with code review or testing with
dummy values
To test:
1 - Put some values in baker and taylor prefs (don't need to be valid)
2 - Do a search on the opac (and have some items with isbns)
3 - Inspect the cover images links to ensure they are formed correctly
4 - prove -v t/External/BakerTaylor.t
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
s/Koha::Cache->get_instance/Koha::Caches->get_instance
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
https://bugs.koha-community.org/show_bug.cgi?id=11921
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Initialize file level lexicals each call. Do not call _initialize
outside the module.
Adjust test by mocking preferences.
Test plan:
Run t/db_dependent/External_BakerTaylor.t.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested module with trivial script under Plack/memcached by toggling
the associated preferences.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Since the tests are expecting an initialize function, the
initialize call was just moved outside of the INIT block.
TEST PLAN
---------
1) prove t/00-load.t
-- warnings about INIT for BakerTaylor
2) prove `git grep -l BakerTaylor | grep [.]t$`
-- should all run okay
3) apply patch
4) repeat steps 1 and 2
-- warning should be gone, and everything else run okay
5) run koha qa test tools
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Florent Mara <florent.mara@gmail.com>
NOTE: Tweaked test plan based on comment #4,
Added sign off based on comment #6.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
$VERSION reintroduced into External/BakerTaylor.pm but was
not declared. Causes tests to fail.
Readd VERSION to the package vars
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
These files should be managed on their own bug reports.
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Mainly a
perl -p -i -e 's/^.*3.07.00.049.*\n//' **/*.pm
Then some adjustements
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
perl -p -i -e 's/^(use vars .*)\$VERSION\s?(.*)/$1$2/' **/*.pm
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Correct $KOHA::VERSION to $Koha::VERSION.
Also, passing this string to LWP::UserAgent is wrong. It expects key/value
pairs. Since this string is apparently intended as an agent, this patch
passes it as such.
Note: The OverDrive has unfortunately no unit tests.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested this change in the perl debugger with just these lines:
use C4::External::OverDrive;
C4::External::OverDrive::_request();
Printed $ua->agent while stepping into sub _request.
Without the agent change, the adjusted Koha string would just be ignored
and I would still have "libwww-perl/6.04" as agent.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
It will permit not to run another perl interpreter.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
http://bugs.koha-community.org/show_bug.cgi?id=9987
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
* Syndetics routines include a statement to check that the returned
content from Syndetics is xml. The get_syndetics_index routine was
missing this check and so when a 'not found' html page was returned
the opac-detail page would take a long time to load whilst xml::simple
attempted to parse the large html document.
Test Plan
1. Enable Syndetics indexes on opac.
2. Head over to an opac-detail page on the opac.
3. Remove the ISBN from the same item in the staff client.
4. Reload the opac-detail page for the item noticeing a much slower
page load.
5. Apply the patch
6. Reload the opac-detail page for the item and note that it now laods
in a reasonable timescale again.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This makes Koha::Cache behave better by default. It will use memcached
if available to do shared caching, if that's not available it will fall
back to in-memory caching. It also allows for a singleton accessor to
allow a single cache to be shared within a process.
* Added tests to confirm UTF8-cleanness.
* Added minor fixups to stop warnings.
Test plan:
* The t/Cache.t file runs successfully with and without the
MEMCACHED_SERVERS envvar set (and memcached running in the
environment.)
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This patch fixes a copypasta'd copyright statement, and some incorrect
POD and indentation.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Switch to the new method of showing star ratings. Also, fix some
translation bugs, an error that occurred when caching was disabled and
add a stub unit test.
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Show any relevant results from the OverDrive ebook/audiobook service
on the OPAC search. This is done by showing a link with "Found xx
results in the library's OverDrive collection" at the top of search
results and linking to a page that shows the full results.
This requires an OverDrive developer account, and is enabled by
setting the OverDriveClientKey and OverDriveClientSecret
system preferences. In addition, this patch adds the
OverDriveLibraryID system preference.
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Henry Bankhead <hbankhead@losgatosca.gov>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Subroutine prototypes used at line 82, column 1. See page 194 of PBP. (Severity: 5)
"return" statement with explicit "undef" at line 83, column 22. See page 199 of PBP. (Severity: 5)
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This patch removes the AmazonReviews and AmazonSimilarItems
features from the OPAC and staff client. With on Amazon
feature remaining, cover images, the *AmazonEnabled preference
is also removed in favor of checking the *AmazonCoverImages
preference. Two other system preferences, AWSAccessKeyID and
AWSPrivateKey are removed as they were required only by the
removed features.
Handling of book cover images from Amazon is unchanged.
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Turned on amazon covers in opac and staff client and all
worked as expected. Then tested to make sure other cover image
services still worked and they do.
Signing off.
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
working through the master branch to eliminate all
podchecker warnings/errors
Actual improvement to the quality of the POD will
come later (hopefully with assistance of others)
Signed-off-by: Andrew Elwell <Andrew.Elwell@gmail.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This patch updates the URL for image links in ContentCafe
Sponsored by Plano Independent School District, Plano, TX, USA
[RM note: the previous book cover URL was for a varient of Baker
and Taylor's service that has to do with 'bookstore integration',
and if I remember correctly, the main difference is that the
book jacket image had "buy now" text. The version supplied
in this patch should work for normal use of ContentCafe.]
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
* Add AWSPrivateKey system preference to the
Enhanced Content tab in the syspref editor
* Now warns to log if attempting to use
the Amazon API without setting AWSPrivateKey
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
[1] There were some ersataz spaces in the string
being signed.
[2] AWS expects a trailing '=' in the Base64 signature
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
After 2009-08-15, Amazon Web Services will expect that
all requests to the Product Advertising API, which is what
Koha uses for retrieving reviews and other enhanced content
from Amazon, include signatures. This patch and
subsequenct patches implement this functionality.
What this means in practice (assuming the user has elected
to use any enhanced content from Amazon) is that
[1] The user must get a Amazon Secret Access Key. This can
be done by logging in to the user's AWS account
at (e.g.) http://aws.amazon.com/, going to the 'Access Identifiers'
page, and from there retrieving and/or creating a new Secret
Access Key.
[2] The contents of the Secret Access Key should then be
entered into the new AWSPrivateKey system preference.
Once that is done, grabbing reviews and table of contents from Amazon
should work as normal. If the user doesn't do this before 2009-08-15,
reviews and TOCs will no longer be supplied from Amazon, although there
should be no crashes - the content will simply not show up.
Note that the requirement to sign requests does *NOT* appear to apply
to simply displaying book covers from Amazon.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
An Amazon ItemLookup response can sometimes have
more than one Item element, where the ones after
the first appear to be cross references to items
that have the same ISBN. Changed parsing so that
those responses are no longer treated like pseudohashes.
This fixes the following crash:
[error] detail.pl: Pseudo-hashes are deprecated at /catalogue/detail.pl line
213., referer: /cgi-bin/koha/catalogue/detail.pl
Which may lead to a nasty:
[error] Out of memory!, referer: /cgi-bin/koha/catalogue/detail.pl
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Added support for the Syndetics AV summary and AV profile
data elements. The AV summary is displayed in the description
tab if present, while the AV profile is displayed as
a link off of the OPAC bib details page.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
XML::Simple doesn't handle mixed content, which is a
problem because reviews provided by Syndetics sometimes
contain HTML tags. Furthermore, it's often easier to write
XPath to extract bits of an XML document than trying
to play with XML::Simple's options.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
For some reason different Syndetics users get
slightly different results when requesting
an XML-formatted review, so it's necessary to
handle both observed variations:
Here's one variation:
...
<Notes>
<Fld520 I1="BLANK" I2="BLANK">
<a>This is a review
And another:
...
<Notes>
<Fld520 I1="BLANK" I2="BLANK">
This is a review
This patch fixes a bug where some users the
source of a review but not the review itself.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This patch fixes Amazon content use in pro interface :
* Control Amazon Editorial Review by a new syspref:
AmazonReviews.
* /catalogue/detail.tmpl doesn't display Amazon reader reviews.
It displays only Editorial review in Description tab.
This patch disable request for AWS reader reviews.
* Use Amazon TLD for linking book cover to local
Amazon Search Inside.
* Minor clean up on C4::External::Amazon.pm
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This patch modifies how AWS is called. AWS is now called
depending on syspref. It works completly for OPAC; it
has to be refined for intranet.
For OPAC:
* If OPACAmazonReviews is set, AWS EditorialReview and
Reviews (users) are grabed.
* If OPACAmazonSimilarItems is set, AWS Similarities info
are grabed.
* If nothing is asked, AWS is not called anymore,
sparing server bandwidth.
For intranet:
It works as it used to work. AWS is called if AmazonEnabled
is set whatever how other syspref are set.
TODO:
* Add a AmazonReviews syspref
* Request Amazon content depending on AmazonSimilarities
and AmazonReviews syspref
DOCUMENTATION:
It should be explained that Amazon services related syspref
have two levels:
* AmazonEnable / OPACAmazonEnable
* Other: OPACAmazonReviews (new), OPACAmazonSimilarProduct,
OPACAmazonCover
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
* Use of uninitialized value in pattern match (m//) at C4/Biblio.pm line 1305
(displaying MARC21 856s that don't have $3)
* Use of uninitialized value in multiplication (*) at catalogue/detail.pl line 243.
(attemping to calculate average Amazon rating if no Amazon info
is available)
* opac-detail.pl: Use of uninitialized value in length at C4/External/Amazon.pm line 90
(attempting to calculate length of $isbn if it happens to be undef)
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
With this patch:
* On Amazon book cover, 'search inside' text is not displayed
anymore because it's not translatable.
* Link the image to local Amazon web site 'search inside' service.
Based on AmazonLocale syspref.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This patch resolves a number of problems related to Enhanced Content:
1. Previously, there was no syspref for controlling whether or not to display
Amazon.com cover images apart from other content. This had the side effect
of preventing use of amazon.com content alongside use of another provider's
images. This patch introduces AmazonCoverImages and OPACAmazonCoverImages,
and changes the name of AmazonContent to AmazonEnabled.
So, for instance, you can now enable OPACAmazonSimilarItems yet utilize
SyndeticsCoverImages for displaying those similar items.
NOTE TO DOCUMENTATION TEAM: please update references to AmazonContent
and OPACAmazonContent to comply with the above.
2. Fixes some semantically incorrect uses of AmazonContent (now OPACAmazonEnabled)
on the OPAC side.
3. Resolves once and for all, the normalization of ISBN,UPC,EAN and OCLC numbers
for all enhanced content elements; These elements can be normalized using the
new functions in C4::Koha; I've replaced use of the various previously used
variables $xisbn,$norm_isbn,$clean_isbn, etc with $isbn, and the template
variable normalized_isbn.
We finally have a single, consistant place to retrieve normalize values for
these fields given a particular record.
4. Adds Syndetics attribution statements to display of all Syndetics content
'enhanced content provide by Syndetics' or 'Enhanced Description from Syndetics'
5. Adds an option to view the large cover image on the detail page on the OPAC
when using SyndeticsCoverImages; this option is controlled by a new system
preference: SyndeticsCoverImageSize which has two values: MC (medium) LC (large)
6. Adds UPC and OCLC numbers for Syndetics enhanced content queries especially
helpful for finding enhanced content for DVD and Music materials
7. Adds capability to display Syndetics images to opac-user for checkouts and overdues
8. Updates to systempreferences.sql, and updatedatabase.pl database revision 015
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This patch also includes a new function to retrieve the index
page from Syndetics and parse it for available content prior to
retrieving content; this is done to speed up syndetics content
by not retrieving content that doesn't exist for an item. However,
Syndetics continues to be a very slow service compared to Amazon.com
and other enhanced content services
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>