CRM-12133: Changed OptionValue's auto-increment function to use numeric comparison...
authorKirk Jackson <kirk@caat.org.uk>
Tue, 2 Apr 2013 16:41:51 +0000 (17:41 +0100)
committerKirk Jackson <kirk@caat.org.uk>
Tue, 2 Apr 2013 16:41:51 +0000 (17:41 +0100)
CRM/Core/BAO/OptionValue.php

index edc771bf333f87a8757eb3ec0dc8b9ffa6bba20e..1aba33a61827d5e3e50a5b7d90621a30847e3fc9 100644 (file)
@@ -111,7 +111,7 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
      }
      $bao->selectAdd();
      $bao->whereAdd("value REGEXP '^[0-9]+$'");
-     $bao->selectAdd('(ROUND(COALESCE(MAX(value),0)) +1) as nextvalue');
+     $bao->selectAdd('(ROUND(COALESCE(MAX(CONVERT(value, UNSIGNED)),0)) +1) as nextvalue');
      $bao->find(TRUE);
      return $bao->nextvalue;
   }