Completed
Push — master ( 23aac3...27533a )
by Nicolaas
03:31
created

OrderStep_QuickDispatch::initStep()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
4
5
class OrderStep_QuickDispatch extends OrderStep_Sent implements OrderStepInterface
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
8
    private static $defaults = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $defaults is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
9
        'CustomerCanEdit' => 0,
10
        'CustomerCanPay' => 0,
11
        'CustomerCanCancel' => 0,
12
        'Name' => 'Dispatch',
13
        'Code' => 'QUICK_DISPATCH',
14
        'ShowAsInProcessOrder' => 1,
15
    );
16
17
18
    /**
19
     * Can run this step once any items have been submitted.
20
     * makes sure the step is ready to run.... (e.g. check if the order is ready to be emailed as receipt).
21
     * should be able to run this function many times to check if the step is ready.
22
     *
23
     * @see Order::doNextStatus
24
     *
25
     * @param Order object
26
     *
27
     * @return bool - true if the current step is ready to be run...
28
     **/
29
    public function initStep(Order $order)
30
    {
31
        return parent::initStep($order);
32
    }
33
34
     /**
35
      * Add a member to the order - in case he / she is not a shop admin.
36
      *
37
      * @param Order object
38
      *
39
      * @return bool - true if run correctly.
0 ignored issues
show
Documentation introduced by
Should the return type not be boolean|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
40
      **/
41
     public function doStep(Order $order)
42
     {
43
         if($order->HasBeenDispatched) {
44
            if ( ! $this->RelevantLogEntry($order)) {
45
                 $log = OrderStatusLog_DispatchPhysicalOrder::create();
46
                 $log->OrderID = $order->ID;
47
                 $log->write();
48
            }
49
         }
50
         return parent::doStep($order);
51
     }
52
53
    /**
54
     * go to next step if order has been submitted.
55
     *
56
     * @param Order $order
57
     *
58
     * @return OrderStep | Null	(next step OrderStep)
0 ignored issues
show
Documentation introduced by
Should the return type not be OrderStep|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
59
     **/
60
    public function nextStep(Order $order)
61
    {
62
        return parent::nextStep($order);
63
    }
64
65
66
    /**
67
     * Explains the current order step.
68
     *
69
     * @return string
70
     */
71
    protected function myDescription()
72
    {
73
        return _t('OrderStep.QUICKDISPATCH_DESCRIPTION', 'The order is on its way to the customer.');
74
    }
75
76
77
78
}
79