Completed
Branch 1.2 (19915c)
by Jason
02:54
created
thirdparty/rc4crypt.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @access public
36 36
 	 * @return string
37 37
 	 */
38
-	static function encrypt ($pwd, $data, $ispwdHex = 0)
38
+	static function encrypt($pwd, $data, $ispwdHex = 0)
39 39
 	{
40 40
 		if ($ispwdHex)
41 41
 			$pwd = @pack('H*', $pwd); // valid input, please!
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @access public
81 81
 	 * @return string
82 82
 	 */
83
-	static function decrypt ($pwd, $data, $ispwdHex = 0)
83
+	static function decrypt($pwd, $data, $ispwdHex = 0)
84 84
 	{
85 85
 		return self::encrypt($pwd, $data, $ispwdHex);
86 86
 	}
Please login to merge, or discard this patch.
code/admin/OrderAdmin.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,19 +10,19 @@
 block discarded – undo
10 10
 	
11 11
 	static $menu_title = 'Orders';
12 12
 
13
-    public function getEditForm($id = null, $fields = null) {
14
-        $form = parent::getEditForm($id, $fields);
13
+	public function getEditForm($id = null, $fields = null) {
14
+		$form = parent::getEditForm($id, $fields);
15 15
 
16
-        $gridFieldName = $this->sanitiseClassName($this->modelClass);
17
-        $gridField = $form->Fields()->fieldByName($gridFieldName);
16
+		$gridFieldName = $this->sanitiseClassName($this->modelClass);
17
+		$gridField = $form->Fields()->fieldByName($gridFieldName);
18 18
 
19
-        // GridField configuration
20
-        $config = $gridField->getConfig();
19
+		// GridField configuration
20
+		$config = $gridField->getConfig();
21 21
 
22
-        // remove edit icon
23
-        $config->removeComponentsByType('GridFieldEditButton');
22
+		// remove edit icon
23
+		$config->removeComponentsByType('GridFieldEditButton');
24 24
 
25
-        return $form;
26
-    }
25
+		return $form;
26
+	}
27 27
 	
28 28
 }
Please login to merge, or discard this patch.
code/model/foxycart.cart_validation.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 							$input_signed = preg_replace('%([\'"])'.$prefix.preg_quote($name[2]).'\1%', '${1}'.$prefix.self::fc_hash_value($code, $name[2], $value[2], 'name', FALSE)."$1", $input);
253 253
 						}
254 254
 						self::$log[] = '<strong>INPUT:</strong> Code: <strong>'.htmlspecialchars($prefix.$code).
255
-						               '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$name[2]).
256
-						               '</strong> :: Value: <strong>'.htmlspecialchars($value[2]).
257
-						               '</strong><br />Initial input: '.htmlspecialchars($input).
258
-						               '<br />Signed: <span style="color:#060;">'.htmlspecialchars($input_signed).'</span>';
255
+									   '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$name[2]).
256
+									   '</strong> :: Value: <strong>'.htmlspecialchars($value[2]).
257
+									   '</strong><br />Initial input: '.htmlspecialchars($input).
258
+									   '<br />Signed: <span style="color:#060;">'.htmlspecialchars($input_signed).'</span>';
259 259
 						$form = str_replace($input, $input_signed, $form);
260 260
 					}
261 261
 				}
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 							$option[0]);
277 277
 						$form_part_signed = str_replace($option[0], $option_signed, $form_part_signed );
278 278
 						self::$log[] = '<strong>OPTION:</strong> Code: <strong>'.htmlspecialchars($prefix.$code).
279
-						               '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]).
280
-						               '</strong> :: Value: <strong>'.htmlspecialchars($option[2]).
281
-						               '</strong><br />Initial option: '.htmlspecialchars($option[0]).
282
-						               '<br />Signed: <span style="color:#060;">'.htmlspecialchars($option_signed).'</span>';
279
+									   '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]).
280
+									   '</strong> :: Value: <strong>'.htmlspecialchars($option[2]).
281
+									   '</strong><br />Initial option: '.htmlspecialchars($option[0]).
282
+									   '<br />Signed: <span style="color:#060;">'.htmlspecialchars($option_signed).'</span>';
283 283
 					}
284 284
 					$form = str_replace($list[0], $form_part_signed, $form);
285 285
 				}
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 					$textarea_signed = preg_replace('%([\'"])'.preg_quote($prefix.$textarea[2]).'\1%', "$1".self::fc_hash_value($code, $textarea[2], $textarea[3], 'name', FALSE)."$1", $textarea[0]);
296 296
 					$form = str_replace($textarea[0], $textarea_signed, $form);
297 297
 					self::$log[] = '<strong>TEXTAREA:</strong> Code: <strong>'.htmlspecialchars($prefix.$code).
298
-					               '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$textarea[2]).
299
-					               '</strong> :: Value: <strong>'.htmlspecialchars($textarea[3]).
300
-					               '</strong><br />Initial textarea: '.htmlspecialchars($textarea[0]).
301
-					               '<br />Signed: <span style="color:#060;">'.htmlspecialchars($textarea_signed).'</span>';
298
+								   '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$textarea[2]).
299
+								   '</strong> :: Value: <strong>'.htmlspecialchars($textarea[3]).
300
+								   '</strong><br />Initial textarea: '.htmlspecialchars($textarea[0]).
301
+								   '<br />Signed: <span style="color:#060;">'.htmlspecialchars($textarea_signed).'</span>';
302 302
 				}
303 303
 				self::$log[] = '<strong>FORM after TEXTAREAS:</strong> <pre>'.htmlspecialchars($form).'</pre>';
304 304
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,20 +30,20 @@  discard block
 block discarded – undo
30 30
 	// protected static $cart_url = 'https://yourdomain.foxycart.com/cart';
31 31
 	protected static $cart_url;
32 32
 
