mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-02-02 09:48:41 +00:00
fix tests
This commit is contained in:
parent
3c987e4b9c
commit
7089904e59
|
|
@ -18,9 +18,10 @@ use phpOMS\Localization\ISO3166TwoEnum;
|
|||
use phpOMS\Localization\Money;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
require_once $this->getData('defaultTemplates')
|
||||
->findFile('.pdf.php')
|
||||
->getAbsolutePath();
|
||||
/** @var \Modules\Media\Models\Collection $media */
|
||||
$media = $this->getData('defaultTemplates');
|
||||
|
||||
require_once $media->findFile('.pdf.php')->getAbsolutePath();
|
||||
|
||||
/** @var \Modules\Billing\Models\Bill $bill */
|
||||
$bill = $this->data['bill'] ?? new NullBill();
|
||||
|
|
|
|||
|
|
@ -534,6 +534,7 @@ final class ApiBillController extends Controller
|
|||
|
||||
$path = $this->createBillDir($bill);
|
||||
|
||||
/** @var \Modules\Media\Models\Collection[] */
|
||||
$billCollection = CollectionMapper::getAll()
|
||||
->where('virtual', $path)
|
||||
->execute();
|
||||
|
|
@ -1060,7 +1061,7 @@ final class ApiBillController extends Controller
|
|||
|
||||
if ($client->getAttribute('bill_emails')->value->getValue() === 1) {
|
||||
$email = empty($tmp = $client->getAttribute('bill_email_address')->value->getValue())
|
||||
? $tmp
|
||||
? (string) $tmp
|
||||
: $client->account->getEmail();
|
||||
|
||||
$this->sendBillEmail($media, $email, $response->header->l11n->language);
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ final class ApiPriceController extends Controller
|
|||
// Find base price (@todo: probably not a good solution)
|
||||
$bestBasePrice = null;
|
||||
foreach ($prices as $price) {
|
||||
if ($price->price !== 0 && $price->priceNew === 0
|
||||
if ($price->price->value !== 0 && $price->priceNew === 0
|
||||
&& $price->item->id !== 0
|
||||
&& $price->itemgroup->id === 0
|
||||
&& $price->itemsegment->id === 0
|
||||
|
|
@ -165,7 +165,7 @@ final class ApiPriceController extends Controller
|
|||
&& $price->clientsection->id === 0
|
||||
&& $price->clienttype->id === 0
|
||||
&& $price->promocode === ''
|
||||
&& $price->price < ($bestBasePrice?->price ?? \PHP_INT_MAX)
|
||||
&& $price->price->value < ($bestBasePrice?->price->value ?? \PHP_INT_MAX)
|
||||
) {
|
||||
$bestBasePrice = $price;
|
||||
}
|
||||
|
|
@ -178,10 +178,10 @@ final class ApiPriceController extends Controller
|
|||
$bestPriceValue = \PHP_INT_MAX;
|
||||
|
||||
foreach ($prices as $price) {
|
||||
$newPrice = $bestBasePrice->price;
|
||||
$newPrice = $bestBasePrice->price->value;
|
||||
|
||||
if ($price->price < $newPrice) {
|
||||
$newPrice = $price->price;
|
||||
if ($price->price->value < $newPrice) {
|
||||
$newPrice = $price->price->value;
|
||||
}
|
||||
|
||||
if ($price->priceNew < $newPrice) {
|
||||
|
|
|
|||
|
|
@ -100,8 +100,11 @@ final class ApiPurchaseController extends Controller
|
|||
|
||||
/** @var \Modules\Media\Models\Media[] $uploaded */
|
||||
$uploaded = $mediaResponse->get('')['response']['upload'];
|
||||
$in = \reset($uploaded)->getAbsolutePath(); // pdf is parsed in $in->content
|
||||
if (empty($uploaded)) {
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
$in = \reset($uploaded)->getAbsolutePath(); // pdf parsed content is available in $in->content
|
||||
if (!\is_file($in)) {
|
||||
throw new \Exception();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,11 +277,20 @@ final class ApiTaxController extends Controller
|
|||
__DIR__ . '/../Admin/Install/Taxes'
|
||||
)
|
||||
) {
|
||||
$this->createInvalidUpdateResponse($request, $response, []);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$content = \file_get_contents($path);
|
||||
if ($content === false) {
|
||||
$this->createInvalidUpdateResponse($request, $response, []);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var array $combinations */
|
||||
$combinations = \json_decode(\file_get_contents($path), true);
|
||||
$combinations = \json_decode($content, true);
|
||||
|
||||
foreach ($combinations as $combination) {
|
||||
/** @var TaxCombination[] $old */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user