initial commit
[namibia] / module / Stock / src / Stock / Workflow.php
1 <?php
2 namespace Stock;
3
4
5 /**
6  * A workflow.
7  * @author andre.fourie
8  */
9
10 class Workflow extends \Workspace\Workflow
11 {
12
13         /**
14          * @var string
15          */
16         protected $namespace = __NAMESPACE__;
17         /**
18          * @var string
19          */
20         protected $parentFeature = 'Stock';
21         /**
22          * @var string
23          */
24         protected $initState = 'This.NewItem';
25         /**
26          * @var string
27          */
28         protected $initTrigger = 'Stock.Create';
29         /**
30          * @var string
31          */
32         protected $primaryEntity = 'Stock';
33         /**
34          * @var array
35          */
36         protected $entityMap = array(
37                 'Stock'     => '\Stock\Entity\Stock',
38                 'Accessory' => '\Stock\Entity\Accessory'
39         );
40         /**
41          * @var array
42          */
43         protected $linkMap = array(
44                 'Valuation'  => 'Stock',
45                 'PriceGuide' => 'Stock',
46                 'Auction'    => 'Stock',
47                 'Retail'     => 'Stock'
48         );
49         /**
50          * @var array
51          */
52         protected $listen = array();
53         /**
54          * @var array
55          */
56         protected $reclaim = array();
57         /**
58          * @var array
59          */
60         protected $stateLabel = array(
61                 'PriceGuide'  => 'Price Guide',
62                 'TradeCenter' => 'Trade Center'
63         );
64         /**
65          * @var array
66          */
67         protected $stateMap = array(
68                 'Global'       => array(
69                         'Actions' => array(
70                                 'Tuhpi.Grid'                    => array(),
71                                 'Tuhpi.Create'                  => array(),
72                                 'Tuhpi.Print'                   => array(),
73                 'Tuhpi.PrintAccident'           => array(),
74                                 'Tuhpi.List'                    => array(),
75                                 'Import.Upload'                 => array(),
76                 'BulkImport.Upload'             => array(),
77                                 'Stock.Grid'                    => array(),
78                                 'Type.GetMmCode'                => array(),
79                                 'Type.SelectList'               => array(),
80                                 'Stock.Create'                  => array(),
81                                 'Stock.CreateAuction'           => array(),
82                                 'Stock.TradeCenterGrid'         => array(),
83                                 'Report.StockControl'           => array(),
84                                 'Make.SelectList'               => array(),
85                                 'MakeMobi.SelectList'           => array(),
86                                 'RegionMobi.SelectList'         => array(),
87                                 'Year.SelectList'               => array(),
88                                 'Accessory.List'                => array(),
89                                 'Accessory.SelectList'          => array(),
90                                 'Damage.List'                   => array(),
91                                 'Damage.SelectList'             => array(),
92                                 'Category.SelectList'           => array(),
93                                 'Condition.SelectList'          => array(),
94                                 'ExteriorColour.SelectList'     => array(),
95                                 'InteriorColour.SelectList'     => array(),
96                                 'Upholstery.SelectList'         => array(),
97                                 'Paper.SelectList'              => array(),
98                                 'Natis.SelectList'              => array(),
99                                 'FullServiceHistory.SelectList' => array(),
100                                 'TransmissionType.SelectList'   => array(),
101                                 'FuelType.SelectList'           => array(),
102                                 'Accessory.Create'              => array(),
103                                 'Accessory.Update'              => array(),
104                                 'Damage.Create'                 => array(),
105                                 'Damage.Update'                 => array(),
106                                 'ExteriorColour.Create'         => array(),
107                                 'ExteriorColour.Update'         => array(),
108                                 'InteriorColour.Create'         => array(),
109                                 'InteriorColour.Update'         => array(),
110                                 'FuelType.Create'               => array(),
111                                 'FuelType.Update'               => array(),
112                                 'TransmissionType.Create'       => array(),
113                                 'TransmissionType.Update'       => array(),
114                                 'FullServiceHistory.Create'     => array(),
115                                 'FullServiceHistory.Update'     => array(),
116                                 'Natis.Create'                  => array(),
117                                 'Natis.Update'                  => array(),
118                                 'Paper.Create'                  => array(),
119                                 'Paper.Update'                  => array(),
120                                 'Upholstery.Create'             => array(),
121                                 'Upholstery.Update'             => array(),
122                                 'Utility.ListMakes'             => array(),
123                                 'Utility.ListModels'            => array(),
124                                 'Utility.ListTypes'             => array(),
125                                 'Utility.TransUnionFromMmCode'  => array(),
126                                 'Utility.TransUnionForHPI'      => array(),
127                 'Utility.TransUnionForHPIAccident'      => array(),
128                                 'PricingHistory.Grid'           => array()
129                         )
130                 ),
131                 'NewItem'      => array(
132                         'InitRoute' => 'Stock.routeNewItem'
133                 ),
134                 /*
135                  * Internal states.
136                  */
137                 'Stock'        => array(
138                         'Actions' => array(
139                                 'Stock.Update' => array(),
140                                 'Stock.View'   => array(),
141                                 'Pdf.Print'    => array(),
142                                 'Tuhpi.Print'  => array(),
143                 'Tuhpi.PrintAccident'  => array()
144                         ),
145                         'Routes'  => array(
146                                 'Stock.SendToRetail'      => array(),
147                                 'Stock.SendToPriceGuide'  => array(
148                                         'Destination'      => 'PriceGuide.NewItem',
149                                         'ContractRequired' => true
150                                 ),
151                                 'Stock.SendToRetail'      => array(
152                                         'Destination'      => 'Retail.NewItem',
153                                         'ContractRequired' => true
154                                 ),
155                                 'Stock.SendToAuction'     => array(
156                                         'Destination'      => 'Auction.NewItem',
157                                         'ContractRequired' => true
158                                 ),
159                                 'Stock.SendToTradeCenter' => array(),
160                                 'Stock.MoveToArchive'  => array(
161                                         'Destination' => 'This.Archived'
162                                 )
163                         )
164                 ),
165                 'Sold'         => array(
166                         'Actions'   => array(
167                                 'Stock.LimitedUpdate' => array(),
168                                 'Stock.View'          => array(),
169                                 'Pdf.Print'           => array()
170                         ),
171                         'RouteBack' => array(
172                                 'Action' => 'Stock.routeAuctionHandover'
173                         ),
174                         'Routes'    => array()
175                 ),
176                 'Retail'       => array(
177                         'Actions' => array(
178                                 'Stock.LimitedUpdate' => array(),
179                                 'Stock.View'          => array(),
180                                 'Pdf.Print'           => array()
181                         ),
182                         'Routes'  => array(
183                                 'Stock.ReclaimFromRetail' => array()
184                         )
185                 ),
186                 'Trade Center' => array(
187                         'Actions' => array(
188                                 'Stock.Update'        => array(),
189                                 'Stock.LimitedUpdate' => array(),
190                                 'Stock.View'          => array(),
191                                 'Pdf.Print'           => array()
192                         ),
193                         'Routes'  => array(
194                                 'Stock.SendToAuction' => array(
195                                         'Destination'      => 'Auction.NewItem',
196                                         'ContractRequired' => true
197                                 ),
198                                 'Stock.SendToDealer'  => array(
199                                         'Destination' => 'This.Stock'
200                                 )
201                         )
202                 ),
203                 'Archived'     => array(
204                         'Actions' => array(
205                                 'Stock.LimitedUpdate' => array(),
206                                 'Stock.View'          => array(),
207                                 'Pdf.Print'           => array()
208                         ),
209                         'Routes'  => array(
210                                 'Stock.MoveToStock' => array(
211                                         'Destination' => 'This.Stock'
212                                 )
213                         )
214                 ),
215                 /*
216                  * External states.
217                  */
218                 'Valuation'    => array(
219                         'Actions'   => array(
220                                 'Stock.Update' => array(),
221                                 'Stock.View'   => array(),
222                                 'Pdf.Print'    => array(),
223                                 'Tuhpi.Print'  => array(),
224                 'Tuhpi.PrintAccident'  => array()
225                         ),
226                         'RouteBack' => array(
227                                 'State' => 'This.Stock'
228                         )
229                 ),
230                 'Price Guide'  => array(
231                         'Actions'   => array(
232                                 'Stock.LimitedUpdate' => array(),
233                                 'Stock.View'          => array(),
234                                 'Pdf.Print'           => array(),
235                                 'Tuhpi.Print'         => array(),
236                 'Tuhpi.PrintAccident'  => array()
237                         ),
238                         'RouteBack' => array(
239                                 'State' => 'This.Stock'
240                         )
241                 ),
242                 'Auction'      => array(
243                         'Actions'   => array(
244                                 'Stock.Update'        => array(),
245                                 'Stock.LimitedUpdate' => array(),
246                                 'Stock.View'          => array(),
247                                 'Pdf.Print'           => array(),
248                                 'Tuhpi.Print'         => array(),
249                 'Tuhpi.PrintAccident'  => array()
250                         ),
251                         'RouteBack' => array(
252                                 'Action' => 'Stock.routeAuctionHandover'
253                         )
254                 ),
255         'Relist'     => array(
256             'Actions'   => array(
257                 'Stock.Update'        => array(),
258                 'Stock.LimitedUpdate' => array(),
259                 'Stock.View'          => array(),
260                 'Pdf.Print'           => array(),
261                 'Tuhpi.Print'         => array(),
262                 'Tuhpi.PrintAccident'  => array()
263             ),
264             'RouteBack' => array(
265                 'Action' => 'Stock.routeAuctionHandover'
266             )
267         ),
268         );
269
270
271 }