Lines 1498-1504
sub AddIssue {
Link Here
|
1498 |
my $dbh = C4::Context->dbh; |
1498 |
my $dbh = C4::Context->dbh; |
1499 |
my $barcodecheck = CheckValidBarcode($barcode); |
1499 |
my $barcodecheck = CheckValidBarcode($barcode); |
1500 |
|
1500 |
|
1501 |
my $issue; |
1501 |
my ($issue, $item_location_updated); |
1502 |
|
1502 |
|
1503 |
if ( $datedue && ref $datedue ne 'DateTime' ) { |
1503 |
if ( $datedue && ref $datedue ne 'DateTime' ) { |
1504 |
$datedue = dt_from_string($datedue); |
1504 |
$datedue = dt_from_string($datedue); |
Lines 1675-1680
sub AddIssue {
Link Here
|
1675 |
CartToShelf( $item_object->itemnumber ); |
1675 |
CartToShelf( $item_object->itemnumber ); |
1676 |
} |
1676 |
} |
1677 |
|
1677 |
|
|
|
1678 |
# Update item location |
1679 |
$item_location_updated = $item_object->update_item_location( 'checkout' ); |
1680 |
|
1678 |
if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { |
1681 |
if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { |
1679 |
UpdateTotalIssues( $item_object->biblionumber, 1, undef, { skip_holds_queue => 1 } ); |
1682 |
UpdateTotalIssues( $item_object->biblionumber, 1, undef, { skip_holds_queue => 1 } ); |
1680 |
} |
1683 |
} |
Lines 1787-1793
sub AddIssue {
Link Here
|
1787 |
) if C4::Context->preference('RealTimeHoldsQueue'); |
1790 |
) if C4::Context->preference('RealTimeHoldsQueue'); |
1788 |
} |
1791 |
} |
1789 |
} |
1792 |
} |
1790 |
return $issue; |
1793 |
return ($issue, $item_location_updated); |
1791 |
} |
1794 |
} |
1792 |
|
1795 |
|
1793 |
=head2 GetLoanLength |
1796 |
=head2 GetLoanLength |
Lines 2104-2135
sub AddReturn {
Link Here
|
2104 |
my $borrowernumber = $patron ? $patron->borrowernumber : undef; # we don't know if we had a borrower or not |
2107 |
my $borrowernumber = $patron ? $patron->borrowernumber : undef; # we don't know if we had a borrower or not |
2105 |
my $patron_unblessed = $patron ? $patron->unblessed : {}; |
2108 |
my $patron_unblessed = $patron ? $patron->unblessed : {}; |
2106 |
|
2109 |
|
2107 |
my $update_loc_rules = Koha::Config::SysPrefs->find('UpdateItemLocationOnCheckin')->get_yaml_pref_hash(); |
2110 |
# Update item location |
2108 |
map { $update_loc_rules->{$_} = $update_loc_rules->{$_}[0] } keys %$update_loc_rules; #We can only move to one location so we flatten the arrays |
2111 |
$messages = $item->update_item_location( 'checkin' ); |
2109 |
if ($update_loc_rules) { |
|
|
2110 |
if (defined $update_loc_rules->{_ALL_}) { |
2111 |
if ($update_loc_rules->{_ALL_} eq '_PERM_') { $update_loc_rules->{_ALL_} = $item->permanent_location; } |
2112 |
if ($update_loc_rules->{_ALL_} eq '_BLANK_') { $update_loc_rules->{_ALL_} = ''; } |
2113 |
if ( |
2114 |
( defined $item->location && $item->location ne $update_loc_rules->{_ALL_}) || |
2115 |
(!defined $item->location && $update_loc_rules->{_ALL_} ne "") |
2116 |
) { |
2117 |
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{_ALL_} }; |
2118 |
$item->location($update_loc_rules->{_ALL_})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1}); |
2119 |
} |
2120 |
} |
2121 |
else { |
2122 |
foreach my $key ( keys %$update_loc_rules ) { |
2123 |
if ( $update_loc_rules->{$key} eq '_PERM_' ) { $update_loc_rules->{$key} = $item->permanent_location; } |
2124 |
if ( $update_loc_rules->{$key} eq '_BLANK_') { $update_loc_rules->{$key} = '' ;} |
2125 |
if ( ($item->location eq $key && $item->location ne $update_loc_rules->{$key}) || ($key eq '_BLANK_' && $item->location eq '' && $update_loc_rules->{$key} ne '') ) { |
2126 |
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{$key} }; |
2127 |
$item->location($update_loc_rules->{$key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1}); |
2128 |
last; |
2129 |
} |
2130 |
} |
2131 |
} |
2132 |
} |
2133 |
|
2112 |
|
2134 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
2113 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
2135 |
if ($yaml) { |
2114 |
if ($yaml) { |