Bewital Hook-Anpassung

This commit is contained in:
2026-02-06 13:17:23 +01:00
parent e11a2f2590
commit 3b18084dac

View File

@@ -89,11 +89,33 @@ class Hook {
} }
@Entrypoint( entrypoint = 'hook_validate_update_entry_10' )
public int hookValidateUpdateEntry10( D3Interface d3, User user, DocumentType docType, Document doc, String nextcall ){
d3.log.info("START | hookValidateUpdateEntry10 ");
validateValues(d3, docType, doc);
d3.log.info("ENDE | hookValidateUpdateEntry10 ");
return 0;
}
@Entrypoint( entrypoint = "hook_insert_entry_10" ) @Entrypoint( entrypoint = "hook_insert_entry_10" )
public int hookInsertEntry10(D3Interface d3, User user, DocumentType docType, Document doc) public int hookInsertEntry10(D3Interface d3, User user, DocumentType docType, Document doc)
{ {
d3.log.info("START | hookInsertEntry10 "); d3.log.info("START | hookInsertEntry10 ");
validateValues(d3, docType, doc);
def dokuart_liste = "DIE01;DIE02;DIE03;DIE04;DIE05;DIE06;DIE07;DIE08;DNV01;DNV02;DNV03;DNV04;DNV05;DNV06;DNV07;DNV08;DFE01;DFE02;DFE03;DQM01";
if ( dokuart_liste.contains( docType.id() ) )
{
doc.status = Document.DocStatus.DOC_STAT_RELEASE;
}
d3.log.info("ENDE | hookInsertEntry10 ");
return 0;
}
public void validateValues(D3Interface d3, DocumentType docType, Document doc){
//////////////////////////////////////// ////////////////////////////////////////
// Validierung Kundennummer calb/d.velop 2025.12.08 START // Validierung Kundennummer calb/d.velop 2025.12.08 START
@@ -108,19 +130,19 @@ class Hook {
// Kundennummer // Kundennummer
if ( werte[ 0 ].length() > 0 ) if ( werte[ 0 ].length() > 0 )
{ {
doc.field[ 2 ] = werte[ 0 ]; doc.field[ 2 ] = werte[ 0 ].trim();
} }
// Kundenname // Kundenname
if ( werte[ 1 ].length() > 0 ) if ( werte[ 1 ].length() > 0 )
{ {
doc.field[ 1 ] = werte[ 1 ]; doc.field[ 1 ] = werte[ 1 ].trim();
} }
// Land // Land
if ( werte[ 2 ].length() > 0 ) if ( werte[ 2 ].length() > 0 )
{ {
doc.field[ 4 ] = werte[ 2 ]; doc.field[ 4 ] = werte[ 2 ].trim();
} }
} }
} }
@@ -143,13 +165,13 @@ class Hook {
// Artikelnummer // Artikelnummer
if ( werte[ 0 ].length() > 0 ) if ( werte[ 0 ].length() > 0 )
{ {
doc.field[ 12 ] = werte[ 0 ]; doc.field[ 12 ] = werte[ 0 ].trim();
} }
// Artikelname // Artikelname
if ( werte[ 1 ].length() > 0 ) if ( werte[ 1 ].length() > 0 )
{ {
doc.field[ 13 ] = werte[ 1 ]; doc.field[ 13 ] = werte[ 1 ].trim();
} }
} }
@@ -170,16 +192,16 @@ class Hook {
{ {
def werte = doc.field[ 15 ].tokenize( "|" ); def werte = doc.field[ 15 ].tokenize( "|" );
// Artikelnummer // Mandant
if ( werte[ 0 ].length() > 0 ) if ( werte[ 0 ].length() > 0 )
{ {
doc.field[ 15 ] = werte[ 0 ]; doc.field[ 15 ] = werte[ 0 ].trim();
} }
// Artikelname // Mandantenname
if ( werte[ 1 ].length() > 0 ) if ( werte[ 1 ].length() > 0 )
{ {
doc.field[ 19 ] = werte[ 1 ]; doc.field[ 19 ] = werte[ 1 ].trim();
} }
} }
@@ -203,13 +225,13 @@ class Hook {
// Artikelnummer // Artikelnummer
if ( werte[ 0 ].length() > 0 ) if ( werte[ 0 ].length() > 0 )
{ {
doc.field[ 32 ] = werte[ 0 ]; doc.field[ 32 ] = werte[ 0 ].trim();
} }
// Artikelname // Artikelname
if ( werte[ 1 ].length() > 0 ) if ( werte[ 1 ].length() > 0 )
{ {
doc.field[ 35 ] = werte[ 1 ]; doc.field[ 35 ] = werte[ 1 ].trim();
} }
} }
} }
@@ -217,19 +239,8 @@ class Hook {
// Validierung Vertreter ENDE // Validierung Vertreter ENDE
//////////////////////////////////////// ////////////////////////////////////////
d3.log.info("ENDE | hookInsertEntry10 ");
return 0;
} }
private boolean isRepoIdInDocType( D3Interface d3, String docTypeShort, int repoId ) private boolean isRepoIdInDocType( D3Interface d3, String docTypeShort, int repoId )
{ {
boolean isRepoIdInDocType = false; boolean isRepoIdInDocType = false;