Documentation/Index/VatNoteCostBeanBeforeSave: VatNoteCostFormAfterSave.inc

Plik VatNoteCostFormAfterSave.inc, 1.3 KB (dodany przez TS, 3 years temu)
xx
Line 
1<?php
2require_once('./classes/FeatureBox/FeaturesHelper.inc');
3require_once(MOD_PATH.'ADocuments/beans/VatNoteCost.inc');
4
5/**
6 * VatNoteCostFormAfterSave
7 *
8 * @author Tomasz Świenty
9 * @version 0.1
10 * @copyright Copyright (c) eDokumenty
11 */
12final class VatNoteCostFormAfterSave {
13
14
15    public static function init($args) {
16
17        // [TS] usuń aby skrypt fungał
18        return TRUE;
19
20        if (!isset($args['container']->mode) OR ($args['container']->mode != 'new')) {
21            return TRUE;
22        }
23
24        $data = $args['container']->getData();
25        $vtcoid = $data['vtcoid'] ?? NULL;
26        if (filter_var($vtcoid, FILTER_VALIDATE_INT) === FALSE) {
27            return TRUE;
28        }
29
30        $featureID = ''; // tutaj właściwe features.featid
31        $tableNameSpace = MapService::VNCOST;
32        $tableID = $vtcoid;
33
34        // jeśli cecha jest opcją to pobranie wartosci jako
35        $out = FeaturesHelper::getOptionsValues($featureID, $tableNameSpace, $tableID);
36
37        // jeśli cecha jest tekstowa to
38        $out = FeaturesHelper::getTextValue($featureID, $tableNameSpace, $tableID);
39
40        $vatnoteCostBean = new VatNoteCost($vtcoid);
41        $vatnoteCostBean->set('remark', time());
42        $vatnoteCostBean->save();
43
44        return TRUE;
45
46    }
47
48}
49
50if (isset($args)) {
51    VatNoteCostFormAfterSave::init($args);
52}