Fixed little bugs in SerializeField and errors debbuging in Webmodel

This commit is contained in:
Antonio de la Rosa 2015-10-08 03:45:31 +02:00
parent 31917a339c
commit fcd3d53cd1
2 changed files with 22 additions and 2 deletions

View file

@ -2,6 +2,7 @@
namespace PhangoApp\PhaModels\CoreFields; namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaUtils\Utils; use PhangoApp\PhaUtils\Utils;
use PhangoApp\PhaModels\Webmodel;
/** /**
* Serializefield is a field if you need save serialize values * Serializefield is a field if you need save serialize values
@ -71,7 +72,7 @@ class SerializeField extends PhangoField {
$this->value=$value; $this->value=$value;
return webtsys_escape_string(serialize($value)); return Webmodel::escape_string(serialize($value));
} }

View file

@ -667,6 +667,13 @@ class Webmodel {
else else
{ {
if($fields===0)
{
$this->std_error.=I18n::lang('error_model', 'any_field_found', 'Not valid fields found').' ';
}
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').' ';
@ -1475,6 +1482,8 @@ class Webmodel {
//Make a foreach inside components, fields that are not found in components, are ignored //Make a foreach inside components, fields that are not found in components, are ignored
$z=0;
foreach($this->components as $key => $field) foreach($this->components as $key => $field)
{ {
@ -1507,6 +1516,8 @@ class Webmodel {
} }
$z++;
} }
else if($this->components[$key]->required==1) else if($this->components[$key]->required==1)
{ {
@ -1528,6 +1539,14 @@ class Webmodel {
} }
if($z==0)
{
$this->std_error='Error: no fields to check';
$set_error++;
}
//Set std_error for the model where is stored all errors in checking... //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);