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

(-)a/C4/Serials.pm (-11 / +7 lines)
Lines 2259-2279 sub GetSubscriptionsFromBorrower { Link Here
2259
    my ($borrowernumber) = @_;
2259
    my ($borrowernumber) = @_;
2260
    my $dbh              = C4::Context->dbh;
2260
    my $dbh              = C4::Context->dbh;
2261
    my $sth              = $dbh->prepare(
2261
    my $sth              = $dbh->prepare(
2262
        "SELECT subscription.subscriptionid, biblio.title
2262
        "SELECT subscriptionroutinglist.*, biblio.title AS bibliotitle
2263
            FROM subscription
2263
            FROM subscriptionroutinglist
2264
            JOIN subscriptionrouting ON (subscriptionroutinglist.routinglistid = subscriptionrouting.routinglistid)
2265
            JOIN subscription ON (subscriptionroutinglist.subscriptionid = subscription.subscriptionid)
2264
            JOIN biblio ON biblio.biblionumber = subscription.biblionumber
2266
            JOIN biblio ON biblio.biblionumber = subscription.biblionumber
2265
            JOIN subscriptionroutinglist USING (subscriptionid)
2267
            WHERE subscriptionrouting.borrowernumber = ? ORDER BY title ASC
2266
            WHERE subscriptionroutinglist.borrowernumber = ? ORDER BY title ASC
2267
                               "
2268
                               "
2268
    );
2269
    );
2269
    $sth->execute($borrowernumber);
2270
    $sth->execute($borrowernumber);
2270
    my @routinglist;
2271
    my $routinglists = $sth->fetchall_arrayref({});
2271
    my $count = 0;
2272
    return $routinglists ? @$routinglists : ();
2272
    while ( my $line = $sth->fetchrow_hashref ) {
2273
        $count++;
2274
        push( @routinglist, $line );
2275
    }
2276
    return ( $count, @routinglist );
2277
}
2273
}
2278
2274
2279
2275
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt (-39 / +36 lines)
Lines 21-70 Link Here
21
<!-- Search Bar End -->
21
<!-- Search Bar End -->
22
22
23
<h1>
23
<h1>
24
[% IF ( countSubscrip ) %]
24
[% IF ( routinglists.size > 0 ) %]
25
[% countSubscrip %] Subscription routing list(s)
25
  [% routinglists.size %] Subscription routing list(s)
26
[% ELSE %]
26
[% ELSE %]
27
0 Subscription routing lists
27
  0 Subscription routing lists
28
[% END %]
28
[% END %]
29
</h1>
29
</h1>
30
30
31
<div id="subscriptions">
31
<div id="subscriptions">
32
[% IF ( subscripLoop ) %]
32
  [% IF ( routinglists.size > 0 ) %]
33
<table id="subscriptiont">
33
    <table id="subscriptiont">
34
              <thead>
34
      <thead>
35
                <tr>
35
        <tr>
36
                  <th>Subscription title</th>
36
          <th>Subscription title</th>
37
                  <th>Routing list</th>
37
          <th>Routing list</th>
38
                </tr>
38
          <th>Actions</th>
39
              </thead>
39
        </tr>
40
              <tbody>
40
      </thead>
41
[% FOREACH subscripLoop IN subscripLoop %]
41
      <tbody>
42
<tr>
42
        [% FOREACH routinglist IN routinglists %]
43
    <td>
43
          <tr>
44
    <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscripLoop.subscriptionid %]"><strong>
44
            <td>
45
    [% subscripLoop.title %]
45
              <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% routinglist.subscriptionid %]">
46
    </strong>
46
                <strong>
47
                    </a>
47
                  [% routinglist.bibliotitle %]
48
                  </td>
48
                </strong>
49
                  <td>
49
              </a>
50
                    <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscripLoop.subscriptionid %]"><strong>
50
            </td>
51
                    Edit routing list
51
            <td>[% routinglist.title %]</td>
52
                      </strong>
52
            <td>
53
                    </a>
53
              <a href="/cgi-bin/koha/serials/routinglist.pl?routinglistid=[% routinglist.routinglistid %]"><strong>
54
                    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
54
              Edit routing list
55
                    <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
55
                </strong>
56
                  </td>
56
              </a>
57
                </tr>
57
            </td>
58
                [% END %]
58
          </tr>
59
                </tbody>
59
        [% END %]
60
            </table>
60
      </tbody>
61
            </form>
61
    </table>
62
          [% ELSE %]
62
  [% ELSE %]
63
          <p>Patron does not belong to any subscription routing lists.</p>
63
    <p>Patron does not belong to any subscription routing lists.</p>
64
          <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
64
  [% END %]
65
                    <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
66
                    [% END %]
67
68
</div>
65
</div>
69
66
70
67
(-)a/members/routing-lists.pl (-15 / +2 lines)
Lines 76-97 if ($borrowernumber) { Link Here
76
76
77
if ($borrowernumber) {
77
if ($borrowernumber) {
78
# new op dev
78
# new op dev
79
  my $count;
79
  my @routinglists = GetSubscriptionsFromBorrower($borrowernumber );
80
  my @borrowerSubscriptions;
81
  ($count, @borrowerSubscriptions) = GetSubscriptionsFromBorrower($borrowernumber );
82
  my @subscripLoop;
83
84
    foreach my $num_res (@borrowerSubscriptions) {
85
        my %getSubscrip;
86
        $getSubscrip{subscriptionid}	= $num_res->{'subscriptionid'};
87
        $getSubscrip{title}			= $num_res->{'title'};
88
        $getSubscrip{borrowernumber}		= $num_res->{'borrowernumber'};
89
        push( @subscripLoop, \%getSubscrip );
90
    }
91
80
92
    $template->param(
81
    $template->param(
93
        countSubscrip => scalar @subscripLoop,
82
        routinglists => \@routinglists,
94
        subscripLoop  => \@subscripLoop,
95
        routinglistview => 1
83
        routinglistview => 1
96
    );
84
    );
97
85
98
- 

Return to bug 7957