1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Merge fixes

This commit is contained in:
Hillel Coren 2017-11-02 10:54:19 +02:00
parent a1e13ff7e1
commit fa95821375
6 changed files with 13 additions and 10 deletions

View File

@ -281,11 +281,13 @@ class WePayPaymentDriver extends BasePaymentDriver
'checkout_id' => intval($objectId), 'checkout_id' => intval($objectId),
]); ]);
/*
if ($checkout->state == 'refunded') { if ($checkout->state == 'refunded') {
$payment->recordRefund(); $payment->recordRefund();
} elseif (! empty($checkout->refund) && ! empty($checkout->refund->amount_refunded) && ($checkout->refund->amount_refunded - $payment->refunded) > 0) { } elseif (! empty($checkout->refund) && ! empty($checkout->refund->amount_refunded) && ($checkout->refund->amount_refunded - $payment->refunded) > 0) {
$payment->recordRefund($checkout->refund->amount_refunded - $payment->refunded); $payment->recordRefund($checkout->refund->amount_refunded - $payment->refunded);
} }
*/
if ($checkout->state == 'captured') { if ($checkout->state == 'captured') {
$payment->markComplete(); $payment->markComplete();

View File

@ -647,7 +647,8 @@ class ImportService
private function getCsvData($fileName) private function getCsvData($fileName)
{ {
$this->checkForFile($fileName); $this->checkForFile($fileName);
$data = array_map('str_getcsv', file($fileName)); $file = file_get_contents($fileName);
$data = array_map("str_getcsv", preg_split('/\r*\n+|\r+/', $file));
if (count($data) > 0) { if (count($data) > 0) {
$headers = $data[0]; $headers = $data[0];
@ -809,8 +810,10 @@ class ImportService
continue; continue;
} }
if (isset($data[$index])) {
$obj->$field = $data[$index]; $obj->$field = $data[$index];
} }
}
return $obj; return $obj;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -687,7 +687,7 @@ function calculateAmounts(invoice) {
// sum line item // sum line item
for (var i=0; i<invoice.invoice_items.length; i++) { for (var i=0; i<invoice.invoice_items.length; i++) {
var item = invoice.invoice_items[i]; var item = invoice.invoice_items[i];
var lineTotal = invoice.is_statement ? roundToTwo(NINJA.parseFloat(item.balance)) : roundSignificant(NINJA.parseFloat(item.cost)) * roundSignificant(NINJA.parseFloat(item.qty)); var lineTotal = invoice.is_statement ? roundToTwo(NINJA.parseFloat(item.balance)) : roundSignificant(NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty));
lineTotal = roundToTwo(lineTotal); lineTotal = roundToTwo(lineTotal);
if (lineTotal) { if (lineTotal) {
total += lineTotal; total += lineTotal;
@ -740,7 +740,7 @@ function calculateAmounts(invoice) {
} }
// calculate line item tax // calculate line item tax
var lineTotal = roundToFour(NINJA.parseFloat(item.cost)) * roundToFour(NINJA.parseFloat(item.qty)); var lineTotal = roundSignificant(NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty));
if (invoice.discount != 0) { if (invoice.discount != 0) {
if (parseInt(invoice.is_amount_discount)) { if (parseInt(invoice.is_amount_discount)) {
lineTotal -= roundToTwo((lineTotal/total) * invoice.discount); lineTotal -= roundToTwo((lineTotal/total) * invoice.discount);

View File

@ -870,9 +870,7 @@ function ItemModel(data) {
this.totals = ko.observable(); this.totals = ko.observable();
this.totals.rawTotal = ko.computed(function() { this.totals.rawTotal = ko.computed(function() {
var cost = roundSignificant(NINJA.parseFloat(self.cost())); var value = roundSignificant(NINJA.parseFloat(self.cost()) * NINJA.parseFloat(self.qty()));
var qty = roundSignificant(NINJA.parseFloat(self.qty()));
var value = cost * qty;
return value ? roundToTwo(value) : 0; return value ? roundToTwo(value) : 0;
}); });