Merge pull request #1327 from joshua1234511/hotfix/giftcard-stuck-at-10-issue

fix for Giftcard  issue both display and count (#1315)
This commit is contained in:
FrancescoUK
2017-05-30 07:07:05 +01:00
committed by GitHub

View File

@@ -18,9 +18,12 @@ class Giftcard extends CI_Model
*/
public function get_max_number()
{
$this->db->select_max('giftcard_number');
$this->db->select('cast(giftcard_number AS UNSIGNED) AS giftcard_number');
$this->db->from('giftcards');
$this->db->where('giftcard_number REGEXP', "'^[0-9]+$'", FALSE);
$this->db->order_by("giftcard_number","desc");
$this->db->limit(1);
return $this->db->get()->row();
}
@@ -108,7 +111,7 @@ class Giftcard extends CI_Model
{
if($this->db->insert('giftcards', $giftcard_data))
{
$giftcard_data['giftcard_id'] = $this->db->insert_id();
$giftcard_data['giftcard_number'] = $this->db->insert_id();
return TRUE;
}