Skip to content

Commit 7262a32

Browse files
committed
more work, more todo
1 parent cb06521 commit 7262a32

13 files changed

+943
-1008
lines changed

LICENSE

+201-674
Large diffs are not rendered by default.

README.md

+31-30
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,43 @@ Weitere Informationen unter
99
- https://www.itek.de/beratung/open-masterdata
1010
- https://itek-branchenwissen.atlassian.net/wiki/spaces/DS/pages/535593021/Open+Masterdata
1111

12-
# Lizenz / License
13-
14-
english version below
15-
16-
Die Bibliothek "OpenMasterdata-for-Delphi" unterliegt eine Doppellizenz. Sie können sie kostenlos und
17-
ohne Einschränkungen unter der [GPL v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html) verwenden, oder Sie erwerben
18-
eine Lizenz zur kommerziellen Nutzung unter der [Landrix Software Commercial License](commercial.license.md)
12+
# Lieferanten mit Open Masterdata-Unterstützung
1913

20-
Eine kommerzielle Lizenz gewährt Ihnen das Recht, OpenMasterdata-for-Delphi
21-
in Ihren eigenen Anwendungen zu verwenden. Lizenzfrei und ohne Verpflichtung zur
22-
Offenlegung Ihres Quellcodes oder Änderungen an die Landrix Software oder einer anderen Partei.
23-
Eine kommerzielle Lizenz gilt auf Dauer und berechtigt Sie kostenlos zu allen zukünftigen Updates.
14+
| Lieferant | ja | geplant | nein |
15+
|----------|----------|----------|----------
16+
| GC-Gruppe | x | - | - |
17+
| Pietsch | x | - | - |
18+
| Pürsch | - | - | x |
19+
| Sanitär-Heinze | x | - | - |
20+
| ZVSHK | x | - | - |
2421

25-
Jede Firma, die Anwendungen mit der Bibliothek OpenMasterdata-for-Delphi entwickelt, benötigt eine Lizenz.
26-
Die Kosten dafür betragen 400,00 EUR zzgl. MwSt. pro Firma.
22+
## Art der Authentifizierung
2723

28-
Bitte senden Sie eine E-Mail an [email protected], um eine Rechnung mit den Zahlungsinformationen anzufordern.
24+
- GC-Gruppe: ClientID, Client-Secret - Registrierung erforderlich
25+
- Pietsch:
26+
- Sanitär-Heinze: CliendID (eigene ID) - Registrierung erforderlich
27+
- ZVSHK: CliendID (eigene ID) - Registrierung erforderlich
2928

30-
Support- und Erweiterungsanfragen von lizensierten Benutzern werden bevorzugt behandelt.
31-
Neue Entwicklungen können abhängig von der für die Implementierung erforderlichen Zeit zusätzliche Kosten verursachen.
32-
33-
english version
29+
# Lizenz / License
3430

35-
The "OpenMasterdata-for-Delphi" library is dual-licensed. You may choose to use it under the restrictions of
36-
the [GPL v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html) at no cost to you, or you may purchase
37-
for user under the [Landrix Software Commercial License](./commercial.license.md)
31+
License OpenMasterdata-for-Delphi
3832

39-
A commercial licence grants you the right to use OpenMasterdata-for-Delphi in your own applications,
40-
royalty free, and without any requirement to disclose your source code nor any modifications to
41-
Landrix Software to any other party. A commercial licence lasts into perpetuity, and
42-
entitles you to all future updates, free of charge.
33+
Copyright (C) 2024 Landrix Software GmbH & Co. KG
34+
Sven Harazim, [email protected]
4335

44-
A commercial licence is sold per company developing applications that use OpenMasterdata-for-Delphi.
45-
The cost is 400,00 EUR plus VAT per company.
36+
Licensed to the Apache Software Foundation (ASF) under one
37+
or more contributor license agreements. See the NOTICE file
38+
distributed with this work for additional information
39+
regarding copyright ownership. The ASF licenses this file
40+
to you under the Apache License, Version 2.0 (the
41+
"License"); you may not use this file except in compliance
42+
with the License. You may obtain a copy of the License at
4643

47-
Please send an e-mail to [email protected] to request an invoice which will contain the bank details.
44+
http://www.apache.org/licenses/LICENSE-2.0
4845

49-
Support and enhancement requests submitted by users that pay for
50-
support will be prioritised. New developments may incur additional costs depending on time required for implementation.
46+
Unless required by applicable law or agreed to in writing,
47+
software distributed under the License is distributed on an
48+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
49+
KIND, either express or implied. See the License for the
50+
specific language governing permissions and limitations
51+
under the License.

