Index: trunk/core/kernel/db/dbitem.php
===================================================================
diff -u -N -r4029 -r4758
--- trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 4029)
+++ trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 4758)
@@ -45,17 +45,17 @@
* @access public
*/
var $ID;
-
+
function kDBItem()
{
parent::kDBBase();
- $this->ErrorMsgs['required'] = $this->Application->Phrase('la_err_required'); //'Field is required';
- $this->ErrorMsgs['unique'] = $this->Application->Phrase('la_err_unique'); //'Field value must be unique';
- $this->ErrorMsgs['value_out_of_range'] = $this->Application->Phrase('la_err_value_out_of_range'); //'Field is out of range, possible values from %s to %s';
- $this->ErrorMsgs['length_out_of_range'] = $this->Application->Phrase('la_err_length_out_of_range'); //'Field is out of range';
- $this->ErrorMsgs['bad_type'] = $this->Application->Phrase('la_err_bad_type'); //'Incorrect data format, please use %s';
- $this->ErrorMsgs['bad_date_format'] = $this->Application->Phrase('la_err_bad_date_format'); //'Incorrect date format, please use (%s) ex. (%s)';
- $this->ErrorMsgs['primary_lang_required'] = $this->Application->Phrase('la_err_primary_lang_required');
+ $this->ErrorMsgs['required'] = '!la_err_required!'; //'Field is required';
+ $this->ErrorMsgs['unique'] = '!la_err_unique!'; //'Field value must be unique';
+ $this->ErrorMsgs['value_out_of_range'] = '!la_err_value_out_of_range!'; //'Field is out of range, possible values from %s to %s';
+ $this->ErrorMsgs['length_out_of_range'] = '!la_err_length_out_of_range!'; //'Field is out of range';
+ $this->ErrorMsgs['bad_type'] = '!la_err_bad_type!'; //'Incorrect data format, please use %s';
+ $this->ErrorMsgs['bad_date_format'] = '!la_err_bad_date_format!'; //'Incorrect date format, please use (%s) ex. (%s)';
+ $this->ErrorMsgs['primary_lang_required'] = '!la_err_primary_lang_required!';
}
function SetDirtyField($field_name, $field_value)
@@ -372,7 +372,7 @@
if (!$system_update && $affected == 1){
$this->setModifiedFlag();
}
-
+
$this->saveCustomFields();
$this->raiseEvent('OnAfterItemUpdate');
return true;
@@ -531,7 +531,7 @@
$res_temp = $this->Conn->GetOne( str_replace('%s', $this->TableName, $sql) );
$current_table_only = getArrayValue($params, 'current_table_only'); // check unique record only in current table
- $res_live = $current_table_only ? 0 : $this->Conn->GetOne( str_replace('%s', kTempTablesHandler::GetLiveName($this->TableName), $sql) );
+ $res_live = $current_table_only ? 0 : $this->Conn->GetOne( str_replace('%s', $this->Application->GetLiveName($this->TableName), $sql) );
$res = ($res_temp == 0) && ($res_live == 0);
@@ -612,7 +612,6 @@
if( isset($this->Fields[$field]['error_msgs'][$err]) )
{
$msg = $this->Fields[$field]['error_msgs'][$err];
- $msg = $this->Application->ReplaceLanguageTags($msg, $force_escape);
}
else //fall back to defaults
{
@@ -622,6 +621,7 @@
}
$msg = $this->ErrorMsgs[$err];
}
+ $msg = $this->Application->ReplaceLanguageTags($msg, $force_escape);
if ( isset($this->FieldErrors[$field]['params']) )
{
@@ -890,20 +890,20 @@
}
trigger_error('Query method is called in class '.get_class($this).' for prefix '.$this->getPrefixSpecial().'', E_USER_ERROR);
}
-
+
function saveCustomFields()
{
if (!$this->customFields) {
return true;
}
-
+
$cdata_key = rtrim($this->Prefix.'-cdata.'.$this->Special, '.');
$cdata =& $this->Application->recallObject($cdata_key, null, Array('skip_autoload' => true));
-
+
$resource_id = $this->GetDBField('ResourceId');
$cdata->Load($resource_id, 'ResourceId');
$cdata->SetDBField('ResourceId', $resource_id);
-
+
$ml_formatter =& $this->Application->recallObject('kMultiLanguage');
foreach ($this->customFields as $custom_id => $custom_name) {
$cdata->SetDBField($ml_formatter->LangFieldName('cust_'.$custom_id), $this->GetDBField('cust_'.$custom_name));