33
-	public static function setCartURL($storeName = null){
33
+	public static function setCartURL($storeName = null) {
34 34
 		self::$cart_url = 'https://'.$storeName.'.faxycart.com/cart';
35 35
 	}
36 36
 
37
-	public static function setSecret($secret = null){
37
+	public static function setSecret($secret = null) {
38 38
 		self::$secret = $secret;
39 39
 	}
40 40
 
41
-	public function __construct(){
41
+	public function __construct() {
42 42
 		self::setCartURL(FoxyCart::getFoxyCartStoreName());
43 43
 		self::setSecret(FoxyCart::getStoreKey());
44 44
 	}
45 45
 
46
-	public static function getSecret(){
46
+	public static function getSecret() {
47 47
 		return FoxyCart::getStoreKey();
48 48
 	}
49 49
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				$codes[$pair['prefix']] = $pair['value'];
108 108
 			}
109 109
 		}
110
-		if ( ! count($codes)) {
110
+		if (!count($codes)) {
111 111
 			self::$log[] = '<strong style="color:#600;">No code found</strong> for the above link.';
112 112
 			return $fail;
113 113
 		}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 		if ($output) {
133 133
 			echo self::$cart_url.'?'.$qs;
134
-		} else {
134
+		}else {
135 135
 			return self::$cart_url.'?'.$qs;
136 136
 		}
137 137
 	}
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 		if ($option_value == '--OPEN--') {
150 150
 			$hash = hash_hmac('sha256', $product_code.$option_name.$option_value, self::getSecret());
151 151
 			$value = ($urlencode) ? urlencode($option_name).'||'.$hash.'||open' : $option_name.'||'.$hash.'||open';
152
-		} else {
152
+		}else {
153 153
 			$hash = hash_hmac('sha256', $product_code.$option_name.$option_value, self::getSecret());
154 154
 			if ($method == 'name') {
155 155
 				$value = ($urlencode) ? urlencode($option_name).'||'.$hash : $option_name.'||'.$hash;
156
-			} else {
156
+			}else {
157 157
 				$value = ($urlencode) ? urlencode($option_value).'||'.$hash : $option_value.'||'.$hash;
158 158
 			}
159 159
 		}
160 160
 
161 161
 		if ($output) {
162 162
 			echo $value;
163
-		} else {
163
+		}else {
164 164
 			return $value;
165 165
 		}
166 166
 	}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 						$value[2] = ($value[2] == '') ? '--OPEN--' : $value[2];
249 249
 						if ($type[2] == 'radio') {
250 250
 							$input_signed = preg_replace('%([\'"])'.preg_quote($value[2]).'\1%', '${1}'.self::fc_hash_value($code, $name[2], $value[2], 'value', FALSE)."$1", $input);
251
-						} else {
251
+						}else {
252 252
 							$input_signed = preg_replace('%([\'"])'.$prefix.preg_quote($name[2]).'\1%', '${1}'.$prefix.self::fc_hash_value($code, $name[2], $value[2], 'name', FALSE)."$1", $input);
253 253
 						}
254 254
 						self::$log[] = '<strong>INPUT:</strong> Code: <strong>'.htmlspecialchars($prefix.$code).
@@ -267,14 +267,14 @@  discard block
 block discarded – undo
267 267
 					$count['lists']++;
268 268
 					preg_match_all('%<option [^>]*value=([\'"])(.+?)\1[^>]*>(?:.*?)</option>%i', $list[0], $options, PREG_SET_ORDER);
269 269
 					self::$log[] = '<strong>Options:</strong> <pre>'.htmlspecialchars(print_r($options, true)).'</pre>';
270
-					unset( $form_part_signed );
270
+					unset($form_part_signed);
271 271
 					foreach ($options as $option) {
272
-						if( !isset($form_part_signed) ) $form_part_signed = $list[0];
272
+						if (!isset($form_part_signed)) $form_part_signed = $list[0];
273 273
 						$option_signed = preg_replace(
274 274
 							'%'.preg_quote($option[1]).preg_quote($option[2]).preg_quote($option[1]).'%',
275 275
 							$option[1].self::fc_hash_value($code, $list[2], $option[2], 'value', FALSE).$option[1],
276 276
 							$option[0]);
277
-						$form_part_signed = str_replace($option[0], $option_signed, $form_part_signed );
277
+						$form_part_signed = str_replace($option[0], $option_signed, $form_part_signed);
278 278
 						self::$log[] = '<strong>OPTION:</strong> Code: <strong>'.htmlspecialchars($prefix.$code).
279 279
 						               '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]).
280 280
 						               '</strong> :: Value: <strong>'.htmlspecialchars($option[2]).
Please login to merge, or discard this patch.
code/model/FoxyCart.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -48,69 +48,69 @@
 block discarded – undo
48 48
 		return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName() );
49 49
 	}
50 50
 
