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

(-)a/C4/Circulation.pm (+11 lines)
Lines 1493-1498 sub AddIssue { Link Here
1493
                auto_renew      => $auto_renew ? 1 : 0,
1493
                auto_renew      => $auto_renew ? 1 : 0,
1494
            };
1494
            };
1495
1495
1496
            # Get ID of logged in user.  if called from a batch job,
1497
            # no user session exists and C4::Context->userenv() returns
1498
            # the scalar '0'. Only do this is the syspref says so
1499
            if ( C4::Context->preference('RecordIssuer') ) {
1500
                my $userenv = C4::Context->userenv();
1501
                my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : undef;
1502
                if ($usernumber) {
1503
                    $issue_attributes->{issuer} = $usernumber;
1504
                }
1505
            }
1506
1496
            $issue = Koha::Checkouts->find( { itemnumber => $item_object->itemnumber } );
1507
            $issue = Koha::Checkouts->find( { itemnumber => $item_object->itemnumber } );
1497
            if ($issue) {
1508
            if ($issue) {
1498
                $issue->set($issue_attributes)->store;
1509
                $issue->set($issue_attributes)->store;
(-)a/C4/Members.pm (-2 / +4 lines)
Lines 276-291 sub GetAllIssues { Link Here
276
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
276
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
277
  FROM issues
277
  FROM issues
278
  LEFT JOIN items on items.itemnumber=issues.itemnumber
278
  LEFT JOIN items on items.itemnumber=issues.itemnumber
279
  LEFT JOIN borrowers on borrowers.borrowernumber=issues.issuer
279
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
280
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
280
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
281
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
281
  WHERE borrowernumber=?
282
  WHERE issues.borrowernumber=?
282
  UNION ALL
283
  UNION ALL
283
  SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
284
  SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
284
  FROM old_issues
285
  FROM old_issues
285
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
286
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
287
  LEFT JOIN borrowers on borrowers.borrowernumber=old_issues.issuer
286
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
288
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
287
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
289
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
288
  WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL
290
  WHERE old_issues.borrowernumber=? AND old_issues.itemnumber IS NOT NULL
289
  order by ' . $order;
291
  order by ' . $order;
290
    if ($limit) {
292
    if ($limit) {
291
        $query .= " limit $limit";
293
        $query .= " limit $limit";
(-)a/Koha/Checkout.pm (+15 lines)
Lines 91-96 sub patron { Link Here
91
    return Koha::Patron->_new_from_dbic( $patron_rs );
91
    return Koha::Patron->_new_from_dbic( $patron_rs );
92
}
92
}
93
93
94
=head3 issued_by
95
96
my $issued_by = $checkout->issued_by
97
98
Return the patron by whom the checkout was done
99
100
=cut
101
102
sub issued_by {
103
    my ( $self ) = @_;
104
    my $issued_by_rs = $self->_result->issuer;
105
    return Koha::Patron->_new_from_dbic( $issued_by_rs );
106
}
107
94
=head3 to_api_mapping
108
=head3 to_api_mapping
95
109
96
This method returns the mapping for representing a Koha::Checkout object
110
This method returns the mapping for representing a Koha::Checkout object
Lines 102-107 sub to_api_mapping { Link Here
102
    return {
116
    return {
103
        issue_id        => 'checkout_id',
117
        issue_id        => 'checkout_id',
104
        borrowernumber  => 'patron_id',
118
        borrowernumber  => 'patron_id',
119
        issuer          => 'issuer_id',
105
        itemnumber      => 'item_id',
120
        itemnumber      => 'item_id',
106
        date_due        => 'due_date',
121
        date_due        => 'due_date',
107
        branchcode      => 'library_id',
122
        branchcode      => 'library_id',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt (+10 lines)
Lines 37-42 Link Here
37
            [% END %]
37
            [% END %]
38
            <th>Barcode</th>
38
            <th>Barcode</th>
39
            <th>Checked out from</th>
39
            <th>Checked out from</th>
40
            [% IF Koha.Preference('RecordIssuer') %]
41
            <th>Checked out by</th>
42
            [% END %]
40
            <th>Renewed</th>
43
            <th>Renewed</th>
41
            <th class='title-string'>Checkout on</th>
44
            <th class='title-string'>Checkout on</th>
42
            <th class='title-string'>Due date</th>
45
            <th class='title-string'>Due date</th>
Lines 63-68 Link Here
63
                    [% ELSE %]
66
                    [% ELSE %]
64
                        &nbsp;
67
                        &nbsp;
65
                    [% END %]</td>
68
                    [% END %]</td>
69
                [% IF Koha.Preference('RecordIssuer') %]
70
                <td>[% IF checkout.issuer %]
71
                    <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% checkout.issuer | uri %]">
72
                    [% checkout.issued_by.firstname | html %] [% checkout.issued_by.surname | html %]
73
                    </a>
74
                    [% END %]</td>
75
                [% END %]
66
                <td>[% IF checkout.renewals %]
76
                <td>[% IF checkout.renewals %]
67
                        Yes[% IF checkout.lastreneweddate %], <small>last on: [% checkout.lastreneweddate |$KohaDates  with_hours => 1 %]</small>
77
                        Yes[% IF checkout.lastreneweddate %], <small>last on: [% checkout.lastreneweddate |$KohaDates  with_hours => 1 %]</small>
68
                            [% END %]
78
                            [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt (-1 / +6 lines)
Lines 58-63 Link Here
58
        <th>Number of renewals</th>
58
        <th>Number of renewals</th>
59
        <th class="title-string">Checked out on</th>
59
        <th class="title-string">Checked out on</th>
60
        <th>Checked out from</th>
60
        <th>Checked out from</th>
61
        [% IF Koha.Preference('RecordIssuer') %]
62
        <th>Checked out by</th>
63
        [% END %]
61
        <th class="title-string">Date due</th>
64
        <th class="title-string">Date due</th>
62
        <th class="title-string">Return date</th>
65
        <th class="title-string">Return date</th>
63
        </tr>
66
        </tr>
Lines 92-97 Link Here
92
            <span title="[% issue.issuedate | html %]">[% issue.issuedate |$KohaDates  with_hours => 1 %]</span>
95
            <span title="[% issue.issuedate | html %]">[% issue.issuedate |$KohaDates  with_hours => 1 %]</span>
93
          </td>
96
          </td>
94
          <td>[% Branches.GetName( issue.branchcode ) | html %]</td>
97
          <td>[% Branches.GetName( issue.branchcode ) | html %]</td>
98
          [% IF Koha.Preference('RecordIssuer') %]
99
          <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% issue.issuer | uri %]">[% issue.firstname | html %] [% issue.surname | html %]</a></td>
100
          [% END %]
95
          <td>
101
          <td>
96
            [% IF issue.date_due %]
102
            [% IF issue.date_due %]
97
                <span title="[% issue.date_due | html %]">[% issue.date_due |$KohaDates  with_hours => 1 %]</span>
103
                <span title="[% issue.date_due | html %]">[% issue.date_due |$KohaDates  with_hours => 1 %]</span>
98
- 

Return to bug 23916