Ejemplo n.º 1
0
echo _BASE_HREF;
?>
css/desktop.css?ver=5" type="text/css" />
<link type="text/css" href="<?php 
echo _BASE_HREF;
?>
css/smoothness/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" />
<?php 
module_config::print_css();
?>



<script language="javascript" type="text/javascript">
<?php 
switch (strtolower(module_config::s('date_format', 'd/m/Y'))) {
    case 'd/m/y':
        $js_cal_format = 'dd/mm/yy';
        break;
    case 'y/m/d':
        $js_cal_format = 'yy/mm/dd';
        break;
    case 'm/d/y':
        $js_cal_format = 'mm/dd/yy';
        break;
    default:
        $js_cal_format = 'yy-mm-dd';
}
?>

var js_cal_format = '<?php 
Ejemplo n.º 2
0
        </table>
        <?php 
        hook_handle_callback('forgot_password_screen');
        ?>

    </form>
    <?php 
    } else {
        ?>

	<h2><?php 
        echo _l('Please Login');
        ?>
 </h2>
	<p align="center"><?php 
        echo _l('Welcome to %s - Please Login Below', module_config::s('admin_system_name'));
        ?>
</p>




      <table align="center">
        <tr>
            <td width="65" valign="top">
            <img src="<?php 
        echo _BASE_HREF;
        ?>
images/lock.png" alt="lock" />
            </td>
            <td>
Ejemplo n.º 3
0
 public function renew_invoice($invoice_id)
 {
     $invoice = $this->get_invoice($invoice_id);
     if (strtotime($invoice['date_renew']) <= strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days')) {
         // /we are allowed to renew.
         unset($invoice['invoice_id']);
         // work out the difference in start date and end date and add that new renewl date to the new order.
         $time_diff = strtotime($invoice['date_renew']) - strtotime($invoice['date_create']);
         if ($time_diff > 0) {
             // our renewal date is something in the future.
             if (!$invoice['date_create'] || $invoice['date_create'] == '0000-00-00') {
                 set_message('Please set a invoice create date before renewing');
                 redirect_browser($this->link_open($invoice_id));
             }
             // if the time_diff is 28, 29, 30 or 31 days then we stick to the same day a month in the future.
             if (module_config::c('invoice_renew_monthly_fix', 1) && $time_diff >= 2419100 && $time_diff <= 2678500) {
                 $new_renewal_date = date('Y-m-d', strtotime("+1 month", strtotime($invoice['date_renew'])));
             } else {
                 // work out the next renewal date.
                 $new_renewal_date = date('Y-m-d', strtotime($invoice['date_renew']) + $time_diff);
             }
             $invoice['name'] = self::new_invoice_number($invoice['customer_id']);
             $invoice['date_create'] = $invoice['date_renew'];
             $invoice['date_renew'] = $new_renewal_date;
             $invoice['date_sent'] = false;
             $invoice['date_paid'] = false;
             $invoice['deposit_job_id'] = 0;
             if (module_config::c('invoice_renew_discounts', 0)) {
                 // keep the discounts from previous invoices.
             } else {
                 // clear the discounts back to defaults.
                 $invoice['discount_amount'] = 0;
                 $invoice['discount_description'] = _l('Discount:');
                 $invoice['discount_type'] = !isset($invoice['discount_type']) ? module_config::c('invoice_discount_type', _DISCOUNT_TYPE_BEFORE_TAX) : $invoice['discount_type'];
                 // 1 = After Tax
             }
             $invoice['tax_type'] = !isset($invoice['tax_type']) ? module_config::c('invoice_tax_type', 0) : $invoice['tax_type'];
             $invoice['date_due'] = date('Y-m-d', strtotime('+' . module_config::c('invoice_due_days', 30) . ' days', strtotime($invoice['date_create'])));
             $invoice['status'] = module_config::s('invoice_status_default', 'New');
             // todo: copy the "more" listings over to the new invoice
             // todo: copy any notes across to the new listing.
             // hack to copy the 'extra' fields across to the new invoice.
             // save_invoice() does the extra handling, and if we don't do this
             // then it will move the extra fields from the original invoice to this new invoice.
             if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
                 $owner_table = 'invoice';
                 // get extra fields from this invoice
                 $extra_fields = module_extra::get_extras(array('owner_table' => $owner_table, 'owner_id' => $invoice_id));
                 $x = 1;
                 foreach ($extra_fields as $extra_field) {
                     $_REQUEST['extra_' . $owner_table . '_field']['new' . $x] = array('key' => $extra_field['extra_key'], 'val' => $extra_field['extra']);
                     $x++;
                 }
             }
             // taxes copy across
             if (isset($invoice['taxes']) && is_array($invoice['taxes'])) {
                 $invoice['tax_ids'] = array();
                 $invoice['tax_names'] = array();
                 $invoice['tax_percents'] = array();
                 foreach ($invoice['taxes'] as $tax) {
                     $invoice['tax_ids'][] = 0;
                     $invoice['tax_names'][] = $tax['name'];
                     $invoice['tax_percents'][] = $tax['percent'];
                     if ($tax['increment']) {
                         $invoice['tax_increment_checkbox'] = 1;
                     }
                 }
             }
             $new_invoice_id = $this->save_invoice('new', $invoice);
             if ($new_invoice_id) {
                 // now we create the tasks
                 $tasks = $this->get_invoice_items($invoice_id);
                 foreach ($tasks as $task) {
                     unset($task['invoice_item_id']);
                     if ($task['custom_description']) {
                         $task['description'] = $task['custom_description'];
                     }
                     if ($task['custom_long_description']) {
                         $task['long_description'] = $task['custom_long_description'];
                     }
                     $task['invoice_id'] = $new_invoice_id;
                     $task['date_done'] = $invoice['date_create'];
                     update_insert('invoice_item_id', 'new', 'invoice_item', $task);
                 }
                 // link this up with the old one.
                 update_insert('invoice_id', $invoice_id, 'invoice', array('renew_invoice_id' => $new_invoice_id));
             }
             module_cache::clear('invoice');
             return $new_invoice_id;
         }
     }
     return false;
 }
Ejemplo n.º 4
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_multisafepay_label', 'MultiSafepay');
 }
Ejemplo n.º 5
0
    public function render($type = 'html', $options = array())
    {
        ob_start();
        switch ($type) {
            case 'pretty_html':
                // header and footer so plain contnet can be rendered nicely.
                $display_mode = get_display_mode();
                // addition - woah! we pass this through to the template module for re-rending again:
                ob_start();
                ?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>{PAGE_TITLE}</title>
    {FAVICON}
    {AUTOMATIC_STYLES}
    {AUTOMATIC_SCRIPTS}
    <style type="text/css">
        body{
            margin:0;
        }
    </style>
</head>
<body>
<div class="pretty_content_wrap">
    {CONTENT}
</div>
</body>
</html>
                <?php 
                /*$c = $this->replace_content();
                  if(!$this->wysiwyg){
                      //$c = nl2br($c);
                  }
                  echo $c;*/
                module_template::init_template('external_template', ob_get_clean(), 'Used when displaying the external content such as "External Jobs" and "External Invoices" and "External Tickets".', 'code', array('CONTENT' => 'The inner content', 'PAGE_TITLE' => 'in the <title> tag', 'FAVICON' => 'if the theme specifies a favicon it will be here', 'AUTOMATIC_STYLES' => 'system generated stylesheets', 'AUTOMATIC_SCRIPTS' => 'system generated javascripts'));
                ob_start();
                ?>

                <link rel="stylesheet" href="<?php 
                echo _BASE_HREF;
                ?>
css/desktop.css" type="text/css">
                <link rel="stylesheet" href="<?php 
                echo _BASE_HREF;
                ?>
css/print.css" type="text/css" media="print">
                <link rel="stylesheet" href="<?php 
                echo _BASE_HREF;
                ?>
css/styles.css" type="text/css">
                <link type="text/css" href="<?php 
                echo _BASE_HREF;
                ?>
css/smoothness/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" />
                <?php 
                module_config::print_css();
                ?>
 <?php 
                $css = ob_get_clean();
                ob_start();
                ?>

                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/jquery-1.8.3.min.js"></script>
                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/jquery-ui-1.9.2.custom.min.js"></script>
                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/timepicker.js"></script>
                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/cookie.js"></script>
                <script type="text/javascript" src="<?php 
                echo _BASE_HREF;
                ?>
js/javascript.js?ver=2"></script>
                <?php 
                module_config::print_js();
                ?>

                <?php 
                $scripts = ob_get_clean();
                $external_template = self::get_template_by_key('external_template');
                $external_template->assign_values(array('CONTENT' => $this->replace_content(), 'PAGE_TITLE' => $this->page_title ? $this->page_title : module_config::s('admin_system_name'), 'FAVICON' => module_theme::get_config('theme_favicon', '') ? '<link rel="icon" href="' . htmlspecialchars(module_theme::get_config('theme_favicon', '')) . '">' : '', 'AUTOMATIC_STYLES' => $css, 'AUTOMATIC_SCRIPTS' => $scripts));
                echo $external_template->render('raw');
                break;
            case 'html':
            default:
                $c = $this->replace_content();
                if ($this->wysiwyg) {
                    //$c = nl2br($c);
                }
                echo $c;
                break;
        }
        return ob_get_clean();
    }
Ejemplo n.º 6
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_coinbase_label', 'Bitcoin');
 }
Ejemplo n.º 7
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_check_label', 'Check');
 }
Ejemplo n.º 8
0
 public static function get_quote($quote_id, $full = true, $skip_permissions = false)
 {
     $quote_id = (int) $quote_id;
     if ($quote_id <= 0) {
         $quote = array();
     } else {
         $cache_key = self::_quote_cache_key($quote_id, array($quote_id, $full, $skip_permissions));
         if ($cached_item = module_cache::get('quote', $cache_key)) {
             if (function_exists('hook_filter_var')) {
                 $cached_item = hook_filter_var('get_quote', $cached_item, $quote_id);
             }
             return $cached_item;
         }
         $cache_key_full = self::_quote_cache_key($quote_id, array($quote_id, true, $skip_permissions));
         if ($cache_key_full != $cache_key && ($cached_item = module_cache::get('quote', $cache_key_full))) {
             if (function_exists('hook_filter_var')) {
                 $cached_item = hook_filter_var('get_quote', $cached_item, $quote_id);
             }
             return $cached_item;
         }
         $cache_timeout = module_config::c('cache_objects', 60);
         $quote = get_single("quote", "quote_id", $quote_id);
     }
     // check permissions
     if ($quote && isset($quote['quote_id']) && $quote['quote_id'] == $quote_id) {
         switch (self::get_quote_access_permissions()) {
             case _QUOTE_ACCESS_ALL:
                 break;
             case _QUOTE_ACCESS_ASSIGNED:
                 // only assigned quotes!
                 $has_quote_access = false;
                 if ($quote['user_id'] == module_security::get_loggedin_id()) {
                     $has_quote_access = true;
                     break;
                 }
                 $tasks = module_quote::get_tasks($quote['quote_id']);
                 foreach ($tasks as $task) {
                     if ($task['user_id'] == module_security::get_loggedin_id()) {
                         $has_quote_access = true;
                         break;
                     }
                 }
                 unset($tasks);
                 if (!$has_quote_access) {
                     if ($skip_permissions) {
                         $quote['_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 {
                         $quote = false;
                     }
                 }
                 break;
             case _QUOTE_ACCESS_CUSTOMER:
                 // tie in with customer permissions to only get quotes from customers we can access.
                 $customers = module_customer::get_customers();
                 $has_quote_access = false;
                 if (isset($customers[$quote['customer_id']])) {
                     $has_quote_access = true;
                 }
                 /*foreach($customers as $customer){
                       // todo, if($quote['customer_id'] == 0) // ignore this permission
                       if($customer['customer_id']==$quote['customer_id']){
                           $has_quote_access = true;
                           break;
                       }
                   }*/
                 unset($customers);
                 if (!$has_quote_access) {
                     if ($skip_permissions) {
                         $quote['_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 {
                         $quote = false;
                     }
                 }
                 break;
         }
         if (!$quote) {
             $quote = array();
             if (function_exists('hook_filter_var')) {
                 $quote = hook_filter_var('get_quote', $quote, $quote_id);
             }
             return $quote;
         }
         $quote['taxes'] = get_multiple('quote_tax', array('quote_id' => $quote_id), 'quote_tax_id', 'exact', 'order');
     }
     if (!$full) {
         if (isset($cache_key)) {
             module_cache::put('quote', $cache_key, $quote, $cache_timeout);
         }
         if (function_exists('hook_filter_var')) {
             $quote = hook_filter_var('get_quote', $quote, $quote_id);
         }
         return $quote;
     }
     if (!$quote) {
         $customer_id = 0;
         if (isset($_REQUEST['customer_id']) && $_REQUEST['customer_id']) {
             //
             $customer_id = (int) $_REQUEST['customer_id'];
             // find default website id to use.
             if (isset($_REQUEST['website_id'])) {
                 $website_id = (int) $_REQUEST['website_id'];
             } else {
             }
         }
         $default_quote_name = module_config::c('quote_default_new_name', '');
         if (module_config::c('quote_name_incrementing', 0)) {
             $quote_number = module_config::c('quote_name_incrementing_next', 1);
             // see if there is an quote number matching this one.
             $this_quote_number = $quote_number;
             do {
                 $quotes = get_multiple('quote', array('name' => $this_quote_number));
                 //'customer_id'=>$customer_id,
                 if (!count($quotes)) {
                     $quote_number = $this_quote_number;
                 } else {
                     $this_quote_number++;
                 }
             } while (count($quotes));
             module_config::save_config('quote_name_incrementing_next', $quote_number);
             $default_quote_name = $quote_number . $default_quote_name;
         }
         $quote = array('quote_id' => 'new', 'customer_id' => $customer_id, 'website_id' => isset($_REQUEST['website_id']) ? $_REQUEST['website_id'] : 0, 'hourly_rate' => module_config::c('hourly_rate', 60), 'name' => $default_quote_name, 'date_create' => date('Y-m-d'), 'date_approved' => '0000-00-00', 'approved_by' => '', 'user_id' => module_security::get_loggedin_id(), 'contact_user_id' => -1, 'status' => module_config::s('quote_status_default', 'New'), 'tax_type' => module_config::c('invoice_tax_type', 0), 'type' => module_config::s('quote_type_default', 'Website Design'), 'currency_id' => module_config::c('default_currency_id', 1), 'auto_task_numbers' => '0', 'default_task_type' => module_config::c('default_task_type', _TASK_TYPE_HOURS_AMOUNT), 'description' => '', 'discount_description' => _l('Discount:'), 'discount_amount' => 0, 'discount_type' => module_config::c('invoice_discount_type', _DISCOUNT_TYPE_BEFORE_TAX));
         // some defaults from the db.
         $quote['total_tax_rate'] = module_config::c('tax_percent', 10);
         $quote['total_tax_name'] = module_config::c('tax_name', 'TAX');
         if ($customer_id > 0) {
             $customer_data = module_customer::get_customer($customer_id, false, true);
             if ($customer_data && isset($customer_data['default_tax']) && $customer_data['default_tax'] >= 0) {
                 $quote['total_tax_rate'] = $customer_data['default_tax'];
                 $quote['total_tax_name'] = $customer_data['default_tax_name'];
             }
         }
     }
     // new support for multiple taxes
     if (!isset($quote['taxes']) || !count($quote['taxes']) && $quote['total_tax_rate'] > 0) {
         $quote['taxes'] = array();
         $tax_rates = explode(',', $quote['total_tax_rate']);
         $tax_names = explode(',', $quote['total_tax_name']);
         foreach ($tax_rates as $tax_rate_id => $tax_rate_amount) {
             if ($tax_rate_amount > 0) {
                 $quote['taxes'][] = array('order' => 0, 'percent' => $tax_rate_amount, 'name' => isset($tax_names[$tax_rate_id]) ? $tax_names[$tax_rate_id] : $quote['total_tax_name'], 'total' => 0, 'amount' => 0, 'discount' => 0, 'increment' => module_config::c('tax_multiple_increment', 0));
             }
         }
     }
     if ($quote) {
         // work out total hours etc..
         $quote['total_hours'] = 0;
         $quote['total_hours_completed'] = 0;
         $quote['total_hours_overworked'] = 0;
         $quote['total_sub_amount'] = 0;
         $quote['total_sub_amount_taxable'] = 0;
         $quote['total_sub_amount_unbillable'] = 0;
         $quote['total_sub_amount_invoicable'] = 0;
         $quote['total_sub_amount_invoicable_taxable'] = 0;
         $quote['total_amount_invoicable'] = 0;
         $quote['total_tasks_remain'] = 0;
         $quote['total_amount'] = 0;
         $quote['total_amount_paid'] = 0;
         $quote['total_amount_invoiced'] = 0;
         $quote['total_amount_invoiced_deposit'] = 0;
         $quote['total_amount_todo'] = 0;
         $quote['total_amount_outstanding'] = 0;
         $quote['total_amount_due'] = 0;
         $quote['total_hours_remain'] = 0;
         $quote['total_percent_complete'] = 0;
         $quote['total_tax'] = 0;
         $quote['total_tax_invoicable'] = 0;
         //            $quote['invoice_discount_amount'] = 0;
         //            $quote['invoice_discount_amount_on_tax'] = 0;
         //            $quote['total_amount_discounted'] = 0;
         // new feature to invoice incompleted tasks
         $quote['uninvoiced_quote_task_ids'] = array();
         $quote_items = self::get_quote_items((int) $quote['quote_id'], $quote);
         foreach ($quote_items as $quote_item) {
             if ($quote_item['quote_item_amount'] != 0) {
                 // we have a custom amount for this quote_item
                 if ($quote_item['billable']) {
                     $quote['total_sub_amount'] += $quote_item['quote_item_amount'];
                     if ($quote_item['taxable']) {
                         $quote['total_sub_amount_taxable'] += $quote_item['quote_item_amount'];
                         if (module_config::c('tax_calculate_mode', _TAX_CALCULATE_AT_END) == _TAX_CALCULATE_INCREMENTAL) {
                             // tax calculated along the way (this isn't the recommended way, but was included as a feature request)
                             // we add tax to each of the tax array items
                             //$quote['total_tax'] += round(($quote_item['quote_item_amount'] * ($quote['total_tax_rate'] / 100)),module_config::c('currency_decimal_places',2));
                             foreach ($quote['taxes'] as $quote_tax_id => $quote_tax) {
                                 if (!isset($quote['taxes'][$quote_tax_id]['total'])) {
                                     $quote['taxes'][$quote_tax_id]['total'] = 0;
                                 }
                                 $quote['taxes'][$quote_tax_id]['total'] += $quote_item['quote_item_amount'];
                                 $quote['taxes'][$quote_tax_id]['amount'] += round($quote_item['quote_item_amount'] * ($quote_tax['percent'] / 100), module_config::c('currency_decimal_places', 2));
                             }
                         }
                     }
                 } else {
                     $quote['total_sub_amount_unbillable'] += $quote_item['quote_item_amount'];
                 }
             }
         }
         // add any discounts.
         if ($quote['discount_amount'] != 0) {
             if ($quote['discount_type'] == _DISCOUNT_TYPE_AFTER_TAX) {
                 // after tax discount ::::::::::
                 // handled below.
                 //$quote['final_modification'] = -$quote['discount_amount'];
             } else {
                 if ($quote['discount_type'] == _DISCOUNT_TYPE_BEFORE_TAX) {
                     // before tax discount:::::
                     //$quote['final_modification'] = -$quote['discount_amount'];
                     // problem : this 'discount_amount_on_tax' calculation may not match the correct final discount calculation as per below
                     if (module_config::c('tax_calculate_mode', _TAX_CALCULATE_AT_END) == _TAX_CALCULATE_INCREMENTAL) {
                         // tax calculated along the way.
                         // we have discounted the 'total amount taxable' so that means we need to reduce the tax amount by that much as well.
                         foreach ($quote['taxes'] as $quote_tax_id => $quote_tax) {
                             $this_tax_discount = round($quote['discount_amount'] * ($quote['taxes'][$quote_tax_id]['percent'] / 100), module_config::c('currency_decimal_places', 2));
                             $quote['discount_amount_on_tax'] += $this_tax_discount;
                             if (!isset($quote['taxes'][$quote_tax_id]['total'])) {
                                 $quote['taxes'][$quote_tax_id]['total'] = 0;
                             }
                             $quote['taxes'][$quote_tax_id]['total'] -= $quote['discount_amount'];
                             $quote['taxes'][$quote_tax_id]['amount'] -= $this_tax_discount;
                             $quote['taxes'][$quote_tax_id]['discount'] = $this_tax_discount;
                         }
                     } else {
                         // we work out what the tax would have been if there was no applied discount
                         // this is used in job.php
                         $quote['taxes_backup'] = $quote['taxes'];
                         $quote['total_sub_amount_taxable_backup'] = $quote['total_sub_amount_taxable'];
                         $total_tax_before_discount = 0;
                         foreach ($quote['taxes'] as $quote_tax_id => $quote_tax) {
                             $quote['taxes'][$quote_tax_id]['total'] = $quote['total_sub_amount_taxable'];
                             $quote['taxes'][$quote_tax_id]['amount'] = round($quote['total_sub_amount_taxable'] * ($quote_tax['percent'] / 100), module_config::c('currency_decimal_places', 2));
                             // here we adjust the 'total_sub_amount_taxable' to include the value from the previous calculation.
                             // this is for multiple taxes that addup as they go (eg: Canada)
                             if (isset($quote_tax['increment']) && $quote_tax['increment']) {
                                 $quote['total_sub_amount_taxable'] += $quote['taxes'][$quote_tax_id]['amount'];
                             }
                             $total_tax_before_discount += $quote['taxes'][$quote_tax_id]['amount'];
                         }
                         $quote['taxes'] = $quote['taxes_backup'];
                         $quote['total_sub_amount_taxable'] = $quote['total_sub_amount_taxable_backup'];
                     }
                     $quote['total_sub_amount'] -= $quote['discount_amount'];
                     $quote['total_sub_amount_taxable'] -= $quote['discount_amount'];
                 }
             }
         }
         if (module_config::c('tax_calculate_mode', _TAX_CALCULATE_AT_END) == _TAX_CALCULATE_AT_END) {
             // tax needs to be calculated based on the total_sub_amount_taxable
             $previous_quote_tax_id = false;
             foreach ($quote['taxes'] as $quote_tax_id => $quote_tax) {
                 $quote['taxes'][$quote_tax_id]['total'] = $quote['total_sub_amount_taxable'];
                 if (isset($quote_tax['increment']) && $quote_tax['increment'] && $previous_quote_tax_id) {
                     $quote['taxes'][$quote_tax_id]['total'] += $quote['taxes'][$previous_quote_tax_id]['amount'];
                 }
                 $quote['taxes'][$quote_tax_id]['amount'] = round($quote['taxes'][$quote_tax_id]['total'] * ($quote_tax['percent'] / 100), module_config::c('currency_decimal_places', 2));
                 // here we adjust the 'total_sub_amount_taxable' to include the value from the previous calculation.
                 // this is for multiple taxes that addup as they go (eg: Canada)
                 $previous_quote_tax_id = $quote_tax_id;
             }
             //$quote['total_tax'] = round(($quote['total_sub_amount_taxable'] * ($quote['total_tax_rate'] / 100)),module_config::c('currency_decimal_places',2));
         } else {
             //$quote['total_tax'] = 0;
         }
         if (isset($quote['tax_type']) && $quote['tax_type'] == 1) {
             // hack! not completely correct, oh well.
             // todo - make this work with more than 1 tax rate.
             // $amount / 1.05  ( this is 1 + tax %)
             // this will only work if a single tax has been included.
             if (is_array($quote['taxes']) && count($quote['taxes']) > 1) {
                 set_error('Included tax calculation only works with 1 tax rate');
             } else {
                 if (is_array($quote['taxes']) && count($quote['taxes'])) {
                     reset($quote['taxes']);
                     $quote_tax_id = key($quote['taxes']);
                     if (isset($quote['taxes'][$quote_tax_id])) {
                         $taxable_amount = $quote['total_sub_amount_taxable'] / (1 + $quote['taxes'][$quote_tax_id]['percent'] / 100);
                         $quote['taxes'][$quote_tax_id]['amount'] = $quote['total_sub_amount_taxable'] - $taxable_amount;
                         $quote['total_sub_amount'] = $quote['total_sub_amount'] - $quote['taxes'][$quote_tax_id]['amount'];
                     }
                 }
             }
         }
         $quote['total_tax'] = 0;
         foreach ($quote['taxes'] as $quote_tax_id => $quote_tax) {
             $quote['total_tax'] += $quote_tax['amount'];
         }
         $quote['total_amount'] = $quote['total_sub_amount'] + $quote['total_tax'];
         if ($quote['discount_type'] == _DISCOUNT_TYPE_AFTER_TAX) {
             $quote['total_amount'] -= $quote['discount_amount'];
         }
         $quote['total_amount'] = round($quote['total_amount'], module_config::c('currency_decimal_places', 2));
     }
     if (isset($cache_key)) {
         module_cache::put('quote', $cache_key, $quote, $cache_timeout);
     }
     if (function_exists('hook_filter_var')) {
         $quote = hook_filter_var('get_quote', $quote, $quote_id);
     }
     return $quote;
 }
Ejemplo n.º 9
0
 public static function get_website($website_id)
 {
     $website = get_single("website", "website_id", $website_id);
     if ($website) {
         switch (module_customer::get_customer_data_access()) {
             case _CUSTOMER_ACCESS_ALL:
                 // all customers! so this means all jobs!
                 break;
             case _CUSTOMER_ACCESS_ALL_COMPANY:
             case _CUSTOMER_ACCESS_CONTACTS:
             case _CUSTOMER_ACCESS_STAFF:
                 $valid_customer_ids = module_security::get_customer_restrictions();
                 $is_valid_website = isset($valid_customer_ids[$website['customer_id']]);
                 if (!$is_valid_website) {
                     $website = false;
                 }
                 break;
             case _CUSTOMER_ACCESS_TASKS:
                 // only customers who have linked jobs that I am assigned to.
                 $has_job_access = false;
                 if (isset($website['customer_id']) && $website['customer_id']) {
                     $jobs = module_job::get_jobs(array('customer_id' => $website['customer_id']));
                     foreach ($jobs as $job) {
                         if ($job['user_id'] == module_security::get_loggedin_id()) {
                             $has_job_access = true;
                             break;
                         }
                         $tasks = module_job::get_tasks($job['job_id']);
                         foreach ($tasks as $task) {
                             if ($task['user_id'] == module_security::get_loggedin_id()) {
                                 $has_job_access = true;
                                 break;
                             }
                         }
                     }
                 }
                 if (!$has_job_access) {
                     $website = false;
                 }
                 break;
         }
     }
     if (!$website) {
         $website = array('website_id' => 'new', 'customer_id' => isset($_REQUEST['customer_id']) ? $_REQUEST['customer_id'] : 0, 'name' => '', 'status' => module_config::s('website_status_default', 'New'), 'url' => '');
     }
     return $website;
 }
Ejemplo n.º 10
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_stripe_label', 'Stripe');
 }
Ejemplo n.º 11
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_other_label', 'Other');
 }
