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

(-)a/C4/Members.pm (-66 / +65 lines)
Lines 155-167 use C4::Members; Link Here
155
155
156
=head1 DESCRIPTION
156
=head1 DESCRIPTION
157
157
158
This module contains routines for adding, modifying and deleting members/patrons/borrowers 
158
This module contains routines for adding, modifying and deleting members/patrons/borrowers
159
159
160
=head1 FUNCTIONS
160
=head1 FUNCTIONS
161
161
162
=head2 Search
162
=head2 Search
163
163
164
  $borrowers_result_array_ref = &Search($filter,$orderby, $limit, 
164
  $borrowers_result_array_ref = &Search($filter,$orderby, $limit,
165
                       $columns_out, $search_on_fields,$searchtype);
165
                       $columns_out, $search_on_fields,$searchtype);
166
166
167
Looks up patrons (borrowers) on filter. A wrapper for SearchInTable('borrowers').
167
Looks up patrons (borrowers) on filter. A wrapper for SearchInTable('borrowers').
Lines 379-385 sub GetMemberDetails { Link Here
379
    $borrower->{'authflags'} = $accessflagshash;
379
    $borrower->{'authflags'} = $accessflagshash;
380
380
381
    # For the purposes of making templates easier, we'll define a
381
    # For the purposes of making templates easier, we'll define a
382
    # 'showname' which is the alternate form the user's first name if 
382
    # 'showname' which is the alternate form the user's first name if
383
    # 'other name' is defined.
383
    # 'other name' is defined.
384
    if ($borrower->{category_type} eq 'I') {
384
    if ($borrower->{category_type} eq 'I') {
385
        $borrower->{'showname'} = $borrower->{'othernames'};
385
        $borrower->{'showname'} = $borrower->{'othernames'};
Lines 441-447 The following will be set where applicable: Link Here
441
 $flags->{WAITING}->{message}       Message -- deprecated
441
 $flags->{WAITING}->{message}       Message -- deprecated
442
 $flags->{WAITING}->{itemlist}      ref-to-array: list of available items
442
 $flags->{WAITING}->{itemlist}      ref-to-array: list of available items
443
443
444
=over 
444
=over
445
445
446
=item C<$flags-E<gt>{ODUES}-E<gt>{itemlist}> is a reference-to-array listing the
446
=item C<$flags-E<gt>{ODUES}-E<gt>{itemlist}> is a reference-to-array listing the
447
overdue items. Its elements are references-to-hash, each describing an
447
overdue items. Its elements are references-to-hash, each describing an
Lines 457-463 fields from the reserves table of the Koha database. Link Here
457
457
458
=back
458
=back
459
459
460
All the "message" fields that include language generated in this function are deprecated, 
460
All the "message" fields that include language generated in this function are deprecated,
461
because such strings belong properly in the display layer.
461
because such strings belong properly in the display layer.
462
462
463
The "message" field that comes from the DB is OK.
463
The "message" field that comes from the DB is OK.
Lines 572-578 sub GetMember { Link Here
572
    my $dbh = C4::Context->dbh;
572
    my $dbh = C4::Context->dbh;
573
    my $select =
573
    my $select =
574
    q{SELECT borrowers.*, categories.category_type, categories.description
574
    q{SELECT borrowers.*, categories.category_type, categories.description
575
    FROM borrowers 
575
    FROM borrowers
576
    LEFT JOIN categories on borrowers.categorycode=categories.categorycode WHERE };
576
    LEFT JOIN categories on borrowers.categorycode=categories.categorycode WHERE };
577
    my $more_p = 0;
577
    my $more_p = 0;
578
    my @values = ();
578
    my @values = ();
Lines 722-729 sub GetMemberIssuesAndFines { Link Here
722
    my $issue_count = $sth->fetchrow_arrayref->[0];
722
    my $issue_count = $sth->fetchrow_arrayref->[0];
723
723
724
    $sth = $dbh->prepare(
724
    $sth = $dbh->prepare(
725
        "SELECT COUNT(*) FROM issues 
725
        "SELECT COUNT(*) FROM issues
726
         WHERE borrowernumber = ? 
726
         WHERE borrowernumber = ?
727
         AND date_due < now()"
727
         AND date_due < now()"
728
    );
728
    );
729
    $sth->execute($borrowernumber);
729
    $sth->execute($borrowernumber);
Lines 994-1002 sub changepassword { Link Here
994
        $sth->execute( $uid, $digest, $member );
994
        $sth->execute( $uid, $digest, $member );
995
        $resultcode=1;
995
        $resultcode=1;
996
    }
996
    }
997
    
997
998
    logaction("MEMBERS", "CHANGE PASS", $member, "") if C4::Context->preference("BorrowersLog");
998
    logaction("MEMBERS", "CHANGE PASS", $member, "") if C4::Context->preference("BorrowersLog");
999
    return $resultcode;    
999
    return $resultcode;
1000
}
1000
}
1001
1001
1002
1002
Lines 1068-1074 sub fixup_cardnumber { Link Here
1068
        my ($result) = $sth->fetchrow;
1068
        my ($result) = $sth->fetchrow;
1069
        return $result + 1;
1069
        return $result + 1;
1070
    }
1070
    }
1071
    return $cardnumber;     # just here as a fallback/reminder 
1071
    return $cardnumber;     # just here as a fallback/reminder
1072
}
1072
}
1073
1073
1074
=head2 GetGuarantees
1074
=head2 GetGuarantees
Lines 1098-1111 sub GetGuarantees { Link Here
1098
    $sth->execute($borrowernumber);
1098
    $sth->execute($borrowernumber);
1099
1099
1100
    my @dat;
1100
    my @dat;
1101
    my $data = $sth->fetchall_arrayref({}); 
1101
    my $data = $sth->fetchall_arrayref({});
1102
    return ( scalar(@$data), $data );
1102
    return ( scalar(@$data), $data );
1103
}
1103
}
1104
1104
1105
=head2 UpdateGuarantees
1105
=head2 UpdateGuarantees
1106
1106
1107
  &UpdateGuarantees($parent_borrno);
