Lines 1143-1149
Returns:
Link Here
|
1143 |
|
1143 |
|
1144 |
=item C<$returnallowed> is 0 or 1, corresponding to whether the return is allowed (1) or not (0) |
1144 |
=item C<$returnallowed> is 0 or 1, corresponding to whether the return is allowed (1) or not (0) |
1145 |
|
1145 |
|
1146 |
=item C<$message> is the branchcode where the item SHOULD be returned, if the return is not allowed |
1146 |
=item C<$message> is a HASHref of following possible keys: |
|
|
1147 |
|
1148 |
C<toBranch> branchcode where the item SHOULD be returned, if the return is not allowed |
1149 |
C<transferLimit> transfer limit exists, HASHref of following keys: C<from>, C<to> |
1147 |
|
1150 |
|
1148 |
=back |
1151 |
=back |
1149 |
|
1152 |
|
Lines 1155-1172
sub CanBookBeReturned {
Link Here
|
1155 |
|
1158 |
|
1156 |
# assume return is allowed to start |
1159 |
# assume return is allowed to start |
1157 |
my $allowed = 1; |
1160 |
my $allowed = 1; |
|
|
1161 |
my $to_branch = $branch; |
1158 |
my $message; |
1162 |
my $message; |
1159 |
|
1163 |
|
1160 |
# identify all cases where return is forbidden |
1164 |
# identify all cases where return is forbidden |
1161 |
if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) { |
1165 |
if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) { |
1162 |
$allowed = 0; |
1166 |
$allowed = 0; |
1163 |
$message = $item->homebranch; |
1167 |
$message->{toBranch} = $to_branch = $item->homebranch; |
1164 |
} elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) { |
1168 |
} elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) { |
1165 |
$allowed = 0; |
1169 |
$allowed = 0; |
1166 |
$message = $item->holdingbranch; |
1170 |
$message->{toBranch} = $to_branch = $item->holdingbranch; |
1167 |
} elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) { |
1171 |
} elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) { |
1168 |
$allowed = 0; |
1172 |
$allowed = 0; |
1169 |
$message = $item->homebranch; # FIXME: choice of homebranch is arbitrary |
1173 |
$message->{toBranch} = $to_branch = $item->homebranch; # FIXME: choice of homebranch is arbitrary |
|
|
1174 |
} |
1175 |
|
1176 |
# Make sure there are no branch transfer limits between item's current |
1177 |
# branch (holdinbranch) and the return branch |
1178 |
my $to_library = Koha::Libraries->find($to_branch); |
1179 |
if (!$item->can_be_transferred({ to => $to_library })) { |
1180 |
$allowed = 0; |
1181 |
$message->{transferLimit} = { |
1182 |
from => $item->holdingbranch, |
1183 |
to => $to_branch |
1184 |
}; |
1170 |
} |
1185 |
} |
1171 |
|
1186 |
|
1172 |
return ($allowed, $message); |
1187 |
return ($allowed, $message); |
Lines 1830-1835
This book has was returned to the wrong branch. The value is a hashref
Link Here
|
1830 |
so that C<$messages->{Wrongbranch}->{Wrongbranch}> and C<$messages->{Wrongbranch}->{Rightbranch}> |
1845 |
so that C<$messages->{Wrongbranch}->{Wrongbranch}> and C<$messages->{Wrongbranch}->{Rightbranch}> |
1831 |
contain the branchcode of the incorrect and correct return library, respectively. |
1846 |
contain the branchcode of the incorrect and correct return library, respectively. |
1832 |
|
1847 |
|
|
|
1848 |
=item C<Transferlimit> |
1849 |
|
1850 |
A transfer limit exists between item's holding branch and the return branch. |
1851 |
|
1833 |
=item C<ResFound> |
1852 |
=item C<ResFound> |
1834 |
|
1853 |
|
1835 |
The item was reserved. The value is a reference-to-hash whose keys are |
1854 |
The item was reserved. The value is a reference-to-hash whose keys are |
Lines 1958-1965
sub AddReturn {
Link Here
|
1958 |
unless ($returnallowed){ |
1977 |
unless ($returnallowed){ |
1959 |
$messages->{'Wrongbranch'} = { |
1978 |
$messages->{'Wrongbranch'} = { |
1960 |
Wrongbranch => $branch, |
1979 |
Wrongbranch => $branch, |
1961 |
Rightbranch => $message |
1980 |
Rightbranch => $message->{toBranch} |
1962 |
}; |
1981 |
} if $message->{toBranch}; |
|
|
1982 |
|
1983 |
if ($message->{'transferLimit'}) { |
1984 |
$messages->{'Transferlimit'} = $message->{'transferLimit'}; |
1985 |
} |
1986 |
|
1963 |
$doreturn = 0; |
1987 |
$doreturn = 0; |
1964 |
return ( $doreturn, $messages, $issue, $patron_unblessed); |
1988 |
return ( $doreturn, $messages, $issue, $patron_unblessed); |
1965 |
} |
1989 |
} |