You are here

function pminvoice_token_values in Drupal PM (Project Management) 7

Implements hook_token_values().

File

pminvoice/pminvoice.module, line 900
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_token_values($type, $object = NULL) {
  $values = array();
  $node = $object;
  if (($type == 'node' || $type == 'all') && $node->type === 'pminvoice') {
    $values['pminvoice-number'] = $node->number;
    $values['pminvoice-reference'] = $node->reference;
    $values['pminvoice-organization-nid'] = $node->organization_nid;
    $values['pminvoice-organization-title'] = $node->organization_title;
    $values['pminvoice-project-nid'] = $node->project_nid;
    $values['pminvoice-project-title'] = $node->project_title;
    $values['pminvoice-amount'] = $node->amount;
    $values['pminvoice-total'] = $node->total;
    $values['pminvoice-totalcustomer'] = $node->totalcustomer;
    $values['pminvoice-taxexempt'] = $node->taxexempt;
    if (variable_get('pm_tax1_app', 0)) {
      $values['pminvoice-tax1'] = $node->tax1;
    }
    if (variable_get('pm_tax2_app', 0)) {
      $values['pminvoice-tax2'] = $node->tax2;
    }
    return $values;
  }
}