| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * DelegationPluginAfterOpen |
|---|
| 5 | * |
|---|
| 6 | * @author Tomasz Świenty |
|---|
| 7 | * @version 0.1 |
|---|
| 8 | * @copyright Copyright (c) eDokumenty |
|---|
| 9 | */ |
|---|
| 10 | final class DelegationPluginAfterOpen { |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | public static function init($args) { |
|---|
| 15 | |
|---|
| 16 | if (!isset($args['container'])) { |
|---|
| 17 | return FALSE; |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | $document = $args['container']->dialog->getDocumentBean(); |
|---|
| 21 | |
|---|
| 22 | // jeśli edycja dokumentu to nic nie robimy |
|---|
| 23 | if (is_a($document, 'Bean')) { |
|---|
| 24 | return TRUE; |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | require_once('./classes/CubaToolBar/plugins/UnitOfAccountPlugin.inc'); |
|---|
| 28 | $pp = SystemRegistry::get(UnitOfAccountPlugin::REGISTRY_KEY); |
|---|
| 29 | if (isset($pp['acorid'])) { |
|---|
| 30 | $args['container']->acorid->setValue($pp['acorid']); |
|---|
| 31 | |
|---|
| 32 | if (defined('TYPE_OF_DOCUMENT_FOR_ACCORID') AND (TYPE_OF_DOCUMENT_FOR_ACCORID === TRUE)) { |
|---|
| 33 | $set = new TypesOfAccountantsDocDataSet(FALSE, TRUE); |
|---|
| 34 | $set->outputSQL = TRUE; |
|---|
| 35 | |
|---|
| 36 | $args['container']->accdid->query = $set->getByOrganization($pp['acorid']); |
|---|
| 37 | $args['container']->accdid->update(); |
|---|
| 38 | } |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | if (isset($args)) { |
|---|
| 46 | DelegationPluginAfterOpen::init($args); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | ?> |
|---|