From 1993b3090cb1d947ec045c7dbeb10346d5c7dd27 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 Signed-off-by: Katrin Fischer Cleaner and works as described, no regressions found. Passes tests and QA script. Signed-off-by: Tomas Cohen Arazi --- 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 a72f3100e2..0833ffa254 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -559,7 +559,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."; @@ -599,7 +598,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 8ca517bfcc..6abe803df8 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.39.5