fix: bugs bashing

- Added English translations for customer types in `customer.json`.
- Updated `Model.ts` to improve deletion logic by filtering dependent relations.
- Introduced `BillPaymentBillSyncSubscriber` to handle bill payment events.
- Enhanced `CreateBillPaymentService` and `EditBillPaymentService` to fetch entries after insertion/updating.
- Updated `SaleInvoiceCostGLEntries` to include item entry details in GL entries.
- Refactored various components in the webapp for consistency in naming conventions.
This commit is contained in:
Ahmed Bouhuolia
2026-01-04 01:24:10 +02:00
parent 987ad992a4
commit 0475ce136a
14 changed files with 167 additions and 32 deletions

View File

@@ -48,14 +48,30 @@ export class PaginationQueryBuilder<
// No relations defined
return this.delete();
}
// Only check HasManyRelation and ManyToManyRelation relations, as BelongsToOneRelation are just
// foreign key references and shouldn't prevent deletion. Only dependent records should block deletion.
const dependentRelationNames = relationNames.filter((name) => {
const relation = relationMappings[name];
return relation && (
relation.relation === Model.HasManyRelation ||
relation.relation === Model.ManyToManyRelation
);
});
if (dependentRelationNames.length === 0) {
// No dependent relations defined, safe to delete
return this.delete();
}
const recordQuery = this.clone();
relationNames.forEach((relationName: string) => {
dependentRelationNames.forEach((relationName: string) => {
recordQuery.withGraphFetched(relationName);
});
const record = await recordQuery;
const hasRelations = relationNames.some((name) => {
const hasRelations = dependentRelationNames.some((name) => {
const val = record[name];
return Array.isArray(val) ? val.length > 0 : val != null;
});