Ejemplo n.º 12
0
        		}else{
        			$inner_content .= $this_content;
        		}
        		unset($this_content);*/
        unset($load_page);
        if ($display_mode == 'iframe' || $display_mode == 'ajax') {
            break;
        }
    }
} catch (Exception $e) {
    $inner_content[] = 'Error: ' . $e->getMessage();
}
// combine any inner content together looking for place holders.
$page_title = trim(preg_replace('#' . preg_quote($page_title_delim, '#') . '\\s*$#', '', $page_title));
if (!trim($page_title)) {
    $page_title = htmlspecialchars(module_config::s('admin_system_name', 'Ultimate Client Manager'));
}
if ($page_unique_id && function_exists('newrelic_name_transaction')) {
    newrelic_name_transaction('Admin: ' . $page_unique_id);
    if (function_exists('newrelic_capture_params')) {
        newrelic_capture_params();
    }
}
if (_DEBUG_MODE) {
    module_debug::log(array('title' => 'Displaying contents: ', 'data' => ''));
}
require_once module_theme::include_ucm("design_header.php");
echo implode('', $inner_content);
require_once module_theme::include_ucm("design_footer.php");
if (_DEBUG_MODE) {
    module_debug::log(array('title' => 'Finished displaying contents, running finish hook ', 'data' => ''));
Ejemplo n.º 13
0
 public static function send_admin_alert($ticket_id, $message = '', $allow_to_cc_bcc = false)
 {
     module_cache::clear('ticket');
     $ticket_data = self::get_ticket($ticket_id);
     $ticket_account_data = self::get_ticket_account($ticket_data['ticket_account_id']);
     $ticket_number = self::ticket_number($ticket_id);
     if ($ticket_data['last_ticket_message_id']) {
         $last_message = self::get_ticket_message($ticket_data['last_ticket_message_id']);
         if (!$message) {
             $htmlmessage = trim($last_message['htmlcontent']);
             if ($htmlmessage) {
                 $message = $htmlmessage;
             } else {
                 $message = nl2br(htmlspecialchars(trim($last_message['content'])));
             }
         }
     } else {
         $last_message = false;
     }
     $to = module_config::c('ticket_admin_email_alert', _ERROR_EMAIL);
     $to_user_id = 0;
     $cc = false;
     if (module_config::c('ticket_auto_notify_staff', 0) && $ticket_data['assigned_user_id']) {
         $staff = module_user::get_user($ticket_data['assigned_user_id'], false);
         if ($staff && $staff['user_id'] == $ticket_data['assigned_user_id'] && $staff['email']) {
             $cc = $to;
             $to = $staff['email'];
             $to_user_id = $staff['user_id'];
         }
     }
     if (strlen($to) < 4) {
         return;
     }
     // do we only send this on first emails or not ?
     $first_only = module_config::c('ticket_admin_alert_first_only', 0);
     if ($first_only && $ticket_data['message_count'] > 1) {
         return;
     }
     $s = self::get_statuses();
     $reply_line = module_config::s('ticket_reply_line', '----- (Please reply above this line) -----');
     // autoreplies go back to the user - not our admin system:
     $from_user_a = module_user::get_user($ticket_data['user_id'], false);
     $reply_to_address = $from_user_a['email'];
     $reply_to_name = $from_user_a['name'];
     $template = module_template::get_template_by_key('ticket_admin_email');
     $template->assign_values(self::get_replace_fields($ticket_id, $ticket_data));
     $template->assign_values(array('ticket_number' => self::ticket_number($ticket_id), 'ticket_status' => $s[$ticket_data['status_id']], 'message' => $message, 'subject' => $ticket_data['subject'], 'position_current' => $ticket_data['position'], 'position_all' => $ticket_data['total_pending'], 'reply_line' => $reply_line, 'days' => module_config::c('ticket_turn_around_days', 5), 'url' => self::link_public($ticket_id), 'url_admin' => self::link_open($ticket_id), 'message_count' => $ticket_data['message_count'], 'ticket_url_cancel' => module_ticket::link_public_status($ticket_id, 7), 'ticket_url_resolved' => module_ticket::link_public_status($ticket_id, _TICKET_STATUS_RESOLVED_ID), 'ticket_url_inprogress' => module_ticket::link_public_status($ticket_id, 5), 'faq_product_id' => $ticket_data['faq_product_id']));
     $content = $template->replace_content();
     $email = module_email::new_email();
     $email->replace_values = $template->values;
     if ($to_user_id) {
         $email->set_to('user', $to_user_id);
     } else {
         $email->set_to_manual($to);
     }
     if ($cc) {
         $email->set_cc_manual($cc);
     }
     if ($ticket_account_data && $ticket_account_data['email']) {
         $email->set_from_manual($ticket_account_data['email'], $ticket_account_data['name']);
         $email->set_bounce_address($ticket_account_data['email']);
     } else {
         $email->set_from_manual($to, module_config::s('admin_system_name'));
         $email->set_bounce_address($to);
     }
     //$email->set_from('user',$from_user_id);
     //$email->set_from('foo','foo',$to,'Admin');
     $headers = $last_message ? @unserialize($last_message['cache']) : false;
     if ($allow_to_cc_bcc && $headers && is_array($headers)) {
         // we're right to do our cc/bcc hack
         if ($headers && isset($headers['to_emails'])) {
             foreach ($headers['to_emails'] as $to_emails) {
                 if (isset($to_emails['address']) && strlen($to_emails['address'])) {
                     $email->set_to_manual($to_emails['address'], isset($to_emails['name']) ? $to_emails['name'] : '');
                 }
             }
         }
         if ($headers && isset($headers['cc_emails'])) {
             foreach ($headers['cc_emails'] as $cc_emails) {
                 if (isset($cc_emails['address']) && strlen($cc_emails['address'])) {
                     $email->set_cc_manual($cc_emails['address'], isset($cc_emails['name']) ? $cc_emails['name'] : '');
                 }
             }
         }
         if ($headers && isset($headers['bcc_emails'])) {
             foreach ($headers['bcc_emails'] as $bcc_emails) {
                 if (isset($bcc_emails['address']) && strlen($bcc_emails['address'])) {
                     $email->set_bcc_manual($bcc_emails['address'], isset($bcc_emails['name']) ? $bcc_emails['name'] : '');
                 }
             }
         }
     }
     // do we reply to the user who created this, or to our ticketing system?
     if (module_config::c('ticket_admin_alert_postback', 1) && $ticket_account_data && $ticket_account_data['email']) {
         $email->set_reply_to($ticket_account_data['email'], $ticket_account_data['name']);
     } else {
         $email->set_reply_to($reply_to_address, $reply_to_name);
     }
     if ($last_message && $last_message['private_message']) {
         $email->set_subject(sprintf(module_config::c('ticket_private_message_email_subject', 'Private Support Ticket Message: [TICKET:%s]'), $ticket_number));
     } else {
         $email->set_subject(sprintf(module_config::c('ticket_admin_alert_subject', 'Support Ticket Updated: [TICKET:%s]'), $ticket_number));
     }
     $email->set_html($content);
     // check attachments:
     $attachments = self::get_ticket_message_attachments($ticket_data['last_ticket_message_id']);
     foreach ($attachments as $attachment) {
         $file_path = 'includes/plugin_ticket/attachments/' . $attachment['ticket_message_attachment_id'];
         $file_name = $attachment['file_name'];
         $email->AddAttachment($file_path, $file_name);
     }
     $email->send();
 }
Ejemplo n.º 14
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_paypal_label', 'PayPal');
 }
