Skip to content

Commit

Permalink
Update to 0.12 Bitbucket
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenvheel committed Apr 18, 2012
1 parent fe9a7a6 commit 3ae2670
Show file tree
Hide file tree
Showing 320 changed files with 22,440 additions and 4,714 deletions.
13 changes: 10 additions & 3 deletions application/core/Admin_Controller.php
Expand Up @@ -12,7 +12,9 @@ function __construct() {

$this->load->helper('url');

if (!$this->session->userdata('user_id')) {
$user_id = $this->session->userdata('user_id');

if (!$user_id) {

redirect('sessions/login');

Expand All @@ -28,14 +30,19 @@ function __construct() {

$this->load->database();

$this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice', 'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app'));
$this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice',
'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app',
'mcb_invoice_amount', 'mcb_invoice_item',
'mcb_invoice_payment', 'mcb_numbers'));

$this->load->model(array('mcb_modules/mdl_mcb_modules','mcb_data/mdl_mcb_data'));
$this->load->model(array('mcb_modules/mdl_mcb_modules','mcb_data/mdl_mcb_data','mcb_data/mdl_mcb_userdata'));

$this->mdl_mcb_modules->set_module_data();

$this->mdl_mcb_data->set_session_data();

$this->mdl_mcb_userdata->set_session_data($user_id);

$this->mdl_mcb_modules->load_custom_languages();

$this->load->language('mcb', $this->mdl_mcb_data->setting('default_language'));
Expand Down
45 changes: 24 additions & 21 deletions application/core/Client_Center_Controller.php
Expand Up @@ -2,45 +2,48 @@

class Client_Center_Controller extends MX_Controller {

function __construct($var_required = NULL) {
function __construct($var_required = NULL) {

parent::__construct();
parent::__construct();

$this->load->database();
$this->load->database();

$this->load->helper('url');
$this->load->helper('url');

$this->load->model('mcb_modules/mdl_mcb_modules');
$this->load->model('mcb_modules/mdl_mcb_modules');

$this->load->library('session');

if ($this->session->userdata('is_admin')) {
$this->load->library('session');

redirect('client_center/admin');
if ($this->session->userdata('is_admin')) {

}
redirect('client_center/admin');

if ($var_required and (!$this->session->userdata($var_required))) {
}

redirect('client_center/sessions/login');
if ($var_required and (!$this->session->userdata($var_required))) {

}
redirect('sessions/login');

$this->load->model('mcb_data/mdl_mcb_data');
}

$this->mdl_mcb_data->set_session_data();
$this->load->model('mcb_data/mdl_mcb_data');

$this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice', 'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app'));
$this->mdl_mcb_data->set_session_data();

$this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice',
'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app',
'mcb_invoice_amount', 'mcb_invoice_item',
'mcb_invoice_payment', 'mcb_numbers'));

$this->load->language('mcb', $this->mdl_mcb_data->setting('default_language'));
$this->load->language('mcb', $this->mdl_mcb_data->setting('default_language'));

$this->load->library('form_validation');
$this->load->library('form_validation');

$this->load->model('fields/mdl_fields');
$this->load->model('fields/mdl_fields');

$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

}
}

}

Expand Down
27 changes: 24 additions & 3 deletions application/core/MY_Model.php
@@ -1,11 +1,14 @@
<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

/**
* My_Model Model Library
*
* Description:
* My_Model is an extension to CodeIgniter's core model that helps make
* developing models easier and less repetitive.
*
* Version 2011.07.02
* Written by Jesse Terry
* @version 2011.07.02
* @copyright Copyright (c) 2011 Jesse Terry
*
* CHANGELOG
* 2011.07.02 - Added $params support for joins
Expand All @@ -20,6 +23,24 @@
* 2011.01.15 - Added delete_by_id() method
* 2010.11.18 - Added get_by_id() method
*
* * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/

class MY_Model extends CI_Model {
Expand Down Expand Up @@ -275,7 +296,7 @@ private function _prep_params($params = NULL) {

foreach ($params['like'] as $key=>$value) {

$this->db->like($key, $value);
$this->db->where('(' . $key . " LIKE '%" . $value . "%' or " . $key . " LIKE '" . $value . "%')");

}

Expand Down
4 changes: 2 additions & 2 deletions application/helpers/mcb_currency_helper.php
@@ -1,10 +1,10 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

function display_currency($amount) {
function display_currency($amount, $standardize_number = TRUE) {

global $CI;

$amount = format_number($amount);
$amount = format_number($amount, $standardize_number);

if ($CI->mdl_mcb_data->setting('currency_symbol_placement') == 'before') {

Expand Down
80 changes: 80 additions & 0 deletions application/helpers/mcb_date_helper.php
Expand Up @@ -57,4 +57,84 @@ function standardize_date($date) {

}

function date_formats($format = NULL, $element = NULL) {

$date_formats = array(
'm/d/Y' => array(
'key' => 'm/d/Y',
'picker' => 'mm/dd/yy',
'mask' => '99/99/9999',
'dropdown' => 'mm/dd/yyyy'),
'm/d/y' => array(
'key' => 'm/d/y',
'picker' => 'mm/dd/y',
'mask' => '99/99/99',
'dropdown' => 'mm/dd/yy'),
'Y/m/d' => array(
'key' => 'Y/m/d',
'picker' => 'yy/mm/dd',
'mask' => '9999/99/99',
'dropdown' => 'yyyy/mm/dd'),
'd/m/Y' => array(
'key' => 'd/m/Y',
'picker' => 'dd/mm/yy',
'mask' => '99/99/9999',
'dropdown' => 'dd/mm/yyyy'),
'd/m/y' => array(
'key' => 'd/m/y',
'picker' => 'dd/mm/y',
'mask' => '99/99/99',
'dropdown' => 'dd/mm/yy'),
'm-d-Y' => array(
'key' => 'm-d-Y',
'picker' => 'mm-dd-yy',
'mask' => '99-99-9999',
'dropdown' => 'mm-dd-yyyy'),
'm-d-y' => array(
'key' => 'm-d-y',
'picker' => 'mm-dd-y',
'mask' => '99-99-99',
'dropdown' => 'mm-dd-yy'),
'Y-m-d' => array(
'key' => 'Y-m-d',
'picker' => 'yy-mm-dd',
'mask' => '9999-99-99',
'dropdown' => 'yyyy-mm-dd'),
'y-m-d' => array(
'key' => 'y-m-d',
'picker' => 'y-mm-dd',
'mask' => '99-99-99',
'dropdown' => 'yy-mm-dd'),
'd.m.Y' => array(
'key' => 'd.m.Y',
'picker' => 'dd.mm.yy',
'mask' => '99.99.9999',
'dropdown' => 'dd.mm.yyyy'),
'd.m.y' => array(
'key' => 'd.m.y',
'picker' => 'dd.mm.y',
'mask' => '99.99.99',
'dropdown' => 'dd.mm.yy')
);

if ($format and $element) {

return $date_formats[$format][$element];

}

elseif ($format) {

return $date_formats[$format];

}

else {

return $date_formats;

}

}

?>
4 changes: 3 additions & 1 deletion application/helpers/mcb_invoice_amount_helper.php
Expand Up @@ -60,8 +60,10 @@ function invoice_tax_rate_amount($invoice_tax_rate) {

function invoice_tax_rate_name($invoice_tax_rate) {

$CI =& get_instance();

/* Invoice tax rate */
return $invoice_tax_rate->tax_rate_name . ' @ ' . $invoice_tax_rate->tax_rate_percent . '%';
return $invoice_tax_rate->tax_rate_name . ' @ ' . format_number($invoice_tax_rate->tax_rate_percent, TRUE, $CI->mdl_mcb_data->setting('decimal_taxes_num')) . '%';

}

