From 0db4288861251f069a4ae96dbe89ab9e5059ab0c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 31 Jul 2012 08:14:19 -0400 Subject: [PATCH] Bug 8533 - Non-numeric cardnumbers screw up autoMemberNum Signed-off-by: Jonathan Druart Removes a warning from mysql: Truncated incorrect INTEGER value: 'P13000' Signed-off-by: Paul Poulain Signed-off-by: Chris Cormack --- C4/Members.pm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index f7dc841f96..3c59aa16c0 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -896,11 +896,8 @@ sub fixup_cardnumber ($) { return "V$cardnumber$rem"; } else { - # MODIFIED BY JF: mysql4.1 allows casting as an integer, which is probably - # better. I'll leave the original in in case it needs to be changed for you - # my $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers"); my $sth = $dbh->prepare( - "select max(cast(cardnumber as signed)) from borrowers" + 'SELECT MAX( CAST( cardnumber AS SIGNED ) ) FROM borrowers WHERE cardnumber REGEXP "^-?[0-9]+$"' ); $sth->execute; my ($result) = $sth->fetchrow; -- 2.39.5