Lines 1139-1164
Returns:
Link Here
|
1139 |
=cut |
1139 |
=cut |
1140 |
|
1140 |
|
1141 |
sub CanBookBeReturned { |
1141 |
sub CanBookBeReturned { |
1142 |
my ($item, $branch) = @_; |
1142 |
my ($item, $branch) = @_; |
1143 |
my $allowreturntobranch = C4::Context->preference("AllowReturnToBranch") || 'anywhere'; |
1143 |
my $allowreturntobranch = C4::Context->preference("AllowReturnToBranch") || 'anywhere'; |
1144 |
|
1144 |
|
1145 |
# assume return is allowed to start |
1145 |
# assume return is allowed to start |
1146 |
my $allowed = 1; |
1146 |
my $allowed = 1; |
1147 |
my $message; |
1147 |
my $message; |
1148 |
|
1148 |
|
1149 |
# identify all cases where return is forbidden |
1149 |
# identify all cases where return is forbidden |
1150 |
if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) { |
1150 |
if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) { |
1151 |
$allowed = 0; |
1151 |
$allowed = 0; |
1152 |
$message = $item->homebranch; |
1152 |
$message = $item->homebranch; |
1153 |
} elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) { |
1153 |
} elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) { |
1154 |
$allowed = 0; |
1154 |
$allowed = 0; |
1155 |
$message = $item->holdingbranch; |
1155 |
$message = $item->holdingbranch; |
1156 |
} elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) { |
1156 |
} elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) { |
1157 |
$allowed = 0; |
1157 |
$allowed = 0; |
1158 |
$message = $item->homebranch; # FIXME: choice of homebranch is arbitrary |
1158 |
$message = $item->homebranch; # FIXME: choice of homebranch is arbitrary |
1159 |
} |
1159 |
} |
1160 |
|
1160 |
|
1161 |
return ($allowed, $message); |
1161 |
return ($allowed, $message); |
1162 |
} |
1162 |
} |
1163 |
|
1163 |
|
1164 |
=head2 CheckHighHolds |
1164 |
=head2 CheckHighHolds |
1165 |
- |
|
|