...
Pour l’affiche des données liées dans “sw_data_final_suppliercategory“, il faut donc au minimum également ajouter les deux scripts de définition de cette table.
Script de définition : FINAL_WebhookDefinition_final_suppliercategory :
Bloc de code | ||
---|---|---|
| ||
// FINAL_WebhookDefinition_final_suppliercategory // Webhook definition tableName = "final_suppliercategory" specificOverload = CALL_SCRIPT( "FINAL_WebhookDefinitionOverload_<varscript>tableName</varscript>" ) tableSchema = DB_GET_TABLEINFO( "sw_data_<varscript>tableName</varscript>" ) tableSchemaDocument = DOCUMENT_CREATE_FROM_JSON( tableSchema ) languageCode = VARGET_SHELL( "languageCode", "WebhookDefinition" ) authorizedTables = TRANSLATE( "[{'tableName':'<varscript>tableName</varscript>'}]" ) JSONFieldsDefinition = TRANSLATE( " { 'languageCode': '<varscript>languageCode</varscript>', 'strictFilterMode': 1, 'relatedTablesCount': 0, 'relatedTables': [ ], 'authorizedTables': <varscript>authorizedTables</varscript>, 'simpleFieldsList': 'CodeSupplier,label', 'extendedFieldsListToExclude': '', 'defaultFilters': [ ], 'strictFilters': [ ], 'strictOrderBy': [ ], 'outOfMainTableFields': [ ], 'standardOverload': { }, 'specificOverload': <varscript>specificOverload</varscript>, 'simpleFields': [], 'extendedFields': [], 'strictFilterFields': [], 'defaultFilterFields': [], 'strictOrderByFields': [] } " ) INCLUDE( "FuncWebhook_BuildDefinition" ) |
Script de surcharge de définition : FINAL_WebhookDefinitionOverload_final_suppliercategory :
Bloc de code | ||
---|---|---|
| ||
// FINAL_WebhookDefinitionOverload_suppliercategory languageCode = VARGET_SHELL( "languageCode", "WebhookDefinition" ) specificOverload = TRANSLATE( " { 'extendedFieldsListToExclude': '', 'fieldsList': { }, strictFilters: [ ], 'strictOrderBy': [ ], 'outOfMainTableFields': [ ] } " ) RETURN( "<varscript>specificOverload</varscript>" ) |
...
Compléter webhook existant
Sur le webhook “Intervention” pour la méthode PUT, je veux également mettre à jour des données concernant les opérations.
Ceci va concerner les tables “sw_data_interventionoperationrange“ et “sw_data_interventionoperationtype“.
Script de définition : FINAL_WebhookDefinition_interventionoperationrangeFINAL_WebhookDefinition_interventionoperationtype WebhookDefinition_intervention
Le script de définition “WebhookDefinition_intervention“ existe déjà en standard. Donc on y touche pas.
Script de surcharge de définition : WebhookDefinitionOverload_intervention
Le script de surcharge de définition “WebhookDefinitionOverload_intervention“ est déjà prévu en standard. Il suffit donc de surcharger ce script.
On reprend la propriété “authorizedTables“ du standard, complétée avec les 2 nouvelles tables.
Bloc de code | ||
---|---|---|
| ||
// WebhookDefinitionOverload_intervention
languageCode = VARGET_SHELL( "languageCode", "WebhookDefinition" )
specificOverload = TRANSLATE( "
{
'extendedFieldsListToExclude': '',
'authorizedTables': [{'tableName':'intervention'}, {'tableName':'interventionequipment'}, {'tableName':'interventionpart'}, {'tableName':'interventionoperationrange'}, {'tableName':'interventionoperationtype'}],
'fieldsList': {
},
strictFilters: [
],
'strictOrderBy': [
],
'outOfMainTableFields': [
]
}
" )
RETURN( "<varscript>specificOverload</varscript>" ) |
Complément :
Il faut au minimum créer les scripts de définition pour “interventionoperationrange“ et “interventionoperationtype“ vu qu’ils n’existent pas en standard.
Script de définition : FINAL_WebhookDefinition_interventionoperationrange
Bloc de code | ||
---|---|---|
| ||
// FINAL_WebhookDefinition_interventionoperationrange
tableName = "interventionoperationrange"
specificOverload = CALL_SCRIPT( "FINAL_WebhookDefinitionOverload_<varscript>tableName</varscript>" )
tableSchema = DB_GET_TABLEINFO( "sw_data_<varscript>tableName</varscript>" )
tableSchemaDocument = DOCUMENT_CREATE_FROM_JSON( tableSchema )
languageCode = VARGET_SHELL( "languageCode", "WebhookDefinition" )
authorizedTables = TRANSLATE( "[{'tableName':'<varscript>tableName</varscript>'}]" )
JSONFieldsDefinition = TRANSLATE( "
{
'languageCode': '<varscript>languageCode</varscript>',
'strictFilterMode': 1,
'relatedTablesCount': 0,
'relatedTables': [ ],
'authorizedTables': <varscript>authorizedTables</varscript>,
'simpleFieldsList': '',
'extendedFieldsListToExclude': '',
'defaultFilters': [
],
'strictFilters': [
],
'strictOrderBy': [
],
'outOfMainTableFields': [
],
'standardOverload': {
},
'specificOverload':
<varscript>specificOverload</varscript>,
'simpleFields': [],
'extendedFields': [],
'strictFilterFields': [],
'defaultFilterFields': [],
'strictOrderByFields': []
}
" )
INCLUDE( "FuncWebhook_BuildDefinition" ) |
Script de surcharge de définition : FINAL_WebhookDefinitionOverload_interventionoperationrange
Bloc de code | ||
---|---|---|
| ||
// FINAL_WebhookDefinitionOverload_interventionoperationrange
languageCode = VARGET_SHELL( "languageCode", "WebhookDefinition" )
specificOverload = TRANSLATE( "
{
'extendedFieldsListToExclude': '',
'fieldsList': {
},
strictFilters: [
],
'strictOrderBy': [
],
'outOfMainTableFields': [
]
}
" )
RETURN( "<varscript>specificOverload</varscript>" ) |
Script de définition : FINAL_WebhookDefinition_interventionoperationtype
Bloc de code | ||
---|---|---|
| ||
// FINAL_WebhookDefinition_interventionoperationtype
tableName = "interventionoperationtype"
specificOverload = CALL_SCRIPT( "FINAL_WebhookDefinitionOverload_<varscript>tableName</varscript>" )
tableSchema = DB_GET_TABLEINFO( "sw_data_<varscript>tableName</varscript>" )
tableSchemaDocument = DOCUMENT_CREATE_FROM_JSON( tableSchema )
languageCode = VARGET_SHELL( "languageCode", "WebhookDefinition" )
authorizedTables = TRANSLATE( "[{'tableName':'<varscript>tableName</varscript>'}]" )
JSONFieldsDefinition = TRANSLATE( "
{
'languageCode': '<varscript>languageCode</varscript>',
'strictFilterMode': 1,
'relatedTablesCount': 0,
'relatedTables': [ ],
'authorizedTables': <varscript>authorizedTables</varscript>,
'simpleFieldsList': '',
'extendedFieldsListToExclude': '',
'defaultFilters': [
],
'strictFilters': [
],
'strictOrderBy': [
],
'outOfMainTableFields': [
],
'standardOverload': {
},
'specificOverload':
<varscript>specificOverload</varscript>,
'simpleFields': [],
'extendedFields': [],
'strictFilterFields': [],
'defaultFilterFields': [],
'strictOrderByFields': []
}
" )
INCLUDE( "FuncWebhook_BuildDefinition" ) |
Script de surcharge de définition : FINAL_WebhookDefinitionOverload_interventionoperationtype
Bloc de code | ||
---|---|---|
| ||
// FINAL_WebhookDefinitionOverload_interventionoperationtype
languageCode = VARGET_SHELL( "languageCode", "WebhookDefinition" )
specificOverload = TRANSLATE( "
{
'extendedFieldsListToExclude': '',
'fieldsList': {
},
strictFilters: [
],
'strictOrderBy': [
],
'outOfMainTableFields': [
]
}
" )
RETURN( "<varscript>specificOverload</varscript>" ) |