public function delete() { $flash = Flash::Instance(); //parent::delete('MFOperation'); $errors = array(); $data = array('id' => $this->_data['id'], 'end_date' => date(DATE_FORMAT)); $operation = MFOperation::Factory($data, $errors, 'MFOperation'); if (count($errors) > 0 || !$operation->save()) { $errors[] = 'Could not delete operation'; } if (count($errors) == 0) { $stitem = new STItem(); if ($stitem->load($operation->stitem_id)) { //$stitem->calcLatestCost(); if (!$stitem->rollUp(STItem::ROLL_UP_MAX_LEVEL)) { $errors[] = 'Could not roll-up latest costs'; $db->FailTrans(); } } else { $errors[] = 'Could not roll-up latest costs'; $db->FailTrans(); } } if (count($errors) == 0) { $flash->addMessage('Operation deleted'); sendTo($this->name, 'index', $this->_modules, array('stitem_id' => $this->_data['stitem_id'])); } else { $flash->addErrors($errors); sendBack(); } }