Lines 1337-1343
sub AddIssue {
Link Here
|
1337 |
} |
1337 |
} |
1338 |
); |
1338 |
); |
1339 |
|
1339 |
|
1340 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { ## ReturnToShelvingCart is on, anything issued should be taken off the cart. |
1340 |
if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) { |
|
|
1341 |
## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. |
1341 |
CartToShelf( $item->{'itemnumber'} ); |
1342 |
CartToShelf( $item->{'itemnumber'} ); |
1342 |
} |
1343 |
} |
1343 |
$item->{'issues'}++; |
1344 |
$item->{'issues'}++; |
Lines 1832-1848
sub AddReturn {
Link Here
|
1832 |
|
1833 |
|
1833 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1834 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1834 |
|
1835 |
|
1835 |
if ( $item->{'location'} eq 'PROC' ) { |
|
|
1836 |
if ( C4::Context->preference("InProcessingToShelvingCart") ) { |
1837 |
$item->{'location'} = 'CART'; |
1838 |
} |
1839 |
else { |
1840 |
$item->{location} = $item->{permanent_location}; |
1841 |
} |
1842 |
|
1843 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
1844 |
} |
1845 |
|
1846 |
# full item data, but no borrowernumber or checkout info (no issue) |
1836 |
# full item data, but no borrowernumber or checkout info (no issue) |
1847 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1837 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1848 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
1838 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
Lines 1852-1857
sub AddReturn {
Link Here
|
1852 |
|
1842 |
|
1853 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1843 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1854 |
|
1844 |
|
|
|
1845 |
my $yaml = C4::Context->preference('UpdateItemLocationOnCheckin'); |
1846 |
if ($yaml) { |
1847 |
$yaml = "$yaml\n\n"; # YAML is strict on ending \n. Surplus does not hurt |
1848 |
my $rules; |
1849 |
eval { $rules = YAML::Load($yaml); }; |
1850 |
if ($@) { |
1851 |
warn "Unable to parse UpdateItemLocationOnCheckin syspref : $@"; |
1852 |
} |
1853 |
else { |
1854 |
if (defined $rules->{_ALL_}) { |
1855 |
if ($rules->{_ALL_} eq '_PERM_') { $rules->{_ALL_} = $item->{permanent_location}; } |
1856 |
if ($rules->{_ALL_} eq '_BLANK_') { $rules->{_ALL_} = ''; } |
1857 |
if ( $item->{location} ne $rules->{_ALL_}) { |
1858 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{_ALL_} }; |
1859 |
ModItem( { location => $rules->{_ALL_} }, undef, $itemnumber ); |
1860 |
} |
1861 |
} |
1862 |
else { |
1863 |
foreach my $key ( keys %$rules ) { |
1864 |
if ( $rules->{$key} eq '_PERM_' ) { $rules->{$key} = $item->{permanent_location}; } |
1865 |
if ( $rules->{$key} eq '_BLANK_') { $rules->{$key} = '' ;} |
1866 |
# warn Data::Dumper::Dumper($key,$item->{location}, |
1867 |
if ( ($item->{location} eq $key && $item->{location} ne $rules->{$key}) || ($key eq '_BLANK_' && $item->{location} eq '' && $rules->{$key} ne '') ) { |
1868 |
warn Data::Dumper::Dumper( $key ); |
1869 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{$key} }; |
1870 |
ModItem( { location => $rules->{$key} }, undef, $itemnumber ); |
1871 |
last; |
1872 |
} |
1873 |
} |
1874 |
} |
1875 |
} |
1876 |
} |
1877 |
|
1855 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
1878 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
1856 |
if ($yaml) { |
1879 |
if ($yaml) { |
1857 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
1880 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
Lines 1989-2003
sub AddReturn {
Link Here
|
1989 |
); |
2012 |
); |
1990 |
$sth->execute( $item->{'itemnumber'} ); |
2013 |
$sth->execute( $item->{'itemnumber'} ); |
1991 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
2014 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
1992 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
|
|
1993 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
2015 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
1994 |
} else { |
2016 |
} else { |
1995 |
$messages->{'WrongTransfer'} = $tobranch; |
2017 |
$messages->{'WrongTransfer'} = $tobranch; |
1996 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
2018 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
1997 |
} |
2019 |
} |
1998 |
$validTransfert = 1; |
2020 |
$validTransfert = 1; |
1999 |
} else { |
|
|
2000 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
2001 |
} |
2021 |
} |
2002 |
|
2022 |
|
2003 |
# fix up the accounts..... |
2023 |
# fix up the accounts..... |