Samples/OpenMasterdata.dpr

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
License OpenMasterdata-for-Delphi
55
6-
Copyright (C) 2022 Landrix Software GmbH & Co. KG
6+
Copyright (C) 2024 Landrix Software GmbH & Co. KG
77
Sven Harazim, [email protected]
88
99
This program is free software: you can redistribute it and/or modify

Samples/OpenMasterdata.dproj

+331-189
Large diffs are not rendered by default.

Samples/OpenMasterdata.res

41.5 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<ProjectGuid>{9AA7028E-D250-42B3-8EF9-AD7CC2B2B5C3}</ProjectGuid>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<Projects Include="OpenMasterdata.dproj">
7+
<Dependencies/>
8+
</Projects>
9+
</ItemGroup>
10+
<ProjectExtensions>
11+
<Borland.Personality>Default.Personality.12</Borland.Personality>
12+
<Borland.ProjectType/>
13+
<BorlandProject>
14+
<Default.Personality/>
15+
</BorlandProject>
16+
</ProjectExtensions>
17+
<Target Name="OpenMasterdata">
18+
<MSBuild Projects="OpenMasterdata.dproj"/>
19+
</Target>
20+
<Target Name="OpenMasterdata:Clean">
21+
<MSBuild Projects="OpenMasterdata.dproj" Targets="Clean"/>
22+
</Target>
23+
<Target Name="OpenMasterdata:Make">
24+
<MSBuild Projects="OpenMasterdata.dproj" Targets="Make"/>
25+
</Target>
26+
<Target Name="Build">
27+
<CallTarget Targets="OpenMasterdata"/>
28+
</Target>
29+
<Target Name="Clean">
30+
<CallTarget Targets="OpenMasterdata:Clean"/>
31+
</Target>
32+
<Target Name="Make">
33+
<CallTarget Targets="OpenMasterdata:Make"/>
34+
</Target>
35+
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
36+
</Project>

Samples/OpenMasterdataUnit1.dfm

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ object MainForm: TMainForm
7171
Height = 23
7272
Style = csDropDownList
7373
Anchors = [akLeft, akTop, akRight]
74+
DropDownCount = 20
7475
TabOrder = 2
7576
OnSelect = ComboBox1Select
7677
end
@@ -97,7 +98,10 @@ object MainForm: TMainForm
9798
Height = 287
9899
Anchors = [akLeft, akTop, akRight, akBottom]
99100
TabOrder = 5
101+
AllowSingleSignOnUsingOSPrimaryAccount = False
102+
TargetCompatibleBrowserVersion = '117.0.2045.28'
100103
UserDataFolder = '%LOCALAPPDATA%\bds.exe.WebView2'
104+
OnWebResourceRequested = EdgeBrowser1WebResourceRequested
101105
end
102106
object CheckListBox1: TCheckListBox
103107
Left = 638

Samples/OpenMasterdataUnit1.pas

+79-22
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
{
22
License OpenMasterdata-for-Delphi
33
4-
Copyright (C) 2022 Landrix Software GmbH & Co. KG
4+
Copyright (C) 2024 Landrix Software GmbH & Co. KG
55
Sven Harazim, [email protected]
66
7-
This program is free software: you can redistribute it and/or modify
8-
it under the terms of the GNU General Public License as published by
9-
the Free Software Foundation, either version 3 of the License, or
10-
(at your option) any later version.
11-
12-
This program is distributed in the hope that it will be useful,
13-
but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
GNU General Public License for more details.
16-
17-
You should have received a copy of the GNU General Public License
18-
along with this program. If not, see <https://www.gnu.org/licenses/>.
7+
Licensed to the Apache Software Foundation (ASF) under one
8+
or more contributor license agreements. See the NOTICE file
9+
distributed with this work for additional information
10+
regarding copyright ownership. The ASF licenses this file
11+
to you under the Apache License, Version 2.0 (the
12+
"License"); you may not use this file except in compliance
13+
with the License. You may obtain a copy of the License at
14+
15+
http://www.apache.org/licenses/LICENSE-2.0
16+
17+
Unless required by applicable law or agreed to in writing,
18+
software distributed under the License is distributed on an
19+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20+
KIND, either express or implied. See the License for the
21+
specific language governing permissions and limitations
22+
under the License.
1923
}
2024

