Skip to content
Snippets Groups Projects
Commit 1cfbe2ee authored by Tim Steiner's avatar Tim Steiner
Browse files

Automatically create a comment for the current user when they upload a file for a request.

parent 2d9a4c0d
No related branches found
No related tags found
No related merge requests found
...@@ -633,6 +633,23 @@ class Requests_RequestModel extends Unl_Model ...@@ -633,6 +633,23 @@ class Requests_RequestModel extends Unl_Model
$model['model']->_data['files'][$model['fileId']]['requestFileId'] = $lastId; $model['model']->_data['files'][$model['fileId']]['requestFileId'] = $lastId;
$lastId++; $lastId++;
} }
// Create a comment indicating that the file has been added.
$comments = new Unl_Model_Collection('Requests_CommentsModel');
foreach ($models as $model) {
$file = $model['model']->_data['files'][$model['fileId']];
$model = $model['model'];
$comment = Requests_CommentsModel::fetchNew();
$comment->setRequest($model);
$comment->setText('I have uploaded the ' . $file['type'] . ' file "' . $file['title'] . '"');
$comment->setUser(Auth_UserModel::findCurrentUser());
$comment->setTime(new Zend_Date());
$comment->setVisibility('global');
$comments[] = $comment;
}
Requests_CommentsModel::save($comments);
} }
static protected function _updateFileRows($models) static protected function _updateFileRows($models)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment