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

(-)a/Koha/List/Patron.pm (+19 lines)
Lines 42-47 BEGIN { Link Here
42
      AddPatronList
42
      AddPatronList
43
      ModPatronList
43
      ModPatronList
44
44
45
      GetListsWithPatron
45
      AddPatronsToList
46
      AddPatronsToList
46
      DelPatronsFromList
47
      DelPatronsFromList
47
    );
48
    );
Lines 156-161 sub ModPatronList { Link Here
156
    return $list->update($params);
157
    return $list->update($params);
157
}
158
}
158
159
160
=head2 GetListsWithPatron
161
162
    GetListsWithPatron({ borrowernumber => $borrowernumber });
163
164
=cut
165
166
sub GetListsWithPatron {
167
    my ($params) = @_;
168
169
    my $borrowernumber = $params->{'borrowernumber'};
170
171
    return unless ( $borrowernumber );
172
173
    my @list_ids = map { $_->patron_list_id } Koha::Database->new()->schema()->resultset('PatronListPatron')->search( { borrowernumber => $borrowernumber } );
174
175
    return Koha::List::Patron->search( { patron_list_id => { 'IN' => \@list_ids } }, {order_by => 'name'} );
176
}
177
159
=head2 AddPatronsToList
178
=head2 AddPatronsToList
160
179
161
    AddPatronsToList({ list => $list, cardnumbers => \@cardnumbers });
180
    AddPatronsToList({ list => $list, cardnumbers => \@cardnumbers });
(-)a/Koha/Patron.pm (-1 / +37 lines)
Lines 52-57 use Koha::Patron::Messages; Link Here
52
use Koha::Patron::Modifications;
52
use Koha::Patron::Modifications;
53
use Koha::Patron::Relationships;
53
use Koha::Patron::Relationships;
54
use Koha::Patrons;
54
use Koha::Patrons;
55
use Koha::List::Patron qw( GetListsWithPatron GetPatronLists );
55
use Koha::Plugins;
56
use Koha::Plugins;
56
use Koha::Recalls;
57
use Koha::Recalls;
57
use Koha::Result::Boolean;
58
use Koha::Result::Boolean;
Lines 1049-1055 sub can_request_article { Link Here
1049
1050
1050
    my $count = Koha::ArticleRequests->search(
1051
    my $count = Koha::ArticleRequests->search(
1051
        [   { borrowernumber => $self->borrowernumber, status => [ 'REQUESTED', 'PENDING', 'PROCESSING' ] },
1052
        [   { borrowernumber => $self->borrowernumber, status => [ 'REQUESTED', 'PENDING', 'PROCESSING' ] },
1052
            { borrowernumber => $self->borrowernumber, status => 'COMPLETED', updated_on => { '>=' => \'CAST(NOW() AS DATE)' } },
1053
            { borrowernumber => $self->borrowernumber, status => 'COMPLETED', updated_on => { '>=' => 'CAST(NOW() AS DATE)' } },
1053
        ]
1054
        ]
1054
    )->count;
1055
    )->count;
1055
    return $count < $limit ? 1 : 0;
1056
    return $count < $limit ? 1 : 0;
Lines 1436-1441 sub get_enrollable_clubs { Link Here
1436
    return Koha::Clubs->get_enrollable($params);
1437
    return Koha::Clubs->get_enrollable($params);
1437
}
1438
}
1438
1439
1440
=head3 get_patron_lists
1441
1442
=cut
1443
1444
sub get_patron_lists {
1445
    my ( $self ) = @_;
1446
1447
    return GetListsWithPatron({borrowernumber => $self->borrowernumber()});
1448
}
1449
1450
=head3 get_joinable_patron_lists
1451
1452
=cut
1453
1454
sub get_joinable_patron_lists {
1455
    my ( $self ) = @_;
1456
1457
    my @lists = GetPatronLists();
1458
    my %joined_lists = map { $_->patron_list_id => 1 } GetListsWithPatron({borrowernumber => $self->borrowernumber()})->as_list;
1459
    my @offsets;
1460
1461
    for ( my $i = 0; $i < $#lists; $i++ ) {
1462
        my $list = $lists[$i];
1463
        my $id = $list->patron_list_id();
1464
        if ( $joined_lists{$id} ) {
1465
            unshift @offsets, $i;
1466
        }
1467
    }
1468
    for my $i (@offsets) {
1469
        splice @lists, $i, 1;
1470
    }
1471
1472
    return @lists;
1473
}
1474
1439
=head3 account_locked
1475
=head3 account_locked
1440
1476
1441
my $is_locked = $patron->account_locked
1477
my $is_locked = $patron->account_locked
(-)a/catalogue/moredetail.pl (+3 lines)
Lines 146-151 foreach ( keys %{$data} ) { Link Here
146
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
146
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
147
}
147
}
148
148
149
if ($itemnumber) {
150
    @items = (grep {$_->itemnumber == $itemnumber} @items);
151
}
149
my @item_data;
152
my @item_data;
150
foreach my $item (@items){
153
foreach my $item (@items){
151
154
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +21 lines)
Lines 725-730 Link Here
725
                                    </a>
725
                                    </a>
726
                                </li>
726
                                </li>
727
                            [% END %]
727
                            [% END %]
728
729
                            [% SET patron_lists = patron.get_patron_lists %]
730
                            [% IF CAN_user_tools_manage_patron_lists || patron_lists.count %]
731
                                <li role="presentation">
732
                                    <a id="pat_lists-tab-link" href="#pat_lists-tab" aria-controls="checkouts" role="tab" data-toggle="tab">
733
                                        Patron Lists ([% pat_lists_in.count | html %])
734
                                    </a>
735
                                </li>
736
                            [% END %]
728
                        </ul>
737
                        </ul>
729
738
730
                        <div class="tab-content">
739
                        <div class="tab-content">
Lines 748-753 Link Here
748
                                </div>
757
                                </div>
749
                            [% END %]
758
                            [% END %]
750
759
760
                            [% IF CAN_user_tools_manage_patron_lists || patron_lists.count %]
761
                                <div id="pat_lists-tab" role="tabpanel" class="tab-pane">
762
                                    Loading...
763
                                </div>
764
                            [% END %]
765
766
                            [% IF CAN_user_clubs && ( enrollments.count || enrollable.count ) %]
767
                                <div id="clubs-tab" role="tabpanel" class="tab-pane">
768
                                    Loading...
769
                                </div>
770
                            [% END %]
771
751
                            [% INCLUDE borrower_debarments.inc %]
772
                            [% INCLUDE borrower_debarments.inc %]
752
773
753
                            [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
774
                            [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
754
- 

Return to bug 32583