Documentation/Index/CustomScriptForVatNotePref: VatPrefAutoFilterListAfterCreate.inc

Plik VatPrefAutoFilterListAfterCreate.inc, 1.2 KB (dodany przez TS, 8 years temu)
xx
Line 
1<?php
2
3/**
4 * VatPrefAutoFilterListAfterCreate
5 *
6 * @author Tomasz Świenty
7 * @version 0.1
8 * @copyright Copyright (c) eDokumenty
9 */
10final class VatPrefAutoFilterListAfterCreate {
11
12
13
14    public static function init($args) {
15
16        if (!isset($args['container'])) {
17            return FALSE;
18        }
19
20        if (!is_object($args['container']) OR !is_a($args['container'], 'Dialog')) {
21            return FALSE;
22        }
23
24        $parentClass = get_class($args['container']);
25        fdebug($parentClass);
26       
27        $data = $args['container']->getData();
28        if (!isset($data['doc_id'])) {
29            return FALSE;
30        }
31
32        require_once(MOD_PATH.'ADocuments/beans/Document.inc');
33        $document = Document::getInstance($data['doc_id']);
34
35        // tylko dla kosztowych
36        if ($document->get('state_') != INCOMING) {
37            return FALSE;
38        }
39
40        // klient z faktury
41        $contid = $document->get('frctid');
42
43        // dodatkowy filtr
44        $filter = '';
45       
46        if (isset($args['container']->dataSource)) {
47            $args['container']->dataSource->whereStatement .= ' AND povcid = '.time().'';
48        }
49
50    }
51
52}
53
54if (isset($args)) {
55    VatPrefAutoFilterListAfterCreate::init($args);
56}
57
58?>