Umstellung auf constantValues
This commit is contained in:
@@ -28,30 +28,24 @@ import org.apache.http.impl.client.HttpClientBuilder
|
||||
import org.apache.http.util.EntityUtils
|
||||
import groovy.json.JsonSlurper
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import constantValues;
|
||||
|
||||
public class D3Hooks
|
||||
{
|
||||
@Entrypoint( entrypoint = "hook_insert_exit_20" )
|
||||
public int insertExit_20( D3Interface d3, Document doc, String fileDestination, int importOk, User user, DocumentType docType )
|
||||
{
|
||||
def repo_id = "2e0f1447-d775-51aa-8593-0e0a5d9662aa";
|
||||
def baseUri = "https://d3ecm.rau.rau-pforzheim.de";
|
||||
def authUsr = "Zyu0W+L0fb6HF0sxPRyPdETFQFBCTOBLb1KcZfli2Sfeepce3TAmYQ22Qq1upRpNAsZou2njb9rkV4c0MRzMdwhPMwEcQCgDWo/VDxsOLkk=&_z_A0V5ayCQR0EAw9MiR-iA1MQAZsBKD5iT_eZeqUR-mqT2T-xMwoBzOA2BvbwjxQEXwJoiuAEGbrxTzJRFYMTVwhHGjwW-p";
|
||||
|
||||
//xlog( d3, 2, "repo_id " + repo_id );
|
||||
//xlog( d3, 2, "baseUri " + baseUri );
|
||||
//xlog( d3, 2, "authUsr " + authUsr );
|
||||
|
||||
def empfaenger = [];
|
||||
|
||||
def username = getUserIdpId( d3, "D3-User", repo_id, baseUri, authUsr );
|
||||
def username = getUserIdpId( d3, "D3-User", constantValues.repo_id, constantValues.baseUri, constantValues.authUsr );
|
||||
|
||||
//xlog( d3, 2, "username " + username );
|
||||
xlog( d3, 2, "username " + username );
|
||||
|
||||
|
||||
empfaenger.push( username );
|
||||
|
||||
def e = createTask( d3, user, docType, doc, "Neues Dokument", "Es wurde ein neues Dokument importiert: " + doc.id, empfaenger, baseUri, authUsr, repo_id );
|
||||
def e = createTask( d3, user, docType, doc, "Neues Dokument", "Es wurde ein neues Dokument importiert: " + doc.id, empfaenger, constantValues.baseUri, constantValues.authUsr, constantValues.repo_id );
|
||||
|
||||
|
||||
return 0;
|
||||
@@ -60,10 +54,16 @@ public class D3Hooks
|
||||
@Entrypoint( entrypoint = "hook_validate_import_entry_10" )
|
||||
public int hook_validate_import_entry_10( D3Interface d3, User user, DocumentType docType, Document doc, String nextcall )
|
||||
{
|
||||
doc.setStatus( "Freigabe" );
|
||||
d3.log.error( "START hook_validate_import_entry_10 " );
|
||||
|
||||
|
||||
if ( isRepoIdInDocType( d3, docType.id, 51 ) ) // Kundenstammdaten
|
||||
if ( doc.getStatus() != "DOC_STAT_RELEASE" )
|
||||
{
|
||||
doc.setStatus( "Freigabe" );
|
||||
}
|
||||
|
||||
|
||||
if ( isRepoIdInDocType( d3, docType.id, constantValues.GeschPNrId ) ) // Kundenstammdaten
|
||||
{
|
||||
if ( doc.field[ 6 ] )
|
||||
{
|
||||
@@ -144,11 +144,11 @@ public class D3Hooks
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// eingefügt von CALB/d.velop AG / 2024.06.12 / Setzen des Mandanten bei SAP-Dokumenten (Mandant = 200)
|
||||
// eingefügt von CALB/d.velop AG / 2024.06.12 / Setzen des Mandanten bei SAP-Dokumenten (Mandant = 240)
|
||||
|
||||
if ( ( isRepoIdInDocType( d3, docType.id, 48 ) ) && ( isRepoIdInDocType( d3, docType.id, 1 ) ) ) // Mandant / Buchungskreis ist in der Dokumentart enthalten
|
||||
if ( ( isRepoIdInDocType( d3, docType.id, constantValues.MandantId ) ) && ( isRepoIdInDocType( d3, docType.id, constantValues.BuKrsId ) ) ) // Mandant / Buchungskreis ist in der Dokumentart enthalten
|
||||
{
|
||||
if ( doc.field[ 39 ] == "200" )
|
||||
if ( doc.field[ 39 ] == "240" )
|
||||
{
|
||||
if ( doc.field[ 1 ] )
|
||||
{
|
||||
@@ -158,9 +158,9 @@ public class D3Hooks
|
||||
}
|
||||
else
|
||||
{
|
||||
def sqlQuery = "SELECT mandant_name FROM [D3ServiceT].[dbo].[dv_mandant] where mandant_nr = '" + doc.field[ 1 ] + "'";
|
||||
def sqlQuery = "SELECT mandant_name FROM [" + constantValues.DatabaseName + "].[dbo].[dv_mandant] where mandant_nr = '" + doc.field[ 1 ] + "'";
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def resultRows = sql.rows( sqlQuery );
|
||||
|
||||
@@ -171,10 +171,11 @@ public class D3Hooks
|
||||
}
|
||||
}
|
||||
|
||||
// Einfügung Ende / Setzen des Mandanten bei SAP-Dokumenten (Mandant = 200)
|
||||
// Einfügung Ende / Setzen des Mandanten bei SAP-Dokumenten (Mandant = 240)
|
||||
///////////////////////////
|
||||
|
||||
if ( isRepoIdInDocType( d3, docType.id, 31 ) ) // Materialstammdaten, ID 31 => Materialnummer
|
||||
|
||||
if ( isRepoIdInDocType( d3, docType.id, constantValues.MatNrId ) ) // Materialstammdaten, ID 31 => Materialnummer
|
||||
{
|
||||
for ( int i = 1; i <= Integer.valueOf( d3.config.value( "CUR_60ER_FIELD_NR" ) ); i++ )
|
||||
{
|
||||
@@ -258,9 +259,9 @@ public class D3Hooks
|
||||
// Buchungskreis gefüllt, Firma aber nicht, d.h. offenbar ein Beleg aus SAP (=> da wird nur der Buchungskreis angegeben)
|
||||
// Firma wird aus Stammdaten gefüllt
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def row = sql.firstRow( "SELECT mandant_name FROM [D3ServiceT].[dbo].[dv_mandant] where mandant_nr = '" + doc.field[ 1 ] + "'" );
|
||||
def row = sql.firstRow( "SELECT mandant_name FROM [" + constantValues.DatabaseName + "].[dbo].[dv_mandant] where mandant_nr = '" + doc.field[ 1 ] + "'" );
|
||||
|
||||
if ( row )
|
||||
{
|
||||
@@ -317,6 +318,7 @@ public class D3Hooks
|
||||
// temporäres Objekt holen, um zu prüfen, das sich Eigenschaften geändert haben
|
||||
def oldDocAttributes = d3.archive.getDocument(doc.id());
|
||||
|
||||
|
||||
def ergebnis = hook_validate_update_entry_10( d3, user, docTypeNew, doc, "" );
|
||||
|
||||
d3.log.error("ENDE | hookUpdAttribEntry20")
|
||||
@@ -371,7 +373,7 @@ public class D3Hooks
|
||||
d3.log.info("ENDE | hookInsertEntry10 ");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public String getUserIdpId( D3Interface d3, String UserName, String repo_id, String baseUri, String authUserApiKey )
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user