You are here

function _pmproject_beforesave in Drupal PM (Project Management) 7

Prepare node data before saving it to the database.

2 calls to _pmproject_beforesave()
pmproject_insert in pmproject/pmproject.module
Implements hook_insert().
pmproject_update in pmproject/pmproject.module
Implements hook_update().

File

pmproject/pmproject.module, line 525

Code

function _pmproject_beforesave(&$node) {

  // Allow use of comma when inputting numerical values - str_replace with period decimal
  $node->duration = str_replace(',', '.', $node->duration);
  $node->price = str_replace(',', '.', $node->price);
  if (!is_numeric($node->duration)) {
    $node->duration = 0;
  }
  if (!is_numeric($node->price)) {
    $node->price = 0;
  }
}