Bugzilla – Attachment 73263 Details for
Bug 19520
Show more information about rotating collections
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19520: Add more information about rotating collections
Bug-19520-Add-more-information-about-rotating-coll.patch (text/plain), 5.78 KB, created by
Josef Moravec
on 2018-03-25 19:47:18 UTC
(
hide
)
Description:
Bug 19520: Add more information about rotating collections
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-03-25 19:47:18 UTC
Size:
5.78 KB
patch
obsolete
>From bcacd15f3faa627036dcf585c59d6fd0b4577147 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Sun, 12 Nov 2017 10:50:58 +0000 >Subject: [PATCH] Bug 19520: Add more information about rotating collections > >Test plan: >1) Apply the patch >2) Update database >3) prove t/db_dependent/Koha/RotatingCollections.t >--- > Koha/RotatingCollection.pm | 65 +++++++++++++++++++++- > .../rotating_collections/rotatingCollections.tt | 21 +++++++ > 2 files changed, 85 insertions(+), 1 deletion(-) > >diff --git a/Koha/RotatingCollection.pm b/Koha/RotatingCollection.pm >index 51e7b72864..4648b95e93 100644 >--- a/Koha/RotatingCollection.pm >+++ b/Koha/RotatingCollection.pm >@@ -21,6 +21,8 @@ use Modern::Perl; > > use Carp; > >+use C4::Context; >+ > use Koha::Database; > use Koha::DateUtils; > use Koha::Exceptions; >@@ -40,6 +42,23 @@ Koha::RotatingCollection - Koha Rotating collection Object class > > =cut > >+=head3 new >+ >+ $collection = Koha::RotatingCollection->new(); >+ >+ This sub automatically adds date of creation and librarian who created collection if it is not present in params. >+ >+=cut >+ >+sub new { >+ my ($class, $params) = @_; >+ $params->{createdOn} //= output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); >+ $params->{createdBy} = undef; >+ $params->{createdBy} = C4::Context->userenv->{number} if defined C4::Context->userenv; >+ >+ return $class->SUPER::new($params); >+} >+ > =head3 items > > =cut >@@ -58,6 +77,30 @@ sub items { > return $items; > } > >+=head3 untransferred_items >+ >+my $untransferred_items = $collection->untransferred_items; >+ >+Return all items which are not transferred yet >+ >+=cut >+ >+sub untransferred_items { >+ my ( $self ) = @_; >+ >+ my $items = Koha::Items->search( >+ { >+ 'collections_trackings.colId' => $self->colId, >+ 'branchtransfers.branchtransfer_id' => undef, >+ }, >+ { >+ join => [ 'collections_trackings', 'branchtransfers' ] >+ } >+ ); >+ >+ return $items; >+} >+ > =head3 add_item > > $collection->add_item( $item_object ); >@@ -134,7 +177,9 @@ sub transfer { > > Koha::Exceptions::ObjectNotFound->throw if ref($library) ne 'Koha::Library'; > >- $self->colBranchcode( $library->branchcode )->store; >+ $self->colBranchcode( $library->branchcode ); >+ $self->lastTransferredOn( output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }) ); >+ $self->store; > > my $from; > $from = C4::Context->userenv->{'branch'} if C4::Context->userenv; >@@ -162,6 +207,24 @@ sub transfer { > } > } > >+=head3 creator >+ >+ $creator = $collection->creator >+ >+ return creator (Koha::Patron object) of this collection >+ >+=cut >+ >+sub creator { >+ my ( $self ) = @_; >+ >+ return unless $self->createdBy; >+ >+ my $patron = Koha::Patrons->find( $self->createdBy ); >+ >+ return $patron; >+} >+ > =head3 type > > =cut >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt >index 585f820a05..7df48d697b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt >@@ -1,4 +1,5 @@ > [% USE Branches %] >+[% USE KohaDates %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › Rotating collections</title> >@@ -28,6 +29,10 @@ > <th>Title</th> > <th>Description</th> > <th>Library</th> >+ <th class="title-string">Date created</th> >+ <th>Created by</th> >+ <th>Number of items</td> >+ <th>Number of untransferred items</td> > <th> </th> > </tr> > </thead> >@@ -37,6 +42,22 @@ > <td><a href="/cgi-bin/koha/rotating_collections/addItems.pl?colId=[% collectionsLoo.colId %]">[% collectionsLoo.colTitle %]</a></td> > <td>[% collectionsLoo.colDesc %]</td> > <td>[% Branches.GetName( collectionsLoo.colBranchcode ) %]</td> >+ <td> >+ [% IF collectionsLoo.createdOn %] >+ <span title="[% collectionsLoo.createdOn %]">[% collectionsLoo.createdOn | $KohaDates %]</span> >+ [% ELSE %] >+ <span title="0000-00-00"></span> >+ [% END %] >+ </td> >+ <td> >+ [% IF collectionsLoo.creator %] >+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% collectionsLoo.creator.borrowernumber %]"> >+ [% collectionsLoo.creator.firstname %] [% collectionsLoo.creator.surname %] >+ </a> >+ [% END %] >+ </td> >+ <td>[% collectionsLoo.items.count %]</td> >+ <td>[% collectionsLoo.untransferred_items.count %]</td> > <td> > <div class="dropdown"> > <a class="btn btn-default btn-xs" dropdown-toggle" id="collectionsactions[% collectionsLoo.colId %]" role="button" data-toggle="dropdown" href="#"> >-- >2.14.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 19520
:
72819
|
72820
|
72821
|
72822
|
73260
|
73261
|
73262
|
73263
|
73394
|
73395
|
73396
|
73397