|
Lines 1386-1392
sub AddIssue {
Link Here
|
| 1386 |
} |
1386 |
} |
| 1387 |
); |
1387 |
); |
| 1388 |
|
1388 |
|
| 1389 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { ## ReturnToShelvingCart is on, anything issued should be taken off the cart. |
1389 |
if ( $item->{'location'} eq 'CART' && $item->{'permanent_location'} ne 'CART' ) { |
|
|
1390 |
## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. |
| 1390 |
CartToShelf( $item->{'itemnumber'} ); |
1391 |
CartToShelf( $item->{'itemnumber'} ); |
| 1391 |
} |
1392 |
} |
| 1392 |
$item->{'issues'}++; |
1393 |
$item->{'issues'}++; |
|
Lines 1881-1897
sub AddReturn {
Link Here
|
| 1881 |
|
1882 |
|
| 1882 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1883 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
| 1883 |
|
1884 |
|
| 1884 |
if ( $item->{'location'} eq 'PROC' ) { |
|
|
| 1885 |
if ( C4::Context->preference("InProcessingToShelvingCart") ) { |
| 1886 |
$item->{'location'} = 'CART'; |
| 1887 |
} |
| 1888 |
else { |
| 1889 |
$item->{location} = $item->{permanent_location}; |
| 1890 |
} |
| 1891 |
|
| 1892 |
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); |
| 1893 |
} |
| 1894 |
|
| 1895 |
# full item data, but no borrowernumber or checkout info (no issue) |
1885 |
# full item data, but no borrowernumber or checkout info (no issue) |
| 1896 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1886 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
| 1897 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
1887 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
|
Lines 1901-1906
sub AddReturn {
Link Here
|
| 1901 |
|
1891 |
|
| 1902 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1892 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
| 1903 |
|
1893 |
|
|
|
1894 |
my $yaml = C4::Context->preference('UpdateItemLocationOnCheckin'); |
| 1895 |
if ($yaml) { |
| 1896 |
$yaml = "$yaml\n\n"; # YAML is strict on ending \n. Surplus does not hurt |
| 1897 |
my $rules; |
| 1898 |
eval { $rules = YAML::Load($yaml); }; |
| 1899 |
if ($@) { |
| 1900 |
warn "Unable to parse UpdateItemLocationOnCheckin syspref : $@"; |
| 1901 |
} |
| 1902 |
else { |
| 1903 |
if (defined $rules->{_ALL_}) { |
| 1904 |
if ($rules->{_ALL_} eq '_PERM_') { $rules->{_ALL_} = $item->{permanent_location}; } |
| 1905 |
if ($rules->{_ALL_} eq '_BLANK_') { $rules->{_ALL_} = ''; } |
| 1906 |
if ( $item->{location} ne $rules->{_ALL_}) { |
| 1907 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{_ALL_} }; |
| 1908 |
ModItem( { location => $rules->{_ALL_} }, undef, $itemnumber ); |
| 1909 |
} |
| 1910 |
} |
| 1911 |
else { |
| 1912 |
foreach my $key ( keys %$rules ) { |
| 1913 |
if ( $rules->{$key} eq '_PERM_' ) { $rules->{$key} = $item->{permanent_location}; } |
| 1914 |
if ( $rules->{$key} eq '_BLANK_') { $rules->{$key} = '' ;} |
| 1915 |
if ( ($item->{location} eq $key && $item->{location} ne $rules->{$key}) || ($key eq '_BLANK_' && $item->{location} eq '' && $rules->{$key} ne '') ) { |
| 1916 |
$messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $rules->{$key} }; |
| 1917 |
ModItem( { location => $rules->{$key} }, undef, $itemnumber ); |
| 1918 |
last; |
| 1919 |
} |
| 1920 |
} |
| 1921 |
} |
| 1922 |
} |
| 1923 |
} |
| 1924 |
|
| 1904 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
1925 |
my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); |
| 1905 |
if ($yaml) { |
1926 |
if ($yaml) { |
| 1906 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
1927 |
$yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
|
Lines 2052-2066
sub AddReturn {
Link Here
|
| 2052 |
); |
2073 |
); |
| 2053 |
$sth->execute( $item->{'itemnumber'} ); |
2074 |
$sth->execute( $item->{'itemnumber'} ); |
| 2054 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
2075 |
# if we have a reservation with valid transfer, we can set it's status to 'W' |
| 2055 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
|
|
| 2056 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
2076 |
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W'); |
| 2057 |
} else { |
2077 |
} else { |
| 2058 |
$messages->{'WrongTransfer'} = $tobranch; |
2078 |
$messages->{'WrongTransfer'} = $tobranch; |
| 2059 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
2079 |
$messages->{'WrongTransferItem'} = $item->{'itemnumber'}; |
| 2060 |
} |
2080 |
} |
| 2061 |
$validTransfert = 1; |
2081 |
$validTransfert = 1; |
| 2062 |
} else { |
|
|
| 2063 |
ShelfToCart( $item->{'itemnumber'} ) if ( C4::Context->preference("ReturnToShelvingCart") ); |
| 2064 |
} |
2082 |
} |
| 2065 |
|
2083 |
|
| 2066 |
# fix up the accounts..... |
2084 |
# fix up the accounts..... |