Skip to content

Commit 3a0ee2d

Browse files
committed
bugfix: address listener
1 parent d159051 commit 3a0ee2d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
- [X] Company Cost Report
8888
- [X] Mini Accounting untuk Mencatat Pengeluaran Perusahaan untuk Gaji
8989
- [ ] PPH21
90+
- [ ] Change address default listener to doctrine listener to avoid double listener
9091
- [ ] Perubahan Tax Group dan Risk Ratio
9192
- [ ] Prevent Remove Mutation When Job History is Exist
9293
- [ ] Prevent Remove Placement When Job History is Exist

src/Repository/AddressRepositoryTrait.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use KejawenLab\Application\SemartHris\Component\Address\Model\Addressable;
88
use KejawenLab\Application\SemartHris\Component\Address\Model\AddressInterface;
99
use KejawenLab\Application\SemartHris\Util\StringUtil;
10+
use KejawenLab\Application\SemartHris\Util\UuidUtil;
1011

1112
/**
1213
* @author Muhamad Surya Iksanudin <[email protected]>
@@ -23,7 +24,9 @@ public function unsetDefaultExcept(AddressInterface $address): void
2324
$queryBuilder->from($this->getAddressClass(), 'o');
2425
$queryBuilder->update();
2526
$queryBuilder->set('o.defaultAddress', $queryBuilder->expr()->literal(false));
26-
$queryBuilder->andWhere($queryBuilder->expr()->neq('o.id', $queryBuilder->expr()->literal($address->getId())));
27+
if ($address->getId() && UuidUtil::isValid($address->getId())) {
28+
$queryBuilder->andWhere($queryBuilder->expr()->neq('o.id', $queryBuilder->expr()->literal($address->getId())));
29+
}
2730

2831
$queryBuilder->getQuery()->execute();
2932
}

0 commit comments

Comments
 (0)