51
-    /**
52
-     * FoxyCart API v1.1 functions
53
-     */
54
-
55
-    // FoxyCart API Request
56
-    private static function getAPIRequest($foxyData = array()) {
57
-
58
-        $foxy_domain = FoxyCart::getFoxyCartStoreName().'.foxycart.com';
59
-        $foxyData["api_token"] = FoxyCart::getStoreKey();
60
-
61
-        $ch = curl_init();
62
-        curl_setopt($ch, CURLOPT_URL, "https://" . $foxy_domain . "/api");
63
-        curl_setopt($ch, CURLOPT_POSTFIELDS, $foxyData);
64
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
65
-        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
66
-        curl_setopt($ch, CURLOPT_TIMEOUT, 15);
67
-        // If you get SSL errors, you can uncomment the following, or ask your host to add the appropriate CA bundle
68
-        // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
69
-        $response = trim(curl_exec($ch));
70
-
71
-        // The following if block will print any CURL errors you might have
72
-        if ($response == false) {
73
-            //trigger_error("Could not connect to FoxyCart API", E_USER_ERROR);
74
-            SS_Log::log("Could not connect to FoxyCart API: " . $response, SS_Log::ERR);
75
-        }
76
-        curl_close($ch);
77
-
78
-        return $response;
79
-    }
80
-
81
-    public static function getCustomer($Member = null) {
82
-
83
-        // throw error if no $Member Object
84
-        if (!isset($Member)) trigger_error('No Member set', E_USER_ERROR);
85
-
86
-        // grab customer record from API
87
-
88
-        $foxyData = array();
89
-        $foxyData["api_action"] = "customer_get";
90
-        if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID;
91
-        $foxyData["customer_email"] = $Member->Email;
92
-
93
-        return self::getAPIRequest($foxyData);
94
-
95
-    }
96
-
97
-    public static function putCustomer($Member = null) {
98
-        // throw error if no $Member Object
99
-        if (!isset($Member)) ;//trigger_error('No Member set', E_USER_ERROR);
100
-
101
-        // send updated customer record from API
102
-        $foxyData = array();
103
-        $foxyData["api_action"] = "customer_save";
104
-        // customer_id will be 0 if created in SilverStripe.
105
-        if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID;
106
-        $foxyData["customer_email"] = $Member->Email;
107
-        $foxyData["customer_password_hash"] = $Member->Password;
108
-        $foxyData["customer_password_salt"] = $Member->Salt;
109
-        $foxyData["customer_first_name"] = $Member->FirstName;
110
-        $foxyData["customer_last_name"] = $Member->Surname;
111
-
112
-        return self::getAPIRequest($foxyData);
113
-    }
51
+	/**
52
+	 * FoxyCart API v1.1 functions
53
+	 */
54
+
55
+	// FoxyCart API Request
56
+	private static function getAPIRequest($foxyData = array()) {
57
+
58
+		$foxy_domain = FoxyCart::getFoxyCartStoreName().'.foxycart.com';
59
+		$foxyData["api_token"] = FoxyCart::getStoreKey();
60
+
61
+		$ch = curl_init();
62
+		curl_setopt($ch, CURLOPT_URL, "https://" . $foxy_domain . "/api");
63
+		curl_setopt($ch, CURLOPT_POSTFIELDS, $foxyData);
64
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
65
+		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
66
+		curl_setopt($ch, CURLOPT_TIMEOUT, 15);
67
+		// If you get SSL errors, you can uncomment the following, or ask your host to add the appropriate CA bundle
68
+		// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
69
+		$response = trim(curl_exec($ch));
70
+
71
+		// The following if block will print any CURL errors you might have
72
+		if ($response == false) {
73
+			//trigger_error("Could not connect to FoxyCart API", E_USER_ERROR);
74
+			SS_Log::log("Could not connect to FoxyCart API: " . $response, SS_Log::ERR);
75
+		}
76
+		curl_close($ch);
77
+
78
+		return $response;
79
+	}
80
+
81
+	public static function getCustomer($Member = null) {
82
+
83
+		// throw error if no $Member Object
84
+		if (!isset($Member)) trigger_error('No Member set', E_USER_ERROR);
85
+
86
+		// grab customer record from API
87
+
88
+		$foxyData = array();
89
+		$foxyData["api_action"] = "customer_get";
90
+		if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID;
91
+		$foxyData["customer_email"] = $Member->Email;
92
+
93
+		return self::getAPIRequest($foxyData);
94
+
95
+	}
96
+
97
+	public static function putCustomer($Member = null) {
98
+		// throw error if no $Member Object
99
+		if (!isset($Member)) ;//trigger_error('No Member set', E_USER_ERROR);
100
+
101
+		// send updated customer record from API
102
+		$foxyData = array();
103
+		$foxyData["api_action"] = "customer_save";
104
+		// customer_id will be 0 if created in SilverStripe.
105
+		if ($Member->Customer_ID) $foxyData["customer_id"] = $Member->Customer_ID;
106
+		$foxyData["customer_email"] = $Member->Email;
107
+		$foxyData["customer_password_hash"] = $Member->Password;
108
+		$foxyData["customer_password_salt"] = $Member->Salt;
109
+		$foxyData["customer_first_name"] = $Member->FirstName;
110
+		$foxyData["customer_last_name"] = $Member->Surname;
111
+
112
+		return self::getAPIRequest($foxyData);
113
+	}
114 114
 
