Index: branches/5.0.x/core/kernel/db/cat_dbitem.php =================================================================== diff -u -r12343 -r12466 --- branches/5.0.x/core/kernel/db/cat_dbitem.php (.../cat_dbitem.php) (revision 12343) +++ branches/5.0.x/core/kernel/db/cat_dbitem.php (.../cat_dbitem.php) (revision 12466) @@ -1,6 +1,6 @@ Application->getUnitOption($this->Prefix,'StatusField') ); if ($new_status != $this->GetDBField($status_field)) { // status was changed - $this->sendEmailEvents($new_status); + $this->sendEmailEvents($new_status, $pending_editing); } $this->SetDBField($status_field, $new_status); return $this->Update(); } - function sendEmailEvents($new_status) + function sendEmailEvents($new_status, $pending_editing = false) { - $perm_prefix = $this->Application->getUnitOption($this->Prefix, 'PermItemPrefix'); $owner_field = $this->Application->getUnitOption($this->Prefix, 'OwnerField'); if (!$owner_field) { $owner_field = 'CreatedById'; } - $event_name = $perm_prefix.'.'.($new_status == STATUS_ACTIVE ? 'APPROVE' : 'DENY'); + $event_name = $this->Application->getUnitOption($this->Prefix, 'PermItemPrefix'); + if ($pending_editing) { + $event_name .= '.MODIFY'; + } + + $event_name .= $new_status == STATUS_ACTIVE ? '.APPROVE' : '.DENY'; $this->Application->EmailEventUser($event_name, $this->GetDBField($owner_field)); } @@ -508,7 +512,7 @@ $temp_handler->DeleteItems($this->Prefix, $this->Special, Array($original_id)); $this->SetDBField('OrgId', 0); - return $this->ChangeStatus(STATUS_ACTIVE); + return $this->ChangeStatus(STATUS_ACTIVE, true); } return false; @@ -532,6 +536,7 @@ $temp_handler =& $this->Application->recallObject($this->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); $temp_handler->DeleteItems($this->Prefix, $this->Special, Array($this->GetID())); + $this->sendEmailEvents(STATUS_DISABLED, true); // original item is not changed here, because it is already enabled (thrus pending copy is visible to item's owner or admin with permission) return true; }