-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathKnOrg-embedded-update.txt
148 lines (148 loc) · 5.29 KB
/
KnOrg-embedded-update.txt
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
; A note: one would expect that the presence of a MatchOga/MatchPer of 0 and
; BcCo numbers would make it clear that we are updating all objects. However,
; last time I tested (feb 2015), the XML UpdateConnector threw an error "Object
; variable or With block variable not set" when I did not explicitly specify
; action "update". This is a Visual Basic error, pointing to an error in AFAS'
; program code.
; My takeaway: always specify the $action parameter for SOAP/XML, so the
; "Action" XML attributes are always present.
; We need to specify DEFAULT_CHANGE | ALLOW_CHANGES to get In & SeNm populated
; and to split the house number off the street field
; We need to specify DEFAULT_CHANGE | ALLOW_CHANGES | ALLOW_REFORMAT_PHONE_NR
; to get In & SeNm populated, split the house number off the street field (and
; populate PbAd; and reformat the Dutch phone number.
KnOrganisation:update:1079
[
'code' => '1100000',
'name' => 'Wyz',
; One thing to keep in mind when updating address: the postal_address_is_address
; field (KnOrganisation.PbAd or KnContact/KnPerson.PadAdr) is not set
; automatically for updates, because we have no good way of deriving whether
; we need to update just this one address or also the postal address. The caller
; should take this into account.
'address' => [
'street' => 'Govert Flinckstraat 168A',
'zip_code' => '1072EP',
'town' => 'Amsterdam',
'country_iso' => 'NL',
],
'contact' => [
'email' => '[email protected]',
'person' => [
'code' => '100000',
'first_name' => 'Roderik',
'last_name' => 'Muit',
; A note: I have never actually tried sending a phone number into here because
; I've always put it inside the contact (see insert.txt). But the code at least
; supports it.
'phone' => '0622517218',
],
],
]
--
{
"KnOrganisation": {
"Element": {
"Fields": {
"BcCo": "1100000",
"Nm": "Wyz",
; MatchOga is set to 0 by default, for most updates. If BcCo is not set, that
; would generate an AFAS error, which is on purpose. (See code comments.)
"MatchOga": 0
},
"Objects": {
"KnBasicAddressAdr": {
"Element": {
"Fields": {
"Ad": "Govert Flinckstraat",
"ZpCd": "1072EP",
"Rs": "Amsterdam",
"CoId": "NL",
"HmNr": 168,
"HmAd": "A",
; PbAd = false is added automatically - not because it's the default value but
; because when ALLOW_CHANGES is specified, PbAd is derived from "Ad" on updates.
"PbAd": false,
"BeginDate": {TODAY}
}
}
},
"KnContact": {
"Element": {
"Fields": {
"EmAd": "[email protected]"
},
"Objects": {
"KnPerson": {
"Element": {
"Fields": {
"BcCo": "100000",
"FiNm": "Roderik",
"LaNm": "Muit",
"TeNr": "06-22517218",
; Also "Is" is explicitly set to empty, on updates with ALLOW_CHANGES specified.
"Is": "",
"In": "R.",
"SeNm": "MUIT",
; MatchPer is set to 0 by default, for most updates. If BcCo is not set, that
; would generate an AFAS error, which is on purpose. (See code comments.)
"MatchPer": 0
}
}
}
}
}
}
}
}
}
}
--
<KnOrganisation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Element>
<Fields Action="update">
<BcCo>1100000</BcCo>
<Nm>Wyz</Nm>
<MatchOga>0</MatchOga>
</Fields>
<Objects>
<KnBasicAddressAdr>
<Element>
<Fields Action="update">
<Ad>Govert Flinckstraat</Ad>
<ZpCd>1072EP</ZpCd>
<Rs>Amsterdam</Rs>
<CoId>NL</CoId>
<HmNr>168</HmNr>
<HmAd>A</HmAd>
<PbAd>0</PbAd>
<BeginDate>{TODAY}</BeginDate>
</Fields>
</Element>
</KnBasicAddressAdr>
<KnContact>
<Element>
<Fields Action="update">
<EmAd>[email protected]</EmAd>
</Fields>
<Objects>
<KnPerson>
<Element>
<Fields Action="update">
<BcCo>100000</BcCo>
<FiNm>Roderik</FiNm>
<LaNm>Muit</LaNm>
<TeNr>06-22517218</TeNr>
<Is></Is>
<In>R.</In>
<SeNm>MUIT</SeNm>
<MatchPer>0</MatchPer>
</Fields>
</Element>
</KnPerson>
</Objects>
</Element>
</KnContact>
</Objects>
</Element>
</KnOrganisation>