Jonathan Druart
63a1adff90
This patch is the Koha part of the Hea v2 project. You can find the (testing) code for the server at hea-ws - https://github.com/joubu/hea-ws/commits/v2 hea-app - https://github.com/joubu/hea-app/commits/v2 They contain the different pull requests made over the last 6 months. More information on Hea at https://wiki.koha-community.org/wiki/KohaUsageStat_RFC The goal of this commit message is to provide an overview of what could be a new version of Hea. Prior to these changes, the Hea database was filled with 1 line per Koha installation. System preferences were filled by the libraries and a cronjob (share_usage_with_koha_community.pl) collected these values to send them to a webservice (hea-ws/upload.pl). With the need to collect more data we would want to collect data at the library level (branch) and not at the installation level. For instance the geolocation, the url or the country can be different from one library to another, even if managed from the same Koha installation. The Hea DB has been upgraded to reflect that change (see hea-app/sql/schema.sql). The hidden goal of this patch is to make Hea sexier and explain better to libraries how it can be useful to share their information with the Koha community. I guess the main problem is the lack of communication and explanations about what we are doing we these data. To fill this gap I'd like to (TODO) 1. Communicate on the ML about this new version of Hea (once it got pushed and backported) 2. Link the Privacy_Policy.md from the Hea interface 3. Get help from a native English speaker to add popup/help/info/whatever on "Home › Administration › Usage statistics", to clearly explain what happens (and what will not happen!) when an option or another is set. You can find screenshot of this whole enhancement on bug 18066, comment 2. What this patch does: - Create a new branches.geolocation DB field - Add 3 new sysprefs: * UsageStatsGeolocation * UsageStatsLibrariesInfo * UsageStatsPublicID - Integrate the Leaflet JS library to get a fancy map to pick geolocations How does it works: On the new administration page where statistics to share are configured, there are several new things. It is now possible to share information either per Koha installation or libraries. If UsageStatsLibrariesInfo is set, the info at library level (url, name, country, geolocation) will be sent to the Hea webservice. If it is not set, you can decide to fill UsageStatsLibraryUrl, UsageStatsLibraryName, UsageStatsCountry, UsageStatsGeolocation to share these information. Note that even if the data are retrieved at installation level, it's better to fill the prefs as well: On the Hea website the different libraries defined for a given Koha installation could be displayed on the same page. This page is a public page which will be attributed to every installation (with the pref UsageStatsPublicID). On this page all the info available publicly will be displayed. TODO later: - Add a button on the administration page to delete the info shared publicly. It will be easy to show that the info are no longer displayed on the public page. - Add an icon per Koha installation to get a better "public page" - Any suggestions? Test plan: We will need to test hea-ws, hea-app and the Koha-side code to test the whole enhancement. 1/ To start, clone the hea-ws and hea-app project and checkout the 'master' branch (*not* 'v2') 2/ Create the hea database and user CREATE DATABASE hea CREATE USER 'hea'@'localhost' IDENTIFIED BY 'hea'; GRANT ALL PRIVILEGES ON hea.* TO 'hea'@'localhost'; FLUSH PRIVILEGES; 3/ Fill the DB with some data mysql hea < hea-app/sql/schema.sql mysql hea < hea-app/sql/sql/mock-data.sql 4/ Checkout the 'v2' branch for both hea-ws and hea-app 5/ Execute the upgrade DB script % cd hea-app % perl -p -i -e 's/REPLACE_ME/hea/' sql/upgrade.pl # Fill the DB info % perl sql/upgrade.pl Now the DB is using the v2 structure. That means we have 1 installation row per library previously defined. 1 library row has also been created. 5/ Configure hea-ws % echo '192.168.50.1 hea.koha-community.org' >> /etc/hosts <VirtualHost *:80> DocumentRoot "/path/to/hea-ws" ServerName "hea.koha-community.org" <Directory "/"> Options +ExecCGI Require all granted AddHandler cgi-script .pl </Directory> </VirtualHost> And enable it with a2ensite, then restart apache. The copy the database.yml.sample to database.yml and edit it to fill the DB info. 6/ Launch the hea-app % cd hea-app % edit README.md # to install the missing modules % cp environments/config.yml environments/development.yml % edit environments/development.yml # to fill the DB info % perl bin/app.pl Then hit localhost:3000 You should see a local version of Hea with sample data 7/ Back to Koha side A. We will test that the webservice still works with previous version of Koha (without v2) a. Do not configure Hea % perl misc/cronjobs/share_usage_with_koha_community.pl -f -v Then hit localhost:3000 => Nothing added b. Configure Hea on admin/usage_statistics.pl perl misc/cronjobs/share_usage_with_koha_community.pl -f -v => New library added c. Modify the Hea configuration perl misc/cronjobs/share_usage_with_koha_community.pl -f -v => Info are modified B. Not we will test that it works with the new version (much more fun ;)) % git checkout hea-v2 # koha a. Configure Hea using /admin/usage_statistics.pl perl misc/cronjobs/share_usage_with_koha_community.pl -f -v => Check the result on localhost:3000 b. Share libraries's info perl misc/cronjobs/share_usage_with_koha_community.pl -f -v c. Continue to play a bit and share the info. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
612 lines
21 KiB
Perl
612 lines
21 KiB
Perl
# Copyright 2015 BibLibre
|
|
#
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it under the
|
|
# terms of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 3 of the License, or (at your option) any later
|
|
# version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
use Test::More tests => 59;
|
|
use t::lib::Mocks qw(mock_preference);
|
|
use POSIX qw(strftime);
|
|
use Data::Dumper;
|
|
|
|
use Koha::Libraries;
|
|
|
|
BEGIN {
|
|
use_ok('C4::UsageStats');
|
|
use_ok('C4::Context');
|
|
use_ok('C4::Biblio');
|
|
use_ok( 'C4::AuthoritiesMarc', qw(AddAuthority) );
|
|
use_ok('C4::Reserves');
|
|
use_ok('MARC::Record');
|
|
use_ok('Koha::Acquisition::Order');
|
|
}
|
|
|
|
can_ok(
|
|
'C4::UsageStats', qw(
|
|
NeedUpdate
|
|
BuildReport
|
|
ReportToCommunity
|
|
_count )
|
|
);
|
|
|
|
my $dbh = C4::Context->dbh;
|
|
$dbh->{AutoCommit} = 0;
|
|
$dbh->{RaiseError} = 1;
|
|
|
|
$dbh->do('DELETE FROM issues');
|
|
$dbh->do('DELETE FROM biblio');
|
|
$dbh->do('DELETE FROM items');
|
|
$dbh->do('DELETE FROM auth_header');
|
|
$dbh->do('DELETE FROM old_issues');
|
|
$dbh->do('DELETE FROM old_reserves');
|
|
$dbh->do('DELETE FROM borrowers');
|
|
$dbh->do('DELETE FROM aqorders');
|
|
$dbh->do('DELETE FROM subscription');
|
|
|
|
#################################################
|
|
# Testing Subs
|
|
#################################################
|
|
|
|
# ---------- Testing NeedUpdate -----------------
|
|
|
|
#Mocking C4::Context->preference("UsageStatsLastUpdateTime") to 0
|
|
my $now = strftime( "%s", localtime );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLastUpdateTime", 0 );
|
|
|
|
my $update = C4::UsageStats->NeedUpdate;
|
|
is( $update, 1, "There is no last update, update needed" );
|
|
|
|
#Mocking C4::Context->preference("UsageStatsLastUpdateTime") to now
|
|
$now = strftime( "%s", localtime );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLastUpdateTime", $now );
|
|
|
|
$update = C4::UsageStats->NeedUpdate;
|
|
is( $update, 0, "Last update just be done, no update needed " );
|
|
|
|
# ---------- Testing BuildReport ----------------
|
|
|
|
#Test report->library -----------------
|
|
#mock to 0
|
|
t::lib::Mocks::mock_preference( "UsageStatsID", 0 );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLibraryName", 0 );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLibrariesInfo", 0 );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLibraryType", 0 );
|
|
t::lib::Mocks::mock_preference( "UsageStatsCountry", 0 );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLibraryUrl", 0 );
|
|
|
|
my $report = C4::UsageStats->BuildReport();
|
|
|
|
isa_ok( $report, 'HASH', '$report is a HASH' );
|
|
isa_ok( $report->{library}, 'HASH', '$report->{library} is a HASH' );
|
|
is( scalar( keys %{$report->{library}} ), 6, "There are 6 fields in $report->{library}" );
|
|
is( $report->{library}->{id}, 0, "UsageStatsID is good" );
|
|
is( $report->{library}->{name}, '', "UsageStatsLibraryName is good" );
|
|
is( $report->{library}->{url}, '', "UsageStatsLibraryUrl is good" );
|
|
is( $report->{library}->{type}, '', "UsageStatsLibraryType is good" );
|
|
is( $report->{library}->{country}, '', "UsageStatsCountry is good" );
|
|
is( $report->{library}->{number_of_libraries}, undef, "UsageStatsLibrariesInfo is good" );
|
|
|
|
#mock with values
|
|
t::lib::Mocks::mock_preference( "UsageStatsID", 1 );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLibraryName", 'NAME' );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLibraryUrl", 'URL' );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLibraryType", 'TYPE' );
|
|
t::lib::Mocks::mock_preference( "UsageStatsCountry", 'COUNTRY' );
|
|
t::lib::Mocks::mock_preference( "UsageStatsLibrariesInfo", 1 );
|
|
|
|
$report = C4::UsageStats->BuildReport();
|
|
|
|
isa_ok( $report, 'HASH', '$report is a HASH' );
|
|
isa_ok( $report->{library}, 'HASH', '$report->{library} is a HASH' );
|
|
is( scalar( keys %{$report->{library}} ), 6, "There are 6 fields in $report->{library}" );
|
|
is( $report->{library}->{id}, 1, "UsageStatsID is good" );
|
|
is( $report->{library}->{name}, 'NAME', "UsageStatsLibraryName is good" );
|
|
is( $report->{library}->{url}, 'URL', "UsageStatsLibraryUrl is good" );
|
|
is( $report->{library}->{type}, 'TYPE', "UsageStatsLibraryType is good" );
|
|
is( $report->{library}->{country}, 'COUNTRY', "UsageStatsCountry is good" );
|
|
my $nb_of_libraries = Koha::Libraries->count;
|
|
is( $report->{library}->{number_of_libraries}, $nb_of_libraries, "UsageStatsLibrariesInfo is good" );
|
|
|
|
#Test report->volumetry ---------------
|
|
#with original values
|
|
$report = C4::UsageStats->BuildReport();
|
|
|
|
isa_ok( $report, 'HASH', '$report is a HASH' );
|
|
isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' );
|
|
is( scalar( keys %{$report->{volumetry}} ), 8, "There are 8 fields in $report->{volumetry}" );
|
|
is( $report->{volumetry}->{biblio}, 0, "There is no biblio" );
|
|
is( $report->{volumetry}->{items}, 0, "There is no items" );
|
|
is( $report->{volumetry}->{auth_header}, 0, "There is no auth_header" );
|
|
is( $report->{volumetry}->{old_issues}, 0, "There is no old_issues" );
|
|
is( $report->{volumetry}->{old_reserves}, 0, "There is no old_reserves" );
|
|
is( $report->{volumetry}->{borrowers}, 0, "There is no borrowers" );
|
|
is( $report->{volumetry}->{aqorders}, 0, "There is no aqorders" );
|
|
is( $report->{volumetry}->{subscription}, 0, "There is no subscription" );
|
|
|
|
#after adding objects
|
|
construct_objects_needed();
|
|
|
|
$report = C4::UsageStats->BuildReport();
|
|
|
|
isa_ok( $report, 'HASH', '$report is a HASH' );
|
|
isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' );
|
|
is( scalar( keys %{$report->{volumetry}} ), 8, "There are 8 fields in $report->{volumetry}" );
|
|
is( $report->{volumetry}->{biblio}, 3, "There are 3 biblio" );
|
|
is( $report->{volumetry}->{items}, 3, "There are 3 items" );
|
|
is( $report->{volumetry}->{auth_header}, 2, "There are 2 auth_header" );
|
|
is( $report->{volumetry}->{old_issues}, 1, "There is 1 old_issues" );
|
|
is( $report->{volumetry}->{old_reserves}, 1, "There is 1 old_reserves" );
|
|
is( $report->{volumetry}->{borrowers}, 3, "There are 3 borrowers" );
|
|
is( $report->{volumetry}->{aqorders}, 1, "There is 1 aqorders" );
|
|
is( $report->{volumetry}->{subscription}, 1, "There is 1 subscription" );
|
|
|
|
#Test report->systempreferences -------
|
|
#mock to 0
|
|
mocking_systempreferences_to_a_set_value(0);
|
|
|
|
$report = C4::UsageStats->BuildReport();
|
|
isa_ok( $report, 'HASH', '$report is a HASH' );
|
|
isa_ok( $report->{systempreferences}, 'HASH', '$report->{systempreferences} is a HASH' );
|
|
verif_systempreferences_values( $report, 0 );
|
|
|
|
#mock with values
|
|
mocking_systempreferences_to_a_set_value(1);
|
|
|
|
$report = C4::UsageStats->BuildReport();
|
|
isa_ok( $report, 'HASH', '$report is a HASH' );
|
|
isa_ok( $report->{systempreferences}, 'HASH', '$report->{systempreferences} is a HASH' );
|
|
verif_systempreferences_values( $report, 1 );
|
|
|
|
#Test if unwanted syspref are not sent
|
|
is( $report->{systempreferences}->{useDischarge}, undef, 'useDischarge should not be shared');
|
|
is( $report->{systempreferences}->{OpacUserJS}, undef, 'OpacUserJS should not be shared');
|
|
|
|
# ---------- Testing ReportToCommunity ----------
|
|
|
|
# ---------- Testing _count ---------------------
|
|
my $query = '
|
|
SELECT count(*)
|
|
FROM borrowers
|
|
';
|
|
my $count = $dbh->selectrow_array($query);
|
|
|
|
my $nb_fields = C4::UsageStats::_count('borrowers');
|
|
is( $nb_fields, $count, "_count return the good number of fields" );
|
|
|
|
#################################################
|
|
# Subs
|
|
#################################################
|
|
|
|
# Adding :
|
|
# 3 borrowers
|
|
# 4 biblio
|
|
# 3 biblio items
|
|
# 3 items
|
|
# 2 auth_header
|
|
# 1 old_issues
|
|
# 1 old_reserves
|
|
# 1 subscription
|
|
# 1 aqorders
|
|
sub construct_objects_needed {
|
|
|
|
# ---------- 3 borrowers ---------------------
|
|
my $surname1 = 'Borrower 1';
|
|
my $surname2 = 'Borrower 2';
|
|
my $surname3 = 'Borrower 3';
|
|
my $firstname1 = 'firstname 1';
|
|
my $firstname2 = 'firstname 2';
|
|
my $firstname3 = 'firstname 3';
|
|
my $cardnumber1 = 'test_card1';
|
|
my $cardnumber2 = 'test_card2';
|
|
my $cardnumber3 = 'test_card3';
|
|
my $categorycode = Koha::Database->new()->schema()->resultset('Category')->first()->categorycode();
|
|
my $branchcode = Koha::Database->new()->schema()->resultset('Branch')->first()->branchcode();
|
|
|
|
my $query = '
|
|
INSERT INTO borrowers
|
|
(surname, firstname, cardnumber, branchcode, categorycode)
|
|
VALUES (?,?,?,?,?)';
|
|
my $insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute( $surname1, $firstname1, $cardnumber1, $branchcode, $categorycode );
|
|
my $borrowernumber1 = $dbh->last_insert_id( undef, undef, 'borrowers', undef );
|
|
$insert_sth->execute( $surname2, $firstname2, $cardnumber2, $branchcode, $categorycode );
|
|
my $borrowernumber2 = $dbh->last_insert_id( undef, undef, 'borrowers', undef );
|
|
$insert_sth->execute( $surname3, $firstname3, $cardnumber3, $branchcode, $categorycode );
|
|
my $borrowernumber3 = $dbh->last_insert_id( undef, undef, 'borrowers', undef );
|
|
|
|
# ---------- 3 biblios -----------------------
|
|
my $title1 = 'Title 1';
|
|
my $title2 = 'Title 2';
|
|
my $title3 = 'Title 3';
|
|
my $author1 = 'Author 1';
|
|
my $author2 = 'Author 2';
|
|
my $author3 = 'Author 3';
|
|
|
|
$query = '
|
|
INSERT INTO biblio
|
|
(title, author)
|
|
VALUES (?,?)';
|
|
$insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute( $title1, $author1 );
|
|
my $biblionumber1 = $dbh->last_insert_id( undef, undef, 'biblio', undef );
|
|
$insert_sth->execute( $title2, undef );
|
|
my $biblionumber2 = $dbh->last_insert_id( undef, undef, 'biblio', undef );
|
|
$insert_sth->execute( $title3, $author3 );
|
|
my $biblionumber3 = $dbh->last_insert_id( undef, undef, 'biblio', undef );
|
|
|
|
# ---------- 3 biblio items -------------------------
|
|
$query = '
|
|
INSERT INTO biblioitems
|
|
(biblionumber, itemtype)
|
|
VALUES (?,?)';
|
|
$insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute( $biblionumber1, 'Book' );
|
|
my $biblioitemnumber1 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
|
|
$insert_sth->execute( $biblionumber2, 'Music' );
|
|
my $biblioitemnumber2 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
|
|
$insert_sth->execute( $biblionumber3, 'Book' );
|
|
my $biblioitemnumber3 = $dbh->last_insert_id( undef, undef, 'biblioitems', undef );
|
|
|
|
# ---------- 3 items -------------------------
|
|
my $barcode1 = '111111';
|
|
my $barcode2 = '222222';
|
|
my $barcode3 = '333333';
|
|
|
|
$query = '
|
|
INSERT INTO items
|
|
(biblionumber, biblioitemnumber, barcode, itype)
|
|
VALUES (?,?,?,?)';
|
|
$insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute( $biblionumber1, $biblioitemnumber1, $barcode1, 'Book' );
|
|
my $item_number1 = $dbh->last_insert_id( undef, undef, 'items', undef );
|
|
$insert_sth->execute( $biblionumber2, $biblioitemnumber2, $barcode2, 'Music' );
|
|
my $item_number2 = $dbh->last_insert_id( undef, undef, 'items', undef );
|
|
$insert_sth->execute( $biblionumber3, $biblioitemnumber3, $barcode3, 'Book' );
|
|
my $item_number3 = $dbh->last_insert_id( undef, undef, 'items', undef );
|
|
|
|
# ---------- Add 2 auth_header
|
|
$query = '
|
|
INSERT INTO auth_header
|
|
(authtypecode)
|
|
VALUES (?)';
|
|
$insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute('authtypecode1');
|
|
my $authid1 = $dbh->last_insert_id( undef, undef, 'auth_header', undef );
|
|
$insert_sth->execute('authtypecode2');
|
|
my $authid2 = $dbh->last_insert_id( undef, undef, 'auth_header', undef );
|
|
|
|
# ---------- Add 1 old_issues
|
|
$query = '
|
|
INSERT INTO old_issues
|
|
(borrowernumber, branchcode, itemnumber)
|
|
VALUES (?,?,?)';
|
|
$insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute( $borrowernumber1, $branchcode, $item_number1 );
|
|
my $issue_id1 = $dbh->last_insert_id( undef, undef, 'old_issues', undef );
|
|
|
|
# ---------- Add 1 old_reserves
|
|
AddReserve( $branchcode, $borrowernumber1, $biblionumber1, '', 1, undef, undef, '', 'Title', undef, undef );
|
|
my $reserves1 = GetReservesFromBiblionumber( { biblionumber => $biblionumber1 } );
|
|
my $reserve_id1 = $reserves1->[0]->{reserve_id};
|
|
my $reserve1 = CancelReserve( { reserve_id => $reserve_id1 } );
|
|
|
|
# ---------- Add 1 aqbudgets
|
|
$query = '
|
|
INSERT INTO aqbudgets
|
|
(budget_amount)
|
|
VALUES (?)';
|
|
$insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute("20.0");
|
|
my $aqbudgets1 = $dbh->last_insert_id( undef, undef, 'aqbudgets', undef );
|
|
|
|
# ---------- Add 1 aqorders
|
|
$query = '
|
|
INSERT INTO aqorders
|
|
(budget_id, basketno, biblionumber, invoiceid, subscriptionid)
|
|
VALUES (?,?,?,?,?)';
|
|
$insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute( $aqbudgets1, undef, undef, undef, undef );
|
|
my $aqorders1 = $dbh->last_insert_id( undef, undef, 'aqorders', undef );
|
|
|
|
# --------- Add 1 subscription
|
|
$query = '
|
|
INSERT INTO subscription
|
|
(biblionumber)
|
|
VALUES (?)';
|
|
$insert_sth = $dbh->prepare($query);
|
|
$insert_sth->execute($biblionumber1);
|
|
my $subscription1 = $dbh->last_insert_id( undef, undef, 'subscription', undef );
|
|
|
|
}
|
|
|
|
#Change systempreferences values to $set_value
|
|
sub mocking_systempreferences_to_a_set_value {
|
|
my $set_value = shift;
|
|
|
|
foreach (
|
|
qw/
|
|
AcqCreateItem
|
|
AcqWarnOnDuplicateInvoice
|
|
AcqViewBaskets
|
|
BasketConfirmations
|
|
OrderPdfFormat
|
|
casAuthentication
|
|
casLogout
|
|
AllowPKIAuth
|
|
DebugLevel
|
|
delimiter
|
|
noItemTypeImages
|
|
virtualshelves
|
|
AutoLocation
|
|
IndependentBranches
|
|
SessionStorage
|
|
Persona
|
|
AuthDisplayHierarchy
|
|
AutoCreateAuthorities
|
|
BiblioAddsAuthorities
|
|
dontmerge
|
|
UseAuthoritiesForTracings
|
|
CatalogModuleRelink
|
|
hide_marc
|
|
IntranetBiblioDefaultView
|
|
LabelMARCView
|
|
OpacSuppression
|
|
SeparateHoldings
|
|
UseControlNumber
|
|
advancedMARCeditor
|
|
DefaultClassificationSource
|
|
EasyAnalyticalRecords
|
|
autoBarcode
|
|
item-level_itypes
|
|
marcflavour
|
|
PrefillItem
|
|
z3950NormalizeAuthor
|
|
SpineLabelAutoPrint
|
|
SpineLabelShowPrintOnBibDetails
|
|
BlockReturnOfWithdrawnItems
|
|
CalculateFinesOnReturn
|
|
AgeRestrictionOverride
|
|
AllFinesNeedOverride
|
|
AllowFineOverride
|
|
AllowItemsOnHoldCheckout
|
|
AllowItemsOnHoldCheckoutSCO
|
|
AllowNotForLoanOverride
|
|
AllowRenewalLimitOverride
|
|
AllowReturnToBranch
|
|
AllowTooManyOverride
|
|
AutomaticItemReturn
|
|
AutoRemoveOverduesRestrictions
|
|
CircControl
|
|
HomeOrHoldingBranch
|
|
HomeOrHoldingBranchReturn
|
|
InProcessingToShelvingCart
|
|
IssueLostItem
|
|
IssuingInProcess
|
|
ManInvInNoissuesCharge
|
|
OverduesBlockCirc
|
|
RenewalPeriodBase
|
|
RenewalSendNotice
|
|
RentalsInNoissuesCharge
|
|
ReturnBeforeExpiry
|
|
ReturnToShelvingCart
|
|
TransfersMaxDaysWarning
|
|
UseBranchTransferLimits
|
|
useDaysMode
|
|
UseTransportCostMatrix
|
|
UseCourseReserves
|
|
finesCalendar
|
|
FinesIncludeGracePeriod
|
|
finesMode
|
|
RefundLostOnReturnControl
|
|
WhenLostChargeReplacementFee
|
|
WhenLostForgiveFine
|
|
AllowHoldDateInFuture
|
|
AllowHoldPolicyOverride
|
|
AllowHoldsOnDamagedItems
|
|
AllowHoldsOnPatronsPossessions
|
|
AutoResumeSuspendedHolds
|
|
canreservefromotherbranches
|
|
decreaseLoanHighHolds
|
|
DisplayMultiPlaceHold
|
|
emailLibrarianWhenHoldIsPlaced
|
|
ExpireReservesMaxPickUpDelay
|
|
OPACAllowHoldDateInFuture
|
|
OPACAllowUserToChooseBranch
|
|
ReservesControlBranch
|
|
ReservesNeedReturns
|
|
SuspendHoldsIntranet
|
|
SuspendHoldsOpac
|
|
TransferWhenCancelAllWaitingHolds
|
|
AllowAllMessageDeletion
|
|
AllowOfflineCirculation
|
|
CircAutocompl
|
|
CircAutoPrintQuickSlip
|
|
DisplayClearScreenButton
|
|
FilterBeforeOverdueReport
|
|
FineNotifyAtCheckin
|
|
itemBarcodeFallbackSearch
|
|
itemBarcodeInputFilter
|
|
previousIssuesDefaultSortOrder
|
|
RecordLocalUseOnReturn
|
|
soundon
|
|
SpecifyDueDate
|
|
todaysIssuesDefaultSortOrder
|
|
UpdateTotalIssuesOnCirc
|
|
UseTablesortForCirc
|
|
WaitingNotifyAtCheckin
|
|
AllowSelfCheckReturns
|
|
AutoSelfCheckAllowed
|
|
FRBRizeEditions
|
|
OPACFRBRizeEditions
|
|
AmazonCoverImages
|
|
OPACAmazonCoverImages
|
|
Babeltheque
|
|
BakerTaylorEnabled
|
|
GoogleJackets
|
|
HTML5MediaEnabled
|
|
IDreamBooksReadometer
|
|
IDreamBooksResults
|
|
IDreamBooksReviews
|
|
LibraryThingForLibrariesEnabled
|
|
LocalCoverImages
|
|
OPACLocalCoverImages
|
|
NovelistSelectEnabled
|
|
XISBN
|
|
OpenLibraryCovers
|
|
OpenLibrarySearch
|
|
UseKohaPlugins
|
|
SyndeticsEnabled
|
|
TagsEnabled
|
|
CalendarFirstDayOfWeek
|
|
opaclanguagesdisplay
|
|
AuthoritiesLog
|
|
BorrowersLog
|
|
CataloguingLog
|
|
FinesLog
|
|
IssueLog
|
|
LetterLog
|
|
ReturnLog
|
|
SubscriptionLog
|
|
BiblioDefaultView
|
|
COinSinOPACResults
|
|
DisplayOPACiconsXSLT
|
|
hidelostitems
|
|
HighlightOwnItemsOnOPAC
|
|
OpacAddMastheadLibraryPulldown
|
|
OPACDisplay856uAsImage
|
|
OpacHighlightedWords
|
|
OpacKohaUrl
|
|
OpacMaintenance
|
|
OpacPublic
|
|
OpacSeparateHoldings
|
|
OPACShowBarcode
|
|
OPACShowCheckoutName
|
|
OpacShowFiltersPulldownMobile
|
|
OPACShowHoldQueueDetails
|
|
OpacShowLibrariesPulldownMobile
|
|
OpacShowRecentComments
|
|
OPACShowUnusedAuthorities
|
|
OpacStarRatings
|
|
opacthemes
|
|
OPACURLOpenInNewWindow
|
|
OpacAuthorities
|
|
opacbookbag
|
|
OpacBrowser
|
|
OpacBrowseResults
|
|
OpacCloud
|
|
OPACFinesTab
|
|
OpacHoldNotes
|
|
OpacItemLocation
|
|
OpacPasswordChange
|
|
OPACPatronDetails
|
|
OPACpatronimages
|
|
OPACPopupAuthorsSearch
|
|
OpacTopissue
|
|
opacuserlogin
|
|
QuoteOfTheDay
|
|
RequestOnOpac
|
|
reviewson
|
|
ShowReviewer
|
|
ShowReviewerPhoto
|
|
SocialNetworks
|
|
suggestion
|
|
AllowPurchaseSuggestionBranchChoice
|
|
OpacAllowPublicListCreation
|
|
OpacAllowSharingPrivateLists
|
|
OpacRenewalAllowed
|
|
OpacRenewalBranch
|
|
OPACViewOthersSuggestions
|
|
SearchMyLibraryFirst
|
|
singleBranchMode
|
|
AnonSuggestions
|
|
EnableOpacSearchHistory
|
|
OPACPrivacy
|
|
opacreadinghistory
|
|
TrackClicks
|
|
PatronSelfRegistration
|
|
OPACShelfBrowser
|
|
AutoEmailOpacUser
|
|
AutoEmailPrimaryAddress
|
|
autoMemberNum
|
|
BorrowerRenewalPeriodBase
|
|
checkdigit
|
|
EnableBorrowerFiles
|
|
EnhancedMessagingPreferences
|
|
ExtendedPatronAttributes
|
|
intranetreadinghistory
|
|
memberofinstitution
|
|
patronimages
|
|
TalkingTechItivaPhoneNotification
|
|
uppercasesurnames
|
|
IncludeSeeFromInSearches
|
|
OpacGroupResults
|
|
QueryAutoTruncate
|
|
QueryFuzzy
|
|
QueryStemming
|
|
QueryWeightFields
|
|
TraceCompleteSubfields
|
|
TraceSubjectSubdivisions
|
|
UseICU
|
|
UseQueryParser
|
|
defaultSortField
|
|
displayFacetCount
|
|
OPACdefaultSortField
|
|
OPACItemsResultsDisplay
|
|
expandedSearchOption
|
|
IntranetNumbersPreferPhrase
|
|
OPACNumbersPreferPhrase
|
|
opacSerialDefaultTab
|
|
RenewSerialAddsSuggestion
|
|
RoutingListAddReserves
|
|
RoutingSerials
|
|
SubscriptionHistory
|
|
Display856uAsImage
|
|
DisplayIconsXSLT
|
|
template
|
|
yuipath
|
|
HidePatronName
|
|
intranetbookbag
|
|
StaffDetailItemSelection
|
|
viewISBD
|
|
viewLabeledMARC
|
|
viewMARC
|
|
ILS-DI
|
|
OAI-PMH
|
|
version
|
|
AudioAlerts
|
|
/
|
|
) {
|
|
t::lib::Mocks::mock_preference( $_, $set_value );
|
|
}
|
|
}
|
|
|
|
#Test if all systempreferences are at $value_to_test
|
|
sub verif_systempreferences_values {
|
|
my ( $report, $value_to_test ) = @_;
|
|
|
|
my @missings;
|
|
foreach my $key ( keys %{$report->{systempreferences}} ) {
|
|
if ( $report->{systempreferences}->{$key} ne $value_to_test ) {
|
|
warn $key;
|
|
push @missings, $key;
|
|
}
|
|
}
|
|
unless ( @missings ) {
|
|
ok(1, 'All prefs are present');
|
|
} else {
|
|
ok(0, 'Some prefs are missing: ' . Dumper(\@missings));
|
|
}
|
|
}
|
|
|
|
$dbh->rollback;
|