');
- }
+ }
}
diff --git a/application/core/MY_Model.php b/application/core/MY_Model.php
index 007e351..d84bcb3 100644
--- a/application/core/MY_Model.php
+++ b/application/core/MY_Model.php
@@ -1,11 +1,14 @@
$value) {
- $this->db->like($key, $value);
+ $this->db->where('(' . $key . " LIKE '%" . $value . "%' or " . $key . " LIKE '" . $value . "%')");
}
diff --git a/application/helpers/mcb_currency_helper.php b/application/helpers/mcb_currency_helper.php
index 7d63e20..176cdf3 100644
--- a/application/helpers/mcb_currency_helper.php
+++ b/application/helpers/mcb_currency_helper.php
@@ -1,10 +1,10 @@
mdl_mcb_data->setting('currency_symbol_placement') == 'before') {
diff --git a/application/helpers/mcb_date_helper.php b/application/helpers/mcb_date_helper.php
index 7c233ae..cc6e543 100644
--- a/application/helpers/mcb_date_helper.php
+++ b/application/helpers/mcb_date_helper.php
@@ -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;
+
+ }
+
+}
+
?>
\ No newline at end of file
diff --git a/application/helpers/mcb_invoice_amount_helper.php b/application/helpers/mcb_invoice_amount_helper.php
index 1fe6269..ad7daaa 100644
--- a/application/helpers/mcb_invoice_amount_helper.php
+++ b/application/helpers/mcb_invoice_amount_helper.php
@@ -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')) . '%';
}
diff --git a/application/helpers/mcb_invoice_helper.php b/application/helpers/mcb_invoice_helper.php
index 0bba608..9d7de04 100644
--- a/application/helpers/mcb_invoice_helper.php
+++ b/application/helpers/mcb_invoice_helper.php
@@ -1,9 +1,5 @@
load->helper(array('mcb_invoice_amount', 'mcb_invoice_item', 'mcb_invoice_payment', 'mcb_numbers'));
-
/**
* BEGIN COMPANY (FROM) SPECIFIC HELPERS
*/
@@ -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 */
@@ -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;
@@ -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;
}
@@ -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 '';
}
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 '';
}
diff --git a/application/helpers/mcb_invoice_item_helper.php b/application/helpers/mcb_invoice_item_helper.php
index f006002..843bfe8 100644
--- a/application/helpers/mcb_invoice_item_helper.php
+++ b/application/helpers/mcb_invoice_item_helper.php
@@ -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')) . '%';
}
@@ -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) {
diff --git a/application/helpers/mpdf_helper.php b/application/helpers/mpdf_helper.php
index 85992a0..871d082 100644
--- a/application/helpers/mpdf_helper.php
+++ b/application/helpers/mpdf_helper.php
@@ -14,7 +14,7 @@ function pdf_create($html, $filename, $stream=TRUE) {
if ($stream) {
- $mpdf->Output($filename, 'I');
+ $mpdf->Output($filename . '.pdf', 'I');
}
diff --git a/application/language/english/mcb_lang.php b/application/language/english/mcb_lang.php
index a4e621d..8c357c3 100644
--- a/application/language/english/mcb_lang.php
+++ b/application/language/english/mcb_lang.php
@@ -392,8 +392,9 @@
/* NEW FOR 0.9.4.1 */
$lang['item_tax_rate'] = 'Item Tax Rate';
$lang['item_tax_option'] = 'Item Tax Option';
-$lang['item_tax_option_0'] = 'Add to Total';
-$lang['item_tax_option_1'] = 'Include in Total';
+// These two items are changed below in 0.9.6
+//$lang['item_tax_option_0'] = 'Add to Total';
+//$lang['item_tax_option_1'] = 'Include in Total';
/* NEW FOR 0.9.4.2 */
$lang['default_quote_group'] = 'Default Quote Group';
@@ -456,4 +457,69 @@
$lang['footer'] = 'Footer';
$lang['inventory_type_in_use'] = 'The Inventory Type specified is already in use.';
+/* NEW FOR 0.9.6 (0.10)*/
+//$lang['item_tax_option_0'] = 'Add to Total';
+//$lang['item_tax_option_1'] = 'Include in Total';
+$lang['account_deposits'] = 'Account Deposits';
+$lang['apply_credit'] = 'Apply Credit';
+$lang['calendar_view'] = 'Calendar View';
+$lang['control_center'] = 'Control Center';
+$lang['copy'] = 'Copy';
+$lang['credit_amount'] = 'Credit Amount';
+$lang['dashboard_show_quotes'] = 'Show Quotes';
+$lang['email_body_template'] = 'Default Body Template';
+$lang['email_footer_template'] = 'Default Footer Template';
+$lang['enter_deposit'] = 'Enter Deposit';
+$lang['initial_stock_quantity'] = 'Initial Stock Quantity';
+$lang['invoice_count'] = 'Invoice Count';
+$lang['item_tax_option_0'] = 'Add to Amount';
+$lang['item_tax_option_1'] = 'Include in Amount';
+$lang['list_view'] = 'List View';
+$lang['my_profile'] = 'My Profile';
+$lang['sales'] = 'Sales';
+$lang['sales_with_tax'] = 'Sales With Tax';
+$lang['sales_by_customer'] = 'Sales by Customer';
+
+/* Calendar */
+$lang['calendarToday'] = 'Today';
+$lang['calendarDay'] = 'Day';
+$lang['calendarWeek'] = 'Week';
+$lang['calendarMonth'] = 'Month';
+$lang['months'] = array("January","February","March","April","May","June","July","August","September","October","November","December");
+$lang['monthsShort'] = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
+$lang['days'] = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
+$lang['daysShort'] = array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
+
+/* NEW FOR 0.11 */
+$lang['active'] = 'Active';
+$lang['amount_greater_than_zero'] = 'The Amount must be greater than zero.';
+$lang['default_invoice_email_template'] = 'Default Invoice Email Template';
+$lang['default_item_tax_option'] = 'Default Item Tax Option';
+$lang['default_overdue_invoice_email_template'] = 'Default Overdue Invoice Email Template';
+$lang['default_payment_method'] = 'Default Payment Method';
+$lang['email_body'] = 'Email Body';
+$lang['email_footer'] = 'Email Footer';
+$lang['email_template_form'] = 'Email Template Form';
+$lang['email_template_title'] = 'Email Template Title';
+$lang['email_templates'] = 'Email Templates';
+$lang['merchant_account_id'] = 'Merchant Account ID';
+$lang['merchant_currency_code'] = 'Merchant Currency Code';
+$lang['merchant_driver'] = 'Merchant Driver';
+$lang['merchant_enabled'] = 'Merchant Enabled';
+$lang['merchant_online_payment'] = 'Online Payment';
+$lang['merchant_pay_online'] = 'Pay Online';
+$lang['merchant_payment_cancelled'] = 'Your payment has been cancelled.';
+$lang['merchant_payment_finished'] = 'Thank you for your payment.';
+$lang['merchant_test_mode'] = 'Merchant Test Mode';
+$lang['no'] = 'No';
+$lang['off'] = 'Off';
+$lang['on'] = 'On';
+$lang['yes'] = 'Yes';
+
+/* NEW FOR 0.12 */
+$lang['clear'] = 'Clear';
+$lang['default_apply_invoice_tax'] = 'Default Apply Invoice Tax to Items';
+$lang['group_by'] = 'Group By';
+$lang['payment_entered'] = 'A payment of %s was applied';
+
?>
\ No newline at end of file
diff --git a/application/libraries/MY_Form_validation.php b/application/libraries/MY_Form_validation.php
index d1fa463..046d633 100644
--- a/application/libraries/MY_Form_validation.php
+++ b/application/libraries/MY_Form_validation.php
@@ -2,6 +2,8 @@
class MY_Form_validation extends CI_Form_validation {
+ public $_field_data = array();
+
function run($module = '', $group = '') {
(is_object($module)) AND $this->CI =& $module;
return parent::run($group);
diff --git a/application/libraries/Merchant/Merchant.php b/application/libraries/Merchant/Merchant.php
new file mode 100644
index 0000000..9ddd031
--- /dev/null
+++ b/application/libraries/Merchant/Merchant.php
@@ -0,0 +1,147 @@
+valid_drivers = array('merchant_paypal');
+
+ /** Load a copy of the CI object */
+ $this->CI =& get_instance();
+
+ /** Load the language helper */
+ $this->CI->load->helper('language');
+
+ }
+
+ public function curl_get($url, $post_data = NULL) {
+
+ /** Standard cURL function to send & receive responsee */
+
+ $ch = curl_init($url);
+ curl_setopt($ch, CURLOPT_HEADER, FALSE);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+
+ if ($post_data) {
+
+ if (is_array($post_data)) {
+
+ $post_data = http_build_query($post_data);
+
+ }
+
+ curl_setopt($ch, CURLOPT_POST, TRUE);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
+
+ }
+
+ $response = curl_exec($ch);
+
+ curl_close($ch);
+
+ return $response;
+
+ }
+
+ /** Generates and returns a form for payment, which posts to Merchant */
+ public function payment_form($params, $form_name = 'merchant_form') {
+
+ $post_url = $this->{$this->driver}->post_url();
+
+ $form_data = $this->{$this->driver}->form_data($params);
+
+ $form = '';
+
+ return $form;
+
+ }
+
+ /** Generates and returns a link for payment, which directs to Merchant */
+ public function payment_link($params) {
+
+ $url = $this->{$this->driver}->post_url();
+
+ $data = $this->{$this->driver}->link_data($params);
+
+ $return = '' . lang('merchant_pay_online') . '';
+
+ return $return;
+
+ }
+
+ /** The driver handles the merchant response via this method */
+ public function notify() {
+
+ return $this->{$this->driver}->driver_notify();
+
+ }
+
+ /** @TODO This should be moved somewhere outside of the merchant library */
+ public function save_response($response) {
+
+ $this->CI->db->insert('mcb_merchant_responses', $response);
+
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/libraries/Merchant/drivers/Merchant_paypal.php b/application/libraries/Merchant/drivers/Merchant_paypal.php
new file mode 100644
index 0000000..2cf3dbf
--- /dev/null
+++ b/application/libraries/Merchant/drivers/Merchant_paypal.php
@@ -0,0 +1,119 @@
+test_mode == TRUE) ? self::PROCESS_URL_TEST : self::PROCESS_URL;
+
+ }
+
+ public function form_data($params) {
+
+ $data = array(
+ 'rm' => '2',
+ 'cmd' => '_xclick',
+ 'business' => $params['merchant_account_id'],
+ 'return' => $params['return_url'],
+ 'cancel_return' => $params['cancel_url'],
+ 'notify_url' => $params['notify_url'],
+ 'item_name' => $params['reference'],
+ 'amount' => $params['amount'],
+ 'currency_code' => $params['currency_code'],
+ 'no_shipping' => 1,
+ 'custom' => $params['custom']
+ );
+
+ return $data;
+
+ }
+
+ public function link_data($params) {
+
+ $data = array(
+ 'rm' => '2',
+ 'cmd' => '_xclick',
+ 'business' => urlencode($params['merchant_account_id']),
+ 'return' => urlencode($params['return_url']),
+ 'cancel_return' => urlencode($params['cancel_url']),
+ 'notify_url' => urlencode($params['notify_url']),
+ 'item_name' => urlencode($params['reference']),
+ 'amount' => urlencode($params['amount']),
+ 'currency_code' => urlencode($params['currency_code']),
+ 'no_shipping' => 1,
+ 'custom' => urlencode($params['custom'])
+ );
+
+ return $data;
+
+ }
+
+ public function driver_notify() {
+
+ $ipn_response = $_POST;
+
+ $post_validation = $ipn_response;
+ $post_validation['cmd'] = '_notify-validate';
+
+ $response = $this->curl_get($this->post_url(), $post_validation);
+
+ $db_array = array(
+ 'merchant_response_payment_id' => 0,
+ 'merchant_response_client_id' => 0,
+ 'merchant_response_invoice_id' => $ipn_response['custom'],
+ 'merchant_response_amount' => $ipn_response['mc_gross'],
+ 'merchant_response_method' => 'PayPal',
+ 'merchant_response_status' => $response,
+ 'merchant_response_payment_status' => $ipn_response['payment_status'],
+ 'merchant_response_post' => serialize($ipn_response)
+ );
+
+ $this->save_response($db_array);
+
+ log_message('DEBUG', $response);
+
+ if ($response == 'VERIFIED' and $ipn_response['payment_status'] == 'Completed') {
+
+ return TRUE;
+
+ }
+
+ return FALSE;
+
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/modules_core/calendar/controllers/calendar.php b/application/modules_core/calendar/controllers/calendar.php
new file mode 100644
index 0000000..3604cdf
--- /dev/null
+++ b/application/modules_core/calendar/controllers/calendar.php
@@ -0,0 +1,54 @@
+input->post('btn_list_view')) {
+
+ redirect('invoices');
+
+ }
+
+ elseif ($this->input->post('btn_add_invoice')) {
+
+ redirect('invoices/create');
+
+ }
+
+ $this->load->model('invoices/mdl_invoices');
+
+ }
+
+ function index() {
+
+ $this->load->view('index');
+
+ }
+
+ public function jquery_get_invoices($status = 'open') {
+
+ $function = "get_" . $status;
+
+ $invoices = $this->mdl_invoices->$function();
+
+ $inv_array = array();
+
+ foreach ($invoices as $invoice) {
+
+ $inv_array[] = array(
+ 'id' => $invoice->invoice_id,
+ 'title' => $invoice->client_name . ' (' . display_currency($invoice->invoice_total) . ')',
+ 'start' => date('Y-m-d', $invoice->invoice_due_date),
+ 'url' => './invoices/edit/invoice_id/'. $invoice->invoice_id,
+ );
+
+ }
+
+ echo json_encode($inv_array);
+
+ }
+
+}
\ No newline at end of file
diff --git a/application/modules_core/calendar/controllers/index.html b/application/modules_core/calendar/controllers/index.html
new file mode 100644
index 0000000..c942a79
--- /dev/null
+++ b/application/modules_core/calendar/controllers/index.html
@@ -0,0 +1,10 @@
+
+
+ 403 Forbidden
+
+
+
+
Directory access is forbidden.
+
+
+
\ No newline at end of file
diff --git a/application/modules_core/calendar/credit.txt b/application/modules_core/calendar/credit.txt
new file mode 100644
index 0000000..e354bbb
--- /dev/null
+++ b/application/modules_core/calendar/credit.txt
@@ -0,0 +1 @@
+Calendar module for MyClientBase provided by Omar Orellana
\ No newline at end of file
diff --git a/application/modules_core/calendar/models/index.html b/application/modules_core/calendar/models/index.html
new file mode 100644
index 0000000..c942a79
--- /dev/null
+++ b/application/modules_core/calendar/models/index.html
@@ -0,0 +1,10 @@
+
+
+ 403 Forbidden
+
+
+
+
Directory access is forbidden.
+
+
+
\ No newline at end of file
diff --git a/application/modules_core/calendar/views/header_insert.php b/application/modules_core/calendar/views/header_insert.php
new file mode 100644
index 0000000..0fa9f47
--- /dev/null
+++ b/application/modules_core/calendar/views/header_insert.php
@@ -0,0 +1,132 @@
+
+
+
+
+lang->line('buttonArr')); ?>
+
+
+
+
\ No newline at end of file
diff --git a/application/modules_core/calendar/views/index.html b/application/modules_core/calendar/views/index.html
new file mode 100644
index 0000000..c942a79
--- /dev/null
+++ b/application/modules_core/calendar/views/index.html
@@ -0,0 +1,10 @@
+
+
+ 403 Forbidden
+
+
+
+
Directory access is forbidden.
+
+
+
\ No newline at end of file
diff --git a/application/modules_core/calendar/views/index.php b/application/modules_core/calendar/views/index.php
new file mode 100644
index 0000000..ac04c4d
--- /dev/null
+++ b/application/modules_core/calendar/views/index.php
@@ -0,0 +1,28 @@
+load->view('dashboard/header', array('header_insert'=>'calendar/header_insert')); ?>
+
+
-
+
\ No newline at end of file
diff --git a/application/modules_core/client_center/views/invoice_view.php b/application/modules_core/client_center/views/invoice_view.php
index 11ee5f8..9351817 100644
--- a/application/modules_core/client_center/views/invoice_view.php
+++ b/application/modules_core/client_center/views/invoice_view.php
@@ -14,7 +14,7 @@