View | Details | Raw Unified | Return to bug 11629
Collapse All | Expand All

(-)a/C4/Circulation.pm (-22 / +22 lines)
Lines 1755-1780 sub AddReturn { Link Here
1755
1755
1756
    my $borrowernumber = $borrower->{'borrowernumber'} || undef;    # we don't know if we had a borrower or not
1756
    my $borrowernumber = $borrower->{'borrowernumber'} || undef;    # we don't know if we had a borrower or not
1757
1757
1758
    my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin');
1759
    if ($yaml) {
1760
        $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
1761
        my $rules;
1762
        eval { $rules = YAML::Load($yaml); };
1763
        if ($@) {
1764
            warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@";
1765
        }
1766
        else {
1767
            foreach my $key ( keys %$rules ) {
1768
                if ( $item->{notforloan} eq $key ) {
1769
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->{notforloan}, to => $rules->{$key} };
1770
                    ModItem( { notforloan => $rules->{$key} }, undef, $itemnumber );
1771
                    last;
1772
                }
1773
            }
1774
        }
1775
    }
1776
1777
1778
    # check if the book is in a permanent collection....
1758
    # check if the book is in a permanent collection....
1779
    # FIXME -- This 'PE' attribute is largely undocumented.  afaict, there's no user interface that reflects this functionality.
1759
    # FIXME -- This 'PE' attribute is largely undocumented.  afaict, there's no user interface that reflects this functionality.
1780
    if ( $hbr ) {
1760
    if ( $hbr ) {
Lines 1846-1852 sub AddReturn { Link Here
1846
1826
1847
        }
1827
        }
1848
1828
1849
        ModItem({ onloan => undef }, $issue->{'biblionumber'}, $item->{'itemnumber'});
1829
        my $fields = { onloan => undef };
1830
1831
        my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin');
1832
        if ($yaml) {
1833
            $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
1834
            my $rules;
1835
            eval { $rules = YAML::Load($yaml); };
1836
            if ($@) {
1837
                warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@";
1838
            }
1839
            else {
1840
                foreach my $key ( keys %$rules ) {
1841
                    if ( $item->{notforloan} eq $key ) {
1842
                        $messages->{'NotForLoanStatusUpdated'} = { from => $item->{notforloan}, to => $rules->{$key} };
1843
                        $fields->{notforloan} = $rules->{$key};
1844
                        last;
1845
                    }
1846
                }
1847
            }
1848
        }
1849
1850
        ModItem( $fields, $issue->{'biblionumber'}, $item->{'itemnumber'} );
1850
    }
1851
    }
1851
1852
1852
    # the holdingbranch is updated if the document is returned to another location.
1853
    # the holdingbranch is updated if the document is returned to another location.
1853
- 

Return to bug 11629