Bugzilla – Attachment 107249 Details for
Bug 24446
Stockrotation: Update to use daterequested in branchtransfers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24446: Add Koha::Item::Transfer->in_transit method
Bug-24446-Add-KohaItemTransfer-intransit-method.patch (text/plain), 2.70 KB, created by
Martin Renvoize (ashimema)
on 2020-07-23 13:54:16 UTC
(
hide
)
Description:
Bug 24446: Add Koha::Item::Transfer->in_transit method
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-23 13:54:16 UTC
Size:
2.70 KB
patch
obsolete
>From 14aceed8714b1d80e69299fd6dc09ed2e37914e4 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 24 Mar 2020 07:02:25 +0000 >Subject: [PATCH] Bug 24446: Add Koha::Item::Transfer->in_transit method > >This method returns a boolean representing the in_transit state of the >transfer. >--- > Koha/Item/Transfer.pm | 13 ++++++++++ > t/db_dependent/Koha/Item/Transfer.t | 38 ++++++++++++++++++++++++++++- > 2 files changed, 50 insertions(+), 1 deletion(-) > >diff --git a/Koha/Item/Transfer.pm b/Koha/Item/Transfer.pm >index 80ba0458ba..50c6df832c 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 receipt >diff --git a/t/db_dependent/Koha/Item/Transfer.t b/t/db_dependent/Koha/Item/Transfer.t >index 485c57038a..8e100ac788 100644 >--- a/t/db_dependent/Koha/Item/Transfer.t >+++ b/t/db_dependent/Koha/Item/Transfer.t >@@ -23,7 +23,7 @@ use Koha::Database; > > 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 +167,41 @@ subtest 'receipt 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 24446
:
105943
|
105944
|
105945
|
107246
|
107247
|
107248
|
107249
|
107250
|
107252
|
107253
|
107254
|
107255
|
107256
|
107301
|
107302
|
107303
|
107304
|
107305
|
110280
|
110281
|
110282
|
110283
|
110533
|
110534
|
110535
|
110536
|
110537
|
110538
|
110539
|
110540
|
110541
|
110542
|
111322
|
116557
|
116558
|
116559
|
116560
|
116561
|
116562
|
116563
|
116564
|
116565
|
116566
|
116567
|
116568
|
116569
|
116570
|
117589
|
117590
|
117591
|
117592
|
117593
|
117594
|
117595
|
117596
|
117597
|
117598
|
117599
|
117600
|
117601
|
117602
|
117603
|
117604
|
117605
|
117606
|
117607
|
120116