@@ -, +, @@ --- C4/RotatingCollections.pm | 51 ---------------------- Koha/RotatingCollection.pm | 19 ++++++++ .../en/includes/rotating-collections-toolbar.inc | 9 ++-- .../en/modules/rotating_collections/addItems.tt | 24 +++++----- rotating_collections/addItems.pl | 10 +---- 5 files changed, 36 insertions(+), 77 deletions(-) --- a/C4/RotatingCollections.pm +++ a/C4/RotatingCollections.pm @@ -48,8 +48,6 @@ BEGIN { require Exporter; @ISA = qw( Exporter ); @EXPORT = qw( - GetItemsInCollection - AddItemToCollection RemoveItemFromCollection TransferCollection @@ -58,55 +56,6 @@ BEGIN { ); } -=head2 GetItemsInCollection - - ( $results, $success, $errorcode, $errormessage ) = GetItemsInCollection( $colId ); - - Returns information about the items in the given collection - - Input: - $colId: The id of the collection - - Output: - $results: Reference to an array of associated arrays - $success: 1 if all database operations were successful, 0 otherwise - $errorCode: Code for reason of failure, good for translating errors in templates - $errorMessage: English description of error - -=cut - -sub GetItemsInCollection { - my ($colId) = @_; - - ## Parameter check - if ( !$colId ) { - return ( 0, 0, 1, "NO_ID" ); - } - - my $dbh = C4::Context->dbh; - - my $sth = $dbh->prepare( - "SELECT - biblio.title, - biblio.biblionumber, - items.itemcallnumber, - items.barcode - FROM collections, collections_tracking, items, biblio - WHERE collections.colId = collections_tracking.colId - AND collections_tracking.itemnumber = items.itemnumber - AND items.biblionumber = biblio.biblionumber - AND collections.colId = ? ORDER BY biblio.title" - ); - $sth->execute($colId) or return ( 0, 0, 2, $sth->errstr() ); - - my @results; - while ( my $row = $sth->fetchrow_hashref ) { - push( @results, $row ); - } - - return \@results; -} - =head2 AddItemToCollection ( $success, $errorcode, $errormessage ) = AddItemToCollection( $colId, $itemnumber ); --- a/Koha/RotatingCollection.pm +++ a/Koha/RotatingCollection.pm @@ -22,6 +22,7 @@ use Modern::Perl; use Carp; use Koha::Database; +use Koha::Items; use base qw(Koha::Object); @@ -35,6 +36,24 @@ Koha::RotatingCollection - Koha Rotating collection Object class =cut +=head3 items + +=cut + +sub items { + my ( $self ) = @_; + my $items = Koha::Items->search( + { + 'collections_trackings.colId' => $self->colId + }, + { + join => [ 'collections_trackings' ] + } + ); + + return $items; +} + =head3 type =cut --- a/koha-tmpl/intranet-tmpl/prog/en/includes/rotating-collections-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/rotating-collections-toolbar.inc @@ -2,16 +2,15 @@
- - [% IF ( colId ) %] + [% IF ( collection.colId ) %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt @@ -1,6 +1,6 @@ [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] -- +
@@ -90,8 +90,8 @@Title | @@ -99,12 +99,12 @@Barcode | ||||||
---|---|---|---|---|---|---|---|
[% INCLUDE 'biblio-default-view.inc' biblionumber = collectionItemsLoo.biblionumber %][% collectionItemsLoo.title |html %] | -[% collectionItemsLoo.itemcallnumber %] | -[% collectionItemsLoo.barcode %] | -Remove | +[% INCLUDE 'biblio-default-view.inc' biblionumber = item.biblionumber %][% item.biblio.title |html %] | +[% item.itemcallnumber %] | +[% item.barcode %] | +Remove |