Skip to content

Commit

Permalink
fixed issues with enable reward points
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua1234511 committed Mar 13, 2017
1 parent 3f489d6 commit 74681e7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions application/controllers/Sales.php
Expand Up @@ -245,15 +245,15 @@ public function add_payment()

if(($cur_rewards_value - $current_payments_with_rewards) <= 0)
{
$data['error'] = $this->lang->line('rewards_remaining_balance', to_currency($cur_rewards_value));
$data['error'] = $this->lang->line('rewards_remaining_balance'). to_currency($cur_rewards_value);
}
else
{
$new_reward_value = $points - $this->sale_lib->get_amount_due();
$new_reward_value = $new_reward_value >= 0 ? $new_reward_value : 0;
$this->sale_lib->set_rewards_remainder($new_reward_value);
$new_reward_value = str_replace('$', '\$', to_currency($new_reward_value));
$data['warning'] = $this->lang->line('rewards_remaining_balance', $new_reward_value);
$data['warning'] = $this->lang->line('rewards_remaining_balance'). $new_reward_value;
$amount_tendered = min($this->sale_lib->get_amount_due(), $points);

$this->sale_lib->add_payment($payment_type, $amount_tendered);
Expand Down Expand Up @@ -878,7 +878,7 @@ private function _reload($data = array())
$data['payments_total'] = $this->sale_lib->get_payments_total();
$data['amount_due'] = $this->sale_lib->get_amount_due();
$data['payments'] = $this->sale_lib->get_payments();
if($customer_info)
if($customer_info && $this->config->item('customer_reward_enable') == TRUE)
$data['payment_options'] = $this->Sale->get_payment_options(TRUE,TRUE);
else
$data['payment_options'] = $this->Sale->get_payment_options();
Expand Down
2 changes: 1 addition & 1 deletion application/language/en/sales_lang.php
Expand Up @@ -136,4 +136,4 @@
$lang["customers_available_points"] = "Available Points";
$lang["sales_rewards"] = "Reward Points";
$lang["sales_rewards_balance"] = "Reward Points Balance";
$lang["rewards_remaining_balance"] = "Reward Points remaining value is %1!";
$lang["rewards_remaining_balance"] = "Reward Points remaining value is ";
2 changes: 1 addition & 1 deletion application/models/Sale.php
Expand Up @@ -536,7 +536,7 @@ public function save($items, $customer_id, $employee_id, $comment, $invoice_numb
$total_amount = floatval($total_amount) + floatval($payment['payment_amount']);
}

if(isset($customer_id) && $customer_id!= NULL){
if(isset($customer_id) && $customer_id!= NULL && $this->config->item('customer_reward_enable') == TRUE){
$package_id = $this->Customer->get_info($customer_id)->package_id;
if(isset($package_id) && $package_id!=NULL){
$points_percent = $this->Customer_rewards->get_points_percent($package_id);
Expand Down
4 changes: 2 additions & 2 deletions application/views/customers/form.php
Expand Up @@ -64,7 +64,7 @@
</div>
</div>
</div>

<?php if($this->config->item('customer_reward_enable') == TRUE): ?>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('rewards_package'), 'rewards', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-8'>
Expand All @@ -84,7 +84,7 @@
);?>
</div>
</div>

<?php endif; ?>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('customers_taxable'), 'taxable', array('class' => 'control-label col-xs-3')); ?>
<div class='col-xs-1'>
Expand Down
2 changes: 2 additions & 0 deletions application/views/sales/register.php
Expand Up @@ -290,6 +290,7 @@
<th style='width: 55%;'><?php echo $this->lang->line("sales_customer_discount"); ?></th>
<th style="width: 45%; text-align: right;"><?php echo $customer_discount_percent . ' %'; ?></th>
</tr>
<?php if($this->config->item('customer_reward_enable') == TRUE): ?>
<?php
if(!empty($customer_rewards) && isset($customer_rewards))
{
Expand All @@ -305,6 +306,7 @@
<?php
}
?>
<?php endif; ?>
<tr>
<th style='width: 55%;'><?php echo $this->lang->line("sales_customer_total"); ?></th>
<th style="width: 45%; text-align: right;"><?php echo to_currency($customer_total); ?></th>
Expand Down

0 comments on commit 74681e7

Please sign in to comment.