projects
/
srvgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug 15758: Koha::Libraries - Remove GetBranches
[srvgit]
/
admin
/
patron-attr-types.pl
diff --git
a/admin/patron-attr-types.pl
b/admin/patron-attr-types.pl
index
261d94b
..
9a5fce2
100755
(executable)
--- a/
admin/patron-attr-types.pl
+++ b/
admin/patron-attr-types.pl
@@
-25,13
+25,14
@@
use CGI qw ( -utf8 );
use List::MoreUtils qw/uniq/;
use C4::Auth;
use List::MoreUtils qw/uniq/;
use C4::Auth;
-use C4::Branch;
use C4::Context;
use C4::Output;
use C4::Koha;
use C4::Context;
use C4::Output;
use C4::Koha;
-use C4::Members qw/GetBorrowercategoryList/;
use C4::Members::AttributeTypes;
use C4::Members::AttributeTypes;
+use Koha::Libraries;
+use Koha::Patron::Categories;
+
my $script_name = "/cgi-bin/koha/admin/patron-attr-types.pl";
our $input = new CGI;
my $script_name = "/cgi-bin/koha/admin/patron-attr-types.pl";
our $input = new CGI;
@@
-83,7
+84,7
@@
exit 0;
sub add_attribute_type_form {
my $template = shift;
sub add_attribute_type_form {
my $template = shift;
- my $branches =
GetBranches
;
+ my $branches =
Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed
;
my @branches_loop;
foreach my $branch (sort keys %$branches) {
push @branches_loop, {
my @branches_loop;
foreach my $branch (sort keys %$branches) {
push @branches_loop, {
@@
-92,10
+93,11
@@
sub add_attribute_type_form {
};
}
};
}
+ my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
$template->param(
attribute_type_form => 1,
confirm_op => 'add_attribute_type_confirmed',
$template->param(
attribute_type_form => 1,
confirm_op => 'add_attribute_type_confirmed',
- categories =>
GetBorrowercategoryList
,
+ categories =>
$patron_categories
,
branches_loop => \@branches_loop,
);
authorised_value_category_list($template);
branches_loop => \@branches_loop,
);
authorised_value_category_list($template);
@@
-105,7
+107,7
@@
sub add_attribute_type_form {
sub error_add_attribute_type_form {
my $template = shift;
sub error_add_attribute_type_form {
my $template = shift;
- $template->param(description => $input->param('description'));
+ $template->param(description =>
scalar
$input->param('description'));
if ($input->param('repeatable')) {
$template->param(repeatable_checked => 1);
if ($input->param('repeatable')) {
$template->param(repeatable_checked => 1);
@@
-123,8
+125,8
@@
sub error_add_attribute_type_form {
$template->param(display_checkout_checked => 'checked="checked"');
}
$template->param(display_checkout_checked => 'checked="checked"');
}
- $template->param( category_code => $input->param('category_code') );
- $template->param( class => $input->param('class') );
+ $template->param( category_code =>
scalar
$input->param('category_code') );
+ $template->param( class =>
scalar
$input->param('class') );
$template->param(
attribute_type_form => 1,
$template->param(
attribute_type_form => 1,
@@
-166,8
+168,8
@@
sub add_update_attribute_type {
$attr_type->authorised_value_category($authorised_value_category);
my $display_checkout = $input->param('display_checkout');
$attr_type->display_checkout($display_checkout);
$attr_type->authorised_value_category($authorised_value_category);
my $display_checkout = $input->param('display_checkout');
$attr_type->display_checkout($display_checkout);
- $attr_type->category_code($input->param('category_code'));
- $attr_type->class($input->param('class'));
+ $attr_type->category_code(
scalar
$input->param('category_code'));
+ $attr_type->class(
scalar
$input->param('class'));
my @branches = $input->multi_param('branches');
$attr_type->branches( \@branches );
my @branches = $input->multi_param('branches');
$attr_type->branches( \@branches );
@@
-250,14
+252,14
@@
sub edit_attribute_type_form {
$template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS' ));
$template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS' ));
- my $branches =
GetBranches
;
+ my $branches =
Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed
;
my @branches_loop;
my $selected_branches = $attr_type->branches;
my @branches_loop;
my $selected_branches = $attr_type->branches;
- foreach my $branch (
sort keys %
$branches) {
- my $selected = ( grep {$
$_{branchcode} eq $branch
} @$selected_branches ) ? 1 : 0;
+ foreach my $branch (
@
$branches) {
+ my $selected = ( grep {$
_->{branchcode} eq $branch->{branchcode}
} @$selected_branches ) ? 1 : 0;
push @branches_loop, {
push @branches_loop, {
- branchcode => $branch
es->{$branch}
{branchcode},
- branchname => $branch
es->{$branch}
{branchname},
+ branchcode => $branch
->
{branchcode},
+ branchname => $branch
->
{branchname},
selected => $selected,
};
}
selected => $selected,
};
}
@@
-269,11
+271,12
@@
sub edit_attribute_type_form {
category_description => $attr_type->category_description,
);
category_description => $attr_type->category_description,
);
+ my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['description']});
$template->param(
attribute_type_form => 1,
edit_attribute_type => 1,
confirm_op => 'edit_attribute_type_confirmed',
$template->param(
attribute_type_form => 1,
edit_attribute_type => 1,
confirm_op => 'edit_attribute_type_confirmed',
- categories =>
GetBorrowercategoryList
,
+ categories =>
$patron_categories
,
);
}
);
}