2125
unit OpenMasterdataUnit1;
@@ -48,8 +52,11 @@ TMainForm = class(TForm)
4852
procedure FormCreate(Sender: TObject);
4953
procedure FormDestroy(Sender: TObject);
5054
procedure ComboBox1Select(Sender: TObject);
55+
procedure EdgeBrowser1WebResourceRequested(Sender: TCustomEdgeBrowser;
56+
Args: TWebResourceRequestedEventArgs);
5157
public
5258
Configuration : TMemIniFile;
59+
CurrentAuthorizationToken : String;
5360
end;
5461

5562
var
@@ -70,25 +77,25 @@ procedure TMainForm.FormCreate(Sender: TObject);
7077

7178
configurationFilename := basePath + 'configuration.ini';
7279

73-
Configuration := TMemIniFile.Create(configurationFilename);
80+
Configuration := TMemIniFile.Create(configurationFilename,TEncoding.UTF8);
7481

75-
//Inhaltsaufbau einer Ini-Section je Lieferant
82+
//Inhaltsaufbau configuration.ini, eine Ini-Section je Lieferant
7683
//[Lieferant-Name]
7784
//Username=
7885
//Password=
7986
//Customernumber=
8087
//ClientID=
8188
//ClientSecret=
82-
//ClientScope=
83-
//GrantType=
84-
//UsernameRequired=
85-
//CustomernumberRequired=
86-
//ClientSecretRequired=
89+
//ClientScope=openMasterdata
90+
//GrantType=password or client_credentials
91+
//UsernameRequired=True or False
92+
//CustomernumberRequired=True or False
93+
//ClientSecretRequired=True or False
8794
//OAuthURL=
8895
//BySupplierPIDURL=
8996
//ByManufacturerDataURL=
9097
//ByGTINURL=
91-
//ArtNoAsCommatext=
98+
//ArtNoAsCommatext=123,456
9299

93100
Configuration.ReadSections(ComboBox1.Items);
94101

@@ -114,6 +121,7 @@ procedure TMainForm.FormCreate(Sender: TObject);
114121
for var i : Integer := 0 to CheckListBox1.Items.Count-1 do
115122
CheckListBox1.Checked[i] := true;
116123

124+
EdgeBrowser1.UserDataFolder := ExtractFilePath(Application.ExeName);
117125
EdgeBrowser1.Navigate('about:blank');
118126

119127
var _Result : TOpenMasterdataAPI_Result;
@@ -132,6 +140,20 @@ procedure TMainForm.FormCreate(Sender: TObject);
132140
finally
133141
_Result.Free;
134142
end;
143+
_Result := TOpenMasterdataAPI_Result.Create;
144+
try
145+
try
146+
_Result.LoadFromJson(TFile.ReadAllText(basePath+'supplierPid_WiedemannRaw.json'));
147+
except
148+
on E:Exception do
149+
begin
150+
//FLastErrorMessage := E.ClassName+' '+e.Message;
151+
exit;
152+
end;
153+
end;
154+
finally
155+
_Result.Free;
156+
end;
135157
_Result := TOpenMasterdataAPI_Result.Create;
136158
try
137159
try
@@ -217,6 +239,37 @@ procedure TMainForm.ComboBox1Select(Sender: TObject);
217239
Memo2.Lines.Add(Configuration.ReadString(ComboBox1.Text,'ByGTINURL',''));
218240
end;
219241

242+
procedure TMainForm.EdgeBrowser1WebResourceRequested(Sender: TCustomEdgeBrowser;
243+
Args: TWebResourceRequestedEventArgs);
244+
var
245+
request: ICoreWebView2WebResourceRequest;
246+
// requestURI, responseHeaders, method: PWideChar;
247+
// response: ICoreWebView2WebResourceResponse;
248+
// requestFilename, localFilename, payload: string;
249+
headers: ICoreWebView2HttpRequestHeaders;
250+
// requestStringStream : IStream;
251+
// core:ICoreWebView2;
252+
// sett:ICoreWebView2Settings;
253+
begin
254+
if CurrentAuthorizationToken = '' then
255+
exit;
256+
Args.ArgsInterface.Get_Request(request);
257+
//request.Get_uri(requestURI);
258+
request.Get_Headers(headers);
259+
headers.SetHeader('Authorization',PChar('Bearer '+CurrentAuthorizationToken));
260+
261+
//headers.SetHeader('User-Agent', PChar('TestBrowserDownload v' + GetVersion));
262+
//headers.SetHeader('Content-Type', PChar('application/x-www-form-urlencoded'));
263+
//request.Set_Method('POST');
264+
//payload := 'a=textusw';
265+
// requestStringStream := TStreamAdapter.Create(TStringStream.Create(payload, TEncoding.UTF8), soOwned);
266+
// request.Set_Content(requestStringStream);
267+
// //Versuch IStream für den Dateitransfer zur Verfügung zu stellen...
268+
// Args.ArgsInterface.Get_Response(response);
269+
// requestFileStream := TStreamAdapter.Create(TFileStream.Create(extractfilepath(paramstr(0)) + 'test.dat', fmCreate or fmOpenReadWrite or fmShareDenyNone), soOwned);
270+
// response.Set_Content(requestFileStream);
271+
end;
272+
220273
procedure TMainForm.btBySupplierPidClick(Sender: TObject);
221274
var
222275
client : IOpenMasterdataApiClient;
@@ -228,7 +281,8 @@ procedure TMainForm.btBySupplierPidClick(Sender: TObject);
228281
var
229282
tmpJson: System.JSON.TJSONValue;
230283
begin
231-
tmpJson := System.JSON.TJSONObject.ParseJSONValue(json);
284+
tmpJson := System.JSON.TJSONObject.ParseJSONValue(
285+
TOpenMasterdataHelper.FixJson(json),false,true);
232286
if tmpJson <> nil then
233287
begin
234288
Result := Rest.Json.TJson.Format(tmpJson);
@@ -239,6 +293,7 @@ procedure TMainForm.btBySupplierPidClick(Sender: TObject);
239293

240294
begin
241295
Memo1.Clear;
296+
CurrentAuthorizationToken := '';
242297

243298
if ComboBox1.ItemIndex < 0 then
244299
exit;
@@ -270,7 +325,9 @@ procedure TMainForm.btBySupplierPidClick(Sender: TObject);
270325
Memo1.Lines.Text := FormatJSON(client.GetLastBySupplierPIDResponseContent);
271326

272327
html := TOpenMasterdataAPI_ViewHelper.AsHtml(supplierPid);
328+
CurrentAuthorizationToken := client.GetCurrentAuthorizationToken;
273329

330+
EdgeBrowser1.AddWebResourceRequestedFilter('*', COREWEBVIEW2_WEB_RESOURCE_CONTEXT_ALL);
274331
EdgeBrowser1.NavigateToString(html);
275332
finally
276333
supplierPid.Free;

commercial.license.md

-27
This file was deleted.

intf.OpenMasterdata.Model.pas

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
License OpenMasterdata-for-Delphi
33
4-
Copyright (C) 2022 Landrix Software GmbH & Co. KG
4+
Copyright (C) 2024 Landrix Software GmbH & Co. KG
55
Sven Harazim, [email protected]
66
77
This program is free software: you can redistribute it and/or modify
@@ -239,10 +239,21 @@ procedure TOpenMasterdata_Result.LoadDataFrom(
239239
localFormatSettings := System.SysUtils.FormatSettings;
240240
localFormatSettings.DecimalSeparator := '.';
241241
localFormatSettings.ThousandSeparator := ',';
242-
prices.listPrice.value := StrToCurrDef(_Val.prices.listPrice.value,0,localFormatSettings);
243-
prices.listPrice.currency := _Val.prices.listPrice.currency;
244-
prices.listPrice.basis := _Val.prices.listPrice.basis;
245-
prices.listPrice.quantityUnit := _Val.prices.listPrice.quantityUnit;
242+
//Buderus,...
243+
if (StrToCurrDef(_Val.prices.listPrice.value,0,localFormatSettings) = 0) and
244+
(StrToCurrDef(_Val.prices.rrp.value,0,localFormatSettings) <> 0) then
245+
begin
246+
prices.listPrice.value := StrToCurrDef(_Val.prices.rrp.value,0,localFormatSettings);
247+
prices.listPrice.currency := _Val.prices.rrp.currency;
248+
prices.listPrice.basis := _Val.prices.rrp.basis;
249+
prices.listPrice.quantityUnit := _Val.prices.rrp.quantityUnit;
250+
end else
251+
begin
252+
prices.listPrice.value := StrToCurrDef(_Val.prices.listPrice.value,0,localFormatSettings);
253+
prices.listPrice.currency := _Val.prices.listPrice.currency;
254+
prices.listPrice.basis := _Val.prices.listPrice.basis;
255+
prices.listPrice.quantityUnit := _Val.prices.listPrice.quantityUnit;
256+
end;
246257
prices.netPrice.value := StrToCurrDef(_Val.prices.netPrice.value,0,localFormatSettings);
247258
prices.netPrice.currency := _Val.prices.netPrice.currency;
248259
prices.netPrice.basis := _Val.prices.netPrice.basis;

0 commit comments

Comments
 (0)