Little silly fixes in corefields
This commit is contained in:
parent
a57f714cd2
commit
2747eb56a6
5 changed files with 81 additions and 57 deletions
|
|
@ -35,12 +35,12 @@ class DateField extends PhangoField {
|
|||
|
||||
$final_value=0;
|
||||
|
||||
if($this->set_default_time==0)
|
||||
/*if($this->set_default_time==0)
|
||||
{
|
||||
|
||||
$final_value=PhaTime\DateTime::local_to_gmt(date(PhaTime\DateTime::$sql_format_time));
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
if(gettype($value)=='array')
|
||||
{
|
||||
|
|
@ -80,8 +80,14 @@ class DateField extends PhangoField {
|
|||
}
|
||||
|
||||
}
|
||||
if(PhaTime\DateTime::obtain_timestamp($value))
|
||||
{
|
||||
|
||||
if($final_value===false)
|
||||
$final_value=PhaTime\DateTime::local_to_gmt($value);
|
||||
|
||||
}
|
||||
|
||||
if($final_value==0)
|
||||
{
|
||||
|
||||
$this->error=1;
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ class DoubleField extends PhangoField {
|
|||
function check($value)
|
||||
{
|
||||
|
||||
$this->value=Utils::form_text($value);
|
||||
//$this->value=Utils::form_text($value);
|
||||
settype($value, "double");
|
||||
|
||||
if($this->value==0 && $this->required==true)
|
||||
if($value==0 && $this->required==true)
|
||||
{
|
||||
|
||||
$this->error=1;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class ForeignKeyField extends IntegerField{
|
|||
function get_type_sql()
|
||||
{
|
||||
|
||||
return 'INT('.$this->size.') NOT NULL DEFAULT "0"';
|
||||
return 'INT('.$this->size.') NULL';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class ImageField extends PhangoField {
|
|||
public $min_size=array(0, 0);
|
||||
public $prefix_id=1;
|
||||
public $img_minimal_height=array();
|
||||
public $func_token='Utils::get_token';
|
||||
public $func_token='PhangoApp\PhaUtils\Utils::get_token';
|
||||
public $move_file_func='move_uploaded_file';
|
||||
public $size=255;
|
||||
public $driver='gd';
|
||||
|
|
@ -72,6 +72,13 @@ class ImageField extends PhangoField {
|
|||
|
||||
$name_image=$_FILES[$file_name]['name'];
|
||||
|
||||
if($this->prefix_id)
|
||||
{
|
||||
|
||||
$name_image=hash('sha256', (call_user_func_array($this->func_token, array(25)))).'_'.$name_image;
|
||||
|
||||
}
|
||||
|
||||
$manager = new ImageManager(array('driver' => $this->driver));
|
||||
|
||||
if( ($image=$manager->make($_FILES[$file_name]['tmp_name']))!=false)
|
||||
|
|
|
|||
|
|
@ -921,7 +921,7 @@ class Webmodel {
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -1845,6 +1845,9 @@ class Webmodel {
|
|||
|
||||
$z=0;
|
||||
|
||||
if(count($this->fields_to_update)>0)
|
||||
{
|
||||
|
||||
foreach($this->components as $key => $field)
|
||||
{
|
||||
|
||||
|
|
@ -1898,19 +1901,27 @@ class Webmodel {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$this->std_error.='Error: no fields selected to update or insert ';
|
||||
|
||||
}
|
||||
|
||||
if($z==0)
|
||||
{
|
||||
|
||||
$this->std_error='Error: no fields to check';
|
||||
$this->std_error.='Error: no fields to check ';
|
||||
$set_error++;
|
||||
|
||||
}
|
||||
|
||||
//Set std_error for the model where is stored all errors in checking...
|
||||
|
||||
$this->std_error=implode(', ', $arr_std_error);
|
||||
$this->std_error.=implode(', ', $arr_std_error).' ';
|
||||
|
||||
//If error return 0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue