Bug 13050: Follow-up for bug 12371
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 9 Oct 2014 11:09:47 +0000 (13:09 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 21 Nov 2014 18:29:43 +0000 (15:29 -0300)
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 <chris@bigballofwax.co.nz>
Much cleaner SQL

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Cleaner and works as described, no regressions found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Letters.pm
opac/opac-memberentry.pl

index a72f310..0833ffa 100644 (file)
@@ -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'";
index 8ca517b..6abe803 100755 (executable)
@@ -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,
                 },
             );