Completed
Pull Request — master (#287)
by Nic
07:56
created
code/admin/OrderAdmin.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 
3 3
 class OrderAdmin extends ModelAdmin {
4 4
 
5
-	public static $managed_models = array(
6
-		'Order'
7
-	);
5
+    public static $managed_models = array(
6
+        'Order'
7
+    );
8 8
 	
9
-	static $url_segment = 'orders';
9
+    static $url_segment = 'orders';
10 10
 	
11
-	static $menu_title = 'Orders';
11
+    static $menu_title = 'Orders';
12 12
 
13 13
     public function getEditForm($id = null, $fields = null) {
14 14
         $form = parent::getEditForm($id, $fields);
Please login to merge, or discard this patch.
code/objects/OptionGroup.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -7,32 +7,32 @@  discard block
 block discarded – undo
7 7
 
8 8
 class OptionGroup extends DataObject{
9 9
 
10
-	private static $db = array(
11
-		'Title' => 'Varchar(100)'
12
-	);
10
+    private static $db = array(
11
+        'Title' => 'Varchar(100)'
12
+    );
13 13
 
14 14
     private static $singular_name = 'Product Option Group';
15
-	private static $plural_name = 'Product Option Groups';
16
-	private static $description = 'Groups of product options, e.g. size, color, etc';
15
+    private static $plural_name = 'Product Option Groups';
16
+    private static $description = 'Groups of product options, e.g. size, color, etc';
17 17
 
18
-	function getCMSFields(){
18
+    function getCMSFields(){
19 19
 
20
-		$fields = parent::getCMSFields();
20
+        $fields = parent::getCMSFields();
21 21
 
22
-		$this->extend('getCMSFields', $fields);
22
+        $this->extend('getCMSFields', $fields);
23 23
 
24
-		return $fields;
25
-	}
24
+        return $fields;
25
+    }
26 26
 
27
-	public function requireDefaultRecords() {
28
-		parent::requireDefaultRecords();
29
-		// create a catch-all group
30
-		if(!OptionGroup::get()->filter(array('Title' => 'Options'))->first()) {
31
-			$do = new OptionGroup();
32
-			$do->Title = "Options";
33
-			$do->write();
34
-		}
35
-		if(!OptionGroup::get()->filter(array('Title' => 'Size'))->first()) {
27
+    public function requireDefaultRecords() {
28
+        parent::requireDefaultRecords();
29
+        // create a catch-all group
30
+        if(!OptionGroup::get()->filter(array('Title' => 'Options'))->first()) {
31
+            $do = new OptionGroup();
32
+            $do->Title = "Options";
33
+            $do->write();
34
+        }
35
+        if(!OptionGroup::get()->filter(array('Title' => 'Size'))->first()) {
36 36
             $do = new OptionGroup();
37 37
             $do->Title = "Size";
38 38
             $do->write();
@@ -47,64 +47,64 @@  discard block
 block discarded – undo
47 47
             $do->Title = "Type";
48 48
             $do->write();
49 49
         }
50
-	}
51
-
52
-	public function getCMSValidator() {
53
-		return new RequiredFields(array('Title'));
54
-	}
55
-
56
-	public function validate(){
57
-		$result = parent::validate();
58
-
59
-		$title = $this->Title;
60
-		$firstChar = substr($title, 0, 1);
61
-		if(preg_match('/[^a-zA-Z]/', $firstChar)){
62
-			$result->error('The first character of the Title can only be a letter', 'bad');
63
-		}
64
-		if(preg_match('/[^a-zA-Z]\s/', $title)){
65
-			$result->error('Please only use letters, numbers and spaces in the title', 'bad');
66
-		}
67
-
68
-		return $result;
69
-	}
70
-
71
-	public function onBeforeDelete(){
72
-		parent::onBeforeDelete();
73
-
74
-		//make sure that if we delete this option group, we reassign the group's option items to the 'None' group.
75
-		$items = OptionItem::get()->filter(array('ProductOptionGroupID' => $this->ID));
76
-
77
-		if(isset($items)){
78
-			$noneGroup = OptionGroup::get()->filter(array('Title' => 'Options'))->first();
79
-			foreach($items as $item){
80
-				$item->ProductOptionGroupID = $noneGroup->ID;
81
-				$item->write();
82
-			}
83
-		}
84
-	}
85
-
86
-	public function canView($member = false) {
87
-		return true;
88
-	}
89
-
90
-	public function canEdit($member = null) {
91
-		switch($this->Title){
92
-			case 'Options':
93
-				return false;
94
-				break;
95
-			default:
96
-				return Permission::check('Product_CANCRUD');
97
-				break;
98
-		}
99
-
100
-	}
101
-
102
-	public function canDelete($member = null) {
103
-		return $this->canEdit();
104
-	}
105
-
106
-	public function canCreate($member = null) {
107
-		return Permission::check('Product_CANCRUD');
108
-	}
50
+    }
51
+
52
+    public function getCMSValidator() {
53
+        return new RequiredFields(array('Title'));
54
+    }
55
+
56
+    public function validate(){
57
+        $result = parent::validate();
58
+
59
+        $title = $this->Title;
60
+        $firstChar = substr($title, 0, 1);
61
+        if(preg_match('/[^a-zA-Z]/', $firstChar)){
62
+            $result->error('The first character of the Title can only be a letter', 'bad');
63
+        }
64
+        if(preg_match('/[^a-zA-Z]\s/', $title)){
65
+            $result->error('Please only use letters, numbers and spaces in the title', 'bad');
66
+        }
67
+
68
+        return $result;
69
+    }
70
+
71
+    public function onBeforeDelete(){
72
+        parent::onBeforeDelete();
73
+
74
+        //make sure that if we delete this option group, we reassign the group's option items to the 'None' group.
75
+        $items = OptionItem::get()->filter(array('ProductOptionGroupID' => $this->ID));
76
+
77
+        if(isset($items)){
78
+            $noneGroup = OptionGroup::get()->filter(array('Title' => 'Options'))->first();
79
+            foreach($items as $item){
80
+                $item->ProductOptionGroupID = $noneGroup->ID;
81
+                $item->write();
82
+            }
83
+        }
84
+    }
85
+
86
+    public function canView($member = false) {
87
+        return true;
88
+    }
89
+
90
+    public function canEdit($member = null) {
91
+        switch($this->Title){
92
+            case 'Options':
93
+                return false;
94
+                break;
95
+            default:
96
+                return Permission::check('Product_CANCRUD');
97
+                break;
98
+        }
99
+
100
+    }
101
+
102
+    public function canDelete($member = null) {
103
+        return $this->canEdit();
104
+    }
105
+
106
+    public function canCreate($member = null) {
107
+        return Permission::check('Product_CANCRUD');
108
+    }
109 109
 
110 110
 }
Please login to merge, or discard this patch.
code/pages/OrderHistoryPage.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
     private static $plural_name = 'Order History Pages';
12 12
     private static $description = 'Show a customers past orders. Requires authentication';
13 13
 
14
-	public function getCMSFields(){
15
-		$fields = parent::getCMSFields();
14
+    public function getCMSFields(){
15
+        $fields = parent::getCMSFields();
16 16
 
17 17
 
18 18
 
19
-		$this->extend('updateCMSFields', $fields);
20
-		return $fields;
21
-	}
19
+        $this->extend('updateCMSFields', $fields);
20
+        return $fields;
21
+    }
22 22
 
23 23
     // return all current Member's Orders
24 24
     public function getOrders($limit = 10) {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 class OrderHistoryPage_Controller extends Page_Controller {
38 38
 	
39
-	private static $allowed_actions = array(
39
+    private static $allowed_actions = array(
40 40
         'index'
41 41
     );
42 42
 
Please login to merge, or discard this patch.
code/extensions/FoxyStripeSiteConfig.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -2,21 +2,21 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FoxyStripeSiteConfig extends DataExtension{
4 4
 
5
-	private static $db = array(
6
-		'StoreName' => 'Varchar(255)',
7
-		'StoreKey' => 'Varchar(60)',
8
-		'MultiGroup' => 'Boolean',
9
-		'ProductLimit' => 'Int',
10
-		'CartValidation' => 'Boolean',
11
-		'MaxQuantity' => 'Int'
12
-	);
5
+    private static $db = array(
6
+        'StoreName' => 'Varchar(255)',
7
+        'StoreKey' => 'Varchar(60)',
8
+        'MultiGroup' => 'Boolean',
9
+        'ProductLimit' => 'Int',
10
+        'CartValidation' => 'Boolean',
11
+        'MaxQuantity' => 'Int'
12
+    );
13 13
 
14 14
     // Set Default values
15 15
     private static $defaults = array(
16 16
         'ProductLimit' => 10
17 17
     );
18 18
 
19
-	public function updateCMSFields(FieldList $fields){
19
+    public function updateCMSFields(FieldList $fields){
20 20
 
21 21
         // set TabSet names to avoid spaces from camel case
22 22
         $fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe'));
@@ -24,103 +24,103 @@  discard block
 block discarded – undo
24 24
         // settings tab
25 25
         $fields->addFieldsToTab('Root.FoxyStripe.Settings', array(
26 26
             // Store Details
27
-			HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
28
-			LiteralField::create('DetailsIntro', _t(
29
-				'FoxyStripeSiteConfig.DetailsIntro',
27
+            HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
28
+            LiteralField::create('DetailsIntro', _t(
29
+                'FoxyStripeSiteConfig.DetailsIntro',
30 30
                 '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditStore" target="_blank">FoxyCart store settings</a>.'
31 31
             )),
32
-			TextField::create('StoreName')
33
-				->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Sub Domain'))
34
-				->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'the sub domain for your FoxyCart store')),
32
+            TextField::create('StoreName')
33
+                ->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Sub Domain'))
34
+                ->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'the sub domain for your FoxyCart store')),
35 35
 
36
-			// Advanced Settings
37
-			HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3),
38
-			LiteralField::create('AdvancedIntro', _t(
36
+            // Advanced Settings
37
+            HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3),
38
+            LiteralField::create('AdvancedIntro', _t(
39 39
                 'FoxyStripeSiteConfig.AdvancedIntro',
40
-				'<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures" target="_blank">FoxyCart advanced store settings</a>.</p>'
41
-			)),
42
-			ReadonlyField::create('DataFeedLink', _t('FoxyStripeSiteConfig.DataFeedLink', 'FoxyCart DataFeed URL'), self::getDataFeedLink())
43
-				->setDescription(_t('FoxyStripeSiteConfig.DataFeedLinkDescription', 'copy/paste to FoxyCart')),
44
-			CheckboxField::create('CartValidation')
45
-				->setTitle(_t('FoxyStripeSiteConfig.CartValidation', 'Enable Cart Validation'))
46
-				->setDescription(_t(
40
+                '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures" target="_blank">FoxyCart advanced store settings</a>.</p>'
41
+            )),
42
+            ReadonlyField::create('DataFeedLink', _t('FoxyStripeSiteConfig.DataFeedLink', 'FoxyCart DataFeed URL'), self::getDataFeedLink())
43
+                ->setDescription(_t('FoxyStripeSiteConfig.DataFeedLinkDescription', 'copy/paste to FoxyCart')),
44
+            CheckboxField::create('CartValidation')
45
+                ->setTitle(_t('FoxyStripeSiteConfig.CartValidation', 'Enable Cart Validation'))
46
+                ->setDescription(_t(
47 47
                     'FoxyStripeSiteConfig.CartValidationDescription',
48 48
                     'You must <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures#use_cart_validation" target="_blank">enable cart validation</a> in the FoxyCart admin.'
49 49
             )),
50
-			ReadonlyField::create('StoreKey')
51
-				->setTitle(_t('FoxyStripeSiteConfig.StoreKey', 'FoxyCart API Key'))
52
-				->setDescription(_t('FoxyStripeSiteConfig.StoreKeyDescription', 'copy/paste to FoxyCart')),
53
-			ReadonlyField::create('SSOLink', _t('FoxyStripeSiteConfig.SSOLink', 'Single Sign On URL'), self::getSSOLink())
54
-				->setDescription(_t('FoxyStripeSiteConfig.SSOLinkDescription', 'copy/paste to FoxyCart'))
50
+            ReadonlyField::create('StoreKey')
51
+                ->setTitle(_t('FoxyStripeSiteConfig.StoreKey', 'FoxyCart API Key'))
52
+                ->setDescription(_t('FoxyStripeSiteConfig.StoreKeyDescription', 'copy/paste to FoxyCart')),
53
+            ReadonlyField::create('SSOLink', _t('FoxyStripeSiteConfig.SSOLink', 'Single Sign On URL'), self::getSSOLink())
54
+                ->setDescription(_t('FoxyStripeSiteConfig.SSOLinkDescription', 'copy/paste to FoxyCart'))
55 55
         ));
56 56
 
57 57
         // configuration warning
58
-		if(FoxyCart::store_name_warning()!==null){
59
-			$fields->insertBefore(LiteralField::create(
58
+        if(FoxyCart::store_name_warning()!==null){
59
+            $fields->insertBefore(LiteralField::create(
60 60
                 "StoreSubDomainHeaderWarning",
61 61
                 _t(
62 62
                     'FoxyStripeSiteConfig.StoreSubDomainHeadingWarning',
63 63
                     "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
64 64
                 )
65 65
             ), 'StoreDetails');
66
-		}
66
+        }
67 67
 
68 68
         // products tab
69
-		$fields->addFieldsToTab('Root.FoxyStripe.Products', array(
70
-			HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
71
-			CheckboxField::create('MultiGroup')
72
-				->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
73
-				->setDescription(_t(
69
+        $fields->addFieldsToTab('Root.FoxyStripe.Products', array(
70
+            HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
71
+            CheckboxField::create('MultiGroup')
72
+                ->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
73
+                ->setDescription(_t(
74 74
                     'FoxyStripeSiteConfig.MultiGroupDescription',
75 75
                     'Allows products to be shown in multiple Product Groups'
76 76
                 )),
77
-			HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
78
-			NumericField::create('ProductLimit')
79
-				->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
80
-				->setDescription(_t(
77
+            HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
78
+            NumericField::create('ProductLimit')
79
+                ->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
80
+                ->setDescription(_t(
81 81
                     'FoxyStripeSiteConfig.ProductLimitDescription',
82 82
                     'Number of Products to show per page on a Product Group'
83 83
                 )),
84
-			HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
85
-			NumericField::create('MaxQuantity')
86
-				->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
87
-				->setDescription(_t(
84
+            HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
85
+            NumericField::create('MaxQuantity')
86
+                ->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
87
+                ->setDescription(_t(
88 88
                     'FoxyStripeSiteConfig.MaxQuantityDescription',
89 89
                     'Sets max quantity for product form dropdown (add to cart form - default 10)'
90 90
                 ))
91
-		));
91
+        ));
92 92
 
93 93
         // categories tab
94
-		$fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
95
-			HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
96
-			LiteralField::create('CategoryDescrip', _t(
94
+        $fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
95
+            HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
96
+            LiteralField::create('CategoryDescrip', _t(
97 97
                 'FoxyStripeSiteConfig.CategoryDescrip',
98 98
                 '<p>FoxyCart Categories offer a way to give products additional behaviors that cannot be accomplished by product options alone, including category specific coupon codes, shipping and handling fees, and email receipts. <a href="https://wiki.foxycart.com/v/2.0/categories" target="_blank">Learn More</a></p><p>Categories you\'ve created in FoxyStripe must also be created in your <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">FoxyCart Categories</a> admin panel.</p>'
99 99
             )),
100
-			GridField::create(
100
+            GridField::create(
101 101
                 'ProductCategory',
102 102
                 _t('FoxyStripeSiteConfig.ProductCategory', 'FoxyCart Categories'),
103 103
                 ProductCategory::get(),
104 104
                 GridFieldConfig_RecordEditor::create()
105 105
             )
106
-		));
106
+        ));
107 107
 
108 108
         // option groups tab
109
-		$fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
110
-			HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
111
-			LiteralField::create('OptionGroupsDescrip', _t(
109
+        $fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
110
+            HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
111
+            LiteralField::create('OptionGroupsDescrip', _t(
112 112
                 'FoxyStripeSiteConfig.OptionGroupsDescrip',
113 113
                 '<p>Product Option Groups allow you to name a set of product options.</p>'
114 114
             )),
115
-			GridField::create(
115
+            GridField::create(
116 116
                 'OptionGroup',
117 117
                 _t('FoxyStripeSiteConfig.OptionGroup', 'Product Option Groups'),
118 118
                 OptionGroup::get(),
119 119
                 GridFieldConfig_RecordEditor::create()
120 120
             )
121
-		));
121
+        ));
122 122
 
123
-	}
123
+    }
124 124
 
125 125
     private static function getSSOLink() {
126 126
         return Director::absoluteBaseURL()."foxystripe/sso/";
Please login to merge, or discard this patch.
code/extensions/CustomerExtension.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
         $response = FoxyCart::putCustomer($this->owner);
26 26
 
27 27
         // Grab customer_id record from FoxyCart response, store in Member
28
-		if($response){
29
-        	$foxyResponse = new SimpleXMLElement($response);
30
-        	$this->owner->Customer_ID = (int) $foxyResponse->customer_id;
31
-		}
28
+        if($response){
29
+            $foxyResponse = new SimpleXMLElement($response);
30
+            $this->owner->Customer_ID = (int) $foxyResponse->customer_id;
31
+        }
32 32
     }
33 33
 
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
code/form/FoxyStripeDropdownField.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -50,41 +50,41 @@
 block discarded – undo
50 50
  */
51 51
 class FoxyStripeDropdownField extends DropdownField{
52 52
 
53
-	/**
54
-	 * Mark certain elements as disabled,
55
-	 * regardless of the {@link setDisabled()} settings.
56
-	 *
57
-	 * @param array $items Collection of array keys, as defined in the $source array
53
+    /**
54
+     * Mark certain elements as disabled,
55
+     * regardless of the {@link setDisabled()} settings.
56
+     *
57
+     * @param array $items Collection of array keys, as defined in the $source array
58 58
      * @return $this
59
-	 */
60
-	public function setDisabledItems($items){
61
-		$controller = Controller::curr();
62
-		$code = $controller->data()->Code;
63
-		$updated = [];
64
-		if(is_array($items) && !empty($items)){
65
-			foreach($items as $item){
66
-				array_push($updated, FoxyStripeProduct::getGeneratedValue($code, $this->getName(), $item, 'value'));
67
-			}
68
-		}
69
-		$this->disabledItems = $updated;
70
-		return $this;
71
-	}
59
+     */
60
+    public function setDisabledItems($items){
61
+        $controller = Controller::curr();
62
+        $code = $controller->data()->Code;
63
+        $updated = [];
64
+        if(is_array($items) && !empty($items)){
65
+            foreach($items as $item){
66
+                array_push($updated, FoxyStripeProduct::getGeneratedValue($code, $this->getName(), $item, 'value'));
67
+            }
68
+        }
69
+        $this->disabledItems = $updated;
70
+        return $this;
71
+    }
72 72
 
73
-	/**
74
-	 * @param array $source
73
+    /**
74
+     * @param array $source
75 75
      * @return $this
76
-	 */
77
-	public function setSource($source) {
78
-		$controller = Controller::curr();
79
-		$code = $controller->data()->Code;
80
-		$updated = [];
81
-		if(is_array($source) && !empty($source)){
82
-			foreach($source as $key => $val){
83
-				$updated[FoxyStripeProduct::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val;
84
-			}
85
-		}
86
-		$this->source = $updated;
87
-		return $this;
88
-	}
76
+     */
77
+    public function setSource($source) {
78
+        $controller = Controller::curr();
79
+        $code = $controller->data()->Code;
80
+        $updated = [];
81
+        if(is_array($source) && !empty($source)){
82
+            foreach($source as $key => $val){
83
+                $updated[FoxyStripeProduct::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val;
84
+            }
85
+        }
86
+        $this->source = $updated;
87
+        return $this;
88
+    }
89 89
 
90 90
 }
Please login to merge, or discard this patch.
code/objects/ProductImage.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@  discard block
 block discarded – undo
7 7
 
8 8
 class ProductImage extends DataObject{
9 9
 
10
-	private static $db = array(
11
-		'Title' => 'Text',
12
-		'SortOrder' => 'Int'
13
-	);
10
+    private static $db = array(
11
+        'Title' => 'Text',
12
+        'SortOrder' => 'Int'
13
+    );
14 14
 
15
-	private static $has_one = array(
16
-		'Image' => 'Image',
17
-		'Product' => 'FoxyStripeProduct'
18
-	);
15
+    private static $has_one = array(
16
+        'Image' => 'Image',
17
+        'Product' => 'FoxyStripeProduct'
18
+    );
19 19
 
20
-	private static $default_sort = 'SortOrder';
20
+    private static $default_sort = 'SortOrder';
21 21
 
22
-	private static $summary_fields = array(
23
-		'Image.CMSThumbnail' => 'Image',
24
-		'Title' => 'Caption'
25
-	);
22
+    private static $summary_fields = array(
23
+        'Image.CMSThumbnail' => 'Image',
24
+        'Title' => 'Caption'
25
+    );
26 26
 
27
-	public function getCMSFields(){
28
-		$fields = FieldList::create(
27
+    public function getCMSFields(){
28
+        $fields = FieldList::create(
29 29
             TextField::create('Title')
30 30
                 ->setTitle(_t('ProductImage.Title', 'Product Image Title')),
31 31
             UploadField::create('Image')
@@ -34,25 +34,25 @@  discard block
 block discarded – undo
34 34
                 ->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'))
35 35
         );
36 36
 
37
-		$this->extend('updateCMSFields', $fields);
37
+        $this->extend('updateCMSFields', $fields);
38 38
 
39 39
         return $fields;
40
-	}
40
+    }
41 41
 
42
-	public function canView($member = false) {
43
-		return true;
44
-	}
42
+    public function canView($member = false) {
43
+        return true;
44
+    }
45 45
 
46
-	public function canEdit($member = null) {
47
-		return Permission::check('Product_CANCRUD');
48
-	}
46
+    public function canEdit($member = null) {
47
+        return Permission::check('Product_CANCRUD');
48
+    }
49 49
 
50
-	public function canDelete($member = null) {
51
-		return Permission::check('Product_CANCRUD');
52
-	}
50
+    public function canDelete($member = null) {
51
+        return Permission::check('Product_CANCRUD');
52
+    }
53 53
 
54
-	public function canCreate($member = null) {
55
-		return Permission::check('Product_CANCRUD');
56
-	}
54
+    public function canCreate($member = null) {
55
+        return Permission::check('Product_CANCRUD');
56
+    }
57 57
 
58 58
 }
Please login to merge, or discard this patch.
tests/ProductDiscountTierTest.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -2,79 +2,79 @@
 block discarded – undo
2 2
 
3 3
 class ProductDiscountTierTest extends FS_Test{
4 4
 
5
-	protected static $use_draft_site = true;
5
+    protected static $use_draft_site = true;
6 6
 
7
-	function setUp(){
8
-		parent::setUp();
7
+    function setUp(){
8
+        parent::setUp();
9 9
 
10
-		$productHolder = ProductHolder::create();
11
-		$productHolder->Title = 'Product Holder';
12
-		$productHolder->write();
10
+        $productHolder = ProductHolder::create();
11
+        $productHolder->Title = 'Product Holder';
12
+        $productHolder->write();
13 13
 
14
-		$product = $this->objFromFixture('ShippableProduct', 'product1');
15
-		$product->ParentID = $productHolder->ID;
16
-		$product->write();
17
-	}
14
+        $product = $this->objFromFixture('ShippableProduct', 'product1');
15
+        $product->ParentID = $productHolder->ID;
16
+        $product->write();
17
+    }
18 18
 
19
-	public function testProductDiscountTierCreation(){
20
-		$this->logInWithPermission('Product_CANCRUD');
19
+    public function testProductDiscountTierCreation(){
20
+        $this->logInWithPermission('Product_CANCRUD');
21 21
 
22
-		$discount = ShippableProduct::get()->first();
22
+        $discount = ShippableProduct::get()->first();
23 23
 
24
-		$tier = $this->objFromFixture('ProductDiscountTier', 'fiveforten');
25
-		$tier->ShippableProductID = $discount->ID;
26
-		$tier->write();
27
-		$tierID = $tier->ID;
24
+        $tier = $this->objFromFixture('ProductDiscountTier', 'fiveforten');
25
+        $tier->ShippableProductID = $discount->ID;
26
+        $tier->write();
27
+        $tierID = $tier->ID;
28 28
 
29
-		$checkTier = ProductDiscountTier::get()->byID($tierID);
29
+        $checkTier = ProductDiscountTier::get()->byID($tierID);
30 30
 
31
-		$this->assertEquals($checkTier->Quantity, 5);
32
-		$this->assertEquals($checkTier->Percentage, 10);
31
+        $this->assertEquals($checkTier->Quantity, 5);
32
+        $this->assertEquals($checkTier->Percentage, 10);
33 33
 
34
-		$this->logOut();
35
-	}
34
+        $this->logOut();
35
+    }
36 36
 
37
-	public function testProductDiscountTierEdit(){
38
-		$this->logInWithPermission('ADMIN');
37
+    public function testProductDiscountTierEdit(){
38
+        $this->logInWithPermission('ADMIN');
39 39
 
40
-		$discount = ShippableProduct::get()->first();
40
+        $discount = ShippableProduct::get()->first();
41 41
 
42
-		$tier = $this->objFromFixture('ProductDiscountTier', 'fiveforten');
43
-		$tier->ShippableProductID = $discount->ID;
44
-		$tier->write();
45
-		$tierID = $tier->ID;
46
-		$this->logInWithPermission('Product_CANCRUD');
42
+        $tier = $this->objFromFixture('ProductDiscountTier', 'fiveforten');
43
+        $tier->ShippableProductID = $discount->ID;
44
+        $tier->write();
45
+        $tierID = $tier->ID;
46
+        $this->logInWithPermission('Product_CANCRUD');
47 47
 
48
-		$tier->Quantity = 2;
49
-		$tier->Percentage = 5;
50
-		$tier->write();
48
+        $tier->Quantity = 2;
49
+        $tier->Percentage = 5;
50
+        $tier->write();
51 51
 
52
-		$checkTier = ProductDiscountTier::get()->byID($tierID);
52
+        $checkTier = ProductDiscountTier::get()->byID($tierID);
53 53
 
54
-		$this->assertEquals($checkTier->Quantity, 2);
55
-		$this->assertEquals($checkTier->Percentage, 5);
54
+        $this->assertEquals($checkTier->Quantity, 2);
55
+        $this->assertEquals($checkTier->Percentage, 5);
56 56
 
57
-		$this->logOut();
58
-	}
57
+        $this->logOut();
58
+    }
59 59
 
60
-	public function testProductDiscountTierDeletion(){
61
-		$this->logInWithPermission('ADMIN');
60
+    public function testProductDiscountTierDeletion(){
61
+        $this->logInWithPermission('ADMIN');
62 62
 
63
-		$discount = ShippableProduct::get()->first();
63
+        $discount = ShippableProduct::get()->first();
64 64
 
65
-		$tier = $this->objFromFixture('ProductDiscountTier', 'fiveforten');
66
-		$tier->ShippableProductID = $discount->ID;
67
-		$tier->write();
68
-		$tierID = $tier->ID;
65
+        $tier = $this->objFromFixture('ProductDiscountTier', 'fiveforten');
66
+        $tier->ShippableProductID = $discount->ID;
67
+        $tier->write();
68
+        $tierID = $tier->ID;
69 69
 
70
-		$this->logOut();
70
+        $this->logOut();
71 71
 
72
-		$this->logInWithPermission('Product_CANCRUD');
72
+        $this->logInWithPermission('Product_CANCRUD');
73 73
 
74
-		$tier->delete();
75
-		$this->assertTrue(!ProductDiscountTier::get()->byID($tierID));
74
+        $tier->delete();
75
+        $this->assertTrue(!ProductDiscountTier::get()->byID($tierID));
76 76
 
77
-		$this->logOut();
78
-	}
77
+        $this->logOut();
78
+    }
79 79
 
80 80
 }
Please login to merge, or discard this patch.
tests/StoreSettingsTest.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,28 +2,28 @@
 block discarded – undo
2 2
 
3 3
 class StoreSettingsTest extends FS_Test{
4 4
 
5
-	protected static $use_draft_site = true;
5
+    protected static $use_draft_site = true;
6 6
 
7
-	function setUp(){
8
-		parent::setUp();
7
+    function setUp(){
8
+        parent::setUp();
9 9
 
10
-		$siteConf = SiteConfig::current_site_config();
11
-		$siteConf->StoreName = 'foxystripe';
10
+        $siteConf = SiteConfig::current_site_config();
11
+        $siteConf->StoreName = 'foxystripe';
12 12
         $siteConf->requireDefaultRecords();
13
-		$siteConf->write();
14
-	}
13
+        $siteConf->write();
14
+    }
15 15
 
16
-	function testStoreKey(){
17
-		$siteConf = SiteConfig::current_site_config();
16
+    function testStoreKey(){
17
+        $siteConf = SiteConfig::current_site_config();
18 18
 
19
-		$this->assertTrue(ctype_alnum($siteConf->StoreKey));
19
+        $this->assertTrue(ctype_alnum($siteConf->StoreKey));
20 20
         $this->assertEquals(strlen($siteConf->StoreKey), 60);
21
-	}
21
+    }
22 22
 
23
-	function testStoreName(){
24
-		$siteConf = SiteConfig::current_site_config();
23
+    function testStoreName(){
24
+        $siteConf = SiteConfig::current_site_config();
25 25
 
26 26
         $this->assertEquals($siteConf->StoreName, 'foxystripe');
27
-	}
27
+    }
28 28
 
29 29
 }
Please login to merge, or discard this patch.