forked from Spoje-NET/FlexiPeeHP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateLabel.php
43 lines (39 loc) · 1.02 KB
/
CreateLabel.php
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
#!/usr/bin/php -f
<?php
/**
* FlexiPeeHP - Example how to create FlexiBee label
*
* @author Vítězslav Dvořák <[email protected]>
* @copyright (G) 2017 Vitex Software
*/
namespace Example\FlexiPeeHP;
include_once './config.php';
include_once '../vendor/autoload.php';
/**
* @var \FlexiPeeHP\Stitek Label Object
*/
$stitek = new \FlexiPeeHP\Stitek();
/**
* @var string Name / Code of new Label
*/
$label = 'FlexiPeeHP';
/**
* @see https://demo.flexibee.eu/c/demo/stitek/properties
* @var array initial Label contexts
*/
$stitekData = [
"kod" => strtoupper($label),
"nazev" => $label,
"vsbAdr" => true,
"vsbKatalog" => true,
"vsbSkl" => true
];
$stitekID = $stitek->getColumnsFromFlexibee('id', $stitekData);
if (!isset($stitekID[0]['id'])) {
$stitek->insertToFlexiBee($stitekData);
if ($stitek->lastResponseCode == 201) {
$stitek->addStatusMessage('label '.$label.' created', 'success');
}
} else {
$stitek->addStatusMessage('label '.$label.' already exits');
}