|
Lines 1899-1906
sub AddReturn {
Link Here
|
| 1899 |
} |
1899 |
} |
| 1900 |
} |
1900 |
} |
| 1901 |
|
1901 |
|
| 1902 |
MarkIssueReturned( $borrowernumber, $item->{'itemnumber'}, |
1902 |
eval { |
| 1903 |
$circControlBranch, $return_date, $borrower->{'privacy'} ); |
1903 |
MarkIssueReturned( $borrowernumber, $item->{'itemnumber'}, |
|
|
1904 |
$circControlBranch, $return_date, $borrower->{'privacy'} ); |
| 1905 |
}; |
| 1906 |
if ( $@ ) { |
| 1907 |
$messages->{'Wrongbranch'} = { |
| 1908 |
Wrongbranch => $branch, |
| 1909 |
Rightbranch => $message |
| 1910 |
}; |
| 1911 |
carp $@; |
| 1912 |
return ( 0, { WasReturned => 0 }, $issue, $borrower ); |
| 1913 |
} |
| 1904 |
|
1914 |
|
| 1905 |
# FIXME is the "= 1" right? This could be the borrower hash. |
1915 |
# FIXME is the "= 1" right? This could be the borrower hash. |
| 1906 |
$messages->{'WasReturned'} = 1; |
1916 |
$messages->{'WasReturned'} = 1; |
|
Lines 2075-2080
routine in C<C4::Accounts>.
Link Here
|
| 2075 |
sub MarkIssueReturned { |
2085 |
sub MarkIssueReturned { |
| 2076 |
my ( $borrowernumber, $itemnumber, $dropbox_branch, $returndate, $privacy ) = @_; |
2086 |
my ( $borrowernumber, $itemnumber, $dropbox_branch, $returndate, $privacy ) = @_; |
| 2077 |
|
2087 |
|
|
|
2088 |
my $anonymouspatron; |
| 2089 |
if ( $privacy == 2 ) { |
| 2090 |
# The default of 0 will not work due to foreign key constraints |
| 2091 |
# The anonymisation will fail if AnonymousPatron is not a valid entry |
| 2092 |
# We need to check if the anonymous patron exist, Koha will fail loudly if it does not |
| 2093 |
# Note that a warning should appear on the about page (System information tab). |
| 2094 |
$anonymouspatron = C4::Context->preference('AnonymousPatron'); |
| 2095 |
die "Fatal error: the patron ($borrowernumber) has requested a privacy on returning item but the AnonymousPatron pref is not set correctly" |
| 2096 |
unless C4::Members::GetMember( borrowernumber => $anonymouspatron ); |
| 2097 |
} |
| 2078 |
my $dbh = C4::Context->dbh; |
2098 |
my $dbh = C4::Context->dbh; |
| 2079 |
my $query = 'UPDATE issues SET returndate='; |
2099 |
my $query = 'UPDATE issues SET returndate='; |
| 2080 |
my @bind; |
2100 |
my @bind; |
|
Lines 2100-2109
sub MarkIssueReturned {
Link Here
|
| 2100 |
$sth_copy->execute($borrowernumber, $itemnumber); |
2120 |
$sth_copy->execute($borrowernumber, $itemnumber); |
| 2101 |
# anonymise patron checkout immediately if $privacy set to 2 and AnonymousPatron is set to a valid borrowernumber |
2121 |
# anonymise patron checkout immediately if $privacy set to 2 and AnonymousPatron is set to a valid borrowernumber |
| 2102 |
if ( $privacy == 2) { |
2122 |
if ( $privacy == 2) { |
| 2103 |
# The default of 0 does not work due to foreign key constraints |
|
|
| 2104 |
# The anonymisation will fail quietly if AnonymousPatron is not a valid entry |
| 2105 |
# FIXME the above is unacceptable - bug 9942 relates |
| 2106 |
my $anonymouspatron = (C4::Context->preference('AnonymousPatron')) ? C4::Context->preference('AnonymousPatron') : 0; |
| 2107 |
my $sth_ano = $dbh->prepare("UPDATE old_issues SET borrowernumber=? |
2123 |
my $sth_ano = $dbh->prepare("UPDATE old_issues SET borrowernumber=? |
| 2108 |
WHERE borrowernumber = ? |
2124 |
WHERE borrowernumber = ? |
| 2109 |
AND itemnumber = ?"); |
2125 |
AND itemnumber = ?"); |