if ( $privacy == 2) {
# The default of 0 does not work due to foreign key constraints
# The anonymisation will fail quietly if AnonymousPatron is not a valid entry
+ # FIXME the above is unacceptable - bug 9942 relates
my $anonymouspatron = (C4::Context->preference('AnonymousPatron')) ? C4::Context->preference('AnonymousPatron') : 0;
my $sth_ano = $dbh->prepare("UPDATE old_issues SET borrowernumber=?
WHERE borrowernumber = ?
# FIXME: move prepares outside while loop!
my $usth = $dbh->prepare("UPDATE accountlines SET amountoutstanding= ?
WHERE (accountlines_id = ?)");
- $usth->execute($newamtos,'$thisacct'); # FIXME: '$thisacct' is a string literal!
+ $usth->execute($newamtos,$thisacct);
$usth = $dbh->prepare("INSERT INTO accountoffsets
(borrowernumber, accountno, offsetaccount, offsetamount)
VALUES
my ($itemnumber) = @_;
return unless $itemnumber;
my $sth = C4::Context->dbh->prepare(
- "SELECT *
+ "SELECT items.*, issues.*
FROM issues
LEFT JOIN items ON issues.itemnumber=items.itemnumber
WHERE issues.itemnumber=?");
my $itemtype = (C4::Context->preference('item-level_itypes')) ? $biblio->{'itype'} : $biblio->{'itemtype'};
$datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
- $issuedata->{date_due} :
+ dt_from_string( $issuedata->{date_due} ) :
DateTime->now( time_zone => C4::Context->tz());
$datedue = CalcDateDue($datedue, $itemtype, $issuedata->{'branchcode'}, $borrower, 'is a renewal');
}
=head2 AnonymiseIssueHistory
- $rows = AnonymiseIssueHistory($date,$borrowernumber)
+ ($rows,$err_history_not_deleted) = AnonymiseIssueHistory($date,$borrowernumber)
This function write NULL instead of C<$borrowernumber> given on input arg into the table issues.
if C<$borrowernumber> is not set, it will delete the issue history for all borrower older than C<$date>.
If c<$borrowernumber> is set, it will delete issue history for only that borrower, regardless of their opac privacy
setting (force delete).
-return the number of affected rows.
+return the number of affected rows and a value that evaluates to true if an error occurred deleting the history.
=cut
}
my $sth = $dbh->prepare($query);
$sth->execute(@bind_params);
+ my $anonymisation_err = $dbh->err;
my $rows_affected = $sth->rows; ### doublecheck row count return function
- return $rows_affected;
+ return ($rows_affected, $anonymisation_err);
}
=head2 SendCirculationAlert