Lines 22-31
package C4::Members;
Link Here
|
22 |
|
22 |
|
23 |
use strict; |
23 |
use strict; |
24 |
#use warnings; FIXME - Bug 2505 |
24 |
#use warnings; FIXME - Bug 2505 |
25 |
use C4::Context; |
25 |
|
26 |
use C4::Dates qw(format_date_in_iso format_date); |
26 |
use Hash::Flatten; |
27 |
use String::Random qw( random_string ); |
27 |
use String::Random qw( random_string ); |
28 |
use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/; |
28 |
use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/; |
|
|
29 |
use DateTime; |
30 |
use DateTime::Format::DateParse; |
31 |
use Text::Unaccent qw( unac_string ); |
32 |
|
33 |
use C4::Context; |
34 |
use C4::Dates qw(format_date_in_iso format_date); |
29 |
use C4::Log; # logaction |
35 |
use C4::Log; # logaction |
30 |
use C4::Overdues; |
36 |
use C4::Overdues; |
31 |
use C4::Reserves; |
37 |
use C4::Reserves; |
Lines 35-45
use C4::Letters;
Link Here
|
35 |
use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable); |
41 |
use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable); |
36 |
use C4::Members::Attributes qw(SearchIdMatchingAttribute); |
42 |
use C4::Members::Attributes qw(SearchIdMatchingAttribute); |
37 |
use C4::NewsChannels; #get slip news |
43 |
use C4::NewsChannels; #get slip news |
38 |
use DateTime; |
|
|
39 |
use DateTime::Format::DateParse; |
40 |
use Koha::DateUtils; |
41 |
use Koha::Borrower::Debarments qw(IsDebarred); |
44 |
use Koha::Borrower::Debarments qw(IsDebarred); |
42 |
use Text::Unaccent qw( unac_string ); |
45 |
use Koha::DateUtils; |
43 |
use Koha::AuthUtils qw(hash_password); |
46 |
use Koha::AuthUtils qw(hash_password); |
44 |
use Koha::Database; |
47 |
use Koha::Database; |
45 |
|
48 |
|
Lines 2497-2517
sub HasOverdues {
Link Here
|
2497 |
sub GetOverdues { |
2500 |
sub GetOverdues { |
2498 |
my ( $borrowernumber ) = @_; |
2501 |
my ( $borrowernumber ) = @_; |
2499 |
|
2502 |
|
2500 |
my $sql = " |
2503 |
my $schema = Koha::Database->new()->schema(); |
2501 |
SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS(NOW())-TO_DAYS(date_due) AS days_overdue |
2504 |
my $rs = $schema->resultset('Issue')->search( |
2502 |
FROM issues,items,biblio, biblioitems |
2505 |
{ borrowernumber => $borrowernumber }, |
2503 |
WHERE items.itemnumber=issues.itemnumber |
2506 |
{ |
2504 |
AND biblio.biblionumber = items.biblionumber |
2507 |
select => [ \'TO_DAYS(NOW())-TO_DAYS(date_due)' ], |
2505 |
AND biblio.biblionumber = biblioitems.biblionumber |
2508 |
as => ['days_overdue'], |
2506 |
AND issues.borrowernumber = ? |
2509 |
prefetch => { |
2507 |
"; |
2510 |
'item' => { 'biblio' => 'biblioitems' } |
|
|
2511 |
}, |
2512 |
result_class => 'DBIx::Class::ResultClass::HashRefInflator', |
2513 |
} |
2514 |
); |
2508 |
|
2515 |
|
2509 |
my $sth = C4::Context->dbh->prepare( $sql ); |
2516 |
my @rows; |
2510 |
$sth->execute( $borrowernumber ); |
2517 |
while ( my $r = $rs->next() ) { |
|
|
2518 |
$r = Hash::Flatten::flatten($r); |
2519 |
my $new_r; |
2520 |
foreach my $key ( keys %$r ) { |
2521 |
my $new_key = ( split( '\.', $key ) )[-1]; |
2522 |
$new_r->{$new_key} = $r->{$key}; |
2523 |
} |
2524 |
|
2525 |
push( @rows, $new_r ); |
2526 |
} |
2511 |
|
2527 |
|
2512 |
return $sth->fetchall_arrayref({}); |
2528 |
return \@rows; |
2513 |
} |
2529 |
} |
2514 |
|
2530 |
|
|
|
2531 |
|
2532 |
|
2515 |
END { } # module clean-up code here (global destructor) |
2533 |
END { } # module clean-up code here (global destructor) |
2516 |
|
2534 |
|
2517 |
1; |
2535 |
1; |
2518 |
- |
|
|