|
Lines 1451-1456
sub AddIssue {
Link Here
|
| 1451 |
} |
1451 |
} |
| 1452 |
); |
1452 |
); |
| 1453 |
|
1453 |
|
|
|
1454 |
if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) { |
| 1455 |
## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. |
| 1456 |
CartToShelf( $item->{'itemnumber'} ); |
| 1457 |
} |
| 1458 |
$item->{'issues'}++; |
| 1459 |
if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { |
| 1460 |
UpdateTotalIssues($item->{'biblionumber'}, 1); |
| 1461 |
} |
| 1462 |
|
| 1454 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { |
1463 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { |
| 1455 |
# ReturnToShelvingCart is on, anything issued should be taken off the cart. |
1464 |
# ReturnToShelvingCart is on, anything issued should be taken off the cart. |
| 1456 |
CartToShelf( $item->{'itemnumber'} ); |
1465 |
CartToShelf( $item->{'itemnumber'} ); |
|
Lines 1965-1981
sub AddReturn {
Link Here
|
| 1965 |
|
1974 |
|
| 1966 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1975 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
| 1967 |
|
1976 |
|
| 1968 |
if ( $item->{'location'} eq 'PROC' ) { |
|
|
| 1969 |
if ( C4::Context->preference("InProcessingToShelvingCart") ) { |
| 1970 |
$item->{'location'} = 'CART'; |
| 1971 |
} |
| 1972 |
else { |
| 1973 |
$item->{location} = $item->{permanent_location}; |
| 1974 |
} |
| 1975 |
|
| 1976 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
| 1977 |
} |
| 1978 |
|
| 1979 |
# full item data, but no borrowernumber or checkout info (no issue) |
1977 |
# full item data, but no borrowernumber or checkout info (no issue) |
| 1980 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1978 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
| 1981 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
1979 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
|
Lines 1985-1990
sub AddReturn {
Link Here
|
| 1985 |
|
1983 |
|
| 1986 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1984 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
| 1987 |
|
1985 |
|
|
|
1986 |
my $yaml = C4::Context->preference('UpdateItemLocationOnCheckin'); |
| 1987 |
if ($yaml) { |
| 1988 |
$yaml = "$yaml\n\n"; # YAML is strict on ending \n. Surplus does not hurt |
| 1989 |
my $rules; |
| 1990 |
eval { $rules = YAML::Load($yaml); }; |
| 1991 |
if ($@) { |
| 1992 |
warn "Unable to parse UpdateItemLocationOnCheckin syspref : $@"; |
| 1993 |
} |
| 1994 |
else { |
| 1995 |
if (defined $rules->{_ALL_}) { |
| 1996 |
if ($rules->{_ALL_} eq '_PERM_') { $rules->{_ALL_} = $item->{permanent_location}; } |
| 1997 |
if ($rules->{_ALL_} eq '_BLANK_') { $rules->{_ALL_} = ''; } |
| 1998 |
if ( $item->{location} ne $rules->{_ALL_}) { |
| 1999 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{_ALL_} }; |
| 2000 |
ModItem( { location => $rules->{_ALL_} }, undef, $itemnumber ); |
| 2001 |
} |
| 2002 |
} |
| 2003 |
else { |
| 2004 |
foreach my $key ( keys %$rules ) { |
| 2005 |
if ( $rules->{$key} eq '_PERM_' ) { $rules->{$key} = $item->{permanent_location}; } |
| 2006 |
if ( $rules->{$key} eq '_BLANK_') { $rules->{$key} = '' ;} |
| 2007 |
if ( ($item->{location} eq $key && $item->{location} ne $rules->{$key}) || ($key eq '_BLANK_' && $item->{location} eq '' && $rules->{$key} ne '') ) { |
| 2008 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{$key} }; |
| 2009 |
ModItem( { location => $rules->{$key} }, undef, $itemnumber ); |
| 2010 |
last; |
| 2011 |
} |
| 2012 |
} |
| 2013 |
} |
| 2014 |
} |
| 2015 |
} |
| 2016 |
|
| 1988 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
2017 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
| 1989 |
if ($yaml) { |
2018 |
if ($yaml) { |
| 1990 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
2019 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
|
Lines 2137-2151
sub AddReturn {
Link Here
|
| 2137 |
); |
2166 |
); |
| 2138 |
$sth->execute( $item->{'itemnumber'} ); |
2167 |
$sth->execute( $item->{'itemnumber'} ); |
| 2139 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
2168 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
| 2140 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
|
|
| 2141 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
2169 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
| 2142 |
} else { |
2170 |
} else { |
| 2143 |
$messages->{'WrongTransfer'} = $tobranch; |
2171 |
$messages->{'WrongTransfer'} = $tobranch; |
| 2144 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
2172 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
| 2145 |
} |
2173 |
} |
| 2146 |
$validTransfert = 1; |
2174 |
$validTransfert = 1; |
| 2147 |
} else { |
|
|
| 2148 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
| 2149 |
} |
2175 |
} |
| 2150 |
|
2176 |
|
| 2151 |
# fix up the accounts..... |
2177 |
# fix up the accounts..... |