mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-02-09 12:58:42 +00:00
test fixes and changes for release
This commit is contained in:
parent
b8146997a4
commit
a8303e28b8
|
|
@ -683,7 +683,7 @@
|
|||
"name": "billing_bill_subscription_pattern_numberofoccurrences",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
"billing_bill_responsible": {
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ class Bill implements \JsonSerializable
|
|||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private int $reference = 0;
|
||||
public int $reference = 0;
|
||||
|
||||
/**
|
||||
* Media files
|
||||
|
|
@ -452,7 +452,7 @@ class Bill implements \JsonSerializable
|
|||
*/
|
||||
public function buildNumber() : void
|
||||
{
|
||||
$this->number = \str_replace(
|
||||
$this->number = \str_replace(
|
||||
[
|
||||
'{y}',
|
||||
'{m}',
|
||||
|
|
@ -465,7 +465,7 @@ class Bill implements \JsonSerializable
|
|||
$this->createdAt->format('m'),
|
||||
$this->createdAt->format('d'),
|
||||
$this->id,
|
||||
\is_int($this->type) ? $this->type : $this->type->getId(),
|
||||
$this->type->getId(),
|
||||
],
|
||||
$this->numberFormat
|
||||
);
|
||||
|
|
@ -680,6 +680,10 @@ class Bill implements \JsonSerializable
|
|||
*/
|
||||
public function getMediaByType(int $type = null) : array
|
||||
{
|
||||
if ($type === null) {
|
||||
return $this->media;
|
||||
}
|
||||
|
||||
$files = [];
|
||||
foreach ($this->media as $file) {
|
||||
if ($file->type !== null && $file->type->getId() === $type) {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->andWhere(self::TABLE . '.billing_bill_performance_date', '>=', $start)
|
||||
->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return new Money((int) $result[0]);
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->andWhere(self::TABLE . '.billing_bill_performance_date', '>=', $start)
|
||||
->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return new Money((int) $result[0]);
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->andWhere(self::TABLE . '.billing_bill_performance_date', '>=', $start)
|
||||
->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return new Money($result === false || $result[1] == 0 ? 0 : (int) (((int) $result[0]) / ((int) $result[1])));
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->orderBy('billing_bill_id', 'DESC')
|
||||
->limit(1)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return $result === false ? null : new \DateTimeImmutable($result[0]);
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->orderBy('billing_bill_id', 'DESC')
|
||||
->limit(1)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return $result === false ? null : new \DateTimeImmutable($result[0]);
|
||||
}
|
||||
|
|
@ -195,6 +195,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->where(BillElementMapper::TABLE . '_d1.billing_bill_element_item', '=', $id)
|
||||
->limit($limit);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (!empty(self::CREATED_AT)) {
|
||||
$query->orderBy(self::TABLE . '_d1.' . self::COLUMNS[self::CREATED_AT]['name'], 'DESC');
|
||||
} else {
|
||||
|
|
@ -213,6 +214,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
$query->where(self::TABLE . '_d1.billing_bill_supplier', '=', $id)
|
||||
->limit($limit);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (!empty(self::CREATED_AT)) {
|
||||
$query->orderBy(self::TABLE . '_d1.' . self::COLUMNS[self::CREATED_AT]['name'], 'DESC');
|
||||
} else {
|
||||
|
|
@ -264,9 +266,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end)
|
||||
->groupBy(CountryMapper::TABLE . '.country_region')
|
||||
->execute()
|
||||
->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
?->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
|
||||
return $result;
|
||||
return $result ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -289,9 +291,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->orderBy('net_purchase', 'DESC')
|
||||
->limit($limit)
|
||||
->execute()
|
||||
->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
?->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
|
||||
return $result;
|
||||
return $result ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -312,9 +314,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->groupBy('year', 'month')
|
||||
->orderBy(['year', 'month'], ['ASC', 'ASC'])
|
||||
->execute()
|
||||
->fetchAll();
|
||||
?->fetchAll();
|
||||
|
||||
return $result;
|
||||
return $result ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -333,8 +335,8 @@ final class PurchaseBillMapper extends BillMapper
|
|||
->groupBy('year', 'month')
|
||||
->orderBy(['year', 'month'], ['ASC', 'ASC'])
|
||||
->execute()
|
||||
->fetchAll();
|
||||
?->fetchAll();
|
||||
|
||||
return $result;
|
||||
return $result ?? [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ final class SalesBillMapper extends BillMapper
|
|||
->andWhere(self::TABLE . '.billing_bill_performance_date', '>=', $start)
|
||||
->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return new Money((int) $result[0]);
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ final class SalesBillMapper extends BillMapper
|
|||
->andWhere(self::TABLE . '.billing_bill_performance_date', '>=', $start)
|
||||
->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return new Money((int) $result[0]);
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ final class SalesBillMapper extends BillMapper
|
|||
->andWhere(self::TABLE . '.billing_bill_performance_date', '>=', $start)
|
||||
->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return new Money($result === false || $result[1] == 0 ? 0 : (int) (((int) $result[0]) / ((int) $result[1])));
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ final class SalesBillMapper extends BillMapper
|
|||
->orderBy('billing_bill_id', 'DESC')
|
||||
->limit(1)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return $result === false ? null : new \DateTimeImmutable($result[0]);
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ final class SalesBillMapper extends BillMapper
|
|||
->orderBy('billing_bill_id', 'DESC')
|
||||
->limit(1)
|
||||
->execute()
|
||||
->fetch();
|
||||
?->fetch();
|
||||
|
||||
return $result === false ? null : new \DateTimeImmutable($result[0]);
|
||||
}
|
||||
|
|
@ -195,6 +195,7 @@ final class SalesBillMapper extends BillMapper
|
|||
->where(BillElementMapper::TABLE . '_d1.billing_bill_element_item', '=', $id)
|
||||
->limit($limit);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (!empty(self::CREATED_AT)) {
|
||||
$query->orderBy(self::TABLE . '_d1.' . self::COLUMNS[self::CREATED_AT]['name'], 'DESC');
|
||||
} else {
|
||||
|
|
@ -213,6 +214,7 @@ final class SalesBillMapper extends BillMapper
|
|||
$query->where(self::TABLE . '_d1.billing_bill_client', '=', $id)
|
||||
->limit($limit);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (!empty(self::CREATED_AT)) {
|
||||
$query->orderBy(self::TABLE . '_d1.' . self::COLUMNS[self::CREATED_AT]['name'], 'DESC');
|
||||
} else {
|
||||
|
|
@ -258,6 +260,7 @@ final class SalesBillMapper extends BillMapper
|
|||
->where(BillElementMapper::TABLE . '_d1.billing_bill_element_item', '=', $id)
|
||||
->limit($limit = 10);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (!empty(self::CREATED_AT)) {
|
||||
$query->orderBy(self::TABLE . '_d1.' . self::COLUMNS[self::CREATED_AT]['name'], 'DESC');
|
||||
} else {
|
||||
|
|
@ -278,6 +281,7 @@ final class SalesBillMapper extends BillMapper
|
|||
->where(self::TABLE . '_d1.billing_bill_client', '=', $client)
|
||||
->limit($limit = 10);
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (!empty(self::CREATED_AT)) {
|
||||
$query->orderBy(self::TABLE . '_d1.' . self::COLUMNS[self::CREATED_AT]['name'], 'DESC');
|
||||
} else {
|
||||
|
|
@ -305,9 +309,9 @@ final class SalesBillMapper extends BillMapper
|
|||
->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end)
|
||||
->groupBy(CountryMapper::TABLE . '.country_region')
|
||||
->execute()
|
||||
->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
?->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
|
||||
return $result;
|
||||
return $result ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -330,9 +334,9 @@ final class SalesBillMapper extends BillMapper
|
|||
->orderBy('net_sales', 'DESC')
|
||||
->limit($limit)
|
||||
->execute()
|
||||
->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
?->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
|
||||
return $result;
|
||||
return $result ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -354,9 +358,9 @@ final class SalesBillMapper extends BillMapper
|
|||
->groupBy('year', 'month')
|
||||
->orderBy(['year', 'month'], ['ASC', 'ASC'])
|
||||
->execute()
|
||||
->fetchAll();
|
||||
?->fetchAll();
|
||||
|
||||
return $result;
|
||||
return $result ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -376,8 +380,8 @@ final class SalesBillMapper extends BillMapper
|
|||
->groupBy('year', 'month')
|
||||
->orderBy(['year', 'month'], ['ASC', 'ASC'])
|
||||
->execute()
|
||||
->fetchAll();
|
||||
?->fetchAll();
|
||||
|
||||
return $result;
|
||||
return $result ?? [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,6 +257,25 @@ $CONFIG = [
|
|||
'root' => '/',
|
||||
'https' => false,
|
||||
],
|
||||
'app' => [
|
||||
'path' => __DIR__,
|
||||
'default' => [
|
||||
'app' => 'Backend',
|
||||
'id' => 'backend',
|
||||
'lang' => 'en',
|
||||
'theme' => 'Backend',
|
||||
'org' => 1,
|
||||
],
|
||||
'domains' => [
|
||||
'127.0.0.1' => [
|
||||
'app' => 'Backend',
|
||||
'id' => 'backend',
|
||||
'lang' => 'en',
|
||||
'theme' => 'Backend',
|
||||
'org' => 1,
|
||||
],
|
||||
],
|
||||
],
|
||||
'socket' => [
|
||||
'master' => [
|
||||
'host' => '127.0.0.1',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user