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

(-)a/C4/Reserves.pm (-7 / +12 lines)
Lines 1095-1114 sub ModReserve { Link Here
1095
    # FIXME Other calls may fail
1095
    # FIXME Other calls may fail
1096
    Koha::Exceptions::ObjectNotFound->throw( 'No hold with id ' . $reserve_id ) unless $hold;
1096
    Koha::Exceptions::ObjectNotFound->throw( 'No hold with id ' . $reserve_id ) unless $hold;
1097
1097
1098
    my $original = C4::Context->preference('HoldsLog') ? $hold->unblessed : undef;
1099
1098
    if ( $rank eq "del" ) {
1100
    if ( $rank eq "del" ) {
1099
        $hold->cancel({ cancellation_reason => $cancellation_reason });
1101
        $hold->cancel({ cancellation_reason => $cancellation_reason });
1100
    }
1102
    }
1101
    elsif ($hold->found && $hold->priority eq '0' && $date) {
1103
    elsif ($hold->found && $hold->priority eq '0' && $date) {
1102
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold )
1103
            if C4::Context->preference('HoldsLog');
1104
1104
1105
        # The only column that can be updated for a found hold is the expiration date
1105
        # The only column that can be updated for a found hold is the expiration date
1106
        $hold->expirationdate($date)->store();
1106
        $hold->expirationdate($date)->store();
1107
1108
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original )
1109
            if C4::Context->preference('HoldsLog');
1107
    }
1110
    }
1108
    elsif ($rank =~ /^\d+/ and $rank > 0) {
1111
    elsif ($rank =~ /^\d+/ and $rank > 0) {
1109
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold )
1110
            if C4::Context->preference('HoldsLog');
1111
1112
        my $properties = {
1112
        my $properties = {
1113
            priority    => $rank,
1113
            priority    => $rank,
1114
            branchcode  => $branchcode,
1114
            branchcode  => $branchcode,
Lines 1135-1141 sub ModReserve { Link Here
1135
            }
1135
            }
1136
        }
1136
        }
1137
1137
1138
        _FixPriority({ reserve_id => $reserve_id, rank =>$rank });
1138
        _FixPriority( { reserve_id => $reserve_id, rank => $rank } );
1139
1140
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original )
1141
            if C4::Context->preference('HoldsLog');
1139
    }
1142
    }
1140
}
1143
}
1141
1144
Lines 1209-1214 sub ModReserveAffect { Link Here
1209
1212
1210
    return unless $hold;
1213
    return unless $hold;
1211
1214
1215
    my $original = $hold->unblessed;
1216
1212
    my $already_on_shelf = $hold->found && $hold->found eq 'W';
1217
    my $already_on_shelf = $hold->found && $hold->found eq 'W';
1213
1218
1214
    $hold->itemnumber($itemnumber);
1219
    $hold->itemnumber($itemnumber);
Lines 1249-1255 sub ModReserveAffect { Link Here
1249
    });
1254
    });
1250
    $std->execute($hold->reserve_id);
1255
    $std->execute($hold->reserve_id);
1251
1256
1252
    logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold )
1257
    logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original )
1253
        if C4::Context->preference('HoldsLog');
1258
        if C4::Context->preference('HoldsLog');
1254
1259
1255
    return;
1260
    return;
(-)a/Koha/Hold.pm (-5 / +12 lines)
Lines 92-97 my $hold = $hold->suspend_hold( $suspend_until ); Link Here
92
sub suspend_hold {
92
sub suspend_hold {
93
    my ( $self, $date ) = @_;
93
    my ( $self, $date ) = @_;
94
94
95
    my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef;
96
95
    $date &&= dt_from_string($date)->truncate( to => 'day' )->datetime;
97
    $date &&= dt_from_string($date)->truncate( to => 'day' )->datetime;
96
98
97
    if ( $self->is_found ) {    # We can't suspend found holds
99
    if ( $self->is_found ) {    # We can't suspend found holds
Lines 126-132 sub suspend_hold { Link Here
126
        }
128
        }
127
    );
129
    );
128
130
129
    logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, $self )
131
    logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, $self, undef, $original )
130
        if C4::Context->preference('HoldsLog');
132
        if C4::Context->preference('HoldsLog');
131
133
132
    Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
134
    Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
Lines 147-152 my $hold = $hold->resume(); Link Here
147
sub resume {
149
sub resume {
148
    my ( $self ) = @_;
150
    my ( $self ) = @_;
149
151
152
    my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef;
153
150
    $self->suspend(0);
154
    $self->suspend(0);
151
    $self->suspend_until( undef );
155
    $self->suspend_until( undef );
152
156
Lines 160-166 sub resume { Link Here
160
        }
164
        }
161
    );
165
    );
162
166
163
    logaction( 'HOLDS', 'RESUME', $self->reserve_id, $self )
167
    logaction( 'HOLDS', 'RESUME', $self->reserve_id, $self, undef, $original )
164
        if C4::Context->preference('HoldsLog');
168
        if C4::Context->preference('HoldsLog');
165
169
166
    Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
170
    Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
Lines 669-674 sub cancel { Link Here
669
673
670
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
674
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
671
675
676
    my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef;
677
672
    $self->_result->result_source->schema->txn_do(
678
    $self->_result->result_source->schema->txn_do(
673
        sub {
679
        sub {
674
            my $patron = $self->patron;
680
            my $patron = $self->patron;
Lines 741-747 sub cancel { Link Here
741
                );
747
                );
742
            }
748
            }
743
749
744
            C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, $self )
750
            C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, $self, undef, $original )
745
                if C4::Context->preference('HoldsLog');
751
                if C4::Context->preference('HoldsLog');
746
752
747
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
753
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
Lines 781-786 sub fill { Link Here
781
        sub {
787
        sub {
782
            my $patron = $self->patron;
788
            my $patron = $self->patron;
783
789
790
            my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef;
791
784
            $self->set(
792
            $self->set(
785
                {
793
                {
786
                    found    => 'F',
794
                    found    => 'F',
Lines 825-831 sub fill { Link Here
825
                }
833
                }
826
            }
834
            }
827
835
828
            C4::Log::logaction( 'HOLDS', 'FILL', $self->id, $self )
836
            C4::Log::logaction( 'HOLDS', 'FILL', $self->id, $self, undef, $original )
829
                if C4::Context->preference('HoldsLog');
837
                if C4::Context->preference('HoldsLog');
830
838
831
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
839
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
832
- 

Return to bug 25159