memberNumber as partnerNumber+memberNumberSuffix #13
@ -77,16 +77,16 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
|
||||
|
||||
public String getDebitorNumberString() {
|
||||
// TODO: refactor
|
||||
if (partner.getDebitorNumberPrefix() == null ) {
|
||||
if (partner.getPartnerNumber() == null ) {
|
||||
if (debitorNumberSuffix == null) {
|
||||
return null;
|
||||
}
|
||||
return String.format("%02d", debitorNumberSuffix);
|
||||
}
|
||||
if (debitorNumberSuffix == null) {
|
||||
return partner.getDebitorNumberPrefix() + "??";
|
||||
return partner.getPartnerNumber() + "??";
|
||||
}
|
||||
return partner.getDebitorNumberPrefix() + String.format("%02d", debitorNumberSuffix);
|
||||
return partner.getPartnerNumber() + String.format("%02d", debitorNumberSuffix);
|
||||
}
|
||||
|
||||
public Integer getDebitorNumber() {
|
||||
|
@ -13,10 +13,10 @@ public interface HsOfficeDebitorRepository extends Repository<HsOfficeDebitorEnt
|
||||
|
||||
@Query("""
|
||||
SELECT debitor FROM HsOfficeDebitorEntity debitor
|
||||
WHERE cast(debitor.partner.debitorNumberPrefix as integer) = :debitorNumberPrefix
|
||||
WHERE cast(debitor.partner.partnerNumber as integer) = :partnerNumber
|
||||
AND cast(debitor.debitorNumberSuffix as integer) = :debitorNumberSuffix
|
||||
""")
|
||||
List<HsOfficeDebitorEntity> findDebitorByDebitorNumber(int debitorNumberPrefix, byte debitorNumberSuffix);
|
||||
List<HsOfficeDebitorEntity> findDebitorByDebitorNumber(int partnerNumber, byte debitorNumberSuffix);
|
||||
|
||||
default List<HsOfficeDebitorEntity> findDebitorByDebitorNumber(int debitorNumber) {
|
||||
return findDebitorByDebitorNumber( debitorNumber/100, (byte) (debitorNumber%100));
|
||||
|
@ -36,8 +36,8 @@ public class HsOfficePartnerEntity implements Stringifyable, HasUuid {
|
||||
@GeneratedValue
|
||||
private UUID uuid;
|
||||
|
||||
@Column(name = "debitornumberprefix", columnDefinition = "numeric(5) not null")
|
||||
private Integer debitorNumberPrefix;
|
||||
@Column(name = "partnernumber", columnDefinition = "numeric(5) not null")
|
||||
private Integer partnerNumber;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "personuuid", nullable = false)
|
||||
|
@ -9,7 +9,7 @@ components:
|
||||
uuid:
|
||||
type: string
|
||||
format: uuid
|
||||
debitorNumberPrefix:
|
||||
partnerNumber:
|
||||
type: integer
|
||||
format: int8
|
||||
minimum: 10000
|
||||
@ -91,7 +91,7 @@ components:
|
||||
HsOfficePartnerInsert:
|
||||
type: object
|
||||
properties:
|
||||
debitorNumberPrefix:
|
||||
partnerNumber:
|
||||
type: integer
|
||||
format: int8
|
||||
minimum: 10000
|
||||
@ -105,7 +105,7 @@ components:
|
||||
details:
|
||||
$ref: '#/components/schemas/HsOfficePartnerDetailsInsert'
|
||||
required:
|
||||
- debitorNumberPrefix
|
||||
- partnerNumber
|
||||
- personUuid
|
||||
- contactUuid
|
||||
- details
|
||||
|
@ -32,7 +32,7 @@ call create_journal('hs_office_partner_details');
|
||||
create table hs_office_partner
|
||||
(
|
||||
uuid uuid unique references RbacObject (uuid) initially deferred,
|
||||
debitorNumberPrefix varchar(5),
|
||||
partnerNumber varchar(5),
|
||||
personUuid uuid not null references hs_office_person(uuid),
|
||||
contactUuid uuid not null references hs_office_contact(uuid),
|
||||
detailsUuid uuid not null references hs_office_partner_details(uuid) on delete cascade
|
||||
|
@ -165,8 +165,8 @@ execute procedure hsOfficePartnerRbacRolesTrigger();
|
||||
--changeset hs-office-partner-rbac-IDENTITY-VIEW:1 endDelimiter:--//
|
||||
-- ----------------------------------------------------------------------------
|
||||
call generateRbacIdentityView('hs_office_partner', $idName$
|
||||
-- TODO: simplify by using just debitorNumberPrefix for the essential part
|
||||
debitorNumberPrefix || ':' ||
|
||||
-- TODO: simplify by using just partnerNumber for the essential part
|
||||
partnerNumber || ':' ||
|
||||
(select idName from hs_office_person_iv p where p.uuid = target.personuuid)
|
||||
|| '-' ||
|
||||
(select idName from hs_office_contact_iv c where c.uuid = target.contactuuid)
|
||||
@ -180,7 +180,7 @@ call generateRbacIdentityView('hs_office_partner', $idName$
|
||||
call generateRbacRestrictedView('hs_office_partner',
|
||||
'(select idName from hs_office_person_iv p where p.uuid = target.personUuid)',
|
||||
$updates$
|
||||
hsh-michaelhoennig marked this conversation as resolved
Outdated
|
||||
debitorNumberPrefix = new.debitorNumberPrefix,
|
||||
partnerNumber = new.partnerNumber,
|
||||
personUuid = new.personUuid,
|
||||
contactUuid = new.contactUuid
|
||||
$updates$);
|
||||
|
@ -9,7 +9,7 @@
|
||||
Creates a single partner test record.
|
||||
*/
|
||||
create or replace procedure createHsOfficePartnerTestData(
|
||||
debitorNumberPrefix numeric(5),
|
||||
partnerNumber numeric(5),
|
||||
personTradeOrFamilyName varchar,
|
||||
contactLabel varchar )
|
||||
language plpgsql as $$
|
||||
@ -54,8 +54,8 @@ begin
|
||||
end if;
|
||||
|
||||
insert
|
||||
into hs_office_partner (uuid, debitorNumberPrefix, personuuid, contactuuid, detailsUuid)
|
||||
values (uuid_generate_v4(), debitorNumberPrefix, relatedPerson.uuid, relatedContact.uuid, relatedDetailsUuid);
|
||||
into hs_office_partner (uuid, partnerNumber, personuuid, contactuuid, detailsUuid)
|
||||
values (uuid_generate_v4(), partnerNumber, relatedPerson.uuid, relatedContact.uuid, relatedDetailsUuid);
|
||||
end; $$;
|
||||
--//
|
||||
|
||||
|
@ -173,7 +173,7 @@ execute procedure hsOfficeDebitorRbacRolesTrigger();
|
||||
-- ----------------------------------------------------------------------------
|
||||
call generateRbacIdentityView('hs_office_debitor', $idName$
|
||||
'#' ||
|
||||
(select debitornumberprefix from hs_office_partner p where p.uuid = target.partnerUuid) ||
|
||||
(select partnerNumber from hs_office_partner p where p.uuid = target.partnerUuid) ||
|
||||
to_char(debitorNumberSuffix, 'fm00') ||
|
||||
':' || (select split_part(idName, ':', 2) from hs_office_partner_iv pi where pi.uuid = target.partnerUuid)
|
||||
$idName$);
|
||||
|
@ -21,7 +21,7 @@ class HsOfficeDebitorEntityUnitTest {
|
||||
.tradeName("some trade name")
|
||||
.build())
|
||||
.details(HsOfficePartnerDetailsEntity.builder().birthName("some birth name").build())
|
||||
.debitorNumberPrefix(12345)
|
||||
.partnerNumber(12345)
|
||||
.build())
|
||||
.billingContact(HsOfficeContactEntity.builder().label("some label").build())
|
||||
.defaultPrefix("som")
|
||||
@ -39,7 +39,7 @@ class HsOfficeDebitorEntityUnitTest {
|
||||
.partner(HsOfficePartnerEntity.builder()
|
||||
.person(null)
|
||||
.details(HsOfficePartnerDetailsEntity.builder().birthName("some birth name").build())
|
||||
.debitorNumberPrefix(12345)
|
||||
.partnerNumber(12345)
|
||||
.build())
|
||||
.billingContact(HsOfficeContactEntity.builder().label("some label").build())
|
||||
.build();
|
||||
@ -53,7 +53,7 @@ class HsOfficeDebitorEntityUnitTest {
|
||||
void toShortStringContainsDebitorNumber() {
|
||||
final var given = HsOfficeDebitorEntity.builder()
|
||||
.partner(HsOfficePartnerEntity.builder()
|
||||
.debitorNumberPrefix(12345)
|
||||
.partnerNumber(12345)
|
||||
.build())
|
||||
.debitorNumberSuffix((byte)67)
|
||||
.build();
|
||||
|
@ -551,7 +551,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
final var person = HsOfficePersonEntity.builder().build();
|
||||
|
||||
final var partner = HsOfficePartnerEntity.builder()
|
||||
.debitorNumberPrefix(rec.getInteger("member_id"))
|
||||
.partnerNumber(rec.getInteger("member_id"))
|
||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||
.contact(null) // is set during contacts import depending on assigned roles
|
||||
.person(person)
|
||||
|
@ -125,7 +125,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"debitorNumberPrefix": "12345",
|
||||
"partnerNumber": "12345",
|
||||
"contactUuid": "%s",
|
||||
"personUuid": "%s",
|
||||
"details": {
|
||||
@ -167,7 +167,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"debitorNumberPrefix": "12345",
|
||||
"partnerNumber": "12345",
|
||||
"contactUuid": "%s",
|
||||
"personUuid": "%s",
|
||||
"details": {}
|
||||
@ -195,7 +195,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"debitorNumberPrefix": "12345",
|
||||
"partnerNumber": "12345",
|
||||
"contactUuid": "%s",
|
||||
"personUuid": "%s",
|
||||
"details": {}
|
||||
|
@ -105,7 +105,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth contact").get(0);
|
||||
final var newPartner = toCleanup(HsOfficePartnerEntity.builder()
|
||||
.debitorNumberPrefix(22222)
|
||||
.partnerNumber(22222)
|
||||
.person(givenPerson)
|
||||
.contact(givenContact)
|
||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||
@ -396,13 +396,13 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
}
|
||||
|
||||
private HsOfficePartnerEntity givenSomeTemporaryPartnerBessler(
|
||||
final Integer debitorNumberPrefix, final String person, final String contact) {
|
||||
final Integer partnerNumber, final String person, final String contact) {
|
||||
return jpaAttempt.transacted(() -> {
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike(person).get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike(contact).get(0);
|
||||
final var newPartner = HsOfficePartnerEntity.builder()
|
||||
.debitorNumberPrefix(debitorNumberPrefix)
|
||||
.partnerNumber(partnerNumber)
|
||||
.person(givenPerson)
|
||||
.contact(givenContact)
|
||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||
|
@ -12,7 +12,7 @@ public class TestHsOfficePartner {
|
||||
|
||||
static public HsOfficePartnerEntity hsOfficePartnerWithLegalPerson(final String tradeName) {
|
||||
return HsOfficePartnerEntity.builder()
|
||||
.debitorNumberPrefix(10001)
|
||||
.partnerNumber(10001)
|
||||
.person(HsOfficePersonEntity.builder()
|
||||
.personType(LEGAL)
|
||||
.tradeName(tradeName)
|
||||
|
Loading…
Reference in New Issue
Block a user
entfernen, nicht sinnvoll