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

(-)a/C4/Reserves.pm (-7 / +12 lines)
Lines 1129-1148 sub ModReserve { Link Here
1129
    # FIXME Other calls may fail
1129
    # FIXME Other calls may fail
1130
    Koha::Exceptions::ObjectNotFound->throw( 'No hold with id ' . $reserve_id ) unless $hold;
1130
    Koha::Exceptions::ObjectNotFound->throw( 'No hold with id ' . $reserve_id ) unless $hold;
1131
1131
1132
    my $original = C4::Context->preference('HoldsLog') ? $hold->unblessed : undef;
1133
1132
    if ( $rank eq "del" ) {
1134
    if ( $rank eq "del" ) {
1133
        $hold->cancel({ cancellation_reason => $cancellation_reason });
1135
        $hold->cancel({ cancellation_reason => $cancellation_reason });
1134
    }
1136
    }
1135
    elsif ($hold->found && $hold->priority eq '0' && $date) {
1137
    elsif ($hold->found && $hold->priority eq '0' && $date) {
1136
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold )
1137
            if C4::Context->preference('HoldsLog');
1138
1138
1139
        # The only column that can be updated for a found hold is the expiration date
1139
        # The only column that can be updated for a found hold is the expiration date
1140
        $hold->expirationdate($date)->store();
1140
        $hold->expirationdate($date)->store();
1141
1142
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original )
1143
            if C4::Context->preference('HoldsLog');
1141
    }
1144
    }
1142
    elsif ($rank =~ /^\d+/ and $rank > 0) {
1145
    elsif ($rank =~ /^\d+/ and $rank > 0) {
1143
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold )
1144
            if C4::Context->preference('HoldsLog');
1145
1146
        my $properties = {
1146
        my $properties = {
1147
            priority    => $rank,
1147
            priority    => $rank,
1148
            branchcode  => $branchcode,
1148
            branchcode  => $branchcode,
Lines 1169-1175 sub ModReserve { Link Here
1169
            }
1169
            }
1170
        }
1170
        }
1171
1171
1172
        _FixPriority({ reserve_id => $reserve_id, rank =>$rank });
1172
        _FixPriority( { reserve_id => $reserve_id, rank => $rank } );
1173
1174
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original )
1175
            if C4::Context->preference('HoldsLog');
1173
    }
1176
    }
1174
}
1177
}
1175
1178
Lines 1243-1248 sub ModReserveAffect { Link Here
1243
1246
1244
    return unless $hold;
1247
    return unless $hold;
1245
1248
1249
    my $original = $hold->unblessed;
1250
1246
    my $already_on_shelf = $hold->found && $hold->found eq 'W';
1251
    my $already_on_shelf = $hold->found && $hold->found eq 'W';
1247
1252
1248
    $hold->itemnumber($itemnumber);
1253
    $hold->itemnumber($itemnumber);
Lines 1283-1289 sub ModReserveAffect { Link Here
1283
    });
1288
    });
1284
    $std->execute($hold->reserve_id);
1289
    $std->execute($hold->reserve_id);
1285
1290
1286
    logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold )
1291
    logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold, undef, $original )
1287
        if C4::Context->preference('HoldsLog');
1292
        if C4::Context->preference('HoldsLog');
1288
1293
1289
    return;
1294
    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 697-702 sub cancel { Link Here
697
701
698
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
702
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
699
703
704
    my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef;
705
700
    $self->_result->result_source->schema->txn_do(
706
    $self->_result->result_source->schema->txn_do(
701
        sub {
707
        sub {
702
            my $patron = $self->patron;
708
            my $patron = $self->patron;
Lines 784-790 sub cancel { Link Here
784
                );
790
                );
785
            }
791
            }
786
792
787
            C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, $self )
793
            C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, $self, undef, $original )
788
                if C4::Context->preference('HoldsLog');
794
                if C4::Context->preference('HoldsLog');
789
795
790
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
796
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
Lines 824-829 sub fill { Link Here
824
        sub {
830
        sub {
825
            my $patron = $self->patron;
831
            my $patron = $self->patron;
826
832
833
            my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef;
834
827
            $self->set(
835
            $self->set(
828
                {
836
                {
829
                    found    => 'F',
837
                    found    => 'F',
Lines 868-874 sub fill { Link Here
868
                }
876
                }
869
            }
877
            }
870
878
871
            C4::Log::logaction( 'HOLDS', 'FILL', $self->id, $self )
879
            C4::Log::logaction( 'HOLDS', 'FILL', $self->id, $self, undef, $original )
872
                if C4::Context->preference('HoldsLog');
880
                if C4::Context->preference('HoldsLog');
873
881
874
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
882
            Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue(
875
- 

Return to bug 25159