1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Nicolaas [at] sunnysideup.co.nz |
4
|
|
|
*/ |
5
|
|
|
class SalesAdminOld extends ReportAdmin |
|
|
|
|
6
|
|
|
{ |
7
|
|
|
public static $url_segment = 'salesold'; |
8
|
|
|
|
9
|
|
|
public static $url_rule = '/$Action/$ID'; |
10
|
|
|
|
11
|
|
|
public static $menu_title = 'Sales'; |
12
|
|
|
|
13
|
|
|
public static $template_path = null; // defaults to (project)/templates/email |
14
|
|
|
|
15
|
|
|
public function init() |
16
|
|
|
{ |
17
|
|
|
parent::init(); |
18
|
|
|
//generic requirements |
19
|
|
|
Requirements::javascript(THIRDPARTY_DIR."/jquery/jquery.js"); |
20
|
|
|
Requirements::javascript(THIRDPARTY_DIR."/jquery-livequery/jquery.livequery.js"); |
21
|
|
|
Requirements::javascript(THIRDPARTY_DIR."/jquery-form/jquery.form.js"); |
22
|
|
|
|
23
|
|
|
|
24
|
|
|
//payment requirements |
25
|
|
|
Requirements::javascript("ecommercextras/javascript/PaymentsReport.js"); |
26
|
|
|
Requirements::customScript('var PaymentsReportURL = "'.Director::baseURL()."PaymentsReport_Handler".'/";', 'PaymentsReport_Handler_Base_URL'); |
|
|
|
|
27
|
|
|
$list = singleton('Payment')->dbObject('Status')->enumValues(); |
28
|
|
|
$js = ''; |
29
|
|
|
foreach ($list as $key => $value) { |
30
|
|
|
if ($key && $value) { |
31
|
|
|
$js .= 'PaymentsReport.addStatus("'.$value.'");'; |
32
|
|
|
} |
33
|
|
|
} |
34
|
|
|
Requirements::customScript($js, "PaymentsReport_Handler_PaymentStatusList"); |
|
|
|
|
35
|
|
|
|
36
|
|
|
//sales report |
37
|
|
|
Requirements::javascript("ecommercextras/javascript/SalesReport.js"); |
38
|
|
|
Requirements::customScript('var SalesReportURL = "'.Director::baseURL()."SalesReport_Handler".'/";', 'SalesReport_Handler_Base_URL'); |
|
|
|
|
39
|
|
|
$list = OrderDecorator::get_order_status_options(); |
40
|
|
|
$js = ''; |
41
|
|
|
foreach ($list as $key => $value) { |
42
|
|
|
if ($key && $value) { |
43
|
|
|
$js .= 'SalesReport.addStatus("'.$value.'");'; |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
Requirements::customScript($js, "SalesReport_Handler_OrderStatusList"); |
|
|
|
|
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Does the parent permission checks, but also |
51
|
|
|
* makes sure that instantiatable subclasses of |
52
|
|
|
* {@link Report} exist. By default, the CMS doesn't |
53
|
|
|
* include any Reports, so there's no point in showing |
54
|
|
|
* |
55
|
|
|
* @param Member $member |
56
|
|
|
* @return boolean |
57
|
|
|
*/ |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Return a DataObjectSet of SSReport subclasses |
62
|
|
|
* that are available for use. |
63
|
|
|
* |
64
|
|
|
* @return DataObjectSet |
65
|
|
|
*/ |
66
|
|
|
public function Reports() |
67
|
|
|
{ |
68
|
|
|
$processedReports = array(); |
69
|
|
|
$subClasses = ClassInfo::subclassesFor('SalesReport'); |
70
|
|
|
|
71
|
|
|
if ($subClasses) { |
|
|
|
|
72
|
|
|
foreach ($subClasses as $subClass) { |
73
|
|
|
if ($subClass != 'SalesReport') { |
74
|
|
|
$processedReports[] = new $subClass(); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
$subClasses = ClassInfo::subclassesFor('PaymentsReport'); |
79
|
|
|
|
80
|
|
|
if ($subClasses) { |
|
|
|
|
81
|
|
|
foreach ($subClasses as $subClass) { |
82
|
|
|
if ($subClass != "PaymentsReport") { |
83
|
|
|
$processedReports[] = new $subClass(); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
$reports = new DataObjectSet($processedReports); |
89
|
|
|
|
90
|
|
|
return $reports; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|
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.