Lines 1336-1342
sub ModReserveStatus {
Link Here
|
1336 |
|
1336 |
|
1337 |
=head2 ModReserveAffect |
1337 |
=head2 ModReserveAffect |
1338 |
|
1338 |
|
1339 |
&ModReserveAffect({ itemnumber => $itemnumber, borrowernumber => $borrowernumber, force_transfer => $diffBranchSend }); |
1339 |
&ModReserveAffect({ item => $item, itemnumber => $itemnumber, borrowernumber => $borrowernumber, force_transfer => $diffBranchSend }); |
1340 |
|
1340 |
|
1341 |
This function affect an item and a status for a given reserve |
1341 |
This function affect an item and a status for a given reserve |
1342 |
The itemnumber parameter is used to find the biblionumber. |
1342 |
The itemnumber parameter is used to find the biblionumber. |
Lines 1351-1360
take care of the waiting status
Link Here
|
1351 |
|
1351 |
|
1352 |
sub ModReserveAffect { |
1352 |
sub ModReserveAffect { |
1353 |
my ( $params ) = @_; |
1353 |
my ( $params ) = @_; |
|
|
1354 |
my $item = $params->{item}; |
1354 |
my $borrowernumber = $params->{borrowernumber}; |
1355 |
my $borrowernumber = $params->{borrowernumber}; |
1355 |
my $itemnumber = $params->{itemnumber}; |
1356 |
my $itemnumber = $params->{itemnumber}; |
1356 |
my $force_transfer = $params->{force_transfer}; |
1357 |
my $force_transfer = $params->{force_transfer}; |
1357 |
|
1358 |
|
|
|
1359 |
if ( $item ) { |
1360 |
$itemnumber = $item->{itemnumber}; |
1361 |
} else { |
1362 |
$item = GetBiblioFromItemNumber( $itemnumber ); |
1363 |
} |
1364 |
|
1358 |
my $dbh = C4::Context->dbh; |
1365 |
my $dbh = C4::Context->dbh; |
1359 |
|
1366 |
|
1360 |
# we want to attach $itemnumber to $borrowernumber, find the biblionumber |
1367 |
# we want to attach $itemnumber to $borrowernumber, find the biblionumber |
Lines 1373-1381
sub ModReserveAffect {
Link Here
|
1373 |
my $request = GetReserveInfo($reserve_id); |
1380 |
my $request = GetReserveInfo($reserve_id); |
1374 |
my $already_on_shelf = ($request && $request->{found} eq 'W') ? 1 : 0; |
1381 |
my $already_on_shelf = ($request && $request->{found} eq 'W') ? 1 : 0; |
1375 |
|
1382 |
|
|
|
1383 |
my $transfer_to_do = 0; |
1384 |
if ( defined $force_transfer ) { |
1385 |
$transfer_to_do = $force_transfer; |
1386 |
} else { |
1387 |
my $userenv_branch = C4::Context->userenv->{'branch'} || ''; |
1388 |
$transfer_to_do = 1 |
1389 |
if $userenv_branch ne $request->{branchcode}; |
1390 |
} |
1391 |
|
1376 |
# If we affect a reserve that has to be transfered, don't set to Waiting |
1392 |
# If we affect a reserve that has to be transfered, don't set to Waiting |
1377 |
my $query; |
1393 |
my $query; |
1378 |
if ( $force_transfer ) { |
1394 |
if ( $transfer_to_do ) { |
1379 |
$query = " |
1395 |
$query = " |
1380 |
UPDATE reserves |
1396 |
UPDATE reserves |
1381 |
SET priority = 0, |
1397 |
SET priority = 0, |
Lines 1399-1405
sub ModReserveAffect {
Link Here
|
1399 |
} |
1415 |
} |
1400 |
$sth = $dbh->prepare($query); |
1416 |
$sth = $dbh->prepare($query); |
1401 |
$sth->execute( $itemnumber, $borrowernumber,$biblionumber); |
1417 |
$sth->execute( $itemnumber, $borrowernumber,$biblionumber); |
1402 |
_koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$force_transfer && !$already_on_shelf ); |
1418 |
|
|
|
1419 |
_koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) |
1420 |
unless $transfer_to_do or $already_on_shelf; |
1403 |
_FixPriority( { biblionumber => $biblionumber } ); |
1421 |
_FixPriority( { biblionumber => $biblionumber } ); |
1404 |
|
1422 |
|
1405 |
if ( C4::Context->preference("ReturnToShelvingCart") ) { |
1423 |
if ( C4::Context->preference("ReturnToShelvingCart") ) { |
Lines 1842-1848
sub _FixPriority {
Link Here
|
1842 |
$priority[$j]->{'reserve_id'} |
1860 |
$priority[$j]->{'reserve_id'} |
1843 |
); |
1861 |
); |
1844 |
} |
1862 |
} |
1845 |
|
1863 |
|
1846 |
$sth = $dbh->prepare( "SELECT reserve_id FROM reserves WHERE lowestPriority = 1 ORDER BY priority" ); |
1864 |
$sth = $dbh->prepare( "SELECT reserve_id FROM reserves WHERE lowestPriority = 1 ORDER BY priority" ); |
1847 |
$sth->execute(); |
1865 |
$sth->execute(); |
1848 |
|
1866 |
|