Fixed little bugs in SerializeField and errors debbuging in Webmodel
This commit is contained in:
parent
31917a339c
commit
fcd3d53cd1
2 changed files with 22 additions and 2 deletions
|
|
@ -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));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue