Exemplo n.º 1
0
hook_handle_callback('layout_column_half', 1);
$title = 'User Details';
include module_theme::include_ucm('includes/plugin_user/pages/contact_admin_form.php');
if (module_config::c('users_have_address', 0)) {
    ob_start();
    handle_hook("address_block", $module, "physical", "user", "user_id");
    $fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Address'), 'elements_before' => ob_get_clean());
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
}
if ((int) $user_id > 0) {
    //handle_hook("note_list",$module,"user","user_id",$user_id);
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'User Notes', 'owner_table' => 'user', 'owner_id' => $user_id, 'view_link' => $module->link_open($user_id)));
    }
    if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
        module_group::display_groups(array('title' => 'User Groups', 'owner_table' => 'user', 'owner_id' => $user_id, 'view_link' => module_user::link_open($user_id)));
    }
}
hook_handle_callback('layout_column_half', 2);
if (is_file('includes/plugin_user/pages/user_admin_edit_login.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_login.php');
}
if (is_file('includes/plugin_user/pages/user_admin_edit_staff.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_staff.php');
}
if (is_file('includes/plugin_user/pages/user_admin_edit_company.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_company.php');
}
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save User')), array('ignore' => !($user_id != 1 && module_user::can_i('delete', 'Users', 'Config')), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . $module->link_open(false) . "';")));
Exemplo n.º 2
0
 public static function get_replace_fields($job_id, $job_data = false)
 {
     if (!$job_data) {
         $job_data = self::get_job($job_id);
     }
     $data = array('job_number' => htmlspecialchars($job_data['name']), 'project_type' => _l(module_config::c('project_name_single', 'Website')), 'print_link' => self::link_public($job_id), 'title' => module_config::s('admin_system_name'), 'due_date' => print_date($job_data['date_due']));
     //        $customer_data = $job_data['customer_id'] ? module_customer::get_replace_fields($job_data['customer_id']) : array();
     //        $website_data = $job_data['website_id'] ? module_website::get_replace_fields($job_data['website_id']) : array();
     //        $data = array_merge($data,$customer_data,$website_data,$job_data);
     $data = array_merge($data, $job_data);
     if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
         // get the job groups
         $wg = array();
         $g = array();
         if ($job_id > 0) {
             $job_data = module_job::get_job($job_id);
             foreach (module_group::get_groups_search(array('owner_table' => 'job', 'owner_id' => $job_id)) as $group) {
                 $g[$group['group_id']] = $group['name'];
             }
             /*// get the website groups
               foreach(module_group::get_groups_search(array(
                   'owner_table' => 'website',
                   'owner_id' => $job_data['website_id'],
               )) as $group){
                   $wg[$group['group_id']] = $group['name'];
               }*/
         }
         $data['job_group'] = implode(', ', $g);
         /*$data['website_group'] = implode(', ',$wg);*/
     }
     // addition. find all extra keys for this job and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('job');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'job', 'owner_id' => $job_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
     }
     // also do this for customer fields
     /*if($job_data['customer_id']){
           $all_extra_fields = module_extra::get_defaults('customer');
           foreach($all_extra_fields as $e){
               $data[$e['key']] = _l('N/A');
           }
           $extras = module_extra::get_extras(array('owner_table'=>'customer','owner_id'=>$job_data['customer_id']));
           foreach($extras as $e){
               $data[$e['extra_key']] = $e['extra'];
           }
       }*/
     return $data;
 }
Exemplo n.º 3
0
 public static function get_replace_fields($customer_id, $primary_user_id = false)
 {
     $customer_data = module_customer::get_customer($customer_id);
     $address_combined = array();
     if (isset($customer_data['customer_address'])) {
         foreach ($customer_data['customer_address'] as $key => $val) {
             if (strlen(trim($val))) {
                 $address_combined[$key] = $val;
             }
         }
     }
     // do we use the primary contact or
     $contact_data = module_user::get_user($primary_user_id ? $primary_user_id : $customer_data['primary_user_id']);
     //print_r($contact_data);exit;
     if ($contact_data && $contact_data['customer_id'] != $customer_id && (!isset($contact_data['linked_parent_user_id']) || !$contact_data['linked_parent_user_id'])) {
         $contact_data = array('user_id' => 0, 'customer_id' => 0, 'name' => '', 'last_name' => '', 'email' => '', 'password' => '', 'phone' => '', 'mobile' => '', 'fax' => '');
     }
     $data = array('customer_details' => ' - todo - ', 'customer_name' => isset($customer_data['customer_name']) ? htmlspecialchars($customer_data['customer_name']) : _l('N/A'), 'customer_address' => htmlspecialchars(implode(', ', $address_combined)), 'contact_name' => $contact_data['name'] != $contact_data['email'] ? htmlspecialchars($contact_data['name'] . ' ' . $contact_data['last_name']) : '', 'contact_first_name' => $contact_data['name'], 'contact_last_name' => $contact_data['last_name'], 'first_name' => $contact_data['name'], 'last_name' => $contact_data['last_name'], 'contact_email' => htmlspecialchars($contact_data['email']), 'contact_phone' => htmlspecialchars($contact_data['phone']), 'contact_mobile' => htmlspecialchars($contact_data['mobile']), 'customer_invoice_prefix' => isset($customer_data['default_invoice_prefix']) ? $customer_data['default_invoice_prefix'] : '');
     $data = array_merge($customer_data, $data);
     foreach ($customer_data['customer_address'] as $key => $val) {
         $data['address_' . $key] = $val;
     }
     if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
         // get the customer groups
         $g = array();
         if ((int) $customer_data['customer_id'] > 0) {
             foreach (module_group::get_groups_search(array('owner_table' => 'customer', 'owner_id' => $customer_data['customer_id'])) as $group) {
                 $g[] = $group['name'];
             }
         }
         $data['customer_group'] = implode(', ', $g);
         // get the customer groups
         $g = array();
         if ($customer_id > 0) {
             $customer_data = module_customer::get_customer($customer_id);
             foreach (module_group::get_groups_search(array('owner_table' => 'customer', 'owner_id' => $customer_id)) as $group) {
                 $g[$group['group_id']] = $group['name'];
             }
         }
         $data['customer_group'] = implode(', ', $g);
     }
     // addition. find all extra keys for this customer and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('customer');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'customer', 'owner_id' => $customer_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
         // and the primary contact
         $all_extra_fields = module_extra::get_defaults('user');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         if ($contact_data && $contact_data['user_id']) {
             // and find the ones with values:
             $extras = module_extra::get_extras(array('owner_table' => 'user', 'owner_id' => $contact_data['user_id']));
             foreach ($extras as $e) {
                 $data[$e['extra_key']] = $e['extra'];
             }
         }
     }
     return $data;
 }
Exemplo n.º 4
0
 public static function get_replace_fields($quote_id, $quote_data = false)
 {
     if (!$quote_data) {
         $quote_data = self::get_quote($quote_id);
     }
     $data = array('quote_number' => htmlspecialchars($quote_data['name']), 'quote_name' => htmlspecialchars($quote_data['name']), 'project_type' => _l(module_config::c('project_name_single', 'Website')), 'print_link' => self::link_public_print($quote_id), 'quote_url' => self::link_public($quote_id), 'title' => module_config::s('admin_system_name'), 'create_date' => print_date($quote_data['date_create']));
     if (isset($quote_data['customer_id']) && $quote_data['customer_id']) {
         $customer_data = module_customer::get_replace_fields($quote_data['customer_id'], $quote_data['contact_user_id'] ? $quote_data['contact_user_id'] : false);
         $data = array_merge($data, $customer_data);
         // so we get total_amount_due and stuff.
     }
     $user_details = array('staff_first_name' => '', 'staff_last_name' => '', 'staff_email' => '', 'staff_phone' => '', 'staff_fax' => '', 'staff_mobile' => '');
     if (isset($quote_data['user_id']) && $quote_data['user_id']) {
         $user_data = module_user::get_user($quote_data['user_id'], false);
         if ($user_data && $user_data['user_id'] == $quote_data['user_id']) {
             $user_details = array('staff_first_name' => $user_data['name'], 'staff_last_name' => $user_data['last_name'], 'staff_email' => $user_data['email'], 'staff_phone' => $user_data['phone'], 'staff_fax' => $user_data['fax'], 'staff_mobile' => $user_data['mobile']);
         }
     }
     $data = array_merge($data, $user_details);
     foreach ($quote_data as $key => $val) {
         if (strpos($key, 'date') !== false) {
             $quote_data[$key] = print_date($val);
         }
     }
     if (isset($quote_data['description'])) {
         $quote_data['description'] = module_security::purify_html($quote_data['description']);
     }
     //        $customer_data = $quote_data['customer_id'] ? module_customer::get_replace_fields($quote_data['customer_id']) : array();
     //        $website_data = $quote_data['website_id'] ? module_website::get_replace_fields($quote_data['website_id']) : array();
     //        $data = array_merge($data,$customer_data,$website_data,$quote_data);
     $data = array_merge($data, $quote_data);
     $website_url = $project_names = $project_names_and_url = array();
     if ($quote_data['website_id']) {
         $website_data = module_website::get_website($quote_data['website_id']);
         if ($website_data && $website_data['website_id'] == $quote_data['website_id']) {
             if (isset($website_data['url']) && $website_data['url']) {
                 $website_url[$website_data['website_id']] = module_website::urlify($website_data['url']);
                 $website_data['name_url'] = $website_data['name'] . ' (' . module_website::urlify($website_data['url']) . ')';
             } else {
                 $website_data['name_url'] = $website_data['name'];
             }
             $project_names[$website_data['website_id']] = $website_data['name'];
             $project_names_and_url[$website_data['website_id']] = $website_data['name_url'];
             $fields = module_website::get_replace_fields($website_data['website_id'], $website_data);
             foreach ($fields as $key => $val) {
                 if (!isset($data[$key]) || !$data[$key] && $val) {
                     $data[$key] = $val;
                 }
             }
         }
     }
     $data['website_name'] = $data['project_name'] = forum_text(count($project_names) ? implode(', ', $project_names) : '');
     $data['website_name_url'] = forum_text(count($project_names_and_url) ? implode(', ', $project_names_and_url) : '');
     $data['website_url'] = forum_text(count($website_url) ? implode(', ', $website_url) : '');
     if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
         // get the quote groups
         $wg = array();
         $g = array();
         if ($quote_id > 0) {
             $quote_data = module_quote::get_quote($quote_id);
             foreach (module_group::get_groups_search(array('owner_table' => 'quote', 'owner_id' => $quote_id)) as $group) {
                 $g[$group['group_id']] = $group['name'];
             }
             /*// get the website groups
               foreach(module_group::get_groups_search(array(
                   'owner_table' => 'website',
                   'owner_id' => $quote_data['website_id'],
               )) as $group){
                   $wg[$group['group_id']] = $group['name'];
               }*/
         }
         $data['quote_group'] = implode(', ', $g);
         /*$data['website_group'] = implode(', ',$wg);*/
     }
     // addition. find all extra keys for this quote and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('quote');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'quote', 'owner_id' => $quote_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
     }
     // also do this for customer fields
     /*if($quote_data['customer_id']){
           $all_extra_fields = module_extra::get_defaults('customer');
           foreach($all_extra_fields as $e){
               $data[$e['key']] = _l('N/A');
           }
           $extras = module_extra::get_extras(array('owner_table'=>'customer','owner_id'=>$quote_data['customer_id']));
           foreach($extras as $e){
               $data[$e['extra_key']] = $e['extra'];
           }
       }*/
     return $data;
 }
