New feature for not use quotes on integers fields

This commit is contained in:
Antonio de la Rosa 2016-05-05 01:01:46 +02:00
parent 8a8588d70c
commit ecbaec5bbb
3 changed files with 17 additions and 7 deletions

View file

@ -14,8 +14,8 @@ class DoubleField extends PhangoField {
public $label=""; public $label="";
public $required=0; public $required=0;
public $form=""; public $form="";
public $quot_open='\''; public $quot_open='';
public $quot_close='\''; public $quot_close='';
public $std_error=''; public $std_error='';
function __construct($size=11) function __construct($size=11)

View file

@ -27,6 +27,8 @@ class IntegerField extends PhangoField {
$this->only_positive=$only_positive; $this->only_positive=$only_positive;
$this->min_num=$min_num; $this->min_num=$min_num;
$this->max_num=$max_num; $this->max_num=$max_num;
$this->quot_open='';
$this->quot_close='';
} }

View file

@ -732,8 +732,16 @@ class Webmodel {
foreach($args as $key => $arg) foreach($args as $key => $arg)
{ {
$quot='"';
$arr_conditions[$key]=$arr_conditions[$key].'"'.$this->escape_string($arg).'"'; if(gettype($arg)==='integer' || gettype($arg)==='float')
{
$quot='';
}
$arr_conditions[$key]=trim($arr_conditions[$key].$quot.$this->escape_string($arg).$quot);
} }
@ -893,7 +901,7 @@ class Webmodel {
$this->std_error.=I18n::lang('error_model', 'cant_insert', 'Can\'t insert').' '; $this->std_error.=I18n::lang('error_model', 'cant_insert', 'Can\'t insert').' ';
ModelForm::pass_errors_to_form($this); ModelForm::pass_errors_to_form($this);
return 0; return false;
} }
else else
@ -906,7 +914,7 @@ class Webmodel {
} }
return 1; return true;
} }
} }
@ -923,7 +931,7 @@ class Webmodel {
ModelForm::pass_errors_to_form($this); ModelForm::pass_errors_to_form($this);
$this->std_error.=I18n::lang('error_model', 'cant_insert', "Can't insert").' '; $this->std_error.=I18n::lang('error_model', 'cant_insert', "Can't insert").' ';
return 0; return false;
} }