Fixes in fields and added protection for not update fields in Webmodel

This commit is contained in:
Antonio de la Rosa 2015-12-29 02:02:06 +01:00
parent 479f449b13
commit f0f8b6c9cd
5 changed files with 40 additions and 54 deletions

View file

@ -394,16 +394,22 @@ class Webmodel {
public $update=0;
/**
* Method for set the method used from cache or directly from the database.
* Property for set the method used from cache or directly from the database.
*/
public $method_fetch_array='nocached_fetch_array';
/**
* Method for set the method used from cache or directly from the database.
* Property for set the method used from cache or directly from the database.
*/
public $method_fetch_row='nocached_fetch_row';
/**
* Property that define the fields to update
*/
public $fields_to_update=array();
//Construct the model
@ -1834,7 +1840,7 @@ class Webmodel {
//If is set the variable for this component make checking
if(isset($post[$key]) && ($field->protected==0 || $safe_query==1))
if(isset($post[$key]) && ($field->protected==0 || $safe_query==1) && in_array($key, $this->fields_to_update))
{
$this->components[$key]->update=$this->update;
@ -2034,6 +2040,8 @@ class Webmodel {
$this->check_enctype+=$this->forms[$component_name]->enctype;
$this->fields_to_update[]=$component_name;
$this->components[$component_name]->form_loaded=&$this->forms[$component_name];
$this->components[$component_name]->get_parameters_default();