Exemplo n.º 5
0
        $invoice_total_due[$invoice['currency_id']] += $invoice['c_total_amount_due'];
    }
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_invoice::can_i('view', 'Export Invoices')) {
    $export_settings = array('name' => 'Invoice Export', 'fields' => array('Invoice ID' => 'invoice_id', 'Invoice Number' => 'name', 'Status' => 'status', 'Total Amount' => 'c_total_amount', 'Total Amount Due' => 'c_total_amount_due', 'Create Date' => 'date_create', 'Sent Date' => 'date_sent', 'Due Date' => 'date_due', 'Paid Date' => 'date_paid', 'Cancel Date' => 'date_cancel', 'Customer Name' => 'customer_name', 'Renewal Date' => 'date_renew'), 'extra' => array('owner_table' => 'invoice', 'owner_id' => 'invoice_id'), 'summary' => array());
    if (module_config::c('invoice_list_show_totals', 1)) {
        foreach ($invoice_total + $invoice_total_due as $currency_id => $foo) {
            $currency = get_single('currency', 'currency_id', $currency_id);
            $export_settings['summary'][] = array('invoice_id' => _l('%s Totals:', $currency && isset($currency['code']) ? $currency['code'] : ''), 'c_total_amount' => dollar(isset($invoice_total[$currency_id]) ? $invoice_total[$currency_id] : 0, true, $currency_id), 'c_total_amount_due' => dollar(isset($invoice_total_due[$currency_id]) ? $invoice_total_due[$currency_id] : 0, true, $currency_id));
        }
    }
    module_import_export::enable_pagination_hook($export_settings);
}
// hack to add a "group" option to the pagination results.
if (class_exists('module_group', false) && module_group::is_plugin_enabled() && module_invoice::can_i('edit', 'Invoices')) {
    module_group::enable_pagination_hook(array('bulk_actions' => array('delete' => array('label' => 'Delete selected invoices', 'type' => 'delete', 'callback' => 'module_invoice::bulk_handle_delete'))));
}
$header = array('title' => _l('Invoices'), 'type' => 'h2', 'main' => true, 'button' => array());
if (module_invoice::can_i('create', 'Invoices')) {
    $header['button'] = array('url' => module_invoice::link_open('new'), 'title' => _l('New Manual Invoice'), 'type' => 'add');
}
print_heading($header);
?>



<form action="" method="post">

    <?php 
module_form::print_form_auth();