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

(-)a/C4/Circulation.pm (-14 / +18 lines)
Lines 2131-2150 sub AddReturn { Link Here
2131
        }
2131
        }
2132
    }
2132
    }
2133
2133
2134
    my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin');
2134
    # check if the item should have it's notforloan status changed
2135
    if ($yaml) {
2135
    my $itemtype_object = Koha::ItemTypes->find( $itemtype );
2136
        $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
2136
    if ( defined $itemtype_object && $itemtype_object->updatenotforloan ) {
2137
        my $rules;
2137
        my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin');
2138
        eval { $rules = YAML::XS::Load(Encode::encode_utf8($yaml)); };
2138
        if ($yaml) {
2139
        if ($@) {
2139
            $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
2140
            warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@";
2140
            my $rules;
2141
        }
2141
            eval { $rules = YAML::XS::Load(Encode::encode_utf8($yaml)); };
2142
        else {
2142
            if ($@) {
2143
            foreach my $key ( keys %$rules ) {
2143
                warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@";
2144
                if ( $item->notforloan eq $key ) {
2144
            }
2145
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} };
2145
            else {
2146
                    $item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1 });
2146
                foreach my $key ( keys %$rules ) {
2147
                    last;
2147
                    if ( $item->notforloan eq $key ) {
2148
                        $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} };
2149
                        $item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1 });
2150
                        last;
2151
                    }
2148
                }
2152
                }
2149
            }
2153
            }
2150
        }
2154
        }
(-)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