|
Lines 1427-1433
sub AddIssue {
Link Here
|
| 1427 |
} |
1427 |
} |
| 1428 |
); |
1428 |
); |
| 1429 |
|
1429 |
|
| 1430 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { ## ReturnToShelvingCart is on, anything issued should be taken off the cart. |
1430 |
if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) { |
|
|
1431 |
## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. |
| 1431 |
CartToShelf( $item->{'itemnumber'} ); |
1432 |
CartToShelf( $item->{'itemnumber'} ); |
| 1432 |
} |
1433 |
} |
| 1433 |
$item->{'issues'}++; |
1434 |
$item->{'issues'}++; |
|
Lines 1924-1940
sub AddReturn {
Link Here
|
| 1924 |
|
1925 |
|
| 1925 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1926 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
| 1926 |
|
1927 |
|
| 1927 |
if ( $item->{'location'} eq 'PROC' ) { |
|
|
| 1928 |
if ( C4::Context->preference("InProcessingToShelvingCart") ) { |
| 1929 |
$item->{'location'} = 'CART'; |
| 1930 |
} |
| 1931 |
else { |
| 1932 |
$item->{location} = $item->{permanent_location}; |
| 1933 |
} |
| 1934 |
|
| 1935 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
| 1936 |
} |
| 1937 |
|
| 1938 |
# full item data, but no borrowernumber or checkout info (no issue) |
1928 |
# full item data, but no borrowernumber or checkout info (no issue) |
| 1939 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1929 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
| 1940 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
1930 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
|
Lines 1944-1949
sub AddReturn {
Link Here
|
| 1944 |
|
1934 |
|
| 1945 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1935 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
| 1946 |
|
1936 |
|
|
|
1937 |
my $yaml = C4::Context->preference('UpdateItemLocationOnCheckin'); |
| 1938 |
if ($yaml) { |
| 1939 |
$yaml = "$yaml\n\n"; # YAML is strict on ending \n. Surplus does not hurt |
| 1940 |
my $rules; |
| 1941 |
eval { $rules = YAML::Load($yaml); }; |
| 1942 |
if ($@) { |
| 1943 |
warn "Unable to parse UpdateItemLocationOnCheckin syspref : $@"; |
| 1944 |
} |
| 1945 |
else { |
| 1946 |
if (defined $rules->{_ALL_}) { |
| 1947 |
if ($rules->{_ALL_} eq '_PERM_') { $rules->{_ALL_} = $item->{permanent_location}; } |
| 1948 |
if ($rules->{_ALL_} eq '_BLANK_') { $rules->{_ALL_} = ''; } |
| 1949 |
if ( $item->{location} ne $rules->{_ALL_}) { |
| 1950 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{_ALL_} }; |
| 1951 |
ModItem( { location => $rules->{_ALL_} }, undef, $itemnumber ); |
| 1952 |
} |
| 1953 |
} |
| 1954 |
else { |
| 1955 |
foreach my $key ( keys %$rules ) { |
| 1956 |
if ( $rules->{$key} eq '_PERM_' ) { $rules->{$key} = $item->{permanent_location}; } |
| 1957 |
if ( $rules->{$key} eq '_BLANK_') { $rules->{$key} = '' ;} |
| 1958 |
if ( ($item->{location} eq $key && $item->{location} ne $rules->{$key}) || ($key eq '_BLANK_' && $item->{location} eq '' && $rules->{$key} ne '') ) { |
| 1959 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{$key} }; |
| 1960 |
ModItem( { location => $rules->{$key} }, undef, $itemnumber ); |
| 1961 |
last; |
| 1962 |
} |
| 1963 |
} |
| 1964 |
} |
| 1965 |
} |
| 1966 |
} |
| 1967 |
|
| 1947 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
1968 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
| 1948 |
if ($yaml) { |
1969 |
if ($yaml) { |
| 1949 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
1970 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
|
Lines 2095-2109
sub AddReturn {
Link Here
|
| 2095 |
); |
2116 |
); |
| 2096 |
$sth->execute( $item->{'itemnumber'} ); |
2117 |
$sth->execute( $item->{'itemnumber'} ); |
| 2097 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
2118 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
| 2098 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
|
|
| 2099 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
2119 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
| 2100 |
} else { |
2120 |
} else { |
| 2101 |
$messages->{'WrongTransfer'} = $tobranch; |
2121 |
$messages->{'WrongTransfer'} = $tobranch; |
| 2102 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
2122 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
| 2103 |
} |
2123 |
} |
| 2104 |
$validTransfert = 1; |
2124 |
$validTransfert = 1; |
| 2105 |
} else { |
|
|
| 2106 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
| 2107 |
} |
2125 |
} |
| 2108 |
|
2126 |
|
| 2109 |
# fix up the accounts..... |
2127 |
# fix up the accounts..... |