Ejemplo n.º 15
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_banktransfer_label', 'Bank Transfer');
 }
Ejemplo n.º 16
0
    case 'normal':
    default:
        ?>


         </div> <!-- end .inner -->
         </div> <!-- end .outer -->
         </div> <!-- end .content -->

        </div>
        <!-- /#wrap -->


        <div id="footer">
            <p>&copy; <?php 
        echo module_config::s('admin_system_name', 'Ultimate Client Manager');
        ?>

              - <?php 
        echo date("Y");
        ?>

              - Version: <?php 
        echo module_config::current_version();
        ?>

              - Time: <?php 
        echo round(microtime(true) - $start_time, 5);
        ?>

            </p>
Ejemplo n.º 17
0
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca, 0a3014a3-2b8f-460b-8850-d6025aa845f8
 * Package Date: 2015-11-25 03:08:08 
 * IP Address: 67.79.165.254
 */
if ($header_logo = module_theme::get_config('theme_logo', _BASE_HREF . 'images/logo.png')) {
    ?>

	<div class="text-center logo-box">
				    <img src="<?php 
    echo htmlspecialchars($header_logo);
    ?>
" border="0"
				         title="<?php 
    echo htmlspecialchars(module_config::s('header_title', 'UCM'));
    ?>
">
		</div>
			    <?php 
}
?>


	    <?php 
