|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
class OrderStep_QuickDispatch extends OrderStep_Sent implements OrderStepInterface |
|
|
|
|
|
|
6
|
|
|
{ |
|
7
|
|
|
private static $defaults = array( |
|
|
|
|
|
|
8
|
|
|
'CustomerCanEdit' => 0, |
|
9
|
|
|
'CustomerCanPay' => 0, |
|
10
|
|
|
'CustomerCanCancel' => 0, |
|
11
|
|
|
'Name' => 'Dispatch', |
|
12
|
|
|
'Code' => 'QUICK_DISPATCH', |
|
13
|
|
|
'ShowAsInProcessOrder' => 1, |
|
14
|
|
|
); |
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Can run this step once any items have been submitted. |
|
19
|
|
|
* makes sure the step is ready to run.... (e.g. check if the order is ready to be emailed as receipt). |
|
20
|
|
|
* should be able to run this function many times to check if the step is ready. |
|
21
|
|
|
* |
|
22
|
|
|
* @see Order::doNextStatus |
|
23
|
|
|
* |
|
24
|
|
|
* @param Order object |
|
25
|
|
|
* |
|
26
|
|
|
* @return bool - true if the current step is ready to be run... |
|
27
|
|
|
**/ |
|
28
|
|
|
public function initStep(Order $order) |
|
29
|
|
|
{ |
|
30
|
|
|
return parent::initStep($order); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Add a member to the order - in case he / she is not a shop admin. |
|
35
|
|
|
* |
|
36
|
|
|
* @param Order object |
|
37
|
|
|
* |
|
38
|
|
|
* @return bool - true if run correctly. |
|
|
|
|
|
|
39
|
|
|
**/ |
|
40
|
|
|
public function doStep(Order $order) |
|
41
|
|
|
{ |
|
42
|
|
|
if ($order->HasBeenDispatched) { |
|
43
|
|
|
if (! $this->RelevantLogEntry($order)) { |
|
44
|
|
|
$log = OrderStatusLog_DispatchPhysicalOrder::create(); |
|
45
|
|
|
$log->OrderID = $order->ID; |
|
46
|
|
|
$log->write(); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
return parent::doStep($order); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* go to next step if order has been submitted. |
|
54
|
|
|
* |
|
55
|
|
|
* @param Order $order |
|
56
|
|
|
* |
|
57
|
|
|
* @return OrderStep | Null (next step OrderStep) |
|
|
|
|
|
|
58
|
|
|
**/ |
|
59
|
|
|
public function nextStep(Order $order) |
|
60
|
|
|
{ |
|
61
|
|
|
return parent::nextStep($order); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Explains the current order step. |
|
67
|
|
|
* |
|
68
|
|
|
* @return string |
|
69
|
|
|
*/ |
|
70
|
|
|
protected function myDescription() |
|
71
|
|
|
{ |
|
72
|
|
|
return _t('OrderStep.QUICKDISPATCH_DESCRIPTION', 'The order is on its way to the customer.'); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.