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

(-)a/C4/Circulation.pm (-14 / +18 lines)
Lines 2013-2032 sub AddReturn { Link Here
2013
        }
2013
        }
2014
    }
2014
    }
2015
2015
2016
    my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin');
2016
    # check if the item should have it's notforloan status changed
2017
    if ($yaml) {
2017
    my $itemtype_object = Koha::ItemTypes->find( $itemtype );
2018
        $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
2018
    if ( defined $itemtype_object && $itemtype_object->updatenotforloan ) {
2019
        my $rules;
2019
        my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin');
2020
        eval { $rules = YAML::XS::Load(Encode::encode_utf8($yaml)); };
2020
        if ($yaml) {
2021
        if ($@) {
2021
            $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
2022
            warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@";
2022
            my $rules;
2023
        }
2023
            eval { $rules = YAML::XS::Load(Encode::encode_utf8($yaml)); };
2024
        else {
2024
            if ($@) {
2025
            foreach my $key ( keys %$rules ) {
2025
                warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@";
2026
                if ( $item->notforloan eq $key ) {
2026
            }
2027
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} };
2027
            else {
2028
                    $item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1 });
2028
                foreach my $key ( keys %$rules ) {
2029
                    last;
2029
                    if ( $item->notforloan eq $key ) {
2030
                        $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} };
2031
                        $item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1 });
2032
                        last;
2033
                    }
2030
                }
2034
                }
2031
            }
2035
            }
2032
        }
2036
        }
(-)a/admin/itemtypes.pl (-1 / +3 lines)
Lines 94-99 if ( $op eq 'add_form' ) { Link Here
94
    my $checkinmsg     = $input->param('checkinmsg');
94
    my $checkinmsg     = $input->param('checkinmsg');
95
    my $checkinmsgtype = $input->param('checkinmsgtype');
95
    my $checkinmsgtype = $input->param('checkinmsgtype');
96
    my $hideinopac     = $input->param('hideinopac') // 0;
96
    my $hideinopac     = $input->param('hideinopac') // 0;
97
    my $updatenotforloan = $input->param('updatenotforloan') // 0;
97
    my $searchcategory = $input->param('searchcategory');
98
    my $searchcategory = $input->param('searchcategory');
98
    my $rentalcharge_daily_calendar  = $input->param('rentalcharge_daily_calendar') // 0;
99
    my $rentalcharge_daily_calendar  = $input->param('rentalcharge_daily_calendar') // 0;
99
    my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
100
    my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
Lines 114-119 if ( $op eq 'add_form' ) { Link Here
114
        $itemtype->checkinmsgtype($checkinmsgtype);
115
        $itemtype->checkinmsgtype($checkinmsgtype);
115
        $itemtype->sip_media_type($sip_media_type);
116
        $itemtype->sip_media_type($sip_media_type);
116
        $itemtype->hideinopac($hideinopac);
117
        $itemtype->hideinopac($hideinopac);
118
        $itemtype->updatenotforloan($updatenotforloan);
117
        $itemtype->searchcategory($searchcategory);
119
        $itemtype->searchcategory($searchcategory);
118
        $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar);
120
        $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar);
119
        $itemtype->rentalcharge_hourly_calendar($rentalcharge_hourly_calendar);
121
        $itemtype->rentalcharge_hourly_calendar($rentalcharge_hourly_calendar);
Lines 147-152 if ( $op eq 'add_form' ) { Link Here
147
                checkinmsgtype      => $checkinmsgtype,
149
                checkinmsgtype      => $checkinmsgtype,
148
                sip_media_type      => $sip_media_type,
150
                sip_media_type      => $sip_media_type,
149
                hideinopac          => $hideinopac,
151
                hideinopac          => $hideinopac,
152
                updatenotforloan    => $updatenotforloan,
150
                searchcategory      => $searchcategory,
153
                searchcategory      => $searchcategory,
151
                rentalcharge_daily_calendar  => $rentalcharge_daily_calendar,
154
                rentalcharge_daily_calendar  => $rentalcharge_daily_calendar,
152
                rentalcharge_hourly_calendar => $rentalcharge_hourly_calendar,
155
                rentalcharge_hourly_calendar => $rentalcharge_hourly_calendar,
153
- 

Return to bug 25560