$current_template = isset($invoice['invoice_template_print']) && strlen($invoice['invoice_template_print']) ? $invoice['invoice_template_print'] : module_config::c('invoice_template_print_default', 'invoice_print'); if (function_exists('convert_html2pdf') && isset($find_other_templates) && strlen($find_other_templates) && isset($current_template) && strlen($current_template)) { $other_templates = array(); foreach (module_template::get_templates() as $possible_template) { if (strpos($possible_template['template_key'], $find_other_templates) !== false) { // found another one! $other_templates[$possible_template['template_key']] = $possible_template['template_key']; //$possible_template['description']; } } if (count($other_templates) > 1) { $fieldset_data['elements'][] = array('title' => 'PDF Template', 'field' => array('type' => 'select', 'options' => $other_templates, 'name' => 'invoice_template_print', 'value' => $current_template, 'help' => 'Choose the default template for PDF printing and PDF emailing. Name your custom templates invoice_print_SOMETHING for them to appear in this listing.')); } } if (class_exists('module_company', false) && module_company::is_enabled() && defined('COMPANY_UNIQUE_CONFIG') && COMPANY_UNIQUE_CONFIG && module_company::can_i('view', 'Company') && $invoice['customer_id'] > 0) { $company_list = module_company::get_companys_by_customer($invoice['customer_id']); if (count($company_list) > 1) { $fieldset_data['elements'][] = array('title' => 'Company', 'fields' => array(array('type' => 'select', 'name' => 'set_manual_company_id', 'options' => $company_list, 'blank' => _l('Default'), 'options_array_id' => 'name', 'value' => isset($invoice['company_id']) ? $invoice['company_id'] : 0))); } } echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); } hook_handle_callback('layout_column_half', 2, '65'); if ($invoice['date_cancel'] && $invoice['date_cancel'] != '0000-00-00') { /**** INVOICE CANCELLED ***/ ob_start(); ?> <div class="tableclass_form content"> <p align="center"><?php
public static function get_customer($customer_id, $skip_permissions = false, $basic_for_link = false) { $customer_id = (int) $customer_id; $customer = false; if ($customer_id > 0) { $cache_key_args = func_get_args(); $cache_key = self::_customer_cache_key($customer_id, $cache_key_args); $cache_timeout = module_config::c('cache_objects', 60); if ($cached_item = module_cache::get('customer', $cache_key)) { return $cached_item; } $customer = get_single("customer", "customer_id", $customer_id); // get their address. if ($customer && isset($customer['customer_id']) && $customer['customer_id'] == $customer_id) { if (!$basic_for_link) { $customer['staff_ids'] = array(); foreach (get_multiple('customer_user_rel', array('customer_id' => $customer_id), 'user_id') as $val) { $customer['staff_ids'][] = $val['user_id']; } $customer['customer_address'] = module_address::get_address($customer_id, 'customer', 'physical', true); } switch (self::get_customer_data_access()) { case _CUSTOMER_ACCESS_ALL: break; case _CUSTOMER_ACCESS_ALL_COMPANY: case _CUSTOMER_ACCESS_CONTACTS: case _CUSTOMER_ACCESS_TASKS: case _CUSTOMER_ACCESS_STAFF: $valid_customer_ids = module_security::get_customer_restrictions(); $is_valid_customer = isset($valid_customer_ids[$customer['customer_id']]); if (!$is_valid_customer) { if ($skip_permissions) { $customer['_no_access'] = true; // set a flag for custom processing. we check for this when calling get_customer with the skip permissions argument. (eg: in the ticket file listing link) } else { $customer = false; } } break; } } } if (!$customer) { $customer = array('customer_id' => 'new', 'customer_name' => '', 'customer_status' => _CUSTOMER_STATUS_PAID, 'primary_user_id' => '', 'credit' => '0', 'customer_address' => array(), 'staff_ids' => array(), 'customer_type_id' => self::get_current_customer_type_id()); } if (class_exists('module_company', false) && module_company::is_enabled() && !$basic_for_link) { $customer['company_ids'] = array(); if (isset($customer['customer_id']) && (int) $customer['customer_id'] > 0) { foreach (module_company::get_companys_by_customer($customer['customer_id']) as $company) { $customer['company_ids'][$company['company_id']] = $company['name']; } } } //$customer['customer_industry_id'] = get_multiple('customer_industry_rel',array('customer_id'=>$customer_id),'customer_industry_id'); //echo $customer_id;print_r($customer);exit; if (isset($cache_key) && isset($cache_timeout)) { module_cache::put('customer', $cache_key, $customer, $cache_timeout); } return $customer; }