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

(-)a/Koha/RotatingCollection.pm (-1 / +64 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use Carp;
22
use Carp;
23
23
24
use C4::Context;
25
24
use Koha::Database;
26
use Koha::Database;
25
use Koha::DateUtils;
27
use Koha::DateUtils;
26
use Koha::Exceptions;
28
use Koha::Exceptions;
Lines 40-45 Koha::RotatingCollection - Koha Rotating collection Object class Link Here
40
42
41
=cut
43
=cut
42
44
45
=head3 new
46
47
    $collection = Koha::RotatingCollection->new();
48
49
    This sub automatically adds date of creation and librarian who created collection if it is not present in params.
50
51
=cut
52
53
sub new {
54
    my ($class, $params) = @_;
55
    $params->{createdOn} //= output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
56
    $params->{createdBy} = undef;
57
    $params->{createdBy} = C4::Context->userenv->{number} if defined C4::Context->userenv;
58
59
    return $class->SUPER::new($params);
60
}
61
43
=head3 items
62
=head3 items
44
63
45
=cut
64
=cut
Lines 58-63 sub items { Link Here
58
    return $items;
77
    return $items;
59
}
78
}
60
79
80
=head3 untransferred_items
81
82
my $untransferred_items = $collection->untransferred_items;
83
84
Return all items which are not transferred yet
85
86
=cut
87
88
sub untransferred_items {
89
    my ( $self ) = @_;
90
91
    my $items = Koha::Items->search(
92
        {
93
            'collections_trackings.colId' => $self->colId,
94
            'branchtransfers.branchtransfer_id' => undef,
95
        },
96
        {
97
            join => [ 'collections_trackings', 'branchtransfers' ]
98
        }
99
    );
100
101
    return $items;
102
}
103
61
=head3 add_item
104
=head3 add_item
62
105
63
$collection->add_item( $item_object );
106
$collection->add_item( $item_object );
Lines 134-140 sub transfer { Link Here
134
177
135
    Koha::Exceptions::ObjectNotFound->throw if ref($library) ne 'Koha::Library';
178
    Koha::Exceptions::ObjectNotFound->throw if ref($library) ne 'Koha::Library';
136
179
137
    $self->colBranchcode( $library->branchcode )->store;
180
    $self->colBranchcode( $library->branchcode );
181
    $self->lastTransferredOn( output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }) );
182
    $self->store;
138
183
139
    my $from;
184
    my $from;
140
    $from = C4::Context->userenv->{'branch'} if C4::Context->userenv;
185
    $from = C4::Context->userenv->{'branch'} if C4::Context->userenv;
Lines 162-167 sub transfer { Link Here
162
    }
207
    }
163
}
208
}
164
209
210
=head3 creator
211
212
    $creator = $collection->creator
213
214
    return creator (Koha::Patron object) of this collection
215
216
=cut
217
218
sub creator {
219
    my ( $self ) = @_;
220
221
    return unless $self->createdBy;
222
223
    my $patron = Koha::Patrons->find( $self->createdBy );
224
225
    return $patron;
226
}
227
165
=head3 type
228
=head3 type
166
229
167
=cut
230
=cut
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt (-1 / +21 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE KohaDates %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Tools &rsaquo; Rotating collections</title>
5
<title>Koha &rsaquo; Tools &rsaquo; Rotating collections</title>
Lines 28-33 Link Here
28
                                    <th>Title</th>
29
                                    <th>Title</th>
29
                                    <th>Description</th>
30
                                    <th>Description</th>
30
                                    <th>Library</th>
31
                                    <th>Library</th>
32
                                    <th class="title-string">Date created</th>
33
                                    <th>Created by</th>
34
                                    <th>Number of items</td>
35
                                    <th>Number of untransferred items</td>
31
                                    <th>&nbsp;</th>
36
                                    <th>&nbsp;</th>
32
                                </tr>
37
                                </tr>
33
                            </thead>
38
                            </thead>
Lines 37-42 Link Here
37
                                    <td><a href="/cgi-bin/koha/rotating_collections/addItems.pl?colId=[% collectionsLoo.colId %]">[% collectionsLoo.colTitle %]</a></td>
42
                                    <td><a href="/cgi-bin/koha/rotating_collections/addItems.pl?colId=[% collectionsLoo.colId %]">[% collectionsLoo.colTitle %]</a></td>
38
                                    <td>[% collectionsLoo.colDesc %]</td>
43
                                    <td>[% collectionsLoo.colDesc %]</td>
39
                                    <td>[% Branches.GetName( collectionsLoo.colBranchcode ) %]</td>
44
                                    <td>[% Branches.GetName( collectionsLoo.colBranchcode ) %]</td>
45
                                    <td>
46
                                        [% IF collectionsLoo.createdOn %]
47
                                            <span title="[% collectionsLoo.createdOn %]">[% collectionsLoo.createdOn | $KohaDates %]</span>
48
                                        [% ELSE %]
49
                                            <span title="0000-00-00"></span>
50
                                        [% END %]
51
                                    </td>
52
                                    <td>
53
                                      [% IF collectionsLoo.creator %]
54
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% collectionsLoo.creator.borrowernumber %]">
55
                                          [% collectionsLoo.creator.firstname %] [% collectionsLoo.creator.surname %]
56
                                        </a>
57
                                      [% END %]
58
                                    </td>
59
                                    <td>[% collectionsLoo.items.count %]</td>
60
                                    <td>[% collectionsLoo.untransferred_items.count %]</td>
40
                                    <td>
61
                                    <td>
41
                                    <div class="dropdown">
62
                                    <div class="dropdown">
42
                                        <a class="btn btn-default btn-xs" dropdown-toggle" id="collectionsactions[% collectionsLoo.colId %]" role="button" data-toggle="dropdown" href="#">
63
                                        <a class="btn btn-default btn-xs" dropdown-toggle" id="collectionsactions[% collectionsLoo.colId %]" role="button" data-toggle="dropdown" href="#">
43
- 

Return to bug 19520