115 115
 	public static function getKeyPrefix(){
116 116
 		return self::$keyPrefix;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,43 +9,43 @@  discard block
 block discarded – undo
9 9
 
10 10
 	private static $keyPrefix = 'dYnm1c';
11 11
 
12
-	public static function setStoreKey($length = 54, $count = 0){
12
+	public static function setStoreKey($length = 54, $count = 0) {
13 13
 		$charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.strtotime('now');
14 14
 		$strLength = strlen($charset);
15 15
 		$str = '';
16
-		while($count < $length){
17
-			$str .= $charset[mt_rand(0, $strLength-1)];
16
+		while ($count < $length) {
17
+			$str .= $charset[mt_rand(0, $strLength - 1)];
18 18
 			$count++;
19 19
 		}
20
-		return self::getKeyPrefix().substr(base64_encode($str),0,$length);
20
+		return self::getKeyPrefix().substr(base64_encode($str), 0, $length);
21 21
 	}
22 22
 
23
-	public static function getStoreKey(){
23
+	public static function getStoreKey() {
24 24
 		$config = SiteConfig::current_site_config();
25
-		if($config->StoreKey){
25
+		if ($config->StoreKey) {
26 26
 			return $config->StoreKey;
27 27
 		}
28 28
 		return null;
29 29
 	}
30 30
 
31
-	public static function store_name_warning(){
31
+	public static function store_name_warning() {
32 32
 		$warning = null;
33
-		if(self::getFoxyCartStoreName()===null){
33
+		if (self::getFoxyCartStoreName() === null) {
34 34
 			$warning = 'Must define FoxyCart Store Name in your site settings in the cms';
35 35
 		}
36 36
 		return $warning;
37 37
 	}
38 38
 
39
-	public static function getFoxyCartStoreName(){
39
+	public static function getFoxyCartStoreName() {
40 40
 		$config = SiteConfig::current_site_config();
41
-		if($config->StoreName){
41
+		if ($config->StoreName) {
42 42
 			return $config->StoreName;
43 43
 		}
44 44
 		return null;
45 45
 	}
46 46
 
47 47
 	public static function FormActionURL() {
48
-		return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName() );
48
+		return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName());
49 49
 	}
50 50
 
51 51
     /**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $foxyData["api_token"] = FoxyCart::getStoreKey();
60 60
 
61 61
         $ch = curl_init();
62
-        curl_setopt($ch, CURLOPT_URL, "https://" . $foxy_domain . "/api");
62
+        curl_setopt($ch, CURLOPT_URL, "https://".$foxy_domain."/api");
63 63
         curl_setopt($ch, CURLOPT_POSTFIELDS, $foxyData);
64 64
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
65 65
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         // The following if block will print any CURL errors you might have
72 72
         if ($response == false) {
73 73
             //trigger_error("Could not connect to FoxyCart API", E_USER_ERROR);
74
-            SS_Log::log("Could not connect to FoxyCart API: " . $response, SS_Log::ERR);
74
+            SS_Log::log("Could not connect to FoxyCart API: ".$response, SS_Log::ERR);
75 75
         }
76 76
         curl_close($ch);
77 77
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
     public static function putCustomer($Member = null) {
98 98
         // throw error if no $Member Object
99
-        if (!isset($Member)) ;//trigger_error('No Member set', E_USER_ERROR);
99
+        if (!isset($Member)); //trigger_error('No Member set', E_USER_ERROR);
100 100
 
101 101
         // send updated customer record from API
102 102
         $foxyData = array();
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         return self::getAPIRequest($foxyData);
113 113
     }
114 114
 
115
-	public static function getKeyPrefix(){
115
+	public static function getKeyPrefix() {
116 116
 		return self::$keyPrefix;
117 117
 	}
118 118
 
Please login to merge, or discard this patch.
code/objects/OrderDetail.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,31 +7,31 @@  discard block
 block discarded – undo
7 7
 	private static $description = '';
8 8
 
9 9
 	private static $db = array(
10
-        'Quantity' => 'Int',
11
-        'Price' => 'Currency'
12
-    );
10
+		'Quantity' => 'Int',
11
+		'Price' => 'Currency'
12
+	);
13 13
 
14 14
 	private static $has_one = array(
15
-        'Product' => 'ProductPage',
16
-        'Order' => 'Order'
17
-    );
15
+		'Product' => 'ProductPage',
16
+		'Order' => 'Order'
17
+	);
18 18
 
19 19
 	private static $many_many = array(
20
-        'Options' => 'OptionItem'
21
-    );
20
+		'Options' => 'OptionItem'
21
+	);
22 22
 
23 23
 	private static $summary_fields = array(
24
-        'Product.Title',
25
-        'Quantity',
26
-        'Price.Nice'
27
-    );
24
+		'Product.Title',
25
+		'Quantity',
26
+		'Price.Nice'
27
+	);
28 28
 
29 29
 	public function getCMSFields(){
30 30
 		$fields = parent::getCMSFields();
31 31
 
32
-        $fields->addFieldsToTab('Root.Options', array(
33
-            GridField::create('Options', 'Product Options', $this->Options(), GridFieldConfig_RecordViewer::create())
34
-        ));
32
+		$fields->addFieldsToTab('Root.Options', array(
33
+			GridField::create('Options', 'Product Options', $this->Options(), GridFieldConfig_RecordViewer::create())
34
+		));
35 35
 
36 36
 		$this->extend('updateCMSFields', $fields);
37 37
 		return $fields;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	public function canEdit($member = null) {
55
-        return false;
55
+		return false;
56 56
 	}
57 57
 
58 58
 	public function canDelete($member = null) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         'Price.Nice'
27 27
     );
28 28
 
29
-	public function getCMSFields(){
29
+	public function getCMSFields() {
30 30
 		$fields = parent::getCMSFields();
31 31
 
32 32
         $fields->addFieldsToTab('Root.Options', array(
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		return $fields;
38 38
 	}
39 39
 
40
-	public function validate(){
40
+	public function validate() {
41 41
 		$result = parent::validate();
42 42
 
43 43
 		/*if($this->Country == 'DE' && $this->Postcode && strlen($this->Postcode) != 5) {
Please login to merge, or discard this patch.
code/objects/ProductImage.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,17 +26,17 @@
 block discarded – undo
26 26
 
27 27
 	public function getCMSFields(){
28 28
 		$fields = FieldList::create(
29
-            TextField::create('Title')
30
-                ->setTitle(_t('ProductImage.Title', 'Product Image Title')),
31
-            UploadField::create('Image')
32
-                ->setTitle(_t('ProductCategory.Image', 'Product Image'))
33
-                ->setFolderName('Uploads/Products')
34
-                ->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'))
35
-        );
29
+			TextField::create('Title')
30
+				->setTitle(_t('ProductImage.Title', 'Product Image Title')),
31
+			UploadField::create('Image')
32
+				->setTitle(_t('ProductCategory.Image', 'Product Image'))
33
+				->setFolderName('Uploads/Products')
34
+				->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'))
35
+		);
36 36
 
37 37
 		$this->extend('updateCMSFields', $fields);
38 38
 
39
-        return $fields;
39
+		return $fields;
40 40
 	}
41 41
 
42 42
 	public function canView($member = false) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-class ProductImage extends DataObject{
8
+class ProductImage extends DataObject {
9 9
 
10 10
 	private static $db = array(
11 11
 		'Title' => 'Text',
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 		'Title' => 'Caption'
25 25
 	);
26 26
 
27
-	public function getCMSFields(){
27
+	public function getCMSFields() {
28 28
 		$fields = FieldList::create(
29 29
             TextField::create('Title')
30 30
                 ->setTitle(_t('ProductImage.Title', 'Product Image Title')),
Please login to merge, or discard this patch.
code/objects/Order.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -3,112 +3,112 @@
 block discarded – undo
3 3
 class Order extends DataObject implements PermissionProvider{
4 4
 
5 5
 	private static $db = array(
6
-        'Order_ID' => 'Int',
7
-        'Store_ID' => 'Int',
8
-        'StoreVersion' => 'Varchar',
9
-        'IsTest' => 'Boolean',
10
-        'IsHidden' => 'Boolean',
11
-        'DataIsFed' => 'Boolean',
12
-        'TransactionDate' => 'SS_Datetime',
13
-        'ProcessorResponse' => 'Varchar(200)',
14
-        'ShiptoShippingServiceDescription' => 'Varchar(200)',
15
-        'ProductTotal' => 'Currency',
16
-        'TaxTotal' => 'Currency',
17
-        'ShippingTotal' => 'Currency',
18
-        'OrderTotal' => 'Currency',
19
-        'PaymentGatewayType' => 'Varchar(100)',
20
-        'ReceiptURL' => 'Varchar(255)',
21
-        'OrderStatus' => 'Varchar(255)',
22
-        'CustomerIP' => 'Varchar',
23
-        'Response' => 'Text'
24
-    );
6
+		'Order_ID' => 'Int',
7
+		'Store_ID' => 'Int',
8
+		'StoreVersion' => 'Varchar',
9
+		'IsTest' => 'Boolean',
10
+		'IsHidden' => 'Boolean',
11
+		'DataIsFed' => 'Boolean',
12
+		'TransactionDate' => 'SS_Datetime',
13
+		'ProcessorResponse' => 'Varchar(200)',
14
+		'ShiptoShippingServiceDescription' => 'Varchar(200)',
15
+		'ProductTotal' => 'Currency',
16
+		'TaxTotal' => 'Currency',
17
+		'ShippingTotal' => 'Currency',
18
+		'OrderTotal' => 'Currency',
19
+		'PaymentGatewayType' => 'Varchar(100)',
20
+		'ReceiptURL' => 'Varchar(255)',
21
+		'OrderStatus' => 'Varchar(255)',
22
+		'CustomerIP' => 'Varchar',
23
+		'Response' => 'Text'
24
+	);
25 25
 
26 26
 	private static $has_one = array(
27
-        'Member' => 'Member',
28
-        'BillingAddress' => 'OrderAddress',
29
-        'ShippingAddress' => 'OrderAddress'
30
-    );
27
+		'Member' => 'Member',
28
+		'BillingAddress' => 'OrderAddress',
29
+		'ShippingAddress' => 'OrderAddress'
30
+	);
31 31
 
32 32
 	private static $has_many = array(
33
-        'Details' => 'OrderDetail'
34
-    );
35
-
36
-    private static $singular_name = 'Order';
37
-    private static $plural_name = 'Orders';
38
-    private static $description = 'Orders from FoxyCart Datafeed';
39
-    private static $default_sort = 'TransactionDate DESC';
40
-
41
-    private static $summary_fields = array(
42
-        'Order_ID',
43
-        'TransactionDate.NiceUS',
44
-        'Member.Name',
45
-        'ProductTotal.Nice',
46
-        'TaxTotal.Nice',
47
-        'ShippingTotal.Nice',
48
-        'OrderTotal.Nice',
49
-        'ReceiptLink'
50
-    );
33
+		'Details' => 'OrderDetail'
34
+	);
35
+
36
+	private static $singular_name = 'Order';
37
+	private static $plural_name = 'Orders';
38
+	private static $description = 'Orders from FoxyCart Datafeed';
39
+	private static $default_sort = 'TransactionDate DESC';
40
+
41
+	private static $summary_fields = array(
42
+		'Order_ID',
43
+		'TransactionDate.NiceUS',
44
+		'Member.Name',
45
+		'ProductTotal.Nice',
46
+		'TaxTotal.Nice',
47
+		'ShippingTotal.Nice',
48
+		'OrderTotal.Nice',
49
+		'ReceiptLink'
50
+	);
51 51
 
52 52
 	private static $searchable_fields = array(
53
-        'Order_ID',
54
-        'TransactionDate' => array(
55
-            "field" => "DateField",
56
-            "filter" => "PartialMatchFilter"
57
-        ),
58
-        'Member.ID',
59
-        'OrderTotal',
60
-        'Details.ProductID'
61
-    );
62
-
63
-    private static $casting = array(
64
-        'ReceiptLink' => 'HTMLVarchar'
65
-    );
53
+		'Order_ID',
54
+		'TransactionDate' => array(
55
+			"field" => "DateField",
56
+			"filter" => "PartialMatchFilter"
57
+		),
58
+		'Member.ID',
59
+		'OrderTotal',
60
+		'Details.ProductID'
61
+	);
62
+
63
+	private static $casting = array(
64
+		'ReceiptLink' => 'HTMLVarchar'
65
+	);
66 66
     
67
-    private static $indexes = array(
68
-        'Order_ID' => true // make unique
69
-    );
70
-
71
-    function fieldLabels($includerelations = true) {
72
-        $labels = parent::fieldLabels();
73
-
74
-        $labels['Order_ID'] = _t('Order.Order_ID', 'Order ID#');
75
-        $labels['TransactionDate'] = _t('Order.TransactionDate', "Date");
76
-        $labels['TransactionDate.NiceUS'] = _t('Order.TransactionDate', "Date");
77
-        $labels['Member.Name'] = _t('Order.MemberName', 'Customer');
78
-        $labels['Member.ID'] = _t('Order.MemberName', 'Customer');
79
-        $labels['ProductTotal.Nice'] = _t('Order.ProductTotal', 'Sub Total');
80
-        $labels['TaxTotal.Nice'] = _t('Order.TaxTotal', 'Tax');
81
-        $labels['ShippingTotal.Nice'] = _t('Order.ShippingTotal', 'Shipping');
82
-        $labels['OrderTotal'] = _t('Order.OrderTotal', 'Total');
83
-        $labels['OrderTotal.Nice'] = _t('Order.OrderTotal', 'Total');
84
-        $labels['ReceiptLink'] = _t('Order.ReceiptLink', 'Invoice');
85
-        $labels['Details.ProductID'] = _t('Order.Details.ProductID', 'Product');
86
-
87
-        return $labels;
88
-    }
89
-
90
-    function ReceiptLink() {
91
-        return $this->getReceiptLink();
92
-    }
93
-
94
-    function getReceiptLink(){
95
-        $obj= HTMLVarchar::create();
96
-        $obj->setValue('<a href="' . $this->ReceiptURL . '" target="_blank" class="cms-panel-link action external-link">view</a>');
97
-        return $obj;
98
-    }
67
+	private static $indexes = array(
68
+		'Order_ID' => true // make unique
69
+	);
70
+
71
+	function fieldLabels($includerelations = true) {
72
+		$labels = parent::fieldLabels();
73
+
74
+		$labels['Order_ID'] = _t('Order.Order_ID', 'Order ID#');
75
+		$labels['TransactionDate'] = _t('Order.TransactionDate', "Date");
76
+		$labels['TransactionDate.NiceUS'] = _t('Order.TransactionDate', "Date");
77
+		$labels['Member.Name'] = _t('Order.MemberName', 'Customer');
78
+		$labels['Member.ID'] = _t('Order.MemberName', 'Customer');
79
+		$labels['ProductTotal.Nice'] = _t('Order.ProductTotal', 'Sub Total');
80
+		$labels['TaxTotal.Nice'] = _t('Order.TaxTotal', 'Tax');
81
+		$labels['ShippingTotal.Nice'] = _t('Order.ShippingTotal', 'Shipping');
82
+		$labels['OrderTotal'] = _t('Order.OrderTotal', 'Total');
83
+		$labels['OrderTotal.Nice'] = _t('Order.OrderTotal', 'Total');
84
+		$labels['ReceiptLink'] = _t('Order.ReceiptLink', 'Invoice');
85
+		$labels['Details.ProductID'] = _t('Order.Details.ProductID', 'Product');
86
+
87
+		return $labels;
88
+	}
89
+
90
+	function ReceiptLink() {
91
+		return $this->getReceiptLink();
92
+	}
93
+
94
+	function getReceiptLink(){
95
+		$obj= HTMLVarchar::create();
96
+		$obj->setValue('<a href="' . $this->ReceiptURL . '" target="_blank" class="cms-panel-link action external-link">view</a>');
97
+		return $obj;
98
+	}
99 99
 
100 100
 	public function canView($member = false) {
101 101
 		return Permission::check('Product_ORDERS');
102 102
 	}
103 103
 
104 104
 	public function canEdit($member = null) {
105
-        //return Permission::check('Product_ORDERS');
106
-        return false;
105
+		//return Permission::check('Product_ORDERS');
106
+		return false;
107 107
 	}
108 108
 
109 109
 	public function canDelete($member = null) {
110
-        return false;
111
-        //return Permission::check('Product_ORDERS');
110
+		return false;
111
+		//return Permission::check('Product_ORDERS');
112 112
 	}
113 113
 
114 114
 	public function canCreate($member = null) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class Order extends DataObject implements PermissionProvider{
3
+class Order extends DataObject implements PermissionProvider {
4 4
 
5 5
 	private static $db = array(
6 6
         'Order_ID' => 'Int',
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
         return $this->getReceiptLink();
92 92
     }
93 93
 
94
-    function getReceiptLink(){
95
-        $obj= HTMLVarchar::create();
96
-        $obj->setValue('<a href="' . $this->ReceiptURL . '" target="_blank" class="cms-panel-link action external-link">view</a>');
94
+    function getReceiptLink() {
95
+        $obj = HTMLVarchar::create();
96
+        $obj->setValue('<a href="'.$this->ReceiptURL.'" target="_blank" class="cms-panel-link action external-link">view</a>');
97 97
         return $obj;
98 98
     }
99 99
 
Please login to merge, or discard this patch.
code/objects/OptionGroup.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 		'Title' => 'Varchar(100)'
12 12
 	);
13 13
 
14
-    private static $singular_name = 'Product Option Group';
14
+	private static $singular_name = 'Product Option Group';
15 15
 	private static $plural_name = 'Product Option Groups';
16 16
 	private static $description = 'Groups of product options, e.g. size, color, etc';
17 17
 
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 			$do->write();
34 34
 		}
35 35
 		if(!OptionGroup::get()->filter(array('Title' => 'Size'))->first()) {
36
-            $do = new OptionGroup();
37
-            $do->Title = "Size";
38
-            $do->write();
39
-        }
40
-        if(!OptionGroup::get()->filter(array('Title' => 'Color'))->first()) {
41
-            $do = new OptionGroup();
42
-            $do->Title = "Color";
43
-            $do->write();
44
-        }
45
-        if(!OptionGroup::get()->filter(array('Title' => 'Type'))->first()) {
46
-            $do = new OptionGroup();
47
-            $do->Title = "Type";
48
-            $do->write();
49
-        }
36
+			$do = new OptionGroup();
37
+			$do->Title = "Size";
38
+			$do->write();
39
+		}
40
+		if(!OptionGroup::get()->filter(array('Title' => 'Color'))->first()) {
41
+			$do = new OptionGroup();
42
+			$do->Title = "Color";
43
+			$do->write();
44
+		}
45
+		if(!OptionGroup::get()->filter(array('Title' => 'Type'))->first()) {
46
+			$do = new OptionGroup();
47
+			$do->Title = "Type";
48
+			$do->write();
49
+		}
50 50
 	}
51 51
 
52 52
 	public function getCMSValidator() {
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-class OptionGroup extends DataObject{
8
+class OptionGroup extends DataObject {
9 9
 
10 10
 	private static $db = array(
11 11
 		'Title' => 'Varchar(100)'
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	private static $plural_name = 'Product Option Groups';
16 16
 	private static $description = 'Groups of product options, e.g. size, color, etc';
17 17
 
18
-	function getCMSFields(){
18
+	function getCMSFields() {
19 19
 
20 20
 		$fields = parent::getCMSFields();
21 21
 
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
 	public function requireDefaultRecords() {
28 28
 		parent::requireDefaultRecords();
29 29
 		// create a catch-all group
30
-		if(!OptionGroup::get()->filter(array('Title' => 'Options'))->first()) {
30
+		if (!OptionGroup::get()->filter(array('Title' => 'Options'))->first()) {
31 31
 			$do = new OptionGroup();
32 32
 			$do->Title = "Options";
33 33
 			$do->write();
34 34
 		}
35
-		if(!OptionGroup::get()->filter(array('Title' => 'Size'))->first()) {
35
+		if (!OptionGroup::get()->filter(array('Title' => 'Size'))->first()) {
36 36
             $do = new OptionGroup();
37 37
             $do->Title = "Size";
38 38
             $do->write();
39 39
         }
40
-        if(!OptionGroup::get()->filter(array('Title' => 'Color'))->first()) {
40
+        if (!OptionGroup::get()->filter(array('Title' => 'Color'))->first()) {
41 41
             $do = new OptionGroup();
42 42
             $do->Title = "Color";
43 43
             $do->write();
44 44
         }
45
-        if(!OptionGroup::get()->filter(array('Title' => 'Type'))->first()) {
45
+        if (!OptionGroup::get()->filter(array('Title' => 'Type'))->first()) {
46 46
             $do = new OptionGroup();
47 47
             $do->Title = "Type";
48 48
             $do->write();
@@ -53,30 +53,30 @@  discard block
 block discarded – undo
53 53
 		return new RequiredFields(array('Title'));
54 54
 	}
55 55
 
56
-	public function validate(){
56
+	public function validate() {
57 57
 		$result = parent::validate();
58 58
 
59 59
 		$title = $this->Title;
60 60
 		$firstChar = substr($title, 0, 1);
61
-		if(preg_match('/[^a-zA-Z]/', $firstChar)){
61
+		if (preg_match('/[^a-zA-Z]/', $firstChar)) {
62 62
 			$result->error('The first character of the Title can only be a letter', 'bad');
63 63
 		}
64
-		if(preg_match('/[^a-zA-Z]\s/', $title)){
64
+		if (preg_match('/[^a-zA-Z]\s/', $title)) {
65 65
 			$result->error('Please only use letters, numbers and spaces in the title', 'bad');
66 66
 		}
67 67
 
68 68
 		return $result;
69 69
 	}
70 70
 
71
-	public function onBeforeDelete(){
71
+	public function onBeforeDelete() {
72 72
 		parent::onBeforeDelete();
73 73
 
74 74
 		//make sure that if we delete this option group, we reassign the group's option items to the 'None' group.
75 75
 		$items = OptionItem::get()->filter(array('ProductOptionGroupID' => $this->ID));
76 76
 
77
-		if(isset($items)){
77
+		if (isset($items)) {
78 78
 			$noneGroup = OptionGroup::get()->filter(array('Title' => 'Options'))->first();
79
-			foreach($items as $item){
79
+			foreach ($items as $item) {
80 80
 				$item->ProductOptionGroupID = $noneGroup->ID;
81 81
 				$item->write();
82 82
 			}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 
90 90
 	public function canEdit($member = null) {
91
-		switch($this->Title){
91
+		switch ($this->Title) {
92 92
 			case 'Options':
93 93
 				return false;
94 94
 				break;
Please login to merge, or discard this patch.
code/objects/OptionItem.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 		//'Category' => 'ProductCategory'
26 26
 	);
27 27
 
28
-    private static $belongs_many_many = array(
29
-        'OrderDetails' => 'OrderDetail'
30
-    );
28
+	private static $belongs_many_many = array(
29
+		'OrderDetails' => 'OrderDetail'
30
+	);
31 31
 
32
-    private static $defaults = array(
32
+	private static $defaults = array(
33 33
 		'Available' => true
34 34
 	);
35 35
 
36 36
 	private static $summary_fields = array(
37 37
 		'Title' => 'Title',
38 38
 		'ProductOptionGroup.Title' => 'Group',
39
-        'Available.Nice' => 'Available'
39
+		'Available.Nice' => 'Available'
40 40
 	);
41 41
 
42 42
 	private static $default_sort = 'SortOrder';
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 		);
51 51
 
52 52
 		// set variables from Product
53
-        $productID = ($this->ProductID != 0) ? $this->ProductID : Session::get('CMSMain.currentPage');
54
-        $product = ProductPage::get()->byID($productID);
53
+		$productID = ($this->ProductID != 0) ? $this->ProductID : Session::get('CMSMain.currentPage');
54
+		$product = ProductPage::get()->byID($productID);
55 55
 
56 56
 		$parentPrice = $product->obj('Price')->Nice();
57 57
 		$parentWeight = $product->Weight;
@@ -59,21 +59,21 @@  discard block
 block discarded – undo
59 59
 
60 60
 		// ProductOptionGroup Dropdown field w/ add new
61 61
 		$groups = function(){
62
-		    return OptionGroup::get()->map()->toArray();
62
+			return OptionGroup::get()->map()->toArray();
63 63
 		};
64 64
 		$groupFields = singleton('OptionGroup')->getCMSFields();
65 65
 		$groupField = DropdownField::create('ProductOptionGroupID', _t("OptionItem.Group", "Group"), $groups())
66 66
 			->setEmptyString('')
67
-            ->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>'));
67
+			->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>'));
68 68
 		if (class_exists('QuickAddNewExtension')) $groupField->useAddNew('OptionGroup', $groups, $groupFields);
69 69
 
70
-        $fields->addFieldsToTab('Root.Main', array(
70
+		$fields->addFieldsToTab('Root.Main', array(
71 71
 			HeaderField::create('DetailsHD', _t("OptionItem.DetailsHD", "Product Option Details"), 2),
72 72
 			Textfield::create('Title')
73
-                ->setTitle(_t("OptionItem.Title", "Product Option Name")),
73
+				->setTitle(_t("OptionItem.Title", "Product Option Name")),
74 74
 			CheckboxField::create('Available')
75 75
 				->setTitle( _t("OptionItem.Available", "Available for purchase"))
76
-                ->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")),
76
+				->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")),
77 77
 			$groupField
78 78
 		));
79 79
 
@@ -83,22 +83,22 @@  discard block
 block discarded – undo
83 83
 			// Weight Modifier Fields
84 84
 			HeaderField::create('WeightHD', _t('OptionItem.WeightHD', 'Modify Weight'), 3),
85 85
 			NumericField::create('WeightModifier')
86
-                ->setTitle(_t('OptionItem.WeightModifier', 'Weight')),
86
+				->setTitle(_t('OptionItem.WeightModifier', 'Weight')),
87 87
 			DropdownField::create('WeightModifierAction', _t('OptionItem.WeightModifierAction', 'Weight Modification'),
88 88
 				array(
89
-                    'Add' => _t(
90
-                        'OptionItem.WeightAdd',
91
-                        "Add to Base Weight ({weight})",
92
-                        'Add to weight',
93
-                        array('weight' => $parentWeight)
94
-                    ),
95
-                    'Subtract' => _t(
96
-                        'OptionItem.WeightSubtract',
97
-                        "Subtract from Base Weight ({weight})",
98
-                        'Subtract from weight',
99
-                        array('weight' => $parentWeight)
100
-                    ),
101
-                    'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight')
89
+					'Add' => _t(
90
+						'OptionItem.WeightAdd',
91
+						"Add to Base Weight ({weight})",
92
+						'Add to weight',
93
+						array('weight' => $parentWeight)
94
+					),
95
+					'Subtract' => _t(
96
+						'OptionItem.WeightSubtract',
97
+						"Subtract from Base Weight ({weight})",
98
+						'Subtract from weight',
99
+						array('weight' => $parentWeight)
100
+					),
101
+					'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight')
102 102
 				)
103 103
 			)->setEmptyString('')
104 104
 			->setDescription(_t('OptionItem.WeightDescription', 'Does weight modify or replace base weight?')),
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 			// Price Modifier FIelds
107 107
 			HeaderField::create('PriceHD', _t('OptionItem.PriceHD', 'Modify Price'), 3),
108 108
 			CurrencyField::create('PriceModifier')
109
-                ->setTitle(_t('OptionItem.PriceModifier', 'Price')),
109
+				->setTitle(_t('OptionItem.PriceModifier', 'Price')),
110 110
 			DropdownField::create('PriceModifierAction', _t('OptionItem.PriceModifierAction', 'Price Modification'),
111 111
 				array(
112 112
 					'Add' => _t(
113
-                        'OptionItem.PriceAdd',
114
-                        "Add to Base Price ({price})",
115
-                        'Add to price',
116
-                        array('price' => $parentPrice)
117
-                    ),
113
+						'OptionItem.PriceAdd',
114
+						"Add to Base Price ({price})",
115
+						'Add to price',
116
+						array('price' => $parentPrice)
117
+					),
118 118
 					'Subtract' => _t(
119
-                        'OptionItem.PriceSubtract',
120
-                        "Subtract from Base Price ({price})",
121
-                        'Subtract from price',
122
-                        array('price' => $parentPrice)
123
-                    ),
119
+						'OptionItem.PriceSubtract',
120
+						"Subtract from Base Price ({price})",
121
+						'Subtract from price',
122
+						array('price' => $parentPrice)
123
+					),
124 124
 					'Set' => _t('OptionItem.PriceSet', 'Set as a new Price')
125 125
 				)
126 126
 			)->setEmptyString('')
@@ -129,28 +129,28 @@  discard block
 block discarded – undo
129 129
 			// Code Modifier Fields
130 130
 			HeaderField::create('CodeHD', _t('OptionItem.CodeHD', 'Modify Code'), 3),
131 131
 			TextField::create('CodeModifier')
132
-                ->setTitle(_t('OptionItem.CodeModifier', 'Code')),
132
+				->setTitle(_t('OptionItem.CodeModifier', 'Code')),
133 133
 			DropdownField::create('CodeModifierAction', _t('OptionItem.CodeModifierAction', 'Code Modification'),
134 134
 				array(
135 135
 					'Add' => _t(
136
-                        'OptionItem.CodeAdd',
137
-                        "Add to Base Code ({code})",
138
-                        'Add to code',
139
-                        array('code' => $parentCode)
140
-                    ),
136
+						'OptionItem.CodeAdd',
137
+						"Add to Base Code ({code})",
138
+						'Add to code',
139
+						array('code' => $parentCode)
140
+					),
141 141
 					'Subtract' => _t(
142
-                        'OptionItem.CodeSubtract',
143
-                        'Subtract from Base Code ({code})',
144
-                        'Subtract from code',
145
-                        array('code' => $parentCode)
146
-                    ),
142
+						'OptionItem.CodeSubtract',
143
+						'Subtract from Base Code ({code})',
144
+						'Subtract from code',
145
+						array('code' => $parentCode)
146
+					),
147 147
 					'Set' => _t('OptionItem.CodeSet', 'Set as a new Code')
148 148
 				)
149 149
 			)->setEmptyString('')
150 150
 			->setDescription(_t('OptionItem.CodeDescription', 'Does code modify or replace base code?'))
151 151
 		));
152 152
 
153
-        /*
153
+		/*
154 154
         // Cateogry Dropdown field w/ add new
155 155
         // removed until relevance determined
156 156
         $categories = function(){
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $fields->insertAfter($categoryField, 'ProductOptionGroupID');
167 167
         */
168 168
 
169
-        // allow CMS fields to be extended
169
+		// allow CMS fields to be extended
170 170
 		$this->extend('getCMSFields', $fields);
171 171
 
172 172
 		return $fields;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-class OptionItem extends DataObject{
8
+class OptionItem extends DataObject {
9 9
 
10 10
 	private static $db = array(
11 11
 		'Title' => 'Text',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	private static $default_sort = 'SortOrder';
43 43
 
44
-	public function getCMSFields(){
44
+	public function getCMSFields() {
45 45
 		$fields = FieldList::create(
46 46
 			new Tabset('Root',
47 47
 				new Tab('Main'),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$parentCode = $product->Code;
59 59
 
60 60
 		// ProductOptionGroup Dropdown field w/ add new
61
-		$groups = function(){
61
+		$groups = function() {
62 62
 		    return OptionGroup::get()->map()->toArray();
63 63
 		};
64 64
 		$groupFields = singleton('OptionGroup')->getCMSFields();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			Textfield::create('Title')
73 73
                 ->setTitle(_t("OptionItem.Title", "Product Option Name")),
74 74
 			CheckboxField::create('Available')
75
-				->setTitle( _t("OptionItem.Available", "Available for purchase"))
75
+				->setTitle(_t("OptionItem.Available", "Available for purchase"))
76 76
                 ->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")),
77 77
 			$groupField
78 78
 		));
@@ -172,18 +172,18 @@  discard block
 block discarded – undo
172 172
 		return $fields;
173 173
 	}
174 174
 
175
-	public function validate(){
175
+	public function validate() {
176 176
 		$result = parent::validate();
177 177
 
178
-		if($this->ProductOptionGroupID == 0){
178
+		if ($this->ProductOptionGroupID == 0) {
179 179
 			$result->error('Must set a Group prior to saving');
180 180
 		}
181 181
 
182 182
 		return $result;
183 183
 	}
184 184
 
185
-	public static function getOptionModifierActionSymbol($oma, $returnWithOnlyPlusMinus=false){
186
-		switch($oma){
185
+	public static function getOptionModifierActionSymbol($oma, $returnWithOnlyPlusMinus = false) {
186
+		switch ($oma) {
187 187
 			case 'Subtract':
188 188
 				$symbol = '-';
189 189
 				break;
@@ -196,23 +196,23 @@  discard block
 block discarded – undo
196 196
 		return $symbol;
197 197
 	}
198 198
 
199
-	public function getWeightModifierWithSymbol(){
199
+	public function getWeightModifierWithSymbol() {
200 200
 		return self::getOptionModifierActionSymbol($this->WeightModifierAction).$this->WeightModifier;
201 201
 	}
202 202
 
203
-	public function getPriceModifierWithSymbol(){
203
+	public function getPriceModifierWithSymbol() {
204 204
 		return self::getOptionModifierActionSymbol($this->PriceModifierAction).$this->PriceModifier;
205 205
 	}
206 206
 
207
-	public function getCodeModifierWithSymbol(){
207
+	public function getCodeModifierWithSymbol() {
208 208
 		return self::getOptionModifierActionSymbol($this->CodeModifierAction).$this->CodeModifier;
209 209
 	}
210 210
 
211
-	public function getProductOptionGroupTitle(){
211
+	public function getProductOptionGroupTitle() {
212 212
 		return $this->ProductOptionGroup()->Title;
213 213
 	}
214 214
 
215
-	public function getGeneratedValue(){
215
+	public function getGeneratedValue() {
216 216
 		$modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
217 217
 		$modPriceWithSymbol = OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction).$modPrice;
218 218
 		$modWeight = ($this->WeightModifier) ? (string)$this->WeightModifier : '0';
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
 		return $this->Title.'{p'.$modPriceWithSymbol.'|w'.$modWeight.'|c'.$modCode.'}';
222 222
 	}
223 223
 
224
-	public function getGeneratedTitle(){
224
+	public function getGeneratedTitle() {
225 225
 		$modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
226 226
 		$title = $this->Title;
227
-		$title .= ($this->PriceModifier != 0) ? ': ('.OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction, $returnWithOnlyPlusMinus=true).'$'.$modPrice.')' : '';
227
+		$title .= ($this->PriceModifier != 0) ? ': ('.OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction, $returnWithOnlyPlusMinus = true).'$'.$modPrice.')' : '';
228 228
 		return $title;
229 229
 	}
230 230
 
231
-	public function getAvailability(){
232
-		return ($this->Available == 0) ? true : false ;
231
+	public function getAvailability() {
232
+		return ($this->Available == 0) ? true : false;
233 233
 	}
234 234
 
235 235
 	public function canView($member = false) {
Please login to merge, or discard this patch.