When running the cronjob, delete_expired_opac_registrations.pl on a 3.14 site, I get the following error message: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 6 at /usr/share/koha/bin/cronjobs/delete_expired_opac_registrations.pl line 76. Checking the script, I find this SQL code: my $query = " SELECT borrowernumber FROM borrowers WHERE categorycode = ? AND DATEDIFF( DATE( NOW() ), DATE(dateenrolled) ) = ? ) If I run that SQL statement in the database manually, I get the same error message, e.g.: mysql> select borrowernumber from borrowers where categorycode='SELF' AND DATEDIFF( DATE( NOW() ), DATE(dateenrolled) ) = 7 ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 It would appear there's some problem with the DATEDIFF piece of the SELECT statement. - Larry
Created attachment 32078 [details] [review] Bug 11945: SQL syntax error in delete_expired_opac_registrations.pl This patch corrects a syntax error, adds some comments to the usage instructions and adds a count of the removed borrowers (with verbose flag on). Note that this is a dangerous script. It will delete your patrons in patron category PatronSelfRegistrationDefaultCategory. If you do not use this as a temporary category, you should NOT run this script. Test plan: Check PatronSelfRegistrationDefaultCategory. Check PatronSelfRegistrationExpireTemporaryAccountsDelay. Based on these two settings, check the number of patrons to be deleted (date enrolled should be before NOW minus the delay). Backup your data and run the script. Check the number of deleted borrowers.
Created attachment 32091 [details] [review] Bug 11945: SQL syntax error in delete_expired_opac_registrations.pl This patch corrects a syntax error, adds some comments to the usage instructions and adds a count of the removed borrowers (with verbose flag on). Note that this is a dangerous script. It will delete your patrons in patron category PatronSelfRegistrationDefaultCategory. If you do not use this as a temporary category, you should NOT run this script. Test plan: Check PatronSelfRegistrationDefaultCategory. Check PatronSelfRegistrationExpireTemporaryAccountsDelay. Based on these two settings, check the number of patrons to be deleted (date enrolled should be before NOW minus the delay). Backup your data and run the script. Check the number of deleted borrowers. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 32273 [details] [review] Bug 11945: SQL syntax error in delete_expired_opac_registrations.pl This patch corrects a syntax error, adds some comments to the usage instructions and adds a count of the removed borrowers (with verbose flag on). Note that this is a dangerous script. It will delete your patrons in patron category PatronSelfRegistrationDefaultCategory. If you do not use this as a temporary category, you should NOT run this script. Test plan: Check PatronSelfRegistrationDefaultCategory. Check PatronSelfRegistrationExpireTemporaryAccountsDelay. Based on these two settings, check the number of patrons to be deleted (date enrolled should be before NOW minus the delay). Backup your data and run the script. Check the number of deleted borrowers. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 32274 [details] [review] Bug 11945: The script should die if the pref are not filled If the 2 prefs are not defined, the script should die. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Patches pushed to master. Thanks Marcel and Jonathan!