1107
  &UpdateGuarantees($parent_borrno);
1108
  
1108
1109
1109
1110
C<&UpdateGuarantees> borrower data for an adult and updates all the guarantees
1110
C<&UpdateGuarantees> borrower data for an adult and updates all the guarantees
1111
with the modified information
1111
with the modified information
Lines 1118-1124 sub UpdateGuarantees { Link Here
1118
    my $dbh = C4::Context->dbh;
1118
    my $dbh = C4::Context->dbh;
1119
    my ( $count, $guarantees ) = GetGuarantees( $data{'borrowernumber'} );
1119
    my ( $count, $guarantees ) = GetGuarantees( $data{'borrowernumber'} );
1120
    foreach my $guarantee (@$guarantees){
1120
    foreach my $guarantee (@$guarantees){
1121
        my $guaquery = qq|UPDATE borrowers 
1121
        my $guaquery = qq|UPDATE borrowers
1122
              SET address=?,fax=?,B_city=?,mobile=?,city=?,phone=?
1122
              SET address=?,fax=?,B_city=?,mobile=?,city=?,phone=?
1123
              WHERE borrowernumber=?
1123
              WHERE borrowernumber=?
1124
        |;
1124
        |;
Lines 1240-1253 sub GetAllIssues { Link Here
1240
    my $dbh = C4::Context->dbh;
1240
    my $dbh = C4::Context->dbh;
1241
    my $query =
1241
    my $query =
1242
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
1242
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
1243
  FROM issues 
1243
  FROM issues
1244
  LEFT JOIN items on items.itemnumber=issues.itemnumber
1244
  LEFT JOIN items on items.itemnumber=issues.itemnumber
1245
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1245
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1246
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
1246
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
1247
  WHERE borrowernumber=? 
1247
  WHERE borrowernumber=?
1248
  UNION ALL
1248
  UNION ALL
1249
  SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp 
1249
  SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
1250
  FROM old_issues 
1250
  FROM old_issues
1251
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
1251
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
1252
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1252
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
1253
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
1253
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
Lines 1283-1290 sub GetMemberAccountRecords { Link Here
1283
    my @acctlines;
1283
    my @acctlines;
1284
    my $numlines = 0;
1284
    my $numlines = 0;
1285
    my $strsth      = qq(
1285
    my $strsth      = qq(
1286
                        SELECT * 
1286
                        SELECT *
1287
                        FROM accountlines 
1287
                        FROM accountlines
1288
                        WHERE borrowernumber=?);
1288
                        WHERE borrowernumber=?);
1289
    $strsth.=" ORDER BY date desc,timestamp DESC";
1289
    $strsth.=" ORDER BY date desc,timestamp DESC";
1290
    my $sth= $dbh->prepare( $strsth );
1290
    my $sth= $dbh->prepare( $strsth );
Lines 1362-1372 sub GetBorNotifyAcctRecord { Link Here
1362
    my @acctlines;
1362
    my @acctlines;
1363
    my $numlines = 0;
1363
    my $numlines = 0;
1364
    my $sth = $dbh->prepare(
1364
    my $sth = $dbh->prepare(
1365
            "SELECT * 
1365
            "SELECT *
1366
                FROM accountlines 
1366
                FROM accountlines
1367
                WHERE borrowernumber=? 
1367
                WHERE borrowernumber=?
1368
                    AND notify_id=? 
1368
                    AND notify_id=?
1369
                    AND amountoutstanding != '0' 
1369
                    AND amountoutstanding != '0'
1370
                ORDER BY notify_id,accounttype
1370
                ORDER BY notify_id,accounttype
1371
                ");
1371
                ");
1372
1372
Lines 1519-1526 sub getidcity { Link Here
1519
1519
1520
  $email = GetFirstValidEmailAddress($borrowernumber);
1520
  $email = GetFirstValidEmailAddress($borrowernumber);
1521
1521
1522
Return the first valid email address for a borrower, given the borrowernumber.  For now, the order 
1522
Return the first valid email address for a borrower, given the borrowernumber.  For now, the order
1523
is defined as email, emailpro, B_email.  Returns the empty string if the borrower has no email 
1523
is defined as email, emailpro, B_email.  Returns the empty string if the borrower has no email
1524
addresses.
1524
addresses.
1525
1525
1526
=cut
1526
=cut
Lines 1572-1578 sub GetNoticeEmailAddress { Link Here
1572
    return $data->{'primaryemail'} || '';
1572
    return $data->{'primaryemail'} || '';
1573
}
1573
}
1574
1574
1575
=head2 GetExpiryDate 
1575
=head2 GetExpiryDate
1576
1576
1577
  $expirydate = GetExpiryDate($categorycode, $dateenrolled);
1577
  $expirydate = GetExpiryDate($categorycode, $dateenrolled);
1578
1578
Lines 1668-1683 sub GetBorrowercategory { Link Here
1668
    if ($catcode){
1668
    if ($catcode){
1669
        my $sth       =
1669
        my $sth       =
1670
        $dbh->prepare(
1670
        $dbh->prepare(
1671
    "SELECT description,dateofbirthrequired,upperagelimit,category_type 
1671
    "SELECT description,dateofbirthrequired,upperagelimit,category_type
1672
    FROM categories 
1672
    FROM categories
1673
    WHERE categorycode = ?"
1673
    WHERE categorycode = ?"
1674
        );
1674
        );
1675
        $sth->execute($catcode);
1675
        $sth->execute($catcode);
1676
        my $data =
1676
        my $data =
1677
        $sth->fetchrow_hashref;
1677
        $sth->fetchrow_hashref;
1678
        return $data;
1678
        return $data;
1679
    } 
1679
    }
1680
    return;  
1680
    return;
1681
}    # sub getborrowercategory
1681
}    # sub getborrowercategory
1682
1682
1683
1683
Lines 1880-1886 sub GetCities { Link Here
1880
1880
1881
Returns the authorized value  details
1881
Returns the authorized value  details
1882
C<&$lib>return value of authorized value details
1882
C<&$lib>return value of authorized value details
1883
C<&$sortvalue>this is the value of authorized value 
1883
C<&$sortvalue>this is the value of authorized value
1884
C<&$category>this is the value of authorized value category
1884
C<&$category>this is the value of authorized value category
1885
1885
1886
=cut
1886
=cut
Lines 1888-1895 C<&$category>this is the value of authorized value category Link Here
1888
sub GetSortDetails {
1888
sub GetSortDetails {
1889
    my ( $category, $sortvalue ) = @_;
1889
    my ( $category, $sortvalue ) = @_;
1890
    my $dbh   = C4::Context->dbh;
1890
    my $dbh   = C4::Context->dbh;
1891
    my $query = qq|SELECT lib 
1891
    my $query = qq|SELECT lib
1892
        FROM authorised_values 
1892
        FROM authorised_values
1893
        WHERE category=?
1893
        WHERE category=?
1894
        AND authorised_value=? |;
1894
        AND authorised_value=? |;
1895
    my $sth = $dbh->prepare($query);
1895
    my $sth = $dbh->prepare($query);
Lines 1937-1944 sub DelMember { Link Here
1937
    #warn "in delmember with $borrowernumber";
1937
    #warn "in delmember with $borrowernumber";
1938
    return unless $borrowernumber;    # borrowernumber is mandatory.
1938
    return unless $borrowernumber;    # borrowernumber is mandatory.
1939
1939
1940
    my $query = qq|DELETE 
1940
    my $query = qq|DELETE
1941
          FROM  reserves 
1941
          FROM  reserves
1942
          WHERE borrowernumber=?|;
1942
          WHERE borrowernumber=?|;
1943
    my $sth = $dbh->prepare($query);
1943
    my $sth = $dbh->prepare($query);
1944
    $sth->execute($borrowernumber);
1944
    $sth->execute($borrowernumber);
Lines 1973-1980 sub ExtendMemberSubscriptionTo { Link Here
1973
      $date = GetExpiryDate( $borrower->{'categorycode'}, $date );
1973
      $date = GetExpiryDate( $borrower->{'categorycode'}, $date );
1974
    }
1974
    }
1975
    my $sth = $dbh->do(<<EOF);
1975
    my $sth = $dbh->do(<<EOF);
1976
UPDATE borrowers 
1976
UPDATE borrowers
1977
SET  dateexpiry='$date' 
1977
SET  dateexpiry='$date'
1978
WHERE borrowernumber='$borrowerid'
1978
WHERE borrowernumber='$borrowerid'
1979
EOF
1979
EOF
1980
1980
Lines 2080-2087 sub GetHideLostItemsPreference { Link Here
2080
    my $query = "SELECT hidelostitems FROM borrowers,categories WHERE borrowers.categorycode = categories.categorycode AND borrowernumber = ?";
2080
    my $query = "SELECT hidelostitems FROM borrowers,categories WHERE borrowers.categorycode = categories.categorycode AND borrowernumber = ?";
2081
    my $sth = $dbh->prepare($query);
2081
    my $sth = $dbh->prepare($query);
2082
    $sth->execute($borrowernumber);
2082
    $sth->execute($borrowernumber);
2083
    my $hidelostitems = $sth->fetchrow;    
2083
    my $hidelostitems = $sth->fetchrow;
2084
    return $hidelostitems;    
2084
    return $hidelostitems;
2085
}
2085
}
2086
2086
2087
=head2 GetBorrowersToExpunge
2087
=head2 GetBorrowersToExpunge
Lines 2105-2115 sub GetBorrowersToExpunge { Link Here
2105
    my $filtercategory = $params->{'category_code'};
2105
    my $filtercategory = $params->{'category_code'};
2106
    my $filterbranch   = $params->{'branchcode'} ||
2106
    my $filterbranch   = $params->{'branchcode'} ||
2107
                        ((C4::Context->preference('IndependentBranches')
2107
                        ((C4::Context->preference('IndependentBranches')
2108
                             && C4::Context->userenv 
2108
                             && C4::Context->userenv
2109
                             && !C4::Context->IsSuperLibrarian()
2109
                             && !C4::Context->IsSuperLibrarian()
2110
                             && C4::Context->userenv->{branch})
2110
                             && C4::Context->userenv->{branch})
2111
                         ? C4::Context->userenv->{branch}
2111
                         ? C4::Context->userenv->{branch}
2112
                         : "");  
2112
                         : "");
2113
2113
2114
    my $dbh   = C4::Context->dbh;
2114
    my $dbh   = C4::Context->dbh;
2115
    my $query = "
2115
    my $query = "
Lines 2119-2125 sub GetBorrowersToExpunge { Link Here
2119
        FROM   borrowers
2119
        FROM   borrowers
2120
        JOIN   categories USING (categorycode)
2120
        JOIN   categories USING (categorycode)
2121
        LEFT JOIN old_issues USING (borrowernumber)
2121
        LEFT JOIN old_issues USING (borrowernumber)
2122
        LEFT JOIN issues USING (borrowernumber) 
2122
        LEFT JOIN issues USING (borrowernumber)
2123
        WHERE  category_type <> 'S'
2123
        WHERE  category_type <> 'S'
2124
        AND borrowernumber NOT IN (SELECT guarantorid FROM borrowers WHERE guarantorid IS NOT NULL AND guarantorid <> 0)
2124
        AND borrowernumber NOT IN (SELECT guarantorid FROM borrowers WHERE guarantorid IS NOT NULL AND guarantorid <> 0)
2125
   ";
2125
   ";
Lines 2144-2156 sub GetBorrowersToExpunge { Link Here
2144
    warn $query if $debug;
2144
    warn $query if $debug;
2145
2145
2146
    my $sth = $dbh->prepare($query);
2146
    my $sth = $dbh->prepare($query);
2147
    if (scalar(@query_params)>0){  
2147
    if (scalar(@query_params)>0){
2148
        $sth->execute(@query_params);
2148
        $sth->execute(@query_params);
2149
    } 
2149
    }
2150
    else {
2150
    else {
2151
        $sth->execute;
2151
        $sth->execute;
2152
    }      
2152
    }
2153
    
2153
2154
    my @results;
2154
    my @results;
2155
    while ( my $data = $sth->fetchrow_hashref ) {
2155
    while ( my $data = $sth->fetchrow_hashref ) {
2156
        push @results, $data;
2156
        push @results, $data;
Lines 2169-2181 I<$result> is a ref to an array which all elements are a hasref. Link Here
2169
=cut
2169
=cut
2170
2170
2171
sub GetBorrowersWhoHaveNeverBorrowed {
2171
sub GetBorrowersWhoHaveNeverBorrowed {
2172
    my $filterbranch = shift || 
2172
    my $filterbranch = shift ||
2173
                        ((C4::Context->preference('IndependentBranches')
2173
                        ((C4::Context->preference('IndependentBranches')
2174
                             && C4::Context->userenv 
2174
                             && C4::Context->userenv
2175
                             && !C4::Context->IsSuperLibrarian()
2175
                             && !C4::Context->IsSuperLibrarian()
2176
                             && C4::Context->userenv->{branch})
2176
                             && C4::Context->userenv->{branch})
2177
                         ? C4::Context->userenv->{branch}
2177
                         ? C4::Context->userenv->{branch}
2178
                         : "");  
2178
                         : "");
2179
    my $dbh   = C4::Context->dbh;
2179
    my $dbh   = C4::Context->dbh;
2180
    my $query = "
2180
    my $query = "
2181
        SELECT borrowers.borrowernumber,max(timestamp) as latestissue
2181
        SELECT borrowers.borrowernumber,max(timestamp) as latestissue
Lines 2184-2203 sub GetBorrowersWhoHaveNeverBorrowed { Link Here
2184
        WHERE issues.borrowernumber IS NULL
2184
        WHERE issues.borrowernumber IS NULL
2185
   ";
2185
   ";
2186
    my @query_params;
2186
    my @query_params;
2187
    if ($filterbranch && $filterbranch ne ""){ 
2187
    if ($filterbranch && $filterbranch ne ""){
2188
        $query.=" AND borrowers.branchcode= ?";
2188
        $query.=" AND borrowers.branchcode= ?";
2189
        push @query_params,$filterbranch;
2189
        push @query_params,$filterbranch;
2190
    }
2190
    }
2191
    warn $query if $debug;
2191
    warn $query if $debug;
2192
  
2192
2193
    my $sth = $dbh->prepare($query);
2193
    my $sth = $dbh->prepare($query);
2194
    if (scalar(@query_params)>0){  
2194
    if (scalar(@query_params)>0){
2195
        $sth->execute(@query_params);
2195
        $sth->execute(@query_params);
2196
    } 
2196
    }
2197
    else {
2197
    else {
2198
        $sth->execute;
2198
        $sth->execute;
2199
    }      
2199
    }
2200
    
2200
2201
    my @results;
2201
    my @results;
2202
    while ( my $data = $sth->fetchrow_hashref ) {
2202
    while ( my $data = $sth->fetchrow_hashref ) {
2203
        push @results, $data;
2203
        push @results, $data;
Lines 2219-2243 This hashref is containt the number of time this borrowers has borrowed before I Link Here
2219
sub GetBorrowersWithIssuesHistoryOlderThan {
2219
sub GetBorrowersWithIssuesHistoryOlderThan {
2220
    my $dbh  = C4::Context->dbh;
2220
    my $dbh  = C4::Context->dbh;
2221
    my $date = shift ||POSIX::strftime("%Y-%m-%d",localtime());
2221
    my $date = shift ||POSIX::strftime("%Y-%m-%d",localtime());
2222
    my $filterbranch = shift || 
2222
    my $filterbranch = shift ||
2223
                        ((C4::Context->preference('IndependentBranches')
2223
                        ((C4::Context->preference('IndependentBranches')
2224
                             && C4::Context->userenv 
2224
                             && C4::Context->userenv
2225
                             && !C4::Context->IsSuperLibrarian()
2225
                             && !C4::Context->IsSuperLibrarian()
2226
                             && C4::Context->userenv->{branch})
2226
                             && C4::Context->userenv->{branch})
2227
                         ? C4::Context->userenv->{branch}
2227
                         ? C4::Context->userenv->{branch}
2228
                         : "");  
2228
                         : "");
2229
    my $query = "
2229
    my $query = "
2230
       SELECT count(borrowernumber) as n,borrowernumber
2230
       SELECT count(borrowernumber) as n,borrowernumber
2231
       FROM old_issues
2231
       FROM old_issues
2232
       WHERE returndate < ?
2232
       WHERE returndate < ?
2233
         AND borrowernumber IS NOT NULL 
2233
         AND borrowernumber IS NOT NULL
2234
    "; 
2234
    ";
2235
    my @query_params;
2235
    my @query_params;
2236
    push @query_params, $date;
2236
    push @query_params, $date;
2237
    if ($filterbranch){
2237
    if ($filterbranch){
2238
        $query.="   AND branchcode = ?";
2238
        $query.="   AND branchcode = ?";
2239
        push @query_params, $filterbranch;
2239
        push @query_params, $filterbranch;
2240
    }    
2240
    }
2241
    $query.=" GROUP BY borrowernumber ";
2241
    $query.=" GROUP BY borrowernumber ";
2242
    warn $query if $debug;
2242
    warn $query if $debug;
2243
    my $sth = $dbh->prepare($query);
2243
    my $sth = $dbh->prepare($query);
Lines 2263-2272 This hashref is containt the number of time this borrowers has borrowed before I Link Here
2263
2263
2264
sub GetBorrowersNamesAndLatestIssue {
2264
sub GetBorrowersNamesAndLatestIssue {
2265
    my $dbh  = C4::Context->dbh;
2265
    my $dbh  = C4::Context->dbh;
2266
    my @borrowernumbers=@_;  
2266
    my @borrowernumbers=@_;
2267
    my $query = "
2267
    my $query = "
2268
       SELECT surname,lastname, phone, email,max(timestamp)
2268
       SELECT surname,lastname, phone, email,max(timestamp)
2269
       FROM borrowers 
2269
       FROM borrowers
2270
         LEFT JOIN issues ON borrowers.borrowernumber=issues.borrowernumber
2270
         LEFT JOIN issues ON borrowers.borrowernumber=issues.borrowernumber
2271
       GROUP BY borrowernumber
2271
       GROUP BY borrowernumber
2272
   ";
2272
   ";
2273
- 

Return to bug 12933