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

(-)a/Koha/Illrequest.pm (-1 / +2 lines)
Lines 27-32 use Try::Tiny; Link Here
27
use DateTime;
27
use DateTime;
28
28
29
use Koha::Database;
29
use Koha::Database;
30
use Koha::DateUtils qw/ dt_from_string /;
30
use Koha::Email;
31
use Koha::Email;
31
use Koha::Exceptions::Ill;
32
use Koha::Exceptions::Ill;
32
use Koha::Illcomments;
33
use Koha::Illcomments;
Lines 688-694 Mark a request as completed (status = COMP). Link Here
688
sub mark_completed {
689
sub mark_completed {
689
    my ( $self ) = @_;
690
    my ( $self ) = @_;
690
    $self->status('COMP')->store;
691
    $self->status('COMP')->store;
691
    $self->completed(DateTime->now)->store;
692
    $self->completed(dt_from_string())->store;
692
    return {
693
    return {
693
        error   => 0,
694
        error   => 0,
694
        status  => '',
695
        status  => '',
(-)a/Koha/StockRotationItem.pm (-6 / +6 lines)
Lines 129-135 sub needs_advancing { Link Here
129
        );
129
        );
130
        my $duration = DateTime::Duration
130
        my $duration = DateTime::Duration
131
            ->new( days => $self->stage->duration );
131
            ->new( days => $self->stage->duration );
132
        if ( $arrival + $duration le DateTime->now ) {
132
        if ( $arrival + $duration le dt_from_string() ) {
133
            return 1;
133
            return 1;
134
        } else {
134
        } else {
135
            return 0;
135
            return 0;
Lines 155-161 sub repatriate { Link Here
155
        'itemnumber' => $self->itemnumber_id,
155
        'itemnumber' => $self->itemnumber_id,
156
        'frombranch' => $self->itemnumber->holdingbranch,
156
        'frombranch' => $self->itemnumber->holdingbranch,
157
        'tobranch'   => $self->stage->branchcode_id,
157
        'tobranch'   => $self->stage->branchcode_id,
158
        'datesent'   => DateTime->now,
158
        'datesent'   => dt_from_string(),
159
        'comments'   => $msg,
159
        'comments'   => $msg,
160
        'reason'     => "StockrotationRepatriation"
160
        'reason'     => "StockrotationRepatriation"
161
    })->store;
161
    })->store;
Lines 185-198 sub advance { Link Here
185
    my $transfer = Koha::Item::Transfer->new({
185
    my $transfer = Koha::Item::Transfer->new({
186
        'itemnumber' => $self->itemnumber_id,
186
        'itemnumber' => $self->itemnumber_id,
187
        'frombranch' => $item->holdingbranch,
187
        'frombranch' => $item->holdingbranch,
188
        'datesent'   => DateTime->now,
188
        'datesent'   => dt_from_string(),
189
        'reason'     => "StockrotationAdvance"
189
        'reason'     => "StockrotationAdvance"
190
    });
190
    });
191
191
192
    if ( $self->indemand && !$self->fresh ) {
192
    if ( $self->indemand && !$self->fresh ) {
193
        $self->indemand(0)->store;  # De-activate indemand
193
        $self->indemand(0)->store;  # De-activate indemand
194
        $transfer->tobranch($self->stage->branchcode_id);
194
        $transfer->tobranch($self->stage->branchcode_id);
195
        $transfer->datearrived(DateTime->now);
195
        $transfer->datearrived(dt_from_string());
196
    } else {
196
    } else {
197
        # Find and update our stage.
197
        # Find and update our stage.
198
        my $stage = $self->stage;
198
        my $stage = $self->stage;
Lines 200-206 sub advance { Link Here
200
        if ( $self->fresh ) {   # Just added to rota
200
        if ( $self->fresh ) {   # Just added to rota
201
            $new_stage = $self->stage->first_sibling || $self->stage;
201
            $new_stage = $self->stage->first_sibling || $self->stage;
202
            $transfer->tobranch($new_stage->branchcode_id);
202
            $transfer->tobranch($new_stage->branchcode_id);
203
            $transfer->datearrived(DateTime->now) # Already at first branch
203
            $transfer->datearrived(dt_from_string()) # Already at first branch
204
                if $item->holdingbranch eq $new_stage->branchcode_id;
204
                if $item->holdingbranch eq $new_stage->branchcode_id;
205
            $self->fresh(0)->store;         # Reset fresh
205
            $self->fresh(0)->store;         # Reset fresh
206
        } elsif ( !$stage->last_sibling ) { # Last stage
206
        } elsif ( !$stage->last_sibling ) { # Last stage
Lines 208-214 sub advance { Link Here
208
                # Revert to first stage.
208
                # Revert to first stage.
209
                $new_stage = $stage->first_sibling || $stage;
209
                $new_stage = $stage->first_sibling || $stage;
210
                $transfer->tobranch($new_stage->branchcode_id);
210
                $transfer->tobranch($new_stage->branchcode_id);
211
                $transfer->datearrived(DateTime->now);
211
                $transfer->datearrived(dt_from_string());
212
            } else {
212
            } else {
213
                $self->delete;  # StockRotationItem is done.
213
                $self->delete;  # StockRotationItem is done.
214
                return 1;
214
                return 1;
(-)a/misc/cronjobs/update_totalissues.pl (-2 / +2 lines)
Lines 32-37 use Getopt::Long; Link Here
32
use Pod::Usage;
32
use Pod::Usage;
33
33
34
use Koha::Script -cron;
34
use Koha::Script -cron;
35
use Koha::DateUtils qw/ dt_from_string /;
35
use C4::Context;
36
use C4::Context;
36
use C4::Biblio;
37
use C4::Biblio;
37
use C4::Log;
38
use C4::Log;
Lines 122-128 sub process_items { Link Here
122
123
123
sub process_stats {
124
sub process_stats {
124
    if ($interval) {
125
    if ($interval) {
125
        my $dt = DateTime->now;
126
        my $dt = dt_from_string();
126
127
127
        my %units = (
128
        my %units = (
128
            h => 'hours',
129
            h => 'hours',
129
- 

Return to bug 24840