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

(-)a/C4/SIP/ILS/Transaction.pm (+20 lines)
Lines 8-13 use Carp; Link Here
8
use strict;
8
use strict;
9
use warnings;
9
use warnings;
10
use C4::Context;
10
use C4::Context;
11
use C4::Circulation qw( GetItemIssue );
12
use Koha::DateUtils;
11
13
12
my %fields = (
14
my %fields = (
13
	ok            => 0,
15
	ok            => 0,
Lines 35-40 sub new { Link Here
35
	return bless $self, $class;
37
	return bless $self, $class;
36
}
38
}
37
39
40
sub duedatefromissue {
41
    my ($self, $iss, $itemnum) = @_;
42
    my $due_dt;
43
    if (defined $iss ) {
44
        $due_dt = dt_from_string( $iss->date_due() );
45
    } # renew from AddIssue ??
46
    else {
47
        # need to reread the issue to get due date
48
        $iss = GetItemIssue($itemnum);
49
        if ($iss && $iss->{date_due} ) {
50
            $due_dt = dt_from_string( $iss->{date_due} );
51
        }
52
    }
53
    return $due_dt;
54
}
55
56
57
38
sub DESTROY {
58
sub DESTROY {
39
    # be cool
59
    # be cool
40
}
60
}
(-)a/C4/SIP/ILS/Transaction/Checkout.pm (-7 / +1 lines)
Lines 140-153 sub do_checkout { Link Here
140
		# . "w/ \$borrower: " . Dumper($borrower)
140
		# . "w/ \$borrower: " . Dumper($borrower)
141
		. "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv);
141
		. "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv);
142
    my $issue = AddIssue( $borrower, $barcode, $overridden_duedate, 0 );
142
    my $issue = AddIssue( $borrower, $barcode, $overridden_duedate, 0 );
143
    my $due_dt = dt_from_string( $issue->date_due() );
143
    $self->{due} = $self->duedatefromissue($issue, $itemnumber);
144
    if ($due_dt) {
145
        $self->{due} = $due_dt->clone();
146
    } else {
147
        $self->{due} = undef;
148
    }
149
144
150
    #$self->{item}->due_date($due);
151
	$self->ok(1);
145
	$self->ok(1);
152
	return $self;
146
	return $self;
153
}
147
}
(-)a/C4/SIP/ILS/Transaction/Renew.pm (-6 / +1 lines)
Lines 45-56 sub do_renew_for { Link Here
45
45
46
    }
46
    }
47
    if ($renewokay){
47
    if ($renewokay){
48
        $self->{due} = undef;
49
        my $issue = AddIssue( $borrower, $self->{item}->id, undef, 0 );
48
        my $issue = AddIssue( $borrower, $self->{item}->id, undef, 0 );
50
        my $due_date = dt_from_string( $issue->date_due() );
49
        $self->{due} = $self->duedatefromissue($issue, $self->{item}->{itemnumber});
51
        if ($due_date) {
52
            $self->{due} = $due_date;
53
        }
54
        $self->renewal_ok(1);
50
        $self->renewal_ok(1);
55
    } else {
51
    } else {
56
        $renewerror=~s/on_reserve/Item unavailable due to outstanding holds/;
52
        $renewerror=~s/on_reserve/Item unavailable due to outstanding holds/;
57
- 

Return to bug 14673