1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * DelegationPluginBeforeOpen |
---|
5 | * Tylko walidacja czy wybrano jednostkę rozliczeniową jako kontekst pracy |
---|
6 | * |
---|
7 | * @author Tomasz Świenty |
---|
8 | * @version 0.1 |
---|
9 | * @copyright Copyright (c) eDokumenty |
---|
10 | */ |
---|
11 | final class DelegationPluginBeforeOpen { |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | public static function init($args) { |
---|
16 | |
---|
17 | if (!isset($args['container'])) { |
---|
18 | return FALSE; |
---|
19 | } |
---|
20 | |
---|
21 | $document = $args['container']->dialog->getDocumentBean(); |
---|
22 | |
---|
23 | // jeśli edycja dokumentu to nic nie robimy |
---|
24 | if (is_a($document, 'Bean')) { |
---|
25 | return TRUE; |
---|
26 | } |
---|
27 | |
---|
28 | require_once('./classes/CubaToolBar/plugins/UnitOfAccountPlugin.inc'); |
---|
29 | $pp = SystemRegistry::get(UnitOfAccountPlugin::REGISTRY_KEY); |
---|
30 | if (!isset($pp['acorid'])) { |
---|
31 | throw new WidgetException((new UnitOfAccountPlugin())->getHWND(), Translator::translate('Wybierz jednostkę rozliczeniową')); |
---|
32 | //throw new CustomErrorException(Translator::translate('Wybierz jednostkę rozliczeniową')); |
---|
33 | } |
---|
34 | |
---|
35 | } |
---|
36 | |
---|
37 | } |
---|
38 | |
---|
39 | if (isset($args)) { |
---|
40 | DelegationPluginBeforeOpen::init($args); |
---|
41 | } |
---|
42 | |
---|
43 | ?> |
---|