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

(-)a/C4/Circulation.pm (+11 lines)
Lines 1419-1424 sub AddIssue { Link Here
1419
                auto_renew      => $auto_renew ? 1 : 0,
1419
                auto_renew      => $auto_renew ? 1 : 0,
1420
            };
1420
            };
1421
1421
1422
            # Get ID of logged in user.  if called from a batch job,
1423
            # no user session exists and C4::Context->userenv() returns
1424
            # the scalar '0'. Only do this is the syspref says so
1425
            if ( C4::Context->preference('RecordIssuer') ) {
1426
                my $userenv = C4::Context->userenv();
1427
                my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : undef;
1428
                if ($usernumber) {
1429
                    $issue_attributes->{issuer} = $usernumber;
1430
                }
1431
            }
1432
1422
            $issue = Koha::Checkouts->find( { itemnumber => $item_object->itemnumber } );
1433
            $issue = Koha::Checkouts->find( { itemnumber => $item_object->itemnumber } );
1423
            if ($issue) {
1434
            if ($issue) {
1424
                $issue->set($issue_attributes)->store;
1435
                $issue->set($issue_attributes)->store;
(-)a/C4/Members.pm (-2 / +4 lines)
Lines 278-293 sub GetAllIssues { Link Here
278
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
278
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
279
  FROM issues
279
  FROM issues
280
  LEFT JOIN items on items.itemnumber=issues.itemnumber
280
  LEFT JOIN items on items.itemnumber=issues.itemnumber
281
  LEFT JOIN borrowers on borrowers.borrowernumber=issues.issuer
281
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
282
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
282
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
283
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
283
  WHERE borrowernumber=?
284
  WHERE issues.borrowernumber=?
284
  UNION ALL
285
  UNION ALL
285
  SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
286
  SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
286
  FROM old_issues
287
  FROM old_issues
287
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
288
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
289
  LEFT JOIN borrowers on borrowers.borrowernumber=old_issues.issuer
288
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
290
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
289
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
291
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
290
  WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL
292
  WHERE old_issues.borrowernumber=? AND old_issues.itemnumber IS NOT NULL
291
  order by ' . $order;
293
  order by ' . $order;
292
    if ($limit) {
294
    if ($limit) {
293
        $query .= " limit $limit";
295
        $query .= " limit $limit";
(-)a/Koha/Checkout.pm (+15 lines)
Lines 88-93 sub patron { Link Here
88
    return Koha::Patron->_new_from_dbic( $patron_rs );
88
    return Koha::Patron->_new_from_dbic( $patron_rs );
89
}
89
}
90
90
91
=head3 issued_by
92
93
my $issued_by = $checkout->issued_by
94
95
Return the patron by whom the checkout was done
96
97
=cut
98
99
sub issued_by {
100
    my ( $self ) = @_;
101
    my $issued_by_rs = $self->_result->issuer;
102
    return Koha::Patron->_new_from_dbic( $issued_by_rs );
103
}
104
91
=head3 to_api_mapping
105
=head3 to_api_mapping
92
106
93
This method returns the mapping for representing a Koha::Checkout object
107
This method returns the mapping for representing a Koha::Checkout object
Lines 99-104 sub to_api_mapping { Link Here
99
    return {
113
    return {
100
        issue_id        => 'checkout_id',
114
        issue_id        => 'checkout_id',
101
        borrowernumber  => 'patron_id',
115
        borrowernumber  => 'patron_id',
116
        issuer          => 'issuer_id',
102
        itemnumber      => 'item_id',
117
        itemnumber      => 'item_id',
103
        date_due        => 'due_date',
118
        date_due        => 'due_date',
104
        branchcode      => 'library_id',
119
        branchcode      => 'library_id',
(-)a/Koha/REST/V1/Checkouts.pm (+2 lines)
Lines 238-243 sub _to_model { Link Here
238
our $to_api_mapping = {
238
our $to_api_mapping = {
239
    issue_id        => 'checkout_id',
239
    issue_id        => 'checkout_id',
240
    borrowernumber  => 'patron_id',
240
    borrowernumber  => 'patron_id',
241
    issuer          => 'issuer_id',
241
    itemnumber      => 'item_id',
242
    itemnumber      => 'item_id',
242
    date_due        => 'due_date',
243
    date_due        => 'due_date',
243
    branchcode      => 'library_id',
244
    branchcode      => 'library_id',
Lines 254-259 our $to_api_mapping = { Link Here
254
our $to_model_mapping = {
255
our $to_model_mapping = {
255
    checkout_id       => 'issue_id',
256
    checkout_id       => 'issue_id',
256
    patron_id         => 'borrowernumber',
257
    patron_id         => 'borrowernumber',
258
    issuer_id         => 'issuer',
257
    item_id           => 'itemnumber',
259
    item_id           => 'itemnumber',
258
    due_date          => 'date_due',
260
    due_date          => 'date_due',
259
    library_id        => 'branchcode',
261
    library_id        => 'branchcode',
(-)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