From 5c0b2521cac4f62d437432637760a1015a24b625 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 9 Oct 2014 13:09:47 +0200 Subject: [PATCH] Bug 13050: Follow-up for bug 12371 This patch simplifies the SQL query in Letters.pm for table borrower_modifications. It also addresses the only case this query is used in opac-memberentry. An unused variable in Letters.pm is removed. Test plan: Enable selfregistration on opac. Set verification by email to required in prefs too. Self-register two new users. Check the email notices generated. Verify the new users with the tokens in their notice. Signed-off-by: Chris Cormack Much cleaner SQL --- C4/Letters.pm | 3 +-- opac/opac-memberentry.pl | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 912294e..4a10cac 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -535,7 +535,6 @@ sub _substitute_tables { $values = $param; } else { - my @pk; my $sth = _parseletter_sth($table); unless ($sth) { warn "_parseletter_sth('$table') failed to return a valid sth. No substitution will be done for that table."; @@ -575,7 +574,7 @@ sub _parseletter_sth { ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE id = ?" : ($table eq 'aqorders' ) ? "SELECT * FROM $table WHERE ordernumber = ?" : ($table eq 'opac_news' ) ? "SELECT * FROM $table WHERE idnew = ?" : - ($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE ( borrowernumber = 0 OR borrowernumber = ? ) AND ( verification_token = '' OR verification_token = ? ) AND ( verification_token != '' OR borrowernumber != 0 )" : + ($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" : undef ; unless ($query) { warn "ERROR: No _parseletter_sth query for table '$table'"; diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 8ca517b..6abe803 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -115,8 +115,7 @@ if ( $action eq 'create' ) { module => 'members', letter_code => 'OPAC_REG_VERIFY', tables => { - borrower_modifications => - [ $verification_token, $verification_token ], + borrower_modifications => $verification_token, }, ); -- 2.1.0