push @EXPORT, qw(
&ModMember
&changepassword
+ &ModPrivacy
);
#Delete data
my $noissuescharge = C4::Context->preference("noissuescharge") || 5;
$flaginfo{'message'} = sprintf "Patron owes \$%.02f", $amount;
$flaginfo{'amount'} = sprintf "%.02f", $amount;
- if ( $amount > $noissuescharge ) {
+ if ( $amount > $noissuescharge && !C4::Context->preference("AllowFineOverride") ) {
$flaginfo{'noissues'} = 1;
}
$flags{'CHARGES'} = \%flaginfo;
$flags{'NOTES'} = \%flaginfo;
}
my ( $odues, $itemsoverdue ) = checkoverdues($patroninformation->{'borrowernumber'});
- if ( $odues > 0 ) {
+ if ( $odues && $odues > 0 ) {
my %flaginfo;
$flaginfo{'message'} = "Yes";
$flaginfo{'itemlist'} = $itemsoverdue;
#'
sub UpdateGuarantees {
- my (%data) = @_;
+ my %data = shift;
my $dbh = C4::Context->dbh;
my ( $count, $guarantees ) = GetGuarantees( $data{'borrowernumber'} );
- for ( my $i = 0 ; $i < $count ; $i++ ) {
-
- # FIXME
- # It looks like the $i is only being returned to handle walking through
- # the array, which is probably better done as a foreach loop.
- #
+ foreach my $guarantee (@$guarantees){
my $guaquery = qq|UPDATE borrowers
- SET address='$data{'address'}',fax='$data{'fax'}',
- B_city='$data{'B_city'}',mobile='$data{'mobile'}',city='$data{'city'}',phone='$data{'phone'}'
- WHERE borrowernumber='$guarantees->[$i]->{'borrowernumber'}'
+ SET address=?,fax=?,B_city=?,mobile=?,city=?,phone=?
+ WHERE borrowernumber=?
|;
- my $sth3 = $dbh->prepare($guaquery);
- $sth3->execute;
+ my $sth = $dbh->prepare($guaquery);
+ $sth->execute($data{'address'},$data{'fax'},$data{'B_city'},$data{'mobile'},$data{'city'},$data{'phone'},$guarantee->{'borrowernumber'});
}
}
=head2 GetPendingIssues
}
+=head2 ModPrivacy
+
+=over 4
+
+my $success = ModPrivacy( $borrowernumber, $privacy );
+
+Update the privacy of a patron.
+
+return :
+true on success, false on failure
+
+=back
+
+=cut
+
+sub ModPrivacy {
+ my $borrowernumber = shift;
+ my $privacy = shift;
+ return unless defined $borrowernumber;
+ return unless $borrowernumber =~ /^\d+$/;
+
+ return ModMember( borrowernumber => $borrowernumber,
+ privacy => $privacy );
+}
+
=head2 AddMessage
AddMessage( $borrowernumber, $message_type, $message, $branchcode );
my $query = "SELECT
branches.branchname,
messages.*,
- DATE_FORMAT( message_date, '%m/%d/%Y' ) AS message_date_formatted,
+ message_date,
messages.branchcode LIKE '$branchcode' AS can_delete
FROM messages, branches
WHERE borrowernumber = ?
my @results;
while ( my $data = $sth->fetchrow_hashref ) {
+ my $d = C4::Dates->new( $data->{message_date}, 'iso' );
+ $data->{message_date_formatted} = $d->output;
push @results, $data;
}
return \@results;