|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class OrderStep_RecordDeviceDetails extends OrderStep implements OrderStepInterface |
|
4
|
|
|
{ |
|
5
|
|
|
public function HideFromEveryone() |
|
6
|
|
|
{ |
|
7
|
|
|
return true; |
|
8
|
|
|
} |
|
9
|
|
|
|
|
10
|
|
|
private static $defaults = array( |
|
|
|
|
|
|
11
|
|
|
'CustomerCanEdit' => 0, |
|
12
|
|
|
'CustomerCanPay' => 0, |
|
13
|
|
|
'CustomerCanCancel' => 0, |
|
14
|
|
|
'Name' => 'Record Device Details', |
|
15
|
|
|
'Code' => 'RECORD_DEVICE_DETAILS', |
|
16
|
|
|
'ShowAsInProcessOrder' => 1, |
|
17
|
|
|
); |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* The OrderStatusLog that is relevant to the particular step. |
|
21
|
|
|
* |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $relevantLogEntryClassName = 'OrderStatusLog_DeviceDetails'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Can run this step once any items have been submitted. |
|
28
|
|
|
* makes sure the step is ready to run.... (e.g. check if the order is ready to be emailed as receipt). |
|
29
|
|
|
* should be able to run this function many times to check if the step is ready. |
|
30
|
|
|
* |
|
31
|
|
|
* @see Order::doNextStatus |
|
32
|
|
|
* |
|
33
|
|
|
* @param Order object |
|
34
|
|
|
* |
|
35
|
|
|
* @return bool - true if the current step is ready to be run... |
|
36
|
|
|
**/ |
|
37
|
|
|
public function initStep(Order $order) |
|
38
|
|
|
{ |
|
39
|
|
|
return true; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* |
|
44
|
|
|
* @param Order object |
|
45
|
|
|
* |
|
46
|
|
|
* @return bool - true if run correctly. |
|
47
|
|
|
**/ |
|
48
|
|
|
public function doStep(Order $order) |
|
49
|
|
|
{ |
|
50
|
|
|
$className = $this->getRelevantLogEntryClassName(); |
|
51
|
|
View Code Duplication |
if (class_exists($className)) { |
|
|
|
|
|
|
52
|
|
|
$obj = $className::create(); |
|
53
|
|
|
if (is_a($obj, Object::getCustomClass('OrderStatusLog'))) { |
|
54
|
|
|
$obj->OrderID = $order->ID; |
|
55
|
|
|
$obj->Title = $this->Name; |
|
|
|
|
|
|
56
|
|
|
$obj->write(); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
return true; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* go to next step if order has been submitted. |
|
64
|
|
|
* |
|
65
|
|
|
* @param Order $order |
|
66
|
|
|
* |
|
67
|
|
|
* @return OrderStep | Null (next step OrderStep) |
|
|
|
|
|
|
68
|
|
|
**/ |
|
69
|
|
|
public function nextStep(Order $order) |
|
70
|
|
|
{ |
|
71
|
|
|
return parent::nextStep($order); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Explains the current order step. |
|
77
|
|
|
* |
|
78
|
|
|
* @return string |
|
79
|
|
|
*/ |
|
80
|
|
|
protected function myDescription() |
|
81
|
|
|
{ |
|
82
|
|
|
return _t('OrderStep.RECORDDEVICEDETAILS_DESCRIPTION', 'Records the device details of the customer placing the order.'); |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|