Lines 1441-1446
sub AddIssue {
Link Here
|
1441 |
} |
1441 |
} |
1442 |
); |
1442 |
); |
1443 |
|
1443 |
|
|
|
1444 |
if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) { |
1445 |
## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. |
1446 |
CartToShelf( $item->{'itemnumber'} ); |
1447 |
} |
1448 |
$item->{'issues'}++; |
1449 |
if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) { |
1450 |
UpdateTotalIssues($item->{'biblionumber'}, 1); |
1451 |
} |
1452 |
|
1444 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { |
1453 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { |
1445 |
# ReturnToShelvingCart is on, anything issued should be taken off the cart. |
1454 |
# ReturnToShelvingCart is on, anything issued should be taken off the cart. |
1446 |
CartToShelf( $item->{'itemnumber'} ); |
1455 |
CartToShelf( $item->{'itemnumber'} ); |
Lines 1945-1961
sub AddReturn {
Link Here
|
1945 |
|
1954 |
|
1946 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1955 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1947 |
|
1956 |
|
1948 |
if ( $item->{'location'} eq 'PROC' ) { |
|
|
1949 |
if ( C4::Context->preference("InProcessingToShelvingCart") ) { |
1950 |
$item->{'location'} = 'CART'; |
1951 |
} |
1952 |
else { |
1953 |
$item->{location} = $item->{permanent_location}; |
1954 |
} |
1955 |
|
1956 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
1957 |
} |
1958 |
|
1959 |
# full item data, but no borrowernumber or checkout info (no issue) |
1957 |
# full item data, but no borrowernumber or checkout info (no issue) |
1960 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1958 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1961 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
1959 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
Lines 1965-1970
sub AddReturn {
Link Here
|
1965 |
|
1963 |
|
1966 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1964 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1967 |
|
1965 |
|
|
|
1966 |
my $yaml = C4::Context->preference('UpdateItemLocationOnCheckin'); |
1967 |
if ($yaml) { |
1968 |
$yaml = "$yaml\n\n"; # YAML is strict on ending \n. Surplus does not hurt |
1969 |
my $rules; |
1970 |
eval { $rules = YAML::Load($yaml); }; |
1971 |
if ($@) { |
1972 |
warn "Unable to parse UpdateItemLocationOnCheckin syspref : $@"; |
1973 |
} |
1974 |
else { |
1975 |
if (defined $rules->{_ALL_}) { |
1976 |
if ($rules->{_ALL_} eq '_PERM_') { $rules->{_ALL_} = $item->{permanent_location}; } |
1977 |
if ($rules->{_ALL_} eq '_BLANK_') { $rules->{_ALL_} = ''; } |
1978 |
if ( $item->{location} ne $rules->{_ALL_}) { |
1979 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{_ALL_} }; |
1980 |
ModItem( { location => $rules->{_ALL_} }, undef, $itemnumber ); |
1981 |
} |
1982 |
} |
1983 |
else { |
1984 |
foreach my $key ( keys %$rules ) { |
1985 |
if ( $rules->{$key} eq '_PERM_' ) { $rules->{$key} = $item->{permanent_location}; } |
1986 |
if ( $rules->{$key} eq '_BLANK_') { $rules->{$key} = '' ;} |
1987 |
if ( ($item->{location} eq $key && $item->{location} ne $rules->{$key}) || ($key eq '_BLANK_' && $item->{location} eq '' && $rules->{$key} ne '') ) { |
1988 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{$key} }; |
1989 |
ModItem( { location => $rules->{$key} }, undef, $itemnumber ); |
1990 |
last; |
1991 |
} |
1992 |
} |
1993 |
} |
1994 |
} |
1995 |
} |
1996 |
|
1968 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
1997 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
1969 |
if ($yaml) { |
1998 |
if ($yaml) { |
1970 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
1999 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
Lines 2116-2130
sub AddReturn {
Link Here
|
2116 |
); |
2145 |
); |
2117 |
$sth->execute( $item->{'itemnumber'} ); |
2146 |
$sth->execute( $item->{'itemnumber'} ); |
2118 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
2147 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
2119 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
|
|
2120 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
2148 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
2121 |
} else { |
2149 |
} else { |
2122 |
$messages->{'WrongTransfer'} = $tobranch; |
2150 |
$messages->{'WrongTransfer'} = $tobranch; |
2123 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
2151 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
2124 |
} |
2152 |
} |
2125 |
$validTransfert = 1; |
2153 |
$validTransfert = 1; |
2126 |
} else { |
|
|
2127 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
2128 |
} |
2154 |
} |
2129 |
|
2155 |
|
2130 |
# fix up the accounts..... |
2156 |
# fix up the accounts..... |