Expand Down
50 changes: 43 additions & 7 deletions application/helpers/mcb_invoice_helper.php
@@ -1,9 +1,5 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$CI =& get_instance();

$CI->load->helper(array('mcb_invoice_amount', 'mcb_invoice_item', 'mcb_invoice_payment', 'mcb_numbers'));

/**
* BEGIN COMPANY (FROM) SPECIFIC HELPERS
*/
Expand Down Expand Up @@ -57,6 +53,12 @@ function invoice_from_email($invoice) {

}

function invoice_from_fax_number($invoice) {

return $invoice->from_fax_number;

}

function invoice_from_name($invoice) {

/* First + Last name invoice is from */
Expand Down Expand Up @@ -99,6 +101,34 @@ function invoice_from_zip_city($invoice) {

}

function invoice_payment_link($invoice) {

global $CI;

if ($CI->mdl_mcb_data->setting('merchant_enabled')) {

$link = $CI->lib_output->payment_link($invoice);

/** Unless I'm just stupid (highly likely), the PDF seems to want the
* entire GET string urlencoded...
*/
if ($CI->uri->segment(2) == 'generate_pdf') {

$replace = substr($link, strpos($link, '?') + 1);
$replace = substr($replace, 0, strpos($replace, '">') - 2);

$link = str_replace($replace, urlencode($replace), $link);

}

return $link;

}

return '';

}

function invoice_tax_id($invoice) {

global $CI;
Expand Down Expand Up @@ -165,7 +195,13 @@ function invoice_to_country($invoice) {

function invoice_to_email_address($invoice) {

return $invoice->client_email_address;
return $invoice->client_email_address;

}

function invoice_to_fax_number($invoice) {

return $invoice->client_fax_number;

}

Expand Down Expand Up @@ -279,14 +315,14 @@ function invoice_logo($output_type = 'pdf') {

if ($output_type == 'pdf') {

/** Use a system path to include the image in the PDF **/
/** Use a system path to include the image in the PDF **/
return '<img src="' . getcwd() . '/uploads/invoice_logos/' . $CI->mdl_mcb_data->setting('invoice_logo') . '" />';

}

elseif ($output_type == 'html') {

/** Use a URL to include the image in the HTML **/
/** Use a URL to include the image in the HTML **/
return '<img src="' . base_url() . 'uploads/invoice_logos/' . $CI->mdl_mcb_data->setting('invoice_logo') . '" />';

}
Expand Down
8 changes: 6 additions & 2 deletions application/helpers/mcb_invoice_item_helper.php
Expand Up @@ -49,7 +49,9 @@ function invoice_item_tax($item) {

function invoice_item_tax_rate($item) {

return $item->tax_rate_percent . '%';
$CI =& get_instance();

return format_number($item->tax_rate_percent, TRUE, $CI->mdl_mcb_data->setting('decimal_taxes_num')) . '%';

}

Expand All @@ -62,8 +64,10 @@ function invoice_item_tax_sum($sum) {

function invoice_item_tax_sum_name($sum) {

$CI =& get_instance();

/* For display purposes */
return $sum->tax_rate_name . ' @ ' . $sum->tax_rate_percent . '%';
return $sum->tax_rate_name . ' @ ' . format_number($sum->tax_rate_percent, TRUE, $CI->mdl_mcb_data->setting('decimal_taxes_num')) . '%';

}
function invoice_item_total($item) {
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/mpdf_helper.php
Expand Up @@ -14,7 +14,7 @@ function pdf_create($html, $filename, $stream=TRUE) {

if ($stream) {

$mpdf->Output($filename, 'I');
$mpdf->Output($filename . '.pdf', 'I');

}

Expand Down

0 comments on commit 3ae2670

Please sign in to comment.