Merging fixes from develop

This commit is contained in:
Hillel Coren 2016-07-21 20:12:59 +03:00
parent c78bc88fd5
commit 70244ec12e
5 changed files with 19 additions and 14 deletions

View File

@ -67,8 +67,13 @@ class ChargeRenewalInvoices extends Command
foreach ($invoices as $invoice) { foreach ($invoices as $invoice) {
// check if account has switched to free since the invoice was created // check if account has switched to free since the invoice was created
$account = Account::find($invoice->client->public_id); $account = Account::find($invoice->client->public_id);
if ( ! $account) {
continue;
}
$company = $account->company; $company = $account->company;
if ( ! $company->plan || $company->plan == PLAN_FREE) { if ( ! $company->plan || $company->plan == PLAN_FREE) {
continue; continue;

View File

@ -202,7 +202,7 @@ class AccountGatewayController extends BaseController
$validator = Validator::make(Input::all(), $rules); $validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) { if ($validator->fails()) {
return Redirect::to('gateways/create') return Redirect::to('gateways/create?other_providers=' . ($gatewayId == GATEWAY_WEPAY ? 'false' : 'true'))
->withErrors($validator) ->withErrors($validator)
->withInput(); ->withInput();
} else { } else {

View File

@ -30545,12 +30545,12 @@ function calculateAmounts(invoice) {
invoice.has_product_key = true; invoice.has_product_key = true;
} }
if (item.tax_rate1 && parseFloat(item.tax_rate1)) { if (item.tax_name1) {
taxRate1 = parseFloat(item.tax_rate1); taxRate1 = parseFloat(item.tax_rate1);
taxName1 = item.tax_name1; taxName1 = item.tax_name1;
} }
if (item.tax_rate2 && parseFloat(item.tax_rate2)) { if (item.tax_name2) {
taxRate2 = parseFloat(item.tax_rate2); taxRate2 = parseFloat(item.tax_rate2);
taxName2 = item.tax_name2; taxName2 = item.tax_name2;
} }
@ -30566,7 +30566,7 @@ function calculateAmounts(invoice) {
} }
var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100); var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100);
if (taxAmount1) { if (taxName1) {
var key = taxName1 + taxRate1; var key = taxName1 + taxRate1;
if (taxes.hasOwnProperty(key)) { if (taxes.hasOwnProperty(key)) {
taxes[key].amount += taxAmount1; taxes[key].amount += taxAmount1;
@ -30576,7 +30576,7 @@ function calculateAmounts(invoice) {
} }
var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100); var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100);
if (taxAmount2) { if (taxName2) {
var key = taxName2 + taxRate2; var key = taxName2 + taxRate2;
if (taxes.hasOwnProperty(key)) { if (taxes.hasOwnProperty(key)) {
taxes[key].amount += taxAmount2; taxes[key].amount += taxAmount2;
@ -31542,11 +31542,11 @@ NINJA.subtotals = function(invoice, hideBalance)
} }
} }
if (invoice.tax_amount1) { if (invoice.tax_name1) {
var taxStr = invoice.tax_name1 + ' ' + (invoice.tax_rate1*1).toString() + '%'; var taxStr = invoice.tax_name1 + ' ' + (invoice.tax_rate1*1).toString() + '%';
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax1Label']}, {text: formatMoneyInvoice(invoice.tax_amount1, invoice), style: ['subtotals', 'tax1']}]); data.push([{text: taxStr, style: ['subtotalsLabel', 'tax1Label']}, {text: formatMoneyInvoice(invoice.tax_amount1, invoice), style: ['subtotals', 'tax1']}]);
} }
if (invoice.tax_amount2) { if (invoice.tax_name2) {
var taxStr = invoice.tax_name2 + ' ' + (invoice.tax_rate2*1).toString() + '%'; var taxStr = invoice.tax_name2 + ' ' + (invoice.tax_rate2*1).toString() + '%';
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax2Label']}, {text: formatMoneyInvoice(invoice.tax_amount2, invoice), style: ['subtotals', 'tax2']}]); data.push([{text: taxStr, style: ['subtotalsLabel', 'tax2Label']}, {text: formatMoneyInvoice(invoice.tax_amount2, invoice), style: ['subtotals', 'tax2']}]);
} }

View File

@ -502,11 +502,11 @@ NINJA.subtotals = function(invoice, hideBalance)
} }
} }
if (invoice.tax_amount1) { if (invoice.tax_name1) {
var taxStr = invoice.tax_name1 + ' ' + (invoice.tax_rate1*1).toString() + '%'; var taxStr = invoice.tax_name1 + ' ' + (invoice.tax_rate1*1).toString() + '%';
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax1Label']}, {text: formatMoneyInvoice(invoice.tax_amount1, invoice), style: ['subtotals', 'tax1']}]); data.push([{text: taxStr, style: ['subtotalsLabel', 'tax1Label']}, {text: formatMoneyInvoice(invoice.tax_amount1, invoice), style: ['subtotals', 'tax1']}]);
} }
if (invoice.tax_amount2) { if (invoice.tax_name2) {
var taxStr = invoice.tax_name2 + ' ' + (invoice.tax_rate2*1).toString() + '%'; var taxStr = invoice.tax_name2 + ' ' + (invoice.tax_rate2*1).toString() + '%';
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax2Label']}, {text: formatMoneyInvoice(invoice.tax_amount2, invoice), style: ['subtotals', 'tax2']}]); data.push([{text: taxStr, style: ['subtotalsLabel', 'tax2Label']}, {text: formatMoneyInvoice(invoice.tax_amount2, invoice), style: ['subtotals', 'tax2']}]);
} }

View File

@ -651,12 +651,12 @@ function calculateAmounts(invoice) {
invoice.has_product_key = true; invoice.has_product_key = true;
} }
if (item.tax_rate1 && parseFloat(item.tax_rate1)) { if (item.tax_name1) {
taxRate1 = parseFloat(item.tax_rate1); taxRate1 = parseFloat(item.tax_rate1);
taxName1 = item.tax_name1; taxName1 = item.tax_name1;
} }
if (item.tax_rate2 && parseFloat(item.tax_rate2)) { if (item.tax_name2) {
taxRate2 = parseFloat(item.tax_rate2); taxRate2 = parseFloat(item.tax_rate2);
taxName2 = item.tax_name2; taxName2 = item.tax_name2;
} }
@ -672,7 +672,7 @@ function calculateAmounts(invoice) {
} }
var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100); var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100);
if (taxAmount1) { if (taxName1) {
var key = taxName1 + taxRate1; var key = taxName1 + taxRate1;
if (taxes.hasOwnProperty(key)) { if (taxes.hasOwnProperty(key)) {
taxes[key].amount += taxAmount1; taxes[key].amount += taxAmount1;
@ -682,7 +682,7 @@ function calculateAmounts(invoice) {
} }
var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100); var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100);
if (taxAmount2) { if (taxName2) {
var key = taxName2 + taxRate2; var key = taxName2 + taxRate2;
if (taxes.hasOwnProperty(key)) { if (taxes.hasOwnProperty(key)) {
taxes[key].amount += taxAmount2; taxes[key].amount += taxAmount2;