mirror of
https://github.com/Karaka-Management/oms-ClientManagement.git
synced 2026-01-11 15:28:41 +00:00
fix billing process
This commit is contained in:
parent
dd6f194beb
commit
d6b13086b3
14
.github/user_bug_report.md
vendored
14
.github/user_bug_report.md
vendored
|
|
@ -8,9 +8,11 @@ assignees: ''
|
|||
---
|
||||
|
||||
# Bug Description
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
# How to Reproduce
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
|
|
@ -19,16 +21,20 @@ Steps to reproduce the behavior:
|
|||
4. See error
|
||||
|
||||
# Expected Behavior
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
# Screenshots
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
# System Information
|
||||
- System: [e.g. PC or iPhone11, ...]
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- KarakaVersion [e.g. 22]
|
||||
|
||||
- System: [e.g. PC or iPhone11, ...]
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- KarakaVersion [e.g. 22]
|
||||
|
||||
# Additional Information
|
||||
|
||||
Add any other context about the problem here.
|
||||
|
|
|
|||
|
|
@ -65,6 +65,21 @@ use phpOMS\Utils\StringUtils;
|
|||
*/
|
||||
final class ApiController extends Controller
|
||||
{
|
||||
public function findClientForAccount(int $account, int $unit = null) : ?Client
|
||||
{
|
||||
$clientMapper = ClientMapper::get()
|
||||
->where('account', $account);
|
||||
|
||||
if (!empty($unit)) {
|
||||
$clientMapper->where('unit', $unit);
|
||||
}
|
||||
|
||||
/** @var \Modules\ClientManagement\Models\Client $client */
|
||||
$client = $clientMapper->execute();
|
||||
|
||||
return $client instanceof NullAccount ? null : $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create news article
|
||||
*
|
||||
|
|
@ -224,8 +239,8 @@ final class ApiController extends Controller
|
|||
private function validateClientCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['number'] = empty($request->getData('number')))
|
||||
|| ($val['account'] = empty($request->getData('name1')) && empty($request->getData('account')))
|
||||
if (($val['number'] = !$request->hasData('number'))
|
||||
|| ($val['account'] = !$request->hasData('name1') && !$request->hasData('account'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -297,7 +312,7 @@ final class ApiController extends Controller
|
|||
private function validateMainAddressUpdate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['client'] = (empty($request->getData('client') && empty($request->getData('account')))))
|
||||
if (($val['client'] = (!$request->hasData('client') && !$request->hasData('account')))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -308,9 +323,8 @@ final class ApiController extends Controller
|
|||
/**
|
||||
* Method to update an account from a request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param Address $address Address
|
||||
* @param bool $allowPassword Allow to change password
|
||||
* @param RequestAbstract $request Request
|
||||
* @param Address $address Address
|
||||
*
|
||||
* @return Address
|
||||
*
|
||||
|
|
@ -321,8 +335,8 @@ final class ApiController extends Controller
|
|||
$address->address = $request->getDataString('address') ?? $address->address;
|
||||
$address->postal = $request->getDataString('postal') ?? $address->postal;
|
||||
$address->city = $request->getDataString('city') ?? $address->city;
|
||||
$address->state = $request->getDataString('state') ?? $address->state;
|
||||
$address->setCountry($request->getDataString('country') ?? $address->getCountry());
|
||||
$address->state = $request->getDataString('state') ?? $address->state;
|
||||
|
||||
return $address;
|
||||
}
|
||||
|
|
@ -388,9 +402,9 @@ final class ApiController extends Controller
|
|||
private function validateClientL11nCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['client'] = empty($request->getData('client')))
|
||||
|| ($val['type'] = empty($request->getData('type')))
|
||||
|| ($val['description'] = empty($request->getData('description')))
|
||||
if (($val['client'] = !$request->hasData('client'))
|
||||
|| ($val['type'] = !$request->hasData('type'))
|
||||
|| ($val['description'] = !$request->hasData('description'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -455,7 +469,7 @@ final class ApiController extends Controller
|
|||
private function validateClientL11nTypeCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = empty($request->getData('title')))) {
|
||||
if (($val['title'] = !$request->hasData('title'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
|
@ -530,9 +544,9 @@ final class ApiController extends Controller
|
|||
private function validateClientAttributeCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['type'] = empty($request->getData('type')))
|
||||
|| ($val['value'] = (empty($request->getData('value')) && empty($request->getData('custom'))))
|
||||
|| ($val['client'] = empty($request->getData('client')))
|
||||
if (($val['type'] = !$request->hasData('type'))
|
||||
|| ($val['value'] = (!$request->hasData('value') && !$request->hasData('custom')))
|
||||
|| ($val['client'] = !$request->hasData('client'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -600,8 +614,8 @@ final class ApiController extends Controller
|
|||
private function validateClientAttributeTypeL11nCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = empty($request->getData('title')))
|
||||
|| ($val['type'] = empty($request->getData('type')))
|
||||
if (($val['title'] = !$request->hasData('title'))
|
||||
|| ($val['type'] = !$request->hasData('type'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -671,8 +685,8 @@ final class ApiController extends Controller
|
|||
private function validateClientAttributeTypeCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = empty($request->getData('title')))
|
||||
|| ($val['name'] = empty($request->getData('name')))
|
||||
if (($val['title'] = !$request->hasData('title'))
|
||||
|| ($val['name'] = !$request->hasData('name'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -756,8 +770,8 @@ final class ApiController extends Controller
|
|||
private function validateClientAttributeValueCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['type'] = empty($request->getData('type')))
|
||||
|| ($val['value'] = empty($request->getData('value')))
|
||||
if (($val['type'] = !$request->hasData('type'))
|
||||
|| ($val['value'] = !$request->hasData('value'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -825,8 +839,8 @@ final class ApiController extends Controller
|
|||
private function validateClientAttributeValueL11nCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = empty($request->getData('title')))
|
||||
|| ($val['value'] = empty($request->getData('value')))
|
||||
if (($val['title'] = !$request->hasData('title'))
|
||||
|| ($val['value'] = !$request->hasData('value'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class Client
|
|||
{
|
||||
foreach ($this->attributes as $attribute) {
|
||||
if ($attribute->type->name === $attrName) {
|
||||
return $attribute->value;
|
||||
return $attribute;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= $values['month'] . '/' . \substr((string) $values['year'], -2); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
|
|
@ -327,7 +327,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= (string) $values['year']; ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
@ -1329,7 +1329,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= $values['month'] . '/' . \substr((string) $values['year'], -2); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
|
|
@ -1449,7 +1449,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= (string) $values['year']; ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
@ -2394,7 +2394,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= $values['month'] . '/' . \substr((string) $values['year'], -2); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
|
|
@ -2514,7 +2514,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= (string) $values['year']; ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
@ -3476,7 +3476,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= $values['month'] . '/' . \substr((string) $values['year'], -2); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
|
|
@ -3599,7 +3599,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= (string) $values['year']; ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
|
|
@ -4306,7 +4306,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= $values['month'] . '/' . \substr((string) $values['year'], -2); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
|
|
@ -4428,7 +4428,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
<tr>
|
||||
<td><?= (string) $values['year']; ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
|
||||
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<td><?= ((int) $values['customers']); ?>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$permission = new AccountPermission();
|
||||
$permission->setUnit(1);
|
||||
$permission->setApp('backend');
|
||||
$permission->setApp(2);
|
||||
$permission->setPermission(
|
||||
PermissionType::READ
|
||||
| PermissionType::CREATE
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user