my ($class, $where) = @_;
my @branch_prefs = $class->find($where);
my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} });
- my @cc = Koha::Patron::Categories->search_limited;
+ my @cc = Koha::Patron::Categories->search_with_library_limits;
my @it = Koha::ItemTypes->search;
my $notification = $where->{notification};
my %disabled = map {
use Koha::Patron::Category;
-use base qw(Koha::Objects);
+use base qw(Koha::Objects Koha::Objects::Limit::Library);
=head1 NAME
=cut
-sub search_limited {
- my ( $self, $params, $attributes ) = @_;
- my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
- if ( $branch_limit ) {
- $params->{'categories_branches.branchcode'} = [ $branch_limit, undef ];
- $attributes->{join} = 'categories_branches';
- }
- $attributes->{order_by} = ['description'] unless $attributes->{order_by};
- return $self->search($params, $attributes);
-}
-
=head3 type
=cut
sub all {
my ( $self, $params ) = @_;
- return Koha::Patron::Categories->search_limited($params);
+ return Koha::Patron::Categories->search_with_library_limits($params);
}
sub GetName {
( $referer =~ m|acqui/basket.pl| )
? 1 : 0;
-my $patron_categories = Koha::Patron::Categories->search_limited;
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits;
$template->param(
patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
( $referer =~ m|admin/aqbudgets.pl| )
? 1 : 0;
-my $patron_categories = Koha::Patron::Categories->search_limited;
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits;
$template->param(
patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
);
my $branch = $input->param('branch') || '*';
- my @categories = Koha::Patron::Categories->search_limited;
+ my @categories = Koha::Patron::Categories->search_with_library_limits;
my @item_types = Koha::ItemTypes->search;
my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
my $grid_checkin = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
sub add_attribute_type_form {
my $template = shift;
- my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
+ my $patron_categories = Koha::Patron::Categories->search_with_library_limlits({}, {order_by => ['description']});
$template->param(
attribute_type_form => 1,
confirm_op => 'add_attribute_type_confirmed',
my $referer = $input->referer();
-my $patron_categories = Koha::Patron::Categories->search_limited;
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits;
$template->param(
view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
columns => ['cardnumber', 'name', 'dateofbirth', 'address', 'action' ],
my $no_categories = 1;
my $no_add;
foreach my $category_type (qw(C A S P I X)) {
- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => $category_type }, {order_by => ['categorycode']});
+ my $patron_categories = Koha::Patron::Categories->search_with_library_limits({ category_type => $category_type }, {order_by => ['categorycode']});
$no_categories = 0 if $patron_categories->count > 0;
my @categoryloop;
$template->param(no_branches => 1);
}
-my @categories = Koha::Patron::Categories->search_limited;
+my @categories = Koha::Patron::Categories->search_with_library_limits;
if(scalar(@categories) < 1){
$no_add = 1;
$template->param(no_categories => 1);
my $logged_in_user = Koha::Patrons->find( $loggedinuser );
-my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits({ category_type => 'A' }, {order_by => ['categorycode']});
if ( $op eq 'multi' ) {
# FIXME - what are the possible upgrade paths? C -> A , C -> S ...
# currently just allowing C -> A
my $referer = $input->referer();
-my $patron_categories = Koha::Patron::Categories->search_limited;
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits;
$template->param(
view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
columns => ['cardnumber', 'name', 'category', 'branch', 'dateexpiry', 'borrowernotes', 'action'],
my @mime = ( map { {type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation
my $delims = GetDelimiterChoices;
-my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['categorycode']});
my $itemtypes = Koha::ItemTypes->search_with_localization;
$template->param(
mimeloop => \@mime,
my $CGIextChoice = ( 'CSV' ); # FIXME translation
my $CGIsepChoice = GetDelimiterChoices;
- my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
+ my $patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['categorycode']});
$template->param(
CGIextChoice => $CGIextChoice,
CGIsepChoice => $CGIsepChoice,
@shelvinglocloop = sort {$a->{value} cmp $b->{value}} @shelvinglocloop;
- my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
+ my $patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['categorycode']});
$template->param(
CGIextChoice => $CGIextChoice,
our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed;
-our @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
+our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
our $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
$template->param(do_it => $do_it,
);
-my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
+my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
}
}
elsif ( $crit =~ /category/ ) {
- my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
+ my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
foreach my $patron_category ( @patron_categories ) {
( $value eq $patron_category->categorycode ) or next;
$display_value = $patron_category->description and last;
my $referer = $input->referer();
-my $patron_categories = Koha::Patron::Categories->search_limited;
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits;
$template->param(
view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
columns => ['cardnumber', 'name', 'branch', 'action'],
$dbh->do(q|DELETE FROM virtualshelves|);
# Pick a categorycode from the DB
-my @categories = Koha::Patron::Categories->search_limited;
+my @categories = Koha::Patron::Categories->search_with_library_limits;
my $categorycode = $categories[0]->categorycode;
my $branchcode = "ABC";
my $branch_data = {
$template->param( patron_lists => [ @non_empty_lists ] );
}
-my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
+my $patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
$template->param(
step => $step,
);
# get the patron categories and pass them to the template
-my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
+my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
$template->param( categories => \@patron_categories );
my $columns = C4::Templates::GetColumnDefs( $input )->{borrowers};
$columns = [ grep { $_->{field} ne 'borrowernumber' ? $_ : () } @$columns ];
my @patron_attributes_codes;
my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
my $patron_attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
- my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
+ my @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
while ( my $attr_type = $patron_attribute_types->next ) {
# TODO Repeatable attributes are not correctly managed and can cause data lost.
# This should be implemented.