Lines 42-47
use Text::Unaccent qw( unac_string );
Link Here
|
42 |
use Koha::AuthUtils qw(hash_password); |
42 |
use Koha::AuthUtils qw(hash_password); |
43 |
use Koha::Database; |
43 |
use Koha::Database; |
44 |
use Koha::List::Patron; |
44 |
use Koha::List::Patron; |
|
|
45 |
use Koha::Patron::Categories; |
45 |
|
46 |
|
46 |
our (@ISA,@EXPORT,@EXPORT_OK,$debug); |
47 |
our (@ISA,@EXPORT,@EXPORT_OK,$debug); |
47 |
|
48 |
|
Lines 1510-1531
If no category code provided, the function returns all the categories.
Link Here
|
1510 |
=cut |
1511 |
=cut |
1511 |
|
1512 |
|
1512 |
sub GetBorrowercategoryList { |
1513 |
sub GetBorrowercategoryList { |
1513 |
my $no_branch_limit = @_ ? shift : 0; |
1514 |
my ($no_branch_limit) = @_; |
|
|
1515 |
|
1514 |
my $branch_limit = $no_branch_limit |
1516 |
my $branch_limit = $no_branch_limit |
1515 |
? 0 |
1517 |
? 0 |
1516 |
: C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
1518 |
: C4::Context->userenv && C4::Context->userenv->{"branch"}; |
1517 |
my $dbh = C4::Context->dbh; |
1519 |
|
1518 |
my $query = "SELECT categories.* FROM categories"; |
1520 |
|
1519 |
$query .= qq{ |
1521 |
my %cond; |
1520 |
LEFT JOIN categories_branches ON categories.categorycode = categories_branches.categorycode |
1522 |
my %clause = (distinct => 1, order_by => 'description'); |
1521 |
WHERE branchcode = ? OR branchcode IS NULL GROUP BY description |
1523 |
if ($branch_limit) { |
1522 |
} if $branch_limit; |
1524 |
$clause{join} = 'categories_branches'; |
1523 |
$query .= " ORDER BY description"; |
1525 |
$cond{'categories_branches.branchcode'} = [undef, $branch_limit]; |
1524 |
my $sth = $dbh->prepare( $query ); |
1526 |
} |
1525 |
$sth->execute( $branch_limit ? $branch_limit : () ); |
1527 |
return Koha::Patron::Categories->search(\%cond, \%clause)->unblessed; |
1526 |
my $data = $sth->fetchall_arrayref( {} ); |
|
|
1527 |
$sth->finish; |
1528 |
return $data; |
1529 |
} # sub getborrowercategory |
1528 |
} # sub getborrowercategory |
1530 |
|
1529 |
|
1531 |
=head2 GetAge |
1530 |
=head2 GetAge |