Issues (103)

Examples/Naskladneni.php (1 issue)

1
#!/usr/bin/php -f
2
<?php
3
/**
4
 * FlexiPeeHP - Naskaladnění včetně sériových čísel
5
 *
6
 * @author     Vítězslav Dvořák <[email protected]>
7
 * @copyright  (G) 2018 Vitex Software
8
 */
9
10
namespace Example\FlexiPeeHP;
11
12
include_once './config.php';
13
include_once '../vendor/autoload.php';
14
15
16
17
$storage             = 'SKLAD';
18
$productCode         = \Ease\Sand::randomString();
0 ignored issues
show
The method randomString() does not exist on Ease\Sand. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
/** @scrutinizer ignore-call */ 
19
$productCode         = \Ease\Sand::randomString();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
19
$serialNumbers       = [
20
    \Ease\Sand::randomString(),
21
    \Ease\Sand::randomString(),
22
    \Ease\Sand::randomString(),
23
    \Ease\Sand::randomString()
24
];
25
$defaultSerialNumber = \Ease\Sand::randomString();
26
27
28
29
/** Preparation * */
30
//We need an exising item
31
$product = new \FlexiPeeHP\Cenik();
32
$product->insertToFlexiBee([
33
    'kod' => $productCode,
34
    'nazev' => $productCode,
35
    'typZasobyK' => 'typZasoby.zbozi',
36
    'evidVyrCis' => true,
37
// 'unikVyrCis'=> fase,
38
    'skladove' => true
39
]);
40
41
//with storage card for at least current accounting period
42
$storageCard = new \FlexiPeeHP\SkladovaKarta();
43
$storageCard->insertToFlexiBee([
44
    'sklad' => \FlexiPeeHP\FlexiBeeRO::code($storage),
45
    'cenik' => \FlexiPeeHP\FlexiBeeRO::code($productCode),
46
    'ucetObdobi' => \FlexiPeeHP\FlexiBeeRO::code(date('Y'))
47
]);
48
49
/** Preparation End * */
50
$skladovyPohyb = new \FlexiPeeHP\SkladovyPohyb([
51
    'id' => 'ext:PRIJEMKA:'.time(),
52
    'typDokl' => \FlexiPeeHP\FlexiBeeRO::code('STANDARD'),
53
    'sklad' => \FlexiPeeHP\FlexiBeeRO::code($storage),
54
    'cenik' => \FlexiPeeHP\FlexiBeeRO::code($productCode),
55
    'typPohybuK' => 'typPohybu.prijem',
56
    ],['debug'=>true]);
57
58
// We Need
59
$productModel = new \FlexiPeeHP\SkladovyPohybPolozka([
60
    'sklad' => \FlexiPeeHP\FlexiBeeRO::code($storage),
61
    'cenik' => \FlexiPeeHP\FlexiBeeRO::code($productCode)
62
    ], ['offline' => true]);
63
64
//Add Serial numbers one by one
65
foreach ($serialNumbers as $serialNumber) {
66
    $productModel->addSerialNumber($serialNumber);
67
}
68
69
//Also add default serial number
70
$productModel->addSerialNumber($defaultSerialNumber, true); //Add another number - the Main one
71
//$skladovyPohyb->addArrayToBranch([$productModel->getEvidence() => $productModel->getData()]);
72
$skladovyPohyb->addObjectToBranch($productModel);
73
74
75
//And Now We can save it into FlexiBee
76
$skladovyPohyb->insertToFlexiBee();
77
78
79
echo $skladovyPohyb->postFields;
80
echo $skladovyPohyb->lastCurlResponse;
81