Documentation/Index/VatNoteCostBeanBeforeDelete: VatNoteCostBeforeDelete.inc

Plik VatNoteCostBeforeDelete.inc, 926 bytes (dodany przez TS, 8 years temu)
xx
Line 
1<?php
2
3/**
4 * VatNoteCostBeforeDelete
5 *
6 * @author Tomasz Świenty
7 * @version 0.1
8 * @copyright Copyright (c) eDokumenty
9 */
10final class VatNoteCostBeforeDelete {
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'], 'Bean')) {
21            return FALSE;
22        }
23
24        // dane z beana
25        $data = $args['container']->data;
26       
27        // jakieś sprawdzenia np. czy dodający koszt to ten sam co zalogowany
28        if (!isset($data['adduid']) OR bs_empty_str($data['adduid']) OR ($data['adduid']) != SysContext::$usr_info['usr_id']) {       
29            throw new WidgetException('', 'Nie możesz usunąć tego kosztu bo go nie dodałeś');
30        }
31
32    }
33
34}
35
36if (isset($args)) {
37    VatNoteCostBeforeDelete::init($args);
38}
39
40?>