Lines 1132-1138
Returns:
Link Here
|
1132 |
|
1132 |
|
1133 |
=item C<$returnallowed> is 0 or 1, corresponding to whether the return is allowed (1) or not (0) |
1133 |
=item C<$returnallowed> is 0 or 1, corresponding to whether the return is allowed (1) or not (0) |
1134 |
|
1134 |
|
1135 |
=item C<$message> is the branchcode where the item SHOULD be returned, if the return is not allowed |
1135 |
=item C<$message> is a HASHref of following possible keys: |
|
|
1136 |
|
1137 |
C<toBranch> branchcode where the item SHOULD be returned, if the return is not allowed |
1138 |
C<transferLimit> transfer limit exists, HASHref of following keys: C<from>, C<to> |
1136 |
|
1139 |
|
1137 |
=back |
1140 |
=back |
1138 |
|
1141 |
|
Lines 1144-1161
sub CanBookBeReturned {
Link Here
|
1144 |
|
1147 |
|
1145 |
# assume return is allowed to start |
1148 |
# assume return is allowed to start |
1146 |
my $allowed = 1; |
1149 |
my $allowed = 1; |
|
|
1150 |
my $to_branch = $branch; |
1147 |
my $message; |
1151 |
my $message; |
1148 |
|
1152 |
|
1149 |
# identify all cases where return is forbidden |
1153 |
# identify all cases where return is forbidden |
1150 |
if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) { |
1154 |
if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) { |
1151 |
$allowed = 0; |
1155 |
$allowed = 0; |
1152 |
$message = $item->homebranch; |
1156 |
$message->{toBranch} = $to_branch = $item->homebranch; |
1153 |
} elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) { |
1157 |
} elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) { |
1154 |
$allowed = 0; |
1158 |
$allowed = 0; |
1155 |
$message = $item->holdingbranch; |
1159 |
$message->{toBranch} = $to_branch = $item->holdingbranch; |
1156 |
} elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) { |
1160 |
} elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) { |
1157 |
$allowed = 0; |
1161 |
$allowed = 0; |
1158 |
$message = $item->homebranch; # FIXME: choice of homebranch is arbitrary |
1162 |
$message->{toBranch} = $to_branch = $item->homebranch; # FIXME: choice of homebranch is arbitrary |
|
|
1163 |
} |
1164 |
|
1165 |
# Make sure there are no branch transfer limits between item's current |
1166 |
# branch (holdinbranch) and the return branch |
1167 |
my $to_library = Koha::Libraries->find($to_branch); |
1168 |
if (!$item->can_be_transferred({ to => $to_library })) { |
1169 |
$allowed = 0; |
1170 |
$message->{transferLimit} = { |
1171 |
from => $item->holdingbranch, |
1172 |
to => $to_branch |
1173 |
}; |
1159 |
} |
1174 |
} |
1160 |
|
1175 |
|
1161 |
return ($allowed, $message); |
1176 |
return ($allowed, $message); |
Lines 1803-1808
This book has was returned to the wrong branch. The value is a hashref
Link Here
|
1803 |
so that C<$messages->{Wrongbranch}->{Wrongbranch}> and C<$messages->{Wrongbranch}->{Rightbranch}> |
1818 |
so that C<$messages->{Wrongbranch}->{Wrongbranch}> and C<$messages->{Wrongbranch}->{Rightbranch}> |
1804 |
contain the branchcode of the incorrect and correct return library, respectively. |
1819 |
contain the branchcode of the incorrect and correct return library, respectively. |
1805 |
|
1820 |
|
|
|
1821 |
=item C<Transferlimit> |
1822 |
|
1823 |
A transfer limit exists between item's holding branch and the return branch. |
1824 |
|
1806 |
=item C<ResFound> |
1825 |
=item C<ResFound> |
1807 |
|
1826 |
|
1808 |
The item was reserved. The value is a reference-to-hash whose keys are |
1827 |
The item was reserved. The value is a reference-to-hash whose keys are |
Lines 1928-1935
sub AddReturn {
Link Here
|
1928 |
unless ($returnallowed){ |
1947 |
unless ($returnallowed){ |
1929 |
$messages->{'Wrongbranch'} = { |
1948 |
$messages->{'Wrongbranch'} = { |
1930 |
Wrongbranch => $branch, |
1949 |
Wrongbranch => $branch, |
1931 |
Rightbranch => $message |
1950 |
Rightbranch => $message->{toBranch} |
1932 |
}; |
1951 |
} if $message->{toBranch}; |
|
|
1952 |
|
1953 |
if ($message->{'transferLimit'}) { |
1954 |
$messages->{'Transferlimit'} = $message->{'transferLimit'}; |
1955 |
} |
1956 |
|
1933 |
$doreturn = 0; |
1957 |
$doreturn = 0; |
1934 |
return ( $doreturn, $messages, $issue, $patron_unblessed); |
1958 |
return ( $doreturn, $messages, $issue, $patron_unblessed); |
1935 |
} |
1959 |
} |