Completed
Pull Request — master (#95)
by
unknown
20:25
created

StockChange::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace MarcusJaschen\Collmex\Type;
3
4
/**
5
 * Collmex StockChange Type
6
 *
7
 * @author   Marcus Jaschen <[email protected]>
8
 * @author   René Galle <[email protected]>
9
 * @license  http://www.opensource.org/licenses/mit-license MIT License
10
 * @link     https://github.com/mjaschen/collmex
11
 *
12
 * @property $type_identifier
13
 * @property $stock_change_id
14
 * @property $stock_change_position
15
 * @property $product_id
16
 * @property $stock_change_type
17
 * @property $quantity
18
 * @property $destination_location_id
19
 * @property $destination_stock_type
20
 * @property $destination_charge
21
 * @property $destination_charge_labeling
22
 * @property $reserved_1
23
 * @property $reserved_2
24
 * @property $source_location_id
25
 * @property $source_stock_type
26
 * @property $source_charge
27
 * @property $reserved_3
28
 * @property $reserved_4
29
 * @property $reserved_5
30
 * @property $supplier_order_id
31
 * @property $supplier_order_position
32
 * @property $delivery_id
33
 * @property $delivery_position
34
 * @property $production_order_id
35
 * @property $production_order_position
36
 * @property $invoice_id
37
 * @property $invoice_position
38
 * @property $cancel_stock_change_id
39
 * @property $cancel_stock_change_pos
40
 * @property $notice
41
 * @property $booked_date
42
 * @property $booked_time
43
 */
44
class StockChange extends AbstractType implements TypeInterface
45
{
46
    const STOCK_CHANGE_TYPE_WITHDRAWAL = 0;
47
    const STOCK_CHANGE_TYPE_INPUT = 1;
48
    const STOCK_CHANGE_TYPE_TRANSFER = 2;
49
    const STOCK_CHANGE_TYPE_INVENTORY = 3;
50
51
    const DESTINATION_STOCK_TYPE_FREE = 0;
52
    const DESTINATION_STOCK_TYPE_LOCKED = 1;
53
54
    /**
55
     * @var array
56
     */
57
    protected $template = [
58
        'type_identifier'             => 'STOCK_CHANGE', // 1
59
        'stock_change_id'             => null,
60
        'stock_change_position'       => null,
61
        'product_id'                  => null,
62
        'stock_change_type'           => null, // 5
63
        'quantity'                    => null,
64
        // 7-12: only STOCK_CHANGE_TYPE_INPUT, STOCK_CHANGE_TYPE_TRANSFER, STOCK_CHANGE_TYPE_INVENTORY
65
        'destination_location_id'     => null,
66
        'destination_stock_type'      => null,
67
        'destination_charge'          => null,
68
        'destination_charge_labeling' => null, // 10
69
        'reserved_1'                  => null,
70
        'reserved_2'                  => null,
71
        // 13-18: only STOCK_CHANGE_TYPE_WITHDRAWAL, STOCK_CHANGE_TYPE_TRANSFER
72
        'source_location_id'          => null,
73
        'source_stock_type'           => null,
74
        'source_charge'               => null, // 15
75
        'reserved_3'                  => null,
76
        'reserved_4'                  => null,
77
        'reserved_5'                  => null,
78
        'supplier_order_id'           => null,
79
        'supplier_order_position'     => null, // 20
80
        'delivery_id'                 => null,
81
        'delivery_position'           => null,
82
        'production_order_id'         => null,
83
        'production_order_position'   => null,
84
        'invoice_id'                  => null, // 25
85
        'invoice_position'            => null,
86
        'cancel_stock_change_id'      => null,
87
        'cancel_stock_change_pos'     => null,
88
        'notice'                      => null,
89
        'booked_date'                 => null, // 30
90
        'booked_time'                 => null,
91
    ];
92
93
    /**
94
     * Formally validates the type data in $data attribute.
95
     *
96
     * @return bool Validation success
97
     */
98
    public function validate()
99
    {
100
        return true;
101
    }
102
}
103