You are here

function oa_files_update_document in Open Atrium Files 7.2

Update a document to a new file.

Parameters

$mode: The node to update

$row: The row in the database to update (with delta and language).

$file: The file object

1 call to oa_files_update_document()
oa_files_upload_create_documents_form_submit in ./oa_files.module
Submit callback that creates or updates documents.

File

./oa_files.module, line 446

Code

function oa_files_update_document($node, $row, $file) {
  $node->field_oa_media[$row->language][$row->delta]['fid'] = $file->fid;
  $node->revision = 1;
  $node->log = 'Update file via upload.';
  node_save($node);
  if (module_exists('oa_workbench')) {
    drupal_set_message(t('New draft of <a href="@url">@title</a> created.', array(
      '@title' => $node->title,
      '@url' => url('node/' . $node->nid),
    )));
  }
  else {
    drupal_set_message(t('Document <a href="@url">@title</a> updated.', array(
      '@title' => $node->title,
      '@url' => url('node/' . $node->nid),
    )));
  }
}