if (isset($_REQUEST['signup']) && module_config::c('customer_signup_on_login', 0)) {
    ?>


		    <div id="signup" class="tab-pane">
Ejemplo n.º 18
0
 private static function update_job_completion_status($job_id)
 {
     module_cache::clear('job');
     //module_cache::clear_cache();
     $data = self::save_job_cache($job_id);
     $return_status = $data['status'];
     $tasks = self::get_tasks($job_id);
     $all_completed = count($tasks) > 0;
     foreach ($tasks as $task) {
         if (module_config::c('job_task_log_all_hours', 1) && $task['fully_completed'] || !module_config::c('job_task_log_all_hours', 1) && ($task['fully_completed'] || $task['hours'] > 0 && $task['completed'] >= $task['hours'] || $task['hours'] <= 0 && $task['completed'] > 0)) {
             // this one is done!
         } else {
             $all_completed = false;
             break;
         }
     }
     if ($all_completed) {
         if (!isset($data['date_completed']) || !$data['date_completed'] || $data['date_completed'] == '0000-00-00') {
             // update, dont complete if no tasks.
             //if(count($tasks)){
             $return_status = $data['status'] == module_config::s('job_status_default', 'New') ? _l('Completed') : $data['status'];
             update_insert("job_id", $job_id, "job", array('date_completed' => date('Y-m-d'), 'status' => $return_status));
             //}
         }
     } else {
         // not completed. remove compelted date and reset the job status
         $return_status = $data['status'] == _l('Completed') ? module_config::s('job_status_default', 'New') : $data['status'];
         update_insert("job_id", $job_id, "job", array('date_completed' => '0000-00-00', 'status' => $return_status));
     }
     module_cache::clear('job');
     return $return_status;
 }
Ejemplo n.º 19
0
				</td>
                <td valign="top">
                    <h3><?php 
echo _l('Ticket Messages');
?>
</h3>

<div id="ticket_container" style="<?php 
echo module_config::c('ticket_scroll', 0) ? ' max-height: 400px; overflow-y:auto;' : '';
?>
">
                                            <?php 
$ticket_messages = module_ticket::get_ticket_messages($ticket_id);
$reply__ine_default = '----- (Please reply above this line) -----';
// incase they change it
$reply__ine = module_config::s('ticket_reply_line', $reply__ine_default);
$ticket_message_count = count($ticket_messages);
$ticket_message_counter = 0;
foreach ($ticket_messages as $ticket_message) {
    if ($ticket_message['private_message']) {
        continue;
    }
    $ticket_message_counter++;
    $attachments = module_ticket::get_ticket_message_attachments($ticket_message['ticket_message_id']);
    ?>

                                                <div class="ticket_message ticket_message_<?php 
    //echo $ticket['user_id'] == $ticket_message['from_user_id'] ? 'creator' : 'admin';
    echo !isset($admins_rel[$ticket_message['from_user_id']]) ? 'creator' : 'admin';
    ?>
">
Ejemplo n.º 20
0
$widget_columns[3] = array(1 => array(), 2 => array(), 3 => array());
// then display the welcome message:
module_template::init_template('welcome_message', '<p>
   Hi {USER_NAME}, and Welcome to {SYSTEM_NAME}
</p>', 'Welcome message on Dashboard', array('USER_NAME' => 'Current user name', 'SYSTEM_NAME' => 'System name from settings area'));
// check if there is a template for this user role.
$my_account = module_user::get_user(module_security::get_loggedin_id());
$security_role = current($my_account['roles']);
$template = false;
if ($security_role && isset($security_role['security_role_id'])) {
    $template = module_template::get_template_by_key('welcome_message_role_' . $security_role['security_role_id']);
}
if (!$template || !$template->template_key) {
    $template = module_template::get_template_by_key('welcome_message');
}
$template->assign_values(array('user_name' => htmlspecialchars($_SESSION['_user_name']), 'system_name' => htmlspecialchars(module_config::s('admin_system_name'))));
$widget_sort_json = @json_decode(module_config::c('dash_widgets_sort_' . module_security::get_loggedin_id()), true);
if (!is_array($widget_sort_json)) {
    $widget_sort_json = array();
}
$widget_sort_order = array();
$widget_sort_page_order = 1;
foreach ($widget_sort_json as $id => $vals) {
    $bits = explode('|', $vals);
    if (count($bits) == 3) {
        $widget_sort_order[$bits[2]] = array('column' => $bits[0], 'column_number' => $bits[1], 'page_order' => $widget_sort_page_order++);
    }
}
$widget_sort_id = 1;
// then display the alerts list.
if (module_config::c('dashboard_new_layout', 1) && class_exists('module_dashboard', false) && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Alerts')) {
Ejemplo n.º 21
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_google_label', 'Google Checkout');
 }
Ejemplo n.º 22
0
" class="navbar-brand"><img src="<?php 
                echo htmlspecialchars($header_logo);
                ?>
" border="0" title="<?php 
                echo htmlspecialchars(module_config::s('header_title', 'UCM'));
                ?>
"></a>
            <?php 
            } else {
                ?>

                <a href="<?php 
                echo _BASE_HREF;
                ?>
" class="navbar-brand"><?php 
                echo module_config::s('header_title', 'UCM');
                ?>
</a>
            <?php 
            }
            ?>

          </header>

            <?php 
            /*if (module_security::getcred()){ ?>
            
                        <div class="topnav">
            
                            <div class="btn-toolbar">
                                <!-- <div class="btn-group">
Ejemplo n.º 23
0
						<tbody>
                        <tr>
                            <td>
                                <input type="text" name="invoice_invoice_payment[new][date_paid]" value="<?php 
        echo print_date($payment_date);
        ?>
" class="date_field">
                            </td>
                            <td>
                                
                                <?php 
        echo print_select_box(module_invoice::get_payment_methods(), 'invoice_invoice_payment[new][method]', module_config::s('invoice_payment_default_method', 'Bank'), '', true, false, true);
        ?>

                                <!-- <input type="text" name="invoice_invoice_payment[new][method]" value="<?php 
        echo module_config::s('invoice_payment_default_method', 'Bank');
        ?>
" size="20">-->
                            </td>
                            <td nowrap="">
                                <?php 
        echo '<input type="text" name="invoice_invoice_payment[new][amount]" value="' . number_format($invoice['total_amount_due'], 2, '.', '') . '" id="newinvoice_paymentamount" class="currency">';
        ?>

                                <?php 
        echo print_select_box(get_multiple('currency', '', 'currency_id'), 'invoice_invoice_payment[new][currency_id]', $invoice['currency_id'], '', false, 'code');
        ?>

                            </td>
                            <td>&nbsp;</td>
                            <td align="center">
Ejemplo n.º 24
0
                            <td>
                                <input type="text" name="invoice_invoice_payment[new][date_paid]" id="newinvoice_payment_date" value="<?php 
        echo print_date($payment_date);
        ?>
" class="date_field">
                                <input type="hidden" name="invoice_invoice_payment[new][payment_type]" id="newinvoice_payment_type" value="<?php 
        echo _INVOICE_PAYMENT_TYPE_NORMAL;
        ?>
">
                                <input type="hidden" name="invoice_invoice_payment[new][other_id]" id="newinvoice_payment_other_id" value="">

                            </td>
                            <td>
                                
                                <?php 
        echo print_select_box(module_invoice::get_payment_methods(), 'invoice_invoice_payment[new][method]', module_config::s('invoice_payment_default_method', 'Bank'), '', true, false, true);
        ?>

                            </td>
                            <td nowrap="">
                                <?php 
        echo '<input type="text" name="invoice_invoice_payment[new][amount]" value="' . number_out($invoice['total_amount_due']) . '" id="newinvoice_paymentamount" class="currency">';
        ?>

                                <?php 
        echo print_select_box(get_multiple('currency', '', 'currency_id'), 'invoice_invoice_payment[new][currency_id]', $invoice['currency_id'], '', false, 'code');
        ?>

                            </td>
                            <td>
	                            <input type="text" name="invoice_invoice_payment[new][custom_notes]" value="" size="20">
Ejemplo n.º 25
0
 public static function get_payment_method_name()
 {
     return module_config::s('payment_method_authorize_label', 'Authorize');
 }