Lines 1228-1234
sub ModReserveStatus {
Link Here
|
1228 |
|
1228 |
|
1229 |
=head2 ModReserveAffect |
1229 |
=head2 ModReserveAffect |
1230 |
|
1230 |
|
1231 |
&ModReserveAffect({ itemnumber => $itemnumber, borrowernumber => $borrowernumber, force_transfer => $diffBranchSend }); |
1231 |
&ModReserveAffect({ item => $item, itemnumber => $itemnumber, borrowernumber => $borrowernumber, force_transfer => $diffBranchSend }); |
1232 |
|
1232 |
|
1233 |
This function affect an item and a status for a given reserve |
1233 |
This function affect an item and a status for a given reserve |
1234 |
The itemnumber parameter is used to find the biblionumber. |
1234 |
The itemnumber parameter is used to find the biblionumber. |
Lines 1243-1252
take care of the waiting status
Link Here
|
1243 |
|
1243 |
|
1244 |
sub ModReserveAffect { |
1244 |
sub ModReserveAffect { |
1245 |
my ( $params ) = @_; |
1245 |
my ( $params ) = @_; |
|
|
1246 |
my $item = $params->{item}; |
1246 |
my $borrowernumber = $params->{borrowernumber}; |
1247 |
my $borrowernumber = $params->{borrowernumber}; |
1247 |
my $itemnumber = $params->{itemnumber}; |
1248 |
my $itemnumber = $params->{itemnumber}; |
1248 |
my $force_transfer = $params->{force_transfer}; |
1249 |
my $force_transfer = $params->{force_transfer}; |
1249 |
|
1250 |
|
|
|
1251 |
if ( $item ) { |
1252 |
$itemnumber = $item->{itemnumber}; |
1253 |
} else { |
1254 |
$item = GetBiblioFromItemNumber( $itemnumber ); |
1255 |
} |
1256 |
|
1250 |
my $dbh = C4::Context->dbh; |
1257 |
my $dbh = C4::Context->dbh; |
1251 |
|
1258 |
|
1252 |
# we want to attach $itemnumber to $borrowernumber, find the biblionumber |
1259 |
# we want to attach $itemnumber to $borrowernumber, find the biblionumber |
Lines 1265-1273
sub ModReserveAffect {
Link Here
|
1265 |
my $request = GetReserveInfo($reserve_id); |
1272 |
my $request = GetReserveInfo($reserve_id); |
1266 |
my $already_on_shelf = ($request && $request->{found} eq 'W') ? 1 : 0; |
1273 |
my $already_on_shelf = ($request && $request->{found} eq 'W') ? 1 : 0; |
1267 |
|
1274 |
|
|
|
1275 |
my $transfer_to_do = 0; |
1276 |
if ( defined $force_transfer ) { |
1277 |
$transfer_to_do = $force_transfer; |
1278 |
} else { |
1279 |
my $userenv_branch = C4::Context->userenv->{'branch'} || ''; |
1280 |
$transfer_to_do = 1 |
1281 |
if $userenv_branch ne $request->{branchcode}; |
1282 |
} |
1283 |
|
1268 |
# If we affect a reserve that has to be transfered, don't set to Waiting |
1284 |
# If we affect a reserve that has to be transfered, don't set to Waiting |
1269 |
my $query; |
1285 |
my $query; |
1270 |
if ( $force_transfer ) { |
1286 |
if ( $transfer_to_do ) { |
1271 |
$query = " |
1287 |
$query = " |
1272 |
UPDATE reserves |
1288 |
UPDATE reserves |
1273 |
SET priority = 0, |
1289 |
SET priority = 0, |
Lines 1291-1297
sub ModReserveAffect {
Link Here
|
1291 |
} |
1307 |
} |
1292 |
$sth = $dbh->prepare($query); |
1308 |
$sth = $dbh->prepare($query); |
1293 |
$sth->execute( $itemnumber, $borrowernumber,$biblionumber); |
1309 |
$sth->execute( $itemnumber, $borrowernumber,$biblionumber); |
1294 |
_koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$force_transfer && !$already_on_shelf ); |
1310 |
|
|
|
1311 |
_koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) |
1312 |
unless $transfer_to_do or $already_on_shelf; |
1295 |
|
1313 |
|
1296 |
if ( C4::Context->preference("ReturnToShelvingCart") ) { |
1314 |
if ( C4::Context->preference("ReturnToShelvingCart") ) { |
1297 |
CartToShelf( $itemnumber ); |
1315 |
CartToShelf( $itemnumber ); |
Lines 1727-1733
sub _FixPriority {
Link Here
|
1727 |
$priority[$j]->{'reserve_id'} |
1745 |
$priority[$j]->{'reserve_id'} |
1728 |
); |
1746 |
); |
1729 |
} |
1747 |
} |
1730 |
|
1748 |
|
1731 |
$sth = $dbh->prepare( "SELECT reserve_id FROM reserves WHERE lowestPriority = 1 ORDER BY priority" ); |
1749 |
$sth = $dbh->prepare( "SELECT reserve_id FROM reserves WHERE lowestPriority = 1 ORDER BY priority" ); |
1732 |
$sth->execute(); |
1750 |
$sth->execute(); |
1733 |
|
1751 |
|