Lines 1215-1221
sub ModReserveStatus {
Link Here
|
1215 |
|
1215 |
|
1216 |
=head2 ModReserveAffect |
1216 |
=head2 ModReserveAffect |
1217 |
|
1217 |
|
1218 |
&ModReserveAffect({ itemnumber => $itemnumber, borrowernumber => $borrowernumber, force_transfer => $diffBranchSend }); |
1218 |
&ModReserveAffect({ item => $item, itemnumber => $itemnumber, borrowernumber => $borrowernumber, force_transfer => $diffBranchSend }); |
1219 |
|
1219 |
|
1220 |
This function affect an item and a status for a given reserve |
1220 |
This function affect an item and a status for a given reserve |
1221 |
The itemnumber parameter is used to find the biblionumber. |
1221 |
The itemnumber parameter is used to find the biblionumber. |
Lines 1230-1239
take care of the waiting status
Link Here
|
1230 |
|
1230 |
|
1231 |
sub ModReserveAffect { |
1231 |
sub ModReserveAffect { |
1232 |
my ( $params ) = @_; |
1232 |
my ( $params ) = @_; |
|
|
1233 |
my $item = $params->{item}; |
1233 |
my $borrowernumber = $params->{borrowernumber}; |
1234 |
my $borrowernumber = $params->{borrowernumber}; |
1234 |
my $itemnumber = $params->{itemnumber}; |
1235 |
my $itemnumber = $params->{itemnumber}; |
1235 |
my $force_transfer = $params->{force_transfer}; |
1236 |
my $force_transfer = $params->{force_transfer}; |
1236 |
|
1237 |
|
|
|
1238 |
if ( $item ) { |
1239 |
$itemnumber = $item->{itemnumber}; |
1240 |
} else { |
1241 |
$item = GetBiblioFromItemNumber( $itemnumber ); |
1242 |
} |
1243 |
|
1237 |
my $dbh = C4::Context->dbh; |
1244 |
my $dbh = C4::Context->dbh; |
1238 |
|
1245 |
|
1239 |
# we want to attach $itemnumber to $borrowernumber, find the biblionumber |
1246 |
# we want to attach $itemnumber to $borrowernumber, find the biblionumber |
Lines 1252-1260
sub ModReserveAffect {
Link Here
|
1252 |
my $request = GetReserveInfo($reserve_id); |
1259 |
my $request = GetReserveInfo($reserve_id); |
1253 |
my $already_on_shelf = ($request && $request->{found} eq 'W') ? 1 : 0; |
1260 |
my $already_on_shelf = ($request && $request->{found} eq 'W') ? 1 : 0; |
1254 |
|
1261 |
|
|
|
1262 |
my $transfer_to_do = 0; |
1263 |
if ( defined $force_transfer ) { |
1264 |
$transfer_to_do = $force_transfer; |
1265 |
} else { |
1266 |
my $userenv_branch = C4::Context->userenv->{'branch'} || ''; |
1267 |
$transfer_to_do = 1 |
1268 |
if $userenv_branch ne $request->{branchcode}; |
1269 |
} |
1270 |
|
1255 |
# If we affect a reserve that has to be transfered, don't set to Waiting |
1271 |
# If we affect a reserve that has to be transfered, don't set to Waiting |
1256 |
my $query; |
1272 |
my $query; |
1257 |
if ( $force_transfer ) { |
1273 |
if ( $transfer_to_do ) { |
1258 |
$query = " |
1274 |
$query = " |
1259 |
UPDATE reserves |
1275 |
UPDATE reserves |
1260 |
SET priority = 0, |
1276 |
SET priority = 0, |
Lines 1278-1284
sub ModReserveAffect {
Link Here
|
1278 |
} |
1294 |
} |
1279 |
$sth = $dbh->prepare($query); |
1295 |
$sth = $dbh->prepare($query); |
1280 |
$sth->execute( $itemnumber, $borrowernumber,$biblionumber); |
1296 |
$sth->execute( $itemnumber, $borrowernumber,$biblionumber); |
1281 |
_koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$force_transfer && !$already_on_shelf ); |
1297 |
|
|
|
1298 |
_koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) |
1299 |
unless $transfer_to_do or $already_on_shelf; |
1282 |
|
1300 |
|
1283 |
if ( C4::Context->preference("ReturnToShelvingCart") ) { |
1301 |
if ( C4::Context->preference("ReturnToShelvingCart") ) { |
1284 |
CartToShelf( $itemnumber ); |
1302 |
CartToShelf( $itemnumber ); |
Lines 1714-1720
sub _FixPriority {
Link Here
|
1714 |
$priority[$j]->{'reserve_id'} |
1732 |
$priority[$j]->{'reserve_id'} |
1715 |
); |
1733 |
); |
1716 |
} |
1734 |
} |
1717 |
|
1735 |
|
1718 |
$sth = $dbh->prepare( "SELECT reserve_id FROM reserves WHERE lowestPriority = 1 ORDER BY priority" ); |
1736 |
$sth = $dbh->prepare( "SELECT reserve_id FROM reserves WHERE lowestPriority = 1 ORDER BY priority" ); |
1719 |
$sth->execute(); |
1737 |
$sth->execute(); |
1720 |
|
1738 |
|