You are here

function merci_inventory_operations_update in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6.2

Same name and namespace in other branches
  1. 7.2 modules/merci_inventory/merci_inventory.module \merci_inventory_operations_update()

Callback function for adding items to new merci_inventory node.

1 string reference to 'merci_inventory_operations_update'
merci_inventory_node_operations in modules/merci_inventory/merci_inventory.module
Implementation of hook_node_operations().

File

modules/merci_inventory/merci_inventory.module, line 75
Hooks and functions for MERCI Inventory

Code

function merci_inventory_operations_update($nodes) {
  global $user;
  $account = user_load(array(
    'uid' => $user->uid,
  ));

  // Construct the new node object.
  $node = new stdClass();
  $node->title = 'Inventory - ' . format_date(time(), $type = 'small');
  $node->type = 'merci_inventory';
  $node->created = time();
  $node->changed = $node->created;
  $node->status = 1;

  // Published?
  $node->promote = 0;

  // Display on front page?
  $node->sticky = 0;

  // Display top of page?
  $node->format = 1;

  // Filtered HTML?
  $node->uid = $account->uid;

  //  Content owner uid (author)?
  $node->language = 'en';
  $count = 0;
  foreach ($nodes as $nid) {
    $node->field_merci_inventory_item[$count]['nid'] = $nid;
    $count++;
  }

  //node_submit($node);
  node_save($node);
}