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

(-)a/Koha/Item/Transfer.pm (-3 / +3 lines)
Lines 84-102 sub transit { Link Here
84
    return $self;
84
    return $self;
85
}
85
}
86
86
87
=head3 receipt
87
=head3 receive
88
88
89
Receive the transfer by setting the datearrived time.
89
Receive the transfer by setting the datearrived time.
90
90
91
=cut
91
=cut
92
92
93
sub receipt {
93
sub receive {
94
    my ($self) = @_;
94
    my ($self) = @_;
95
95
96
    # Throw exception if item is checked out
96
    # Throw exception if item is checked out
97
    Koha::Exceptions::Item::Transfer::Out->throw() if ($self->item->checkout);
97
    Koha::Exceptions::Item::Transfer::Out->throw() if ($self->item->checkout);
98
98
99
    # Update the receipt state
99
    # Update the arrived date
100
    $self->set({ datearrived => dt_from_string })->store;
100
    $self->set({ datearrived => dt_from_string })->store;
101
101
102
    ModDateLastSeen( $self->item->itemnumber );
102
    ModDateLastSeen( $self->item->itemnumber );
(-)a/t/db_dependent/Koha/Item/Transfer.t (-4 / +3 lines)
Lines 113-119 subtest 'transit tests' => sub { Link Here
113
    $schema->storage->txn_rollback;
113
    $schema->storage->txn_rollback;
114
};
114
};
115
115
116
subtest 'receipt tests' => sub {
116
subtest 'receive tests' => sub {
117
    plan tests => 5;
117
    plan tests => 5;
118
118
119
    $schema->storage->txn_begin;
119
    $schema->storage->txn_begin;
Lines 153-159 subtest 'receipt tests' => sub { Link Here
153
    );
153
    );
154
    is( ref($checkout), 'Koha::Checkout', 'Mock checkout added' );
154
    is( ref($checkout), 'Koha::Checkout', 'Mock checkout added' );
155
155
156
    throws_ok { $transfer->receipt() }
156
    throws_ok { $transfer->receive() }
157
    'Koha::Exceptions::Item::Transfer::Out',
157
    'Koha::Exceptions::Item::Transfer::Out',
158
      'Exception thrown if item is checked out';
158
      'Exception thrown if item is checked out';
159
159
Lines 161-167 subtest 'receipt tests' => sub { Link Here
161
161
162
    # Transit state set
162
    # Transit state set
163
    $transfer->discard_changes;
163
    $transfer->discard_changes;
164
    $transfer->receipt();
164
    $transfer->receive();
165
    ok( $transfer->datearrived, 'Receipt set the datearrived for the transfer' );
165
    ok( $transfer->datearrived, 'Receipt set the datearrived for the transfer' );
166
166
167
    # Last seen
167
    # Last seen
168
- 

Return to bug 25767