1 <?php
2
3 namespace rpf\api\module;
4 use rpf\api\apiModule;
5
6 class order extends apiModule
7 {
8
9 protected $disposition = array();
10
11 12 13 14 15
16 public function getOrders()
17 {
18 return $this->orders;
19 }
20
21 22 23 24 25
26 public function getData()
27 {
28 return $this->data;
29 }
30
31
32 33 34 35 36 37 38 39 40
41
42 43 44 45 46
47 public function loadAll($param = array(), $runOnce = true)
48 {
49
50 if ($runOnce && !$this->runOnce(__METHOD__)) return $this;
51
52 if (empty($param)) {
53 $this->data = $this->system->call('bbOrder::readEntry', ['return_array' => 1]);
54 }
55
56 else if (isset($param['accounting']))
57 {
58 $this->data = $this->system->call('bbOrder::readEntry', ['return_active' => 1, 'return_dispositions' => 1, 'return_account_entrys' => 1, 'return_array' => 1]);
59 }
60 return $this;
61 }
62
63 public function load($ordNr, $param = array(), $runOnce = true)
64 {
65 if ($runOnce && !$this->runOnce(__METHOD__)) return $this;
66
67 if (empty($param)) {
68 $this->data[$ordNr] = $this->system->call('bbOrder::readEntry', ['return_active' => 1, 'return_dispositions' => 1, 'return_customer' => 1, 'return_adress' => 1, 'ordnr' => $ordNr]);
69 }
70 return $this;
71 }
72
73
74
75 public function getDisposition($ordNr = false)
76 {
77 if ($ordNr !== false && isset($this->disposition[$ordNr]))
78 {
79 return $this->disposition[$ordNr];
80 }
81 else if (!empty($this->disposition))
82 {
83 return $this->disposition;
84 }
85 else
86 {
87 throw new \Exception('We don\'t have any dispositions', 404);
88 }
89 }
90
91
92
93
94
95
96 }