Bugzilla – Attachment 116553 Details for
Bug 26481
Add Koha::Item::Transfer->in_transit method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26481: Add Koha::Item::Transfer->in_transit method
Bug-26481-Add-KohaItemTransfer-intransit-method.patch (text/plain), 3.05 KB, created by
Martin Renvoize (ashimema)
on 2021-02-09 11:05:51 UTC
(
hide
)
Description:
Bug 26481: Add Koha::Item::Transfer->in_transit method
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-09 11:05:51 UTC
Size:
3.05 KB
patch
obsolete
>From ea30278c111f92bb4c7a7e3ba780cd39437cc562 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 18 Dec 2020 16:35:44 +0000 >Subject: [PATCH] Bug 26481: Add Koha::Item::Transfer->in_transit method >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This method returns a boolean representing the in_transit state of the >transfer. > >Test plan >1/ Run the included tests > >Signed-off-by: Kathleen Milne <kathleen.milne@cne-siar.gov.uk> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> >--- > Koha/Item/Transfer.pm | 13 ++++++++++ > t/db_dependent/Koha/Item/Transfer.t | 39 ++++++++++++++++++++++++++++- > 2 files changed, 51 insertions(+), 1 deletion(-) > >diff --git a/Koha/Item/Transfer.pm b/Koha/Item/Transfer.pm >index 0afe12ed1a..d4066f08f7 100644 >--- a/Koha/Item/Transfer.pm >+++ b/Koha/Item/Transfer.pm >@@ -82,6 +82,19 @@ sub transit { > > ModDateLastSeen( $self->item->itemnumber ); > return $self; >+ >+} >+ >+=head3 in_transit >+ >+Boolean returning whether the transfer is in transit or waiting >+ >+=cut >+ >+sub in_transit { >+ my ($self) = @_; >+ >+ return ( defined( $self->datesent ) && !defined( $self->datearrived ) ); > } > > =head3 receive >diff --git a/t/db_dependent/Koha/Item/Transfer.t b/t/db_dependent/Koha/Item/Transfer.t >index b82e2c8094..9a8c8258fa 100755 >--- a/t/db_dependent/Koha/Item/Transfer.t >+++ b/t/db_dependent/Koha/Item/Transfer.t >@@ -20,10 +20,11 @@ > use Modern::Perl; > > use Koha::Database; >+use Koha::DateUtils; > > use t::lib::TestBuilder; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::Exception; > > my $schema = Koha::Database->new->schema; >@@ -167,5 +168,41 @@ subtest 'receive tests' => sub { > # Last seen > ok( $item->datelastseen, 'Receipt set item datelastseen date' ); > >+ $schema->storage->txn_rollback; >+}; >+ >+subtest 'in_transit tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $library_from = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library_to = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $item = $builder->build_sample_item( >+ { >+ homebranch => $library_to->branchcode, >+ holdingbranch => $library_from->branchcode, >+ } >+ ); >+ >+ my $transfer = Koha::Item::Transfer->new( >+ { >+ itemnumber => $item->itemnumber, >+ frombranch => $library_from->branchcode, >+ tobranch => $library_to->branchcode, >+ daterequested => dt_from_string, >+ } >+ )->store; >+ >+ ok( !$transfer->in_transit, 'in_transit returns false when only daterequested is defined' ); >+ >+ $transfer->datesent(dt_from_string)->store; >+ ok( $transfer->in_transit, 'in_transit returns true when datesent is defined'); >+ >+ $transfer->datearrived(dt_from_string)->store; >+ ok( !$transfer->in_transit, 'in_transit returns false when datearrived is defined'); >+ >+ > $schema->storage->txn_rollback; > }; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26481
:
110271
|
110279
|
110301
|
110513
|
116553
|
117584