1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * ForteContactLogObserver |
---|
5 | * |
---|
6 | * @uses LogObserver |
---|
7 | * @final |
---|
8 | * @author Tomasz Świenty |
---|
9 | * @version 0.3 |
---|
10 | * @copyright Copyright (c) BetaSoft |
---|
11 | */ |
---|
12 | final class ForteContactLogObserver extends LogObserver { |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | /** |
---|
17 | * update |
---|
18 | * |
---|
19 | * @param SplSubject $subject |
---|
20 | * @access public |
---|
21 | * @return void |
---|
22 | */ |
---|
23 | public function update(SplSubject $subject) { |
---|
24 | |
---|
25 | if (!is_a($subject, 'Log')) { |
---|
26 | return TRUE; |
---|
27 | } |
---|
28 | |
---|
29 | $event = $subject->getLastEvent(); |
---|
30 | |
---|
31 | $details = $event->getEventDetails(TRUE); |
---|
32 | $chacat = $event->getEventCategory(); |
---|
33 | $clsnam = $event->getEventClsnam(); |
---|
34 | |
---|
35 | $keyval = $event->getEventKeyval(); |
---|
36 | $actor = $event->getEventActor(); |
---|
37 | $priorText = $event->getEventPriority(TRUE); |
---|
38 | |
---|
39 | if (!$chacat) { |
---|
40 | return TRUE; |
---|
41 | } |
---|
42 | |
---|
43 | if ($clsnam != 'CONTACT') { |
---|
44 | return TRUE; |
---|
45 | } |
---|
46 | |
---|
47 | if ($chacat == 'ADDED') { |
---|
48 | |
---|
49 | require_once('./classes/BSConnectReadOnly/managers/BSConnectContactsManager.inc'); |
---|
50 | ErrorHandler::tryBegin(); |
---|
51 | |
---|
52 | try { |
---|
53 | error_log("DODANO KONTAKT ID:".$keyval, 3, "./var/log/observer.log"); |
---|
54 | $featid = 222; |
---|
55 | $tblnam = 'contacts'; |
---|
56 | $tbl_id = $keyval; |
---|
57 | $value = 'GPS>12,23,34'; |
---|
58 | require_once('./classes/FeatureBox/FeaturesHelper.inc'); |
---|
59 | $out = FeaturesHelper::setTextValue($featid, $tblnam, $tbl_id, $value); |
---|
60 | |
---|
61 | } catch (BSConnectException $e) { |
---|
62 | // JScript::alert(sprintf(Translator::translate('Eksport kontrahenta do systemu zew. %s zakończony niepowodzeniem.%s'), $requestConfig['system'], '<br><br>'.$e->getMessage())); |
---|
63 | } |
---|
64 | |
---|
65 | ErrorHandler::tryEnd(); |
---|
66 | |
---|
67 | } |
---|
68 | |
---|
69 | } |
---|
70 | |
---|
71 | } // class ForteContactLogObserver |
---|
72 | |
---|
73 | ?> |
---|