1 package Koha::Patron::Modifications;
3 # Copyright 2012 ByWater Solutions
4 # This file is part of Koha.
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 Koha::Patron::Modifications
29 use Koha::Patron::Modification;
31 use base qw(Koha::Objects);
35 $count = Koha::Patron::Modifications->pending_count();
37 Returns the number of pending modifications for existing patrons.
42 my ( $self, $branchcode ) = @_;
44 my $dbh = C4::Context->dbh;
46 SELECT COUNT(*) AS count
47 FROM borrower_modifications, borrowers
48 WHERE borrower_modifications.borrowernumber > 0
49 AND borrower_modifications.borrowernumber = borrowers.borrowernumber
54 $query .= " AND borrowers.branchcode = ? ";
55 push( @params, $branchcode );
58 my $sth = $dbh->prepare($query);
59 $sth->execute(@params);
60 my $result = $sth->fetchrow_hashref();
62 return $result->{count};
67 $arrayref = Koha::Patron::Modifications->pending();
69 Returns an arrayref of hashrefs for all pending modifications for existing patrons.
74 my ( $self, $branchcode ) = @_;
76 my $dbh = C4::Context->dbh;
78 SELECT borrower_modifications.*
79 FROM borrower_modifications, borrowers
80 WHERE borrower_modifications.borrowernumber > 0
81 AND borrower_modifications.borrowernumber = borrowers.borrowernumber
86 $query .= " AND borrowers.branchcode = ? ";
87 push( @params, $branchcode );
89 $query .= " ORDER BY borrowers.surname, borrowers.firstname";
90 my $sth = $dbh->prepare($query);
91 $sth->execute(@params);
94 while ( my $row = $sth->fetchrow_hashref() ) {
95 foreach my $key ( keys %$row ) {
96 delete $row->{$key} unless defined $row->{$key};
106 return 'BorrowerModification';
114 return 'Koha::Patron::Modification';