Commit 34bfa692 authored by Karamel's avatar Karamel
Browse files

Fix importing customer's balances from v7.

parent e150d87c
......@@ -506,7 +506,6 @@ if ($stmt->execute()) {
$customer->setMaxDebt($row['MAXDEBT']);
$debt = ($row['CURDEBT']===null)?0.0:$row['CURDEBT'];
$prepaid = $row['PREPAID'];
$customer->setBalance($prepaid - $debt);
$customer->setFirstName(($row['FIRSTNAME']===null)?'':$row['FIRSTNAME']);
$customer->setLastName(($row['LASTNAME']===null)?'':$row['LASTNAME']);
$customer->setEmail(($row['EMAIL']===null)?'':$row['EMAIL']);
......@@ -532,6 +531,10 @@ if ($stmt->execute()) {
$customer->setTax($taxMapping[$row['TAXCATEGORY']]);
}
$api->write($customer);
$balance = $prepaid - $debt;
if ($balance > 0.005 || $balance < -0.005) {
$api->setBalance($customer->getId(), $balance);
}
}
} else {
$err = $stmt->errorInfo();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment