afb81e6c0f
New module to handle management of circulation to Housebound readers. - Ability to create housebound profiles & scheduled visits for patrons. - Ability to record users as Deliverers or Choosers (or both), using extended patron attributes. - Ability to link choosers and deliverers to individual delivery runs. - 'Delivery Frequencies' are customizable through authorised values ('HSBND_FREQ'). * koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc: add Housebound menu if appropriate. * Koha/Patron.pm (housebound_profile): New method. * Koha/Patrons.pm (housebound_choosers, housebound_deliverers): New methods. * Koha/Patron/HouseboundProfile.pm: New File. * Koha/Patron/HouseboundProfiles.pm: New File. * Koha/Patron/HouseboundVisits.pm: New File. * Koha/Patron/HouseboundVisit.pm: New File. * koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: New file. * members/housebound.pl: New file. * installer/data/mysql/kohastructure.sql: Add housebound_* tables. * installer/data/mysql/sysprefs.sql: Add HouseboundModule syspref. * koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref: Add HouseboundModule syspref. * installer/data/mysql/atomicupdate/housebound_tables.sql: New file. * t/db_dependent/Patron/Borrower_Housebound.t: New file. * t/db_dependent/Patron/Borrower_HouseboundProfiles.t: New file. * t/db_dependent/Patron/Borrower_HouseboundVisits.t: New file. Test plan: - Apply patch. - Run atomic update script. - Run Unit Tests (t/db_dependent/Patron/Housebound*) - Optionally, add additional authorised values to 'HSBND_FREQ'. - Switch on 'HouseboundModule' syspref. - Ensure 'ExtendedPatronAttributes syspref is on. - On patron pages, when editing, add some to the Housebound deliverer and chooser groups. - On a patron page, the Housebound menu should now be present. - create housebound profile + ensure Frequency values seem pulled from 'HSBND_FREQ'. - create 'housebound visits' (deliveries) + ensure chooser/deliverer lists are populated with patrons that have the Chooser or Deliverer Attribute type. - edit visits. - delete visits. - Switch off 'HouseboundModule' - the Housebound menu should disappear Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Claire Gravely <claire_gravely@hotmail.com> Bug 5670: [Followup] Rename test files. * t/db_dependent/Patron/Borrower_Housebound.t: Rename to t/db_dependent/Patron/Housebound.t. * t/db_dependent/Patron/Borrower_HouseboundProfiles.t: Rename to t/db_dependent/Patron/HouseboundProfiles.t. * t/db_dependent/Patron/Borrower_HouseboundVisits.t: Rename to t/db_dependent/Patron/HouseboundVisits.t. Signed-off-by: Claire Gravely <claire_gravely@hotmail.com> Bug 5670: [QA Followup] Fix category_type ref. * koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt: Replace references to `category_type` with `categorycode`. Signed-off-by: Claire Gravely <claire_gravely@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
92 lines
2.6 KiB
Perl
92 lines
2.6 KiB
Perl
#!/usr/bin/perl
|
|
|
|
# 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 => 8;
|
|
|
|
use Koha::Database;
|
|
use Koha::Patron::HouseboundVisits;
|
|
use Koha::Patron::HouseboundVisit;
|
|
|
|
use t::lib::TestBuilder;
|
|
|
|
my $schema = Koha::Database->new->schema;
|
|
$schema->storage->txn_begin;
|
|
|
|
my $builder = t::lib::TestBuilder->new;
|
|
|
|
########### Test HouseboundVisits
|
|
|
|
my $visit = $builder->build({ source => 'HouseboundVisit' });
|
|
|
|
is(
|
|
Koha::Patron::HouseboundVisits
|
|
->find($visit->{id})->id,
|
|
$visit->{id},
|
|
"Find created visit."
|
|
);
|
|
|
|
# Using our Prefetching search
|
|
|
|
# Does it work implicitly?
|
|
my @visits = Koha::Patron::HouseboundVisits
|
|
->special_search({ borrowernumber => $visit->{borrowernumber} });
|
|
my $found_visit = shift @visits;
|
|
is(
|
|
$found_visit->borrowernumber,
|
|
$visit->{borrowernumber},
|
|
"Search for created visit."
|
|
);
|
|
|
|
# Does it work Explicitly?
|
|
@visits = Koha::Patron::HouseboundVisits
|
|
->special_search({ 'me.borrowernumber' => $visit->{borrowernumber} });
|
|
$found_visit = shift @visits;
|
|
is(
|
|
$found_visit->borrowernumber,
|
|
$visit->{borrowernumber},
|
|
"Search for created visit."
|
|
);
|
|
|
|
# Does it work without prefetcing?
|
|
@visits = Koha::Patron::HouseboundVisits
|
|
->special_search({ borrowernumber => $visit->{borrowernumber} }, { prefetch => [] });
|
|
$found_visit = shift @visits;
|
|
is(
|
|
$found_visit->borrowernumber,
|
|
$visit->{borrowernumber},
|
|
"Search for created visit."
|
|
);
|
|
|
|
########### Test HouseboundVisit
|
|
|
|
my $result = Koha::Patron::HouseboundVisits->find($visit->{id});
|
|
|
|
is( $result->deliverer->borrowernumber, $visit->{deliverer_brwnumber} );
|
|
|
|
is( $result->chooser->borrowernumber, $visit->{chooser_brwnumber} );
|
|
|
|
TODO: {
|
|
local $TODO = "We want our results here to be Koha::Patron objects, but they by default return DBIC Schema objects. The currently accepted solution to this (use the _from_dbic method), is defined for Koha::Objects, but not for Koha::Object. We do not resolve this issue here";
|
|
isa_ok( $result->deliverer, "Koha::Patron");
|
|
isa_ok( $result->chooser, "Koha::Patron");
|
|
}
|
|
|
|
$schema->storage->txn_rollback;
|
|
|
|
1;
|