import com.dvelop.d3.server.Document import com.dvelop.d3.server.Entrypoint import com.dvelop.d3.server.User import com.dvelop.d3.server.core.D3Interface import com.dvelop.d3.server.DocumentTypeAttribute; import com.dvelop.d3.server.DocumentType; import com.dvelop.d3.server.RepositoryField; class Hook { @Entrypoint( entrypoint = "hook_insert_entry_10" ) public int hookInsertEntry10(D3Interface d3, User user, DocumentType docType, Document doc) { d3.log.info("START | hookInsertEntry10 "); //////////////////////////////////////////////////// // Validierung Personalnummer mit Mitarbeiternamen calb @ d.velop 2025.12.12 START String Namensvalidierung = "DPERS|APERS|APREG"; if ( Namensvalidierung.contains( docType.id() ) ) { if ( doc.field[ 1 ] ) { if ( doc.field[ 1 ].indexOf( "|" ) > 0 ) { def werte = doc.field[ 1 ].tokenize( " | " ); if ( werte[ 0 ].length() > 0 ) { doc.field[ 1 ] = werte[ 0 ]; } if ( werte[ 1 ].length() > 0 ) { doc.field[ 3 ] = werte[ 1 ]; } if ( werte[ 2 ].length() > 0 ) { doc.field[ 2 ] = werte[ 2 ]; } } } } d3.log.info( "Validierung Personalnummer / Mitarbeiternamen erfolgt."); // Validierung Personalnummer mit Mitarbeiternamen calb @ d.velop 2025.12.12 ENDE //////////////////////////////////////////////////// //////////////////////////////////////////////////// // Validierung Register / Dokumenttyp calb @ d.velop 2025.12.12 START String Registervalidierung = "DPERS"; if ( Registervalidierung.contains( docType.id() ) ) { if ( doc.field[ 16 ] ) { def sqlQuery = "select distinct dok_dat_feld_20 from firmen_spezifisch where kue_dokuart = 'AADM' and dok_dat_feld_21 = '" + doc.field[ 16 ] + "' "; def resultrows = d3.sql.executeAndGet( sqlQuery ); if ( resultrows.size() > 0 ) { doc.field[ 15 ] = resultrows[ 0 ].dok_dat_feld_20; } } } d3.log.info( "Validierung Register / Dokumenttyp erfolgt."); // Validierung Register / Dokumenttyp calb @ d.velop 2025.12.12 ENDE //////////////////////////////////////////////////// d3.log.info("ENDE | hookInsertEntry10 "); return 0; } }