diff --git a/.gitignore b/.gitignore index 30d849079..d05f617d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +application/config/email.php application/config/database.php *.patch patches/ diff --git a/application/controllers/config.php b/application/controllers/config.php index f992ad1b0..d258dde6c 100644 --- a/application/controllers/config.php +++ b/application/controllers/config.php @@ -167,9 +167,9 @@ class Config extends Secure_area // load upload library $config = array('upload_path' => './uploads/', 'allowed_types' => 'gif|jpg|png', - 'max_size' => '100', - 'max_width' => '640', - 'max_height' => '480', + 'max_size' => '1024', + 'max_width' => '800', + 'max_height' => '680', 'file_name' => 'company_logo'); $this->load->library('upload', $config); $this->upload->do_upload('company_logo'); diff --git a/application/controllers/sales.php b/application/controllers/sales.php index b4bdaa65a..2dd4ed37c 100644 --- a/application/controllers/sales.php +++ b/application/controllers/sales.php @@ -330,11 +330,6 @@ class Sales extends Secure_area function invoice_email($sale_id) { $sale_data = $this->_load_sale_data($sale_id); - $sale_data['company_info'] = nl2br($sale_data['company_info']); - if (isset($sale_data['customer_info']) && !empty($sale_data['customer_info'])) { - $sale_data['customer_info'] = nl2br($sale_data['customer_info']); - } - // all images should use this prefix in their path $sale_data['image_prefix'] = base_url(); $this->load->view('sales/invoice_email', $sale_data); $this->sale_lib->clear_all(); @@ -343,10 +338,9 @@ class Sales extends Secure_area function send_invoice($sale_id) { $sale_data = $this->_load_sale_data($sale_id); - $message = $this->config->item('config_invoice_email_message'); - $message = str_replace('$CO', $sale_data['invoice_number'], $message); - $message = $this->_substitute_customer($message,$sale_data['customer_first_name'], - $sale_data['customer_last_name']); + $text = $this->config->item('invoice_email_message'); + $text = str_replace('$CO', $sale_data['invoice_number'], $text); + $text = $this->_substitute_customer($text,(object) $sale_data); $result = FALSE; $message = $this->lang->line('sales_invoice_no_email'); if (isset($sale_data["customer_email"]) && !empty( $sale_data["customer_email"])) { @@ -354,6 +348,7 @@ class Sales extends Secure_area $this->email->from($this->config->item('email'), $this->config->item('company')); $this->email->to($sale_data['customer_email']); $this->email->subject($this->lang->line('sales_invoice') . ' ' . $sale_data['invoice_number']); + $this->email->message($text); $filename = $this->_invoice_email_pdf($sale_data); $this->email->attach($filename); $result = $this->email->send(); @@ -379,14 +374,14 @@ class Sales extends Secure_area return $text; } - function _substitute_customer($text, $first_name, $last_name) + function _substitute_customer($text, $cust_info) { // substitute customer info $customer_id=$this->sale_lib->get_customer(); - if($customer_id!=-1) + if($customer_id!=-1 && $cust_info!='') { - $text=str_replace('$CU',$first_name . ' ' . $last_name,$text); - $words = preg_split("/\s+/", trim($first_name . ' ' . $last_name)); + $text=str_replace('$CU',$cust_info->first_name . ' ' . $cust_info->last_name,$text); + $words = preg_split("/\s+/", trim($cust_info->first_name . ' ' . $cust_info->last_name)); $acronym = ""; foreach ($words as $w) { $acronym .= $w[0]; @@ -396,24 +391,24 @@ class Sales extends Secure_area return $text; } - function _substitute_variables($text, $first_name, $last_name) + function _substitute_variables($text, $cust_info) { $text=$this->_substitute_variable($text, '$YCO', $this->Sale, 'get_invoice_number_for_year'); $text=$this->_substitute_variable($text, '$CO', $this->Sale , 'get_invoice_count'); $text=$this->_substitute_variable($text, '$SCO', $this->Sale_suspended, 'get_invoice_count'); $text=strftime($text); - $text=$this->_substitute_customer($text, $first_name, $last_name); + $text=$this->_substitute_customer($text, $cust_info); return $text; } - function _substitute_invoice_number($first_name,$last_name) + function _substitute_invoice_number($cust_info) { $invoice_number=$this->sale_lib->get_invoice_number(); if (empty($invoice_number)) { $invoice_number=$this->config->config['sales_invoice_format']; } - $invoice_number = $this->_substitute_variables($invoice_number,$first_name,$last_name); + $invoice_number = $this->_substitute_variables($invoice_number, $cust_info); $this->sale_lib->set_invoice_number($invoice_number); return $invoice_number; } @@ -443,8 +438,8 @@ class Sales extends Secure_area { $cust_info=$this->Customer->get_info($customer_id); $data['customer']=$cust_info->first_name.' '.$cust_info->last_name; - $data['customer_first_name']=$cust_info->first_name; - $data['customer_last_name']=$cust_info->last_name; + $data['first_name']=$cust_info->first_name; + $data['last_name']=$cust_info->last_name; $data['customer_address'] = $cust_info->address_1; $data['customer_location'] = $cust_info->zip . ' ' . $cust_info->city; $data['customer_email'] = $cust_info->email; @@ -610,7 +605,7 @@ class Sales extends Secure_area $data['customer']=$cust_info->first_name.' '.$cust_info->last_name; $data['customer_email']=$cust_info->email; } - $data['invoice_number']=$this->_substitute_invoice_number($cust_info->first_name, $cust_info->last_name); + $data['invoice_number']=$this->_substitute_invoice_number($cust_info); $data['invoice_number_enabled']=$this->sale_lib->is_invoice_number_enabled(); $data['payments_cover_total']=$this->_payments_cover_total(); $this->load->view("sales/register",$data); diff --git a/application/helpers/dompdf/dompdf_config.inc.php b/application/helpers/dompdf/dompdf_config.inc.php index 3ab2b0b9e..7152d3fe0 100755 --- a/application/helpers/dompdf/dompdf_config.inc.php +++ b/application/helpers/dompdf/dompdf_config.inc.php @@ -203,7 +203,7 @@ def("DOMPDF_DEFAULT_PAPER_SIZE", "letter"); * Used if no suitable fonts can be found. This must exist in the font folder. * @var string */ -def("DOMPDF_DEFAULT_FONT", "serif"); +def("DOMPDF_DEFAULT_FONT", "Helvetica"); /** * Image DPI setting @@ -300,7 +300,7 @@ def("DOMPDF_FONT_HEIGHT_RATIO", 1.1); * Allows people to disabled CSS float support * @var bool */ -def("DOMPDF_ENABLE_CSS_FLOAT", false); +def("DOMPDF_ENABLE_CSS_FLOAT", true); /** * Enable the built in DOMPDF autoloader diff --git a/application/language/en/sales_lang.php b/application/language/en/sales_lang.php index 1d092cfa5..9409e72ff 100644 --- a/application/language/en/sales_lang.php +++ b/application/language/en/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Giftcard Balance"; $lang["sales_discount_included"] = "% discount included"; $lang["sales_invoice"] = "Invoice"; $lang["sales_total_tax_exclusive"] = "Tax excluded"; +$lang["sales_send_invoice"] = "Send Invoice"; +$lang["sales_invoice_confirm"] = "This invoice will be sent to"; $lang["sales_invoice_no_email"] = "This customer does not have a valid email address"; $lang["sales_invoice_sent"] = "Invoice sent to"; -$lang["sales_invoice_unsent"] = "Invoice failed to be sent to "; +$lang["sales_invoice_unsent"] = "Invoice failed to be sent to"; diff --git a/application/language/es/sales_lang.php b/application/language/es/sales_lang.php index 5e48a3f68..6feb2cef0 100644 --- a/application/language/es/sales_lang.php +++ b/application/language/es/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Giftcard Balance"; $lang["sales_discount_included"] = "% discount included"; $lang["sales_invoice"] = "Invoice"; $lang["sales_total_tax_exclusive"] = "Tax excluded"; +$lang["sales_send_invoice"] = "Send Invoice"; +$lang["sales_invoice_confirm"] = "This invoice will be sent to"; $lang["sales_invoice_no_email"] = "This customer does not have a valid email address"; $lang["sales_invoice_sent"] = "Invoice sent to"; -$lang["sales_invoice_unsent"] = "Invoice failed to be sent to "; +$lang["sales_invoice_unsent"] = "Invoice failed to be sent to"; diff --git a/application/language/fr/sales_lang.php b/application/language/fr/sales_lang.php index 3cc985bb9..8eae2a82e 100644 --- a/application/language/fr/sales_lang.php +++ b/application/language/fr/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Giftcard Balance"; $lang["sales_discount_included"] = "% discount included"; $lang["sales_invoice"] = "Invoice"; $lang["sales_total_tax_exclusive"] = "Tax excluded"; +$lang["sales_send_invoice"] = "Send Invoice"; +$lang["sales_invoice_confirm"] = "This invoice will be sent to"; $lang["sales_invoice_no_email"] = "This customer does not have a valid email address"; $lang["sales_invoice_sent"] = "Invoice sent to"; -$lang["sales_invoice_unsent"] = "Invoice failed to be sent to "; +$lang["sales_invoice_unsent"] = "Invoice failed to be sent to"; diff --git a/application/language/id/sales_lang.php b/application/language/id/sales_lang.php index 7e6b89527..a71528bf6 100644 --- a/application/language/id/sales_lang.php +++ b/application/language/id/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Giftcard Balance"; $lang["sales_discount_included"] = "% discount included"; $lang["sales_invoice"] = "Invoice"; $lang["sales_total_tax_exclusive"] = "Tax excluded"; +$lang["sales_send_invoice"] = "Send Invoice"; +$lang["sales_invoice_confirm"] = "This invoice will be sent to"; $lang["sales_invoice_no_email"] = "This customer does not have a valid email address"; $lang["sales_invoice_sent"] = "Invoice sent to"; -$lang["sales_invoice_unsent"] = "Invoice failed to be sent to "; +$lang["sales_invoice_unsent"] = "Invoice failed to be sent to"; diff --git a/application/language/nl-BE/sales_lang.php b/application/language/nl-BE/sales_lang.php index 8af895b6d..9d52c9e2f 100755 --- a/application/language/nl-BE/sales_lang.php +++ b/application/language/nl-BE/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Waardebon Resterend"; $lang["sales_discount_included"] = "% korting inbegrepen"; $lang["sales_invoice"] = "Factuur"; $lang["sales_total_tax_exclusive"] = "Totaal"; +$lang["sales_send_invoice"] = "Vestuur Factuur"; +$lang["sales_invoice_confirm"] = "Deze factuur zal verstuurd worden naar"; $lang["sales_invoice_no_email"] = "Er werd geen email adres gevonden voor deze klant"; $lang["sales_invoice_sent"] = "Factuur verstuurd naar"; -$lang["sales_invoice_unsent"] = "Fout bij het versturen van factuur naar "; +$lang["sales_invoice_unsent"] = "Fout bij het versturen van factuur naar"; diff --git a/application/language/ru/sales_lang.php b/application/language/ru/sales_lang.php index 884fb166d..69590e997 100644 --- a/application/language/ru/sales_lang.php +++ b/application/language/ru/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Giftcard Balance"; $lang["sales_discount_included"] = "% discount included"; $lang["sales_invoice"] = "Invoice"; $lang["sales_total_tax_exclusive"] = "Tax excluded"; +$lang["sales_send_invoice"] = "Send Invoice"; +$lang["sales_invoice_confirm"] = "This invoice will be sent to"; $lang["sales_invoice_no_email"] = "This customer does not have a valid email address"; $lang["sales_invoice_sent"] = "Invoice sent to"; -$lang["sales_invoice_unsent"] = "Invoice failed to be sent to "; +$lang["sales_invoice_unsent"] = "Invoice failed to be sent to"; diff --git a/application/language/th/sales_lang.php b/application/language/th/sales_lang.php index ef968bd24..e76701e7e 100644 --- a/application/language/th/sales_lang.php +++ b/application/language/th/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Giftcard Balance"; $lang["sales_discount_included"] = "% discount included"; $lang["sales_invoice"] = "Invoice"; $lang["sales_total_tax_exclusive"] = "Tax excluded"; +$lang["sales_send_invoice"] = "Send Invoice"; +$lang["sales_invoice_confirm"] = "This invoice will be sent to"; $lang["sales_invoice_no_email"] = "This customer does not have a valid email address"; $lang["sales_invoice_sent"] = "Invoice sent to"; -$lang["sales_invoice_unsent"] = "Invoice failed to be sent to "; +$lang["sales_invoice_unsent"] = "Invoice failed to be sent to"; diff --git a/application/language/tr/sales_lang.php b/application/language/tr/sales_lang.php index a60104eee..a44cc2c76 100644 --- a/application/language/tr/sales_lang.php +++ b/application/language/tr/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Giftcard Balance"; $lang["sales_discount_included"] = "% discount included"; $lang["sales_invoice"] = "Invoice"; $lang["sales_total_tax_exclusive"] = "Tax excluded"; +$lang["sales_send_invoice"] = "Send Invoice"; +$lang["sales_invoice_confirm"] = "This invoice will be sent to"; $lang["sales_invoice_no_email"] = "This customer does not have a valid email address"; $lang["sales_invoice_sent"] = "Invoice sent to"; -$lang["sales_invoice_unsent"] = "Invoice failed to be sent to "; +$lang["sales_invoice_unsent"] = "Invoice failed to be sent to"; diff --git a/application/language/zh/sales_lang.php b/application/language/zh/sales_lang.php index 993a8d0c1..e2cdc8fef 100755 --- a/application/language/zh/sales_lang.php +++ b/application/language/zh/sales_lang.php @@ -93,6 +93,8 @@ $lang["sales_giftcard_balance"] = "Giftcard Balance"; $lang["sales_discount_included"] = "% discount included"; $lang["sales_invoice"] = "Invoice"; $lang["sales_total_tax_exclusive"] = "Tax excluded"; +$lang["sales_send_invoice"] = "Send Invoice"; +$lang["sales_invoice_confirm"] = "This invoice will be sent to"; $lang["sales_invoice_no_email"] = "This customer does not have a valid email address"; $lang["sales_invoice_sent"] = "Invoice sent to"; -$lang["sales_invoice_unsent"] = "Invoice failed to be sent to "; +$lang["sales_invoice_unsent"] = "Invoice failed to be sent to"; diff --git a/application/views/configs/receipt_config.php b/application/views/configs/receipt_config.php index 7f8af9793..cafa9977f 100644 --- a/application/views/configs/receipt_config.php +++ b/application/views/configs/receipt_config.php @@ -189,19 +189,22 @@ $(document).ready(function() { $('#receipt_printer').append($('