Index: branches/unlabeled/unlabeled-1.34.2/core/units/general/cat_dbitem.php =================================================================== diff -u -r6873 -r7517 --- branches/unlabeled/unlabeled-1.34.2/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 6873) +++ branches/unlabeled/unlabeled-1.34.2/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 7517) @@ -22,13 +22,13 @@ * @var bool */ var $usePendingEditing = false; - + function Clear() { parent::Clear(); $this->CategoryPath = Array(); } - + /** * Set's prefix and special * @@ -41,13 +41,14 @@ parent::Init($prefix, $special, $event_params); $this->usePendingEditing = $this->Application->getUnitOption($this->Prefix, 'UsePendingEditing'); } - + function Create($force_id=false, $system_create=false) { if (!$this->Validate()) return false; $this->SetDBField('ResourceId', $this->Application->NextResourceId()); $this->SetDBField('Modified', adodb_mktime() ); + $this->UpdateFormattersSubFields(); if ($this->mode != 't' && !$this->Application->IsAdmin()) { $this->SetDBField('CreatedById', $this->Application->RecallVar('user_id')); @@ -68,7 +69,7 @@ 'ItemPrefix' => $this->Prefix, 'Filename' => $this->GetDBField('Filename'), ); - $this->Conn->doInsert($fields_hash, $this->CategoryItemsTable()); + $this->Conn->doInsert($fields_hash, $this->CategoryItemsTable()); } return $ret; } @@ -77,6 +78,7 @@ { $this->VirtualFields['ResourceId'] = Array(); $this->SetDBField('Modified', adodb_mktime() ); + $this->UpdateFormattersSubFields(); $this->SetDBField('ModifiedById', $this->Application->RecallVar('user_id')); if ($this->useFilenames) { @@ -109,11 +111,11 @@ if ($this->Application->IsTempTable($this->TableName)) { $table = $this->Application->GetTempName($table, 'prefix:'.$this->Prefix); } - + return $table; } - - + + function checkFilename() { if( !$this->GetDBField('AutomaticFilename') ) @@ -401,14 +403,14 @@ } return $image_data; } - + function ChangeStatus($new_status) { $status_field = array_shift( $this->Application->getUnitOption($this->Prefix,'StatusField') ); $this->SetDBField($status_field, $new_status); return $this->Update(); } - + /** * Approves changes made to category item * @@ -422,19 +424,19 @@ // non-pending copy of original link return $this->ChangeStatus(STATUS_ACTIVE); } - + if ($this->raiseEvent('OnBeforeDeleteOriginal', null, Array('original_id' => $original_id))) { // delete original item, because changes made in pending copy (this item) got to be approved in this method $temp_handler =& $this->Application->recallObject($this->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); $temp_handler->DeleteItems($this->Prefix, $this->Special, Array($original_id)); - + $this->SetDBField('OrgId', 0); return $this->ChangeStatus(STATUS_ACTIVE); } - + return false; } - + /** * Decline changes made to category item * @@ -443,12 +445,12 @@ function DeclineChanges() { $original_id = $this->GetDBField('OrgId'); - + if (!($this->usePendingEditing && $original_id)) { // non-pending copy of original link return $this->ChangeStatus(STATUS_DISABLED); } - + // delete this item, because changes made in pending copy (this item) will be declined in this method $temp_handler =& $this->Application->recallObject($this->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); $temp_handler->DeleteItems($this->Prefix, $this->Special, Array($this->GetID()));