Bugzilla – Attachment 31667 Details for
Bug 12933
Add ability to print overdue slip from staff intranet
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12933 [Followup] - Switch from DBI to DBIC
Bug-12933-Followup---Switch-from-DBI-to-DBIC.patch (text/plain), 2.85 KB, created by
Kyle M Hall (khall)
on 2014-09-17 10:25:26 UTC
(
hide
)
Description:
Bug 12933 [Followup] - Switch from DBI to DBIC
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-09-17 10:25:26 UTC
Size:
2.85 KB
patch
obsolete
>From f5ae88148c3c6c6d64666cb5c1fc099b90697ef1 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 17 Sep 2014 05:46:41 -0400 >Subject: [PATCH] Bug 12933 [Followup] - Switch from DBI to DBIC > >--- > C4/Members.pm | 52 +++++++++++++++++++++++++++++++++++----------------- > 1 files changed, 35 insertions(+), 17 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 21d44b5..094bccc 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -22,10 +22,16 @@ package C4::Members; > > use strict; > #use warnings; FIXME - Bug 2505 >-use C4::Context; >-use C4::Dates qw(format_date_in_iso format_date); >+ >+use Hash::Flatten; > use String::Random qw( random_string ); > use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/; >+use DateTime; >+use DateTime::Format::DateParse; >+use Text::Unaccent qw( unac_string ); >+ >+use C4::Context; >+use C4::Dates qw(format_date_in_iso format_date); > use C4::Log; # logaction > use C4::Overdues; > use C4::Reserves; >@@ -35,11 +41,8 @@ use C4::Letters; > use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable); > use C4::Members::Attributes qw(SearchIdMatchingAttribute); > use C4::NewsChannels; #get slip news >-use DateTime; >-use DateTime::Format::DateParse; >-use Koha::DateUtils; > use Koha::Borrower::Debarments qw(IsDebarred); >-use Text::Unaccent qw( unac_string ); >+use Koha::DateUtils; > use Koha::AuthUtils qw(hash_password); > use Koha::Database; > >@@ -2497,21 +2500,36 @@ sub HasOverdues { > sub GetOverdues { > my ( $borrowernumber ) = @_; > >- my $sql = " >- SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS(NOW())-TO_DAYS(date_due) AS days_overdue >- FROM issues,items,biblio, biblioitems >- WHERE items.itemnumber=issues.itemnumber >- AND biblio.biblionumber = items.biblionumber >- AND biblio.biblionumber = biblioitems.biblionumber >- AND issues.borrowernumber = ? >- "; >+ my $schema = Koha::Database->new()->schema(); >+ my $rs = $schema->resultset('Issue')->search( >+ { borrowernumber => $borrowernumber }, >+ { >+ select => [ \'TO_DAYS(NOW())-TO_DAYS(date_due)' ], >+ as => ['days_overdue'], >+ prefetch => { >+ 'item' => { 'biblio' => 'biblioitems' } >+ }, >+ result_class => 'DBIx::Class::ResultClass::HashRefInflator', >+ } >+ ); > >- my $sth = C4::Context->dbh->prepare( $sql ); >- $sth->execute( $borrowernumber ); >+ my @rows; >+ while ( my $r = $rs->next() ) { >+ $r = Hash::Flatten::flatten($r); >+ my $new_r; >+ foreach my $key ( keys %$r ) { >+ my $new_key = ( split( '\.', $key ) )[-1]; >+ $new_r->{$new_key} = $r->{$key}; >+ } >+ >+ push( @rows, $new_r ); >+ } > >- return $sth->fetchall_arrayref({}); >+ return \@rows; > } > >+ >+ > END { } # module clean-up code here (global destructor) > > 1; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12933
:
31638
|
31667
|
34456
|
34457
|
34467
|
34468
|
34469
|
34470
|
34471
|
34474
|
34475
|
34884
|
34885
|
34886
|
34887
|
34888
|
34889
|
35533
|
35534
|
35535
|
35536
|
35537
|
35538
|
35918
|
41606
|
41607
|
41608
|
41609
|
41610
|
41611
|
43514
|
43515
|
43516
|
43517
|
43518
|
43519
|
43520
|
43521
|
43522
|
43523
|
43904
|
43905
|
43906
|
43907
|
43908
|
43925
|
43926
|
43927
|
43928
|
43929
|
43930
|
43953