Bugzilla – Attachment 32495 Details for
Bug 13084
Prevent mixup of columns in deletedborrowers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 13084 [Master] - QA Followup - Use DBIx::Class to simplify logic
PASSED-QA-Bug-13084-Master---QA-Followup---Use-DBI.patch (text/plain), 1.86 KB, created by
Kyle M Hall (khall)
on 2014-10-17 13:12:43 UTC
(
hide
)
Description:
[PASSED QA] Bug 13084 [Master] - QA Followup - Use DBIx::Class to simplify logic
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-10-17 13:12:43 UTC
Size:
1.86 KB
patch
obsolete
>From 2dfd7a70a309420c414b9b424b7772190af1e848 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 17 Oct 2014 07:52:13 -0400 >Subject: [PATCH] [PASSED QA] Bug 13084 [Master] - QA Followup - Use DBIx::Class to simplify logic > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Members.pm | 31 +++++++++---------------------- > 1 files changed, 9 insertions(+), 22 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index c243f69..e421940 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -1813,28 +1813,15 @@ The routine returns 1 for success, undef for failure. > > sub MoveMemberToDeleted { > my ($member) = shift or return; >- my $dbh = C4::Context->dbh; >- my $query = qq|SELECT * >- FROM borrowers >- WHERE borrowernumber=?|; >- my $sth = $dbh->prepare($query); >- $sth->execute($member); >- my $data = $sth->fetchrow_hashref; >- return if !$data; # probably bad borrowernumber >- >- #now construct a insert query that does not depend on the same order of >- #columns in borrowers and deletedborrowers (see BZ 13084) >- my $insertq = "INSERT INTO deletedborrowers ("; >- my @values; >- foreach my $key ( keys %$data ) { >- $insertq.= $key.","; >- push @values, $data->{$key}; >- } >- $insertq =~ s/,$//; #remove last comma >- $insertq .= ") VALUES (" . ( "?," x ( scalar(@values) - 1 ) ) . "?)"; >- $sth = $dbh->prepare( $insertq ); >- $sth->execute(@values); >- return $sth->err? undef: 1; >+ >+ my $schema = Koha::Database->new()->schema(); >+ my $borrowers_rs = $schema->resultset('Borrower'); >+ $borrowers_rs->result_class('DBIx::Class::ResultClass::HashRefInflator'); >+ my $borrower = $borrowers_rs->find($member); >+ >+ my $deleted = $schema->resultset('Deletedborrower')->create($borrower); >+ >+ return $deleted ? 1 : undef; > } > > =head2 DelMember >-- >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 13084
:
32343
|
32344
|
32378
|
32379
|
32380
|
32381
|
32394
|
32395
|
32396
|
32397
|
32490
|
32491
|
32492
|
32493
|
32494
|
32495
|
32496
|
32497
|
32500
|
32501
|
32502