forked from Koha-Community/Koha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 34519: Add a template plugin for fetch searchable patron attributes
This patch moves code form scripts to a template plguin and unifies the calls To test: 1 - Add a searchable patron attribute type 2 - Add values to several patrons and test patron searching from Patrons home Patrons search results Holds request screen Article request screen Patron search sidebar 3 - Apply patch 4 - Confirm results are the same Signed-off-by: Janusz Kaczmarek <[email protected]> Signed-off-by: Katrin Fischer <[email protected]> Signed-off-by: Tomas Cohen Arazi <[email protected]>
- Loading branch information
1 parent
1e56d49
commit 9d69ae9
Showing
11 changed files
with
78 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package Koha::Template::Plugin::ExtendedAttributeTypes; | ||
|
||
# Copyright ByWater Solutions 2023 | ||
|
||
# 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 Template::Plugin; | ||
use base qw( Template::Plugin ); | ||
|
||
use C4::Koha; | ||
use C4::Context; | ||
use Koha::Patron::Attribute::Types; | ||
|
||
sub all { | ||
my ( $self, $params ) = @_; | ||
return Koha::Patron::Attribute::Types->search($params); | ||
} | ||
|
||
sub codes { | ||
my ( $self, $params ) = @_; | ||
return Koha::Patron::Attribute::Types->search($params)->get_column('code'); | ||
} | ||
|
||
1; | ||
|
||
=head1 NAME | ||
Koha::Template::Plugin::ExtendedAttributeTypes - TT Plugin for retrieving patron attribute types | ||
=head1 SYNOPSIS | ||
[% USE ExtendedAttributeTypes %] | ||
[% ExtendedAttributeTypes.all() %] | ||
=head1 ROUTINES | ||
=head2 all | ||
In a template, you can get the searchable attribute types with | ||
the following TT code: [% ExtendedAttributes.all( staff_searchable => 1 ) %] | ||
The function returns the Koha::Patron::Atribute::Type objects | ||
=head2 codes | ||
In a template, you can get the searchable attribute type codes with | ||
the following TT code: [% ExtendedAttributes.codes( staff_searchable => 1 ) %] | ||
The function returns the Koha::Patron::Atribute::Type codes as an array | ||
=head1 AUTHOR | ||
Nick Clemens <[email protected]> | ||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters