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

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