having the invoices in the admin/content overview with invoice numbers as the titles, I had the need to see the client name ( company name ) in the overview.

While I can create a new module for this and I've done this now locally it might be nice to integrate this in the invoice module.

<?php
/**
 * Implements hook_form_node_admin_content_alter()
 * adding company name to the overview
 */
function click_invoice_admin_content_form_node_admin_content_alter(&$form, &$form_state, $form_id) {

  // Add another column to the table header
  $form['admin']['nodes']['#header']['company_name'] = array('data' => t('Company name'));

  // Loop through the rows in the table and add the company_name column
  foreach ($form['admin']['nodes']['#options'] as $nid => $row) {
    $node = node_load($nid);

    if(isset($node->customer['company_name'])) {
      $form['admin']['nodes']['#options'][$nid]['company_name'] = $node->customer['company_name'];
    }
    else {
      $form['admin']['nodes']['#options'][$nid]['company_name'] = '';
    }
  }
}
?>

If needed I will find out how and create a patch against the dev version.
Let me know if there is any interest for this.

Comments

scuba_fly’s picture

Issue summary: View changes

corrected a minor comment mistake

scuba_fly’s picture

Assigned: scuba_fly » Unassigned
Issue summary: View changes