function pminvoice_load in Drupal PM (Project Management) 7
Implements hook_load().
File
- pminvoice/
pminvoice.module, line 742 - 1: Hooks (help, perm, init, menu, theme, node_info) 2: Access functions 3: Load organization and project details 4: Invoice create / edit form 5: Invoice node manipulation functions 6: Admin settings 7: Views hook 8: Project Managementinvoiceitem…
Code
function pminvoice_load($nodes) {
foreach ($nodes as $nid => &$node) {
$result = db_select('pminvoice', 'pmin')
->fields('pmin')
->condition('vid', $node->vid)
->execute();
$record = array();
$record = $result
->fetchAssoc();
if ($record) {
foreach ($record as $key => $value) {
$node->{$key} = $value;
}
}
$node->title_old = $node->title;
// Load invoice items
$result = db_select('pminvoice_items', 'pmini')
->fields('pmini')
->condition('invoice_vid', $node->vid)
->orderBy('weight')
->execute();
$node->items = array();
foreach ($result as $item) {
$node->items[] = $item;
}
}
}