-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoicePro_Customer_BasicData.xml
More file actions
649 lines (612 loc) · 39.3 KB
/
Copy pathInvoicePro_Customer_BasicData.xml
File metadata and controls
649 lines (612 loc) · 39.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
<?xml version="1.0" encoding="UTF-8"?>
<!--Version 2.3 of the Customer Basic Data Configuration File -->
<erpConnector>
<sections>
<section name="PerformInterface">
</section>
<section name="TestPreImport">
</section>
<!--
Permet créer d'alimenter la table EXT_INV_LIST_7 avec les utilisateurs qui sont dans un groupe d'utilisateurs
dont le role est "Approver"
Attention : si le droit est descendant, toutes les organisations sont importées
-> Scheduled Task "Load Custom Data 7 (Header)"
History:
2019-03-27 CDE Création du code
-->
<section name="PreInvList7">
<section name="jumpInitialize" jumpToXmlFile="{F,COMBINE(v,CustomerConfigurationDir;"InvoicePro_Customer_Initialize.xml")}" jumpToXPath="//section[@name='Initialize']" />
<clearTable>data</clearTable>
<clearTable>filelist2</clearTable>
<variable name="interface_temp">InvList7</variable>
<variable name="PATH">{F,DBSELECT("Select PATH from EXT_IF_BASICDATA where INTERFACE =?";v,providerconnection;v,interface_temp)}</variable>
<variable name="TimeStamp">{F,NOW(),"yyyyMMddHHmmss"}</variable>
<variable name="PATH">{v,PATH}</variable>
<variable name="IF_DATA_ROOT_DIR">{v,PATH}</variable>
<variable name="RootID">{F,DBSELECT("SELECT ORGANIZATION_ELEMENT_ID FROM ADM_STRUCTURE_ITEM ";v,providerconnection)}</variable>
<onError onErrorJumpToXPath="//section[@name='errorHandler_Main']" resume="false">
<section name="ReadFile">
<variable name="RoleApprobateur">%Approver%</variable>
<method name="GetData">
<builtInMethodParameterList name="bw_db_functions" driver="provider">
<parameter name="connectionstring" log="False">{v,connstr}</parameter>
<parameter name="dataprovider">{v,dataprovider}</parameter>
<parameter name="assemblyname">{v,assemblyname}</parameter>
<parameter name="prefix">{v,BoundVariableChar}</parameter>
<parameter name="parameter1">{v,RoleApprobateur}</parameter>
<parameter name="tablename">data</parameter>
<parameter name="command">
SELECT
oc.organization_element_id AS ORG_ID
,oc.code AS ORG_CODE
,ud.login_account AS LOGIN_ACCOUNT
,ud.FULLNAME AS FULLNAME
FROM ADM_USER_GROUP_ROLE ugr
INNER JOIN ADM_ORGANIZATION_ELEMENT oe
ON ugr.ORGANIZATION_ELEMENT_ID = oe.ID
INNER JOIN ADM_ORGANIZATION_CHILD_LIST oc
ON oc.PARENT_ID = oe.ID
AND oc.TYPE = 1
INNER JOIN ADM_USER_GROUP_MEMBER ugm
ON ugr.USER_GROUP_ID = ugm.USER_GROUP_ID
INNER JOIN ADM_USER_DATA ud
ON ud.ID = ugm.USER_DATA_ID
WHERE ugr.USER_ROLE_ID IN (
SELECT ID FROM ADM_USER_ROLE ur
WHERE ur.USER_ROLE_NAME like {v,BoundVariableChar}parameter1)
GROUP BY oc.organization_element_id, oc.code, ud.login_account, ud.FULLNAME
ORDER BY oc.code
</parameter>
</builtInMethodParameterList>
</method>
<transaction name="WriteDataTemp" include="{F,AND(F,IF(F,EXISTS(data);"=";1);F,IF(F,ROWCOUNT(data);>;0))}" ignoreErrors="False">
<section name="BuildInterfaceXML" include="true">
<output type="Basware.ErpConnector.OutputResource.XmlWriterOutputResource">
<parameter name="path">{v,IF_DATA_ROOT_DIR}InvList7.xml</parameter>
<parameter name="checkcharacters">true</parameter>
<parameter name="encoding">UTF-8</parameter>
<parameter name="indent">true</parameter>
<parameter name="newlinechar"></parameter>
<parameter name="omitxmldeclaration">false</parameter>
<outputCommands log="False">
<command type="startelement">DocumentElement</command>
<commandSection name="Item" loopDataSource="data">
<command type="startelement">Item</command>
<!-- Login -->
<command type="startelement">Text_1</command>
<command type="write">{data,LOGIN_ACCOUNT}</command>
<command type="endelement" />
<!-- Full name -->
<command type="startelement">Text_2</command>
<command type="write">{data,FULLNAME}</command>
<command type="endelement" />
<!-- Nothing -->
<command type="startelement">Text_3</command>
<command type="write">{c,""}</command>
<command type="endelement" />
<!-- Company -->
<command type="startelement">Company</command>
<command type="write">{data,ORG_CODE}</command>
<command type="endelement" />
<command type="endelement" />
</commandSection>
<command type="endelement" />
</outputCommands>
</output>
</section>
</transaction>
<removeTable>data</removeTable>
</section>
</onError>
</section>
<!--
Allows to create and fill the table ADM_ACCOUNT
-> Scheduled Task "Load Accounts"
History:
2019-03-29 HPE Code initialization
-->
<section name="PreGLAccount">
<method name="GetAccountFiles">
<builtInMethodParameterList name="bw_file_functions">
<parameter name="command">dir</parameter>
<parameter name="filename">{v,SYS_InBoundDirectory}\BW_GLAccounts*</parameter> <!-- CSV file name and path upload in Inbound Directory -->
<return name="accountlist_temp">
<filter/>
<sort />
</return>
</builtInMethodParameterList>
</method>
<section name="ActionIfFileExist" include="{F,IF(F,ROWCOUNT(accountlist_temp);>;0)}">
<variable name="SourceInputFile">{accountlist_temp,name}</variable> <!-- Full Path of the csv file -->
<onError onErrorJumpToXPath="//section[@name='BasicDataErrorHandler']" resume="false">
<removeTable>CSVData</removeTable> <!-- Clear CSVData datasource -->
<section name="jumpToInitializeSourceData" jumpToXPath="//section[@name='InitializeCSVPreGLAccount']" />
<!-- Variable initialization -->
<section name="jumpToCaptureSourceData" jumpToXPath="//section[@name='CaptureCSVData']" />
<!-- Split CSV and fill CSVData datasource -->
<section name="jumpToGenerateTargetData" jumpToXPath="//section[@name='GenerateXMLDataGLAccount']" />
<!-- Generate XML format in a Datasource from a Datasource -->
<section name="jumpToBackupSourceFile" jumpToXPath="//section[@name='SourceDataBackupFile']" />
<!-- Create XML file backup -->
<removeTable>CSVData</removeTable> <!-- vider la table retour de données -->
</onError>
</section>
</section>
<section name="InitializeCSVPreGLAccount">
<variable name="TempFile">{v,SYS_InBoundDirectory}{c,"Accounts"}.xml</variable> <!-- XML output file name -->
<variable name="CSVFileColumnSeparator">,</variable> <!-- set the character that separates the data in the CSV file here -->
<variable name="CSVUseColumnNameHeaders">false</variable> <!-- Uses the values on the first line of CSV to define the column header names in AnyERP data source (skips 1st line when true) -->
<variable name="CSVSkipLines">1</variable> <!-- Skip the first x lines in CSV file? -->
<variable name="CSVTextDelimiterSwitch"></variable> <!-- OPTIONAL - Populate with none if your values are not surrounded by double quotes -->
</section>
<section name="CaptureCSVData">
<method name="CaptureCSVData">
<builtInMethodParameterList name="bw_textfile_input">
<!-- Split CSV and fill CSVData datasource -->
<parameter name="filename">{v,SYS_InBoundDirectory}{v,SourceInputFile}</parameter>
<parameter name="colseparator">{v,CSVFileColumnSeparator}</parameter>
<parameter name="colnameheader">{v,CSVUseColumnNameHeaders}</parameter>
<parameter name="textdelimiter">{v,CSVTextDelimiterSwitch}</parameter>
<parameter name="skiplines">{v,CSVSkipLines}</parameter>
<return name="CSVData">
<filter />
<sort />
</return>
</builtInMethodParameterList>
</method>
</section>
<section name="GenerateXMLDataGLAccount" include="{F,IF(F,ROWCOUNT(CSVData);>;0)}">
<!-- XML file generation if datasource is not empty -->
<output type="BasWare.ErpConnector.OutputResource.XmlOutputResource">
<parameter name="path">{v,TempFile}</parameter>
<parameter name="append">true</parameter>
<!-- "DocumentElement" node -->
<outputCommands>
<command type="node:DocumentElement"/>
</outputCommands>
<outputCommands loopDataSource="CSVData" log="True">
<!-- Loop on CSVData datasource to create XML file -->
<command type="node:Item" include="{CSVData,F1}" attribute="//DocumentElement"/>
<command type="node:Company" include="{CSVData,F1}" attribute="//DocumentElement/Item[last()]">{CSVData,F4}</command>
<command type="node:Text_1" include="{CSVData,F1}" attribute="//DocumentElement/Item[last()]">{CSVData,F3}</command>
<command type="node:Text_2" include="{CSVData,F1}" attribute="//DocumentElement/Item[last()]">en-US:{CSVData,F2}/en-US</command>
<command type="node:TaxCode" include="{CSVData,F1}" attribute="//DocumentElement/Item[last()]"></command>
<command type="node:Inherit" include="{CSVData,F1}" attribute="//DocumentElement/Item[last()]">{F,LOWER(CSVData,F1)}</command>
</outputCommands>
</output>
</section>
<section name="SourceDataBackupFile"> <!-- Create XML file backup and move in into backup directory -->
<method name="BackupFiles">
<builtInMethodParameterList name="bw_file_functions">
<parameter name="command">rename</parameter>
<parameter name="filename">{v,SYS_InBoundDirectory}{v,SourceInputFile}</parameter>
<parameter name="newname">{v,PATH}\Backup\{v,SourceInputFile}.{F,NOW(),"yyyyMMddHHmmss"}.bak</parameter>
</builtInMethodParameterList>
</method>
</section>
<!--
Allows to create and fill the table ADM_SUPPLIERS
-> Scheduled Task "Load SUPPLIERS"
History:
2019-04-01 HPE Code initialization
-->
<section name="PreSuppliers">
<method name="GetSuppliersFiles">
<builtInMethodParameterList name="bw_file_functions">
<parameter name="command">dir</parameter>
<parameter name="filename">{v,SYS_InBoundDirectory}\BW_Suppliers*</parameter> <!-- CSV file name and path upload in Inbound Directory -->
<return name="list_temp">
<filter/>
<sort />
</return>
</builtInMethodParameterList>
</method>
<section name="ActionIfFileExist" include="{F,IF(F,ROWCOUNT(list_temp);>;0)}">
<variable name="SourceInputFile">{list_temp,name}</variable> <!-- Full Path of the csv file -->
<onError onErrorJumpToXPath="//section[@name='BasicDataErrorHandler']" resume="false">
<removeTable>CSVData</removeTable> <!-- Clear CSVData datasource -->
<section name="jumpToInitializeSourceData" jumpToXPath="//section[@name='InitializeCSVPreSuppliers']" />
<!-- Variable initialization -->
<section name="jumpToCaptureSourceData" jumpToXPath="//section[@name='CaptureCSVData']" />
<!-- Split CSV and fill CSVData datasource -->
<section name="jumpToGenerateTargetData" jumpToXPath="//section[@name='GenerateXMLDataSuppliers']" />
<!-- Generate XML format in a Datasource from a Datasource -->
<section name="jumpToBackupSourceFile" jumpToXPath="//section[@name='SourceDataBackupFile']" />
<!-- Create XML file backup -->
<removeTable>CSVData</removeTable> <!-- vider la table retour de données -->
</onError>
</section>
</section>
<section name="InitializeCSVPreSuppliers">
<variable name="TempFile">{v,SYS_InBoundDirectory}{c,"suppliers"}.xml</variable> <!-- XML output file name -->
<variable name="CSVFileColumnSeparator">,</variable> <!-- set the character that separates the data in the CSV file here -->
<variable name="CSVUseColumnNameHeaders">false</variable> <!-- Uses the values on the first line of CSV to define the column header names in AnyERP data source (skips 1st line when true) -->
<variable name="CSVSkipLines">1</variable> <!-- Skip the first x lines in CSV file? -->
<variable name="CSVTextDelimiterSwitch"></variable> <!-- OPTIONAL - Populate with none if your values are not surrounded by double quotes -->
</section>
<section name="GenerateXMLDataSuppliers" include="{F,IF(F,ROWCOUNT(CSVData);>;0)}">
<section name="WriteSupplierData" include="False"> <!-- Supplier XML creation with XMLoutput -too long to import -->
<!-- XML file generation if datasource is not empty -->
<output type="BasWare.ErpConnector.OutputResource.XmlOutputResource">
<parameter name="path">{v,TempFile}</parameter>
<parameter name="append">true</parameter>
<parameter name="omitutf8bom">False</parameter>
<!-- "DocumentElement" node -->
<outputCommands>
<command type="node:DocumentElement"/>
</outputCommands>
<outputCommands loopDataSource="CSVData" log="True">
<!-- Loop on CSVData datasource to create XML file -->
<command type="node:Supplier" attribute="//DocumentElement"/>
<command type="node:Company" attribute="//DocumentElement/Supplier[last()]">{CSVData,F23}</command>
<command type="node:Code" attribute="//DocumentElement/Supplier[last()]">{CSVData,F14}</command>
<command type="node:Name" attribute="//DocumentElement/Supplier[last()]">{CSVData,F16}</command>
<command type="node:PaymentDenied" attribute="//DocumentElement/Supplier[last()]">{F,EVAL(F,TONUMBER(CSVData,F11;".");=;1;"False";F,EVAL(F,TONUMBER(CSVData,F11;".");=;0;"True";"ERROR"))}</command>
<command type="node:PaymentTermCode" attribute="//DocumentElement/Supplier[last()]">{CSVData,F19}</command>
<command type="node:Currency" attribute="//DocumentElement/Supplier[last()]">{CSVData,F12}</command>
<command type="node:Active" attribute="//DocumentElement/Supplier[last()]">{CSVData,F2}</command>
<command type="node:Inherit" attribute="//DocumentElement/Supplier[last()]">{CSVData,F2}</command>
<command type="node:BankAccounts" attribute="//DocumentElement/Supplier[last()]"/>
<command type="node:SupplierIdentifiers" attribute="//DocumentElement/Supplier[last()]"/>
<command type="node:EmailAddresses" attribute="//DocumentElement/Supplier[last()]"/>
<command type="node:AdditionalDatas" attribute="//DocumentElement/Supplier[last()]"/>
<command type="node:SupplierAddresses" attribute="//DocumentElement/Supplier[last()]"/>
<command type="node:SupplierAddress" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]"/>
<command type="node:ExternalIdentifier" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]">{F,COMBINE(CSVData,F14;C,"Main")}</command>
<command type="node:Name" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]">{F,COMBINE(CSVData,F14;C,"Main")}</command>
<command type="node:AddressParts" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]"></command>
<!-- Address 1 -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">Address_1</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F3}</command>
<!-- Address 2 -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">Address_2</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F4}</command>
<!-- Address 3 -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">Address_3</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F5}</command>
<!-- Phone -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">Phone</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F6}</command>
<!-- Zip Code -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">Zip_Code</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F20}</command>
<!-- City -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">City</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F9}</command>
<!-- State -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">State</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F17}</command>
<!-- Country -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">Country</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F10}</command>
<!-- Attention to -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">Attention_to</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F7}</command>
<!-- Email -->
<command type="node:SupplierAddressPart" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]"></command>
<command type="node:AddressPartKey" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">Email</command>
<command type="node:AddressPartText" attribute="//DocumentElement/Supplier[last()]/SupplierAddresses[last()]/SupplierAddress[last()]/AddressParts[last()]/SupplierAddressPart[last()]">{CSVData,F13}</command>
</outputCommands>
</output>
</section>
<section name="WriteSupplierDataTxt" include="True"> <!-- Supplier XML creation with Textoutput -->
<output type="Basware.ErpConnector.OutputResource.TextOutputResource" log="{v,sys_objectdebug}">
<parameter name="path">{v,TempFile}</parameter>
<parameter name="append">False</parameter>
<parameter name="encoding">utf-8</parameter>
<outputCommands log="False">
<command><?xml version="1.0" encoding="UTF-8"?></command>
<command><DocumentElement></command>
</outputCommands>
</output>
<section name="WriteXMLData" loopDataSource="CSVData">
<output type="Basware.ErpConnector.OutputResource.TextOutputResource">
<parameter name="path">{v,TempFile}</parameter>
<parameter name="append">True</parameter>
<parameter name="encoding">utf-8</parameter>
<outputCommands log="False">
<command> <Supplier></command>
<command> <Company>{F,XMLENCODE(F,TRIM(CSVData,F23))}</Company></command>
<command> <Code>{F,XMLENCODE(F,TRIM(CSVData,F14))}</Code></command>
<command> <Name>{F,XMLENCODE(F,TRIM(CSVData,F16))}</Name></command>
<command> <PaymentTermCode>{F,XMLENCODE(F,REPLACE(CSVData,F19;" ";"_"))}</PaymentTermCode></command>
<command> <Currency>{F,XMLENCODE(F,TRIM(CSVData,F12))}</Currency></command>
<command> <PaymentDenied>{F,XMLENCODE(F,TRIM(F,EVAL(F,TONUMBER(CSVData,F11;".");=;1;"False";F,EVAL(F,TONUMBER(CSVData,F11;".");=;0;"True";"ERROR"))))}</PaymentDenied></command>
<command> <Active>{F,XMLENCODE(F,TRIM(CSVData,F2))}</Active></command>
<command> <Inherit>{F,XMLENCODE(F,TRIM(CSVData,F2))}</Inherit></command>
<commandSection name="SupplierIdentifiers">
<command> <SupplierIdentifiers></command>
<command> <SupplierIdentifier></command>
<command> <key>{c,"PartyID"}</key>
<value>{F,COMBINE(F,XMLENCODE(F,TRIM(CSVData,F23));F,XMLENCODE(F,TRIM(CSVData,F14)))}</value></command>
<command> </SupplierIdentifier></command>
<!-- adresses dans les identifiers -->
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>Address_1_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F3);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>Address_2_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F4);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>Address_3_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F5);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>Phone_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F6);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>Zip_Code_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F20);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>City_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F9);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>State_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F17);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>Country_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F10);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>Attention_to_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F7);50))}</value></command>
<command> </SupplierIdentifier></command>
<!-- Adress street - Address_1 -->
<command> <SupplierIdentifier></command>
<command> <key>Email_Identifier</key></command>
<command> <value>{F,XMLENCODE(F,LEFT(F,TRIM(CSVData,F13);50))}</value></command>
<command> </SupplierIdentifier></command>
<command> </SupplierIdentifiers></command>
</commandSection>
<command> <AdditionalDatas></command>
<command> </AdditionalDatas></command>
<command> <BankAccounts></command>
<command> </BankAccounts></command>
<!-- Add contact email address -->
<command> <EmailAddresses></command>
<command> </EmailAddresses></command>
<command> <SupplierAddresses></command>
<command> <SupplierAddress></command>
<command> <ExternalIdentifier>{F,XMLENCODE(F,TRIM(F,COMBINE(CSVData,F14;C,"Main")))}</ExternalIdentifier></command>
<command> <Name>{F,XMLENCODE(F,TRIM(F,COMBINE(CSVData,F14;C,"Main")))}</Name></command>
<command> <AddressParts></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>Address_1</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F3))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>Address_2</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F4))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>Address_3</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F5))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>Phone</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F6))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>Zip_Code</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F20))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>City</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F9))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>State</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F17))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>Country</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F10))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>Attention_to</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F7))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<!-- Adress street - Address_1 -->
<command> <SupplierAddressPart></command>
<command> <AddressPartKey>Email</AddressPartKey></command>
<command> <AddressPartText>{F,XMLENCODE(F,TRIM(CSVData,F13))}</AddressPartText></command>
<command> </SupplierAddressPart></command>
<command> </AddressParts></command>
<command> </SupplierAddress></command>
<command> </SupplierAddresses></command>
<command> </Supplier></command>
</outputCommands>
</output>
</section>
<output type="Basware.ErpConnector.OutputResource.TextOutputResource" log="{v,sys_objectdebug}">
<parameter name="path">{v,TempFile}</parameter>
<parameter name="append">True</parameter>
<parameter name="encoding">utf-8</parameter>
<outputCommands log="False">
<command></DocumentElement></command>
</outputCommands>
</output>
</section>
</section>
<!--
Allows to create and fill the table ADM_PROJECTS
-> Scheduled Task "Load Projects"
History:
2019-04-02 HPE Code initialization
-->
<section name="PreProjects">
<method name="GetProjectsFiles">
<builtInMethodParameterList name="bw_file_functions">
<parameter name="command">dir</parameter>
<parameter name="filename">{v,SYS_InBoundDirectory}\BW_Project*</parameter> <!-- CSV file name and path upload in Inbound Directory -->
<return name="projectslist_temp">
<filter/>
<sort />
</return>
</builtInMethodParameterList>
</method>
<section name="ActionIfFileExist" include="{F,IF(F,ROWCOUNT(projectslist_temp);>;0)}">
<variable name="SourceInputFile">{projectslist_temp,name}</variable> <!-- Full Path of the csv file -->
<onError onErrorJumpToXPath="//section[@name='BasicDataErrorHandler']" resume="false">
<removeTable>CSVData</removeTable> <!-- Clear CSVData datasource -->
<section name="jumpToInitializeSourceData" jumpToXPath="//section[@name='InitializeCSVPreProjects']" />
<!-- Variable initialization -->
<section name="jumpToCaptureSourceData" jumpToXPath="//section[@name='CaptureCSVData']" />
<!-- Split CSV and fill CSVData datasource -->
<section name="jumpToGenerateTargetData" jumpToXPath="//section[@name='GenerateXMLDataProjects']" />
<!-- Generate XML format in a Datasource from a Datasource -->
<section name="jumpToBackupSourceFile" jumpToXPath="//section[@name='SourceDataBackupFile']" />
<!-- Create XML file backup -->
<removeTable>CSVData</removeTable> <!-- vider la table retour de données -->
</onError>
</section>
</section>
<section name="InitializeCSVPreProjects">
<variable name="TempFile">{v,SYS_InBoundDirectory}{c,"Projects"}.xml</variable> <!-- XML output file name -->
<variable name="CSVFileColumnSeparator">,</variable> <!-- set the character that separates the data in the CSV file here -->
<variable name="CSVUseColumnNameHeaders">false</variable> <!-- Uses the values on the first line of CSV to define the column header names in AnyERP data source (skips 1st line when true) -->
<variable name="CSVSkipLines">1</variable> <!-- Skip the first x lines in CSV file? -->
<variable name="CSVTextDelimiterSwitch"></variable> <!-- OPTIONAL - Populate with none if your values are not surrounded by double quotes -->
</section>
<section name="GenerateXMLDataProjects" include="{F,IF(F,ROWCOUNT(CSVData);>;0)}">
<!-- XML file generation if datasource is not empty -->
<output type="BasWare.ErpConnector.OutputResource.XmlOutputResource">
<parameter name="path">{v,TempFile}</parameter>
<parameter name="append">true</parameter>
<!-- "DocumentElement" node -->
<outputCommands>
<command type="node:DocumentElement"/>
</outputCommands>
<outputCommands loopDataSource="CSVData" log="True">
<!-- Loop on CSVData datasource to create XML file -->
<command type="node:Item" attribute="//DocumentElement"/>
<command type="node:Code" attribute="//DocumentElement/Item[last()]">{CSVData,F3}</command>
<command type="node:Name" attribute="//DocumentElement/Item[last()]">{CSVData,F2}</command>
<command type="node:Description" attribute="//DocumentElement/Item[last()]"></command>
<command type="node:Company" attribute="//DocumentElement/Item[last()]">{CSVData,F4}</command>
<command type="node:Active" attribute="//DocumentElement/Item[last()]">{F,EVAL(CSVData,F1;=;TRUE;1;F,EVAL(CSVData,F1;=;FALSE;0;"ERROR"))}</command>
</outputCommands>
</output>
</section>
<section name="errorHandler_Main">
<!-- Récupération du détail de l'exception -->
<variable name="ExceptionP2P">{F,REGEXP_STRING(error,exception;"(<faultstring>).*(<\/faultstring>)")}</variable>
<variable name="ExceptionP2P">{F,REPLACE(v,ExceptionP2P;"<faultstring>";"")}</variable>
<variable name="ExceptionP2P">{F,REPLACE(v,ExceptionP2P;"</faultstring>";"")}</variable>
<variable name="errorMessage">{error,baseexception}</variable>
<variable name="exceptionMessage">{error,exception}</variable>
<clearTable>Recipients</clearTable>
<method name="SplitRecipients">
<builtInMethodParameterList name="bw_string_functions">
<parameter name="operation">split</parameter>
<parameter name="sourcestring">{v,EMAIL_Recipient}</parameter>
<parameter name="separator">;</parameter>
<return name="Recipients">
<filter />
<sort />
</return>
</builtInMethodParameterList>
</method>
<!-- Alerte par email -->
<section name="SendErrorEmail" include="{v,ERROR_SEND_EMAIL}">
<method name="SendErrorEmail">
<builtInMethodParameterList name="email">
<parameter name="to" loopDataSource="Recipients">{Recipients,Recipients}</parameter>
<parameter name="subject">{v,ERROR_TAG}{F,EVAL(F,EXISTS(v;taskname);=;1;F,COMBINE("[";v,taskname;"]");c,"")}</parameter>
<parameter name="server">{v,EMAIL_Server}</parameter>
<parameter name="from">{v,EMAIL_Sender}</parameter>
<parameter name="format">html</parameter>
<parameter name="body">{v,emailBody}</parameter>
</builtInMethodParameterList>
</method>
</section>
<!-- Renommage du fichier en erreur pour ne pas qu'il soit repris -->
<section name="RenameFile" include="{F,EVAL(F,EXISTS(filelist;name);=;1;true;false)}">
<method name="RenameFile">
<builtInMethodParameterList name="bw_file_functions">
<parameter name="command">rename</parameter>
<parameter name="filename">{v,SYS_InBoundDirectory}{filelist,name}</parameter>
<parameter name="newname">{v,SYS_InBoundDirectory}{F,REPLACE(F,REPLACE(filelist,name;".XML";".ERREUR");".xml";".ERREUR")}</parameter>
</builtInMethodParameterList>
</method>
</section>
</section>
<!-- Pre Cost centers section-->
<section name="PreCostcenters">
<section>
<removeTable>UserList</removeTable>
</section>
<section name="Costcenters">
<method name="GetCostcentersList">
<builtInMethodParameterList name="bw_db_functions" driver="provider">
<parameter name="tablename">Costcenters</parameter>
<parameter name="connectionstring" log="False">{v,connstr}</parameter>
<parameter name="dataprovider">{v,dataprovider}</parameter>
<parameter name="assemblyname">{v,assemblyname}</parameter>
<parameter name="prefix">{v,BoundVariableChar}</parameter>
<parameter name="command">select CODE, NAME, (select ID from ADM_ORGANIZATION_ELEMENT where type=1) as Company from ADM_ORGANIZATION_ELEMENT where type=2</parameter>
</builtInMethodParameterList>
</method>
</section>
<output name="OutputData" type="Basware.ErpConnector.OutputResource.XmlWriterOutputResource">
<parameter name="path">{v,path}\{v,filename}</parameter>
<parameter name="checkcharacters">true</parameter>
<parameter name="encoding">UTF-8</parameter>
<parameter name="indent">true</parameter>
<parameter name="newlinechar" />
<parameter name="omitxmldeclaration">true</parameter>
<outputCommands>
<command type="startelement">DocumentElement</command>
<commandSection loopDataSource="Costcenters" include="{F,IF(F,ROWCOUNT(Costcenters);>;0)}">
<command type="startelement">Item</command>
<command type="startelement">Text_1</command>
<command type="write">{F,NVL(Costcenters,CODE;"")}</command>
<command type="endelement"/>
<command type="startelement">Text_2</command>
<command type="write">{F,NVL(Costcenters,NAME;"")}</command>
<command type="endelement" />
<command type="startelement">Company</command>
<command type="write">{F,NVL(Costcenters,COMPANY;"")}</command>
<command type="endelement"/>
<command type="endelement" />
</commandSection>
<command type="endelement" />
</outputCommands>
</output>
<clearTable>UserList</clearTable>
</section>
</sections>
</erpConnector>