function _pmnote_beforesave in Drupal PM (Project Management) 7
Pre-processing for the PM Note content type (before save).
2 calls to _pmnote_beforesave()
- pmnote_insert in pmnote/
pmnote.module - Implements hook_insert().
- pmnote_update in pmnote/
pmnote.module - Implements hook_update().
File
- pmnote/
pmnote.module, line 373 - Functions for the PM Note module.
Code
function _pmnote_beforesave(&$node) {
$org_result = db_select('node', 'n')
->fields('n', array(
'title',
))
->condition('n.type', 'pmorganization')
->condition('n.nid', $node->organization_nid)
->execute();
$organization = $org_result
->fetchObject();
$node->organization_title = $organization->title;
$pro_result = db_select('node', 'n')
->fields('n', array(
'title',
))
->condition('n.type', 'pmproject')
->condition('n.nid', $node->project_nid)
->execute();
$project = $pro_result
->fetchObject();
$node->project_title = isset($project->title) ? $project->title : '';
$task_result = db_select('node', 'n')
->fields('n', array(
'title',
))
->condition('n.type', 'pmtask')
->condition('n.nid', $node->task_nid)
->execute();
$task = $task_result
->fetchObject();
$node->task_title = isset($task->title) ? $task->title : '';
}