Completed
Branch models-cleanup/model-relations (db5ca7)
by
unknown
13:03 queued 08:35
created
modules/invoice/EED_Invoice.module.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -12,87 +12,87 @@
 block discarded – undo
12 12
 {
13 13
 
14 14
 
15
-    /**
16
-     * @return EED_Invoice
17
-     */
18
-    public static function instance()
19
-    {
20
-        return parent::get_instance(__CLASS__);
21
-    }
15
+	/**
16
+	 * @return EED_Invoice
17
+	 */
18
+	public static function instance()
19
+	{
20
+		return parent::get_instance(__CLASS__);
21
+	}
22 22
 
23 23
 
24
-    /**
25
-     *    set_hooks - for hooking into EE Core, other modules, etc
26
-     *
27
-     * @access    public
28
-     * @return    void
29
-     */
30
-    public static function set_hooks()
31
-    {
32
-        EE_Config::register_route('download_invoice', 'EED_Invoice', 'download_invoice');
33
-        EE_Config::register_route('launch_invoice', 'EED_Invoice', 'launch_invoice');
34
-    }
24
+	/**
25
+	 *    set_hooks - for hooking into EE Core, other modules, etc
26
+	 *
27
+	 * @access    public
28
+	 * @return    void
29
+	 */
30
+	public static function set_hooks()
31
+	{
32
+		EE_Config::register_route('download_invoice', 'EED_Invoice', 'download_invoice');
33
+		EE_Config::register_route('launch_invoice', 'EED_Invoice', 'launch_invoice');
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
39
-     *
40
-     * @access    public
41
-     * @return    void
42
-     */
43
-    public static function set_hooks_admin()
44
-    {
45
-    }
37
+	/**
38
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
39
+	 *
40
+	 * @access    public
41
+	 * @return    void
42
+	 */
43
+	public static function set_hooks_admin()
44
+	{
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     *    run - initial module setup
50
-     *
51
-     * @access    public
52
-     * @return    void
53
-     */
54
-    public function run($WP)
55
-    {
56
-        if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) {
57
-            require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php');
58
-        } else {
59
-            $msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso');
60
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
61
-        }
62
-    }
48
+	/**
49
+	 *    run - initial module setup
50
+	 *
51
+	 * @access    public
52
+	 * @return    void
53
+	 */
54
+	public function run($WP)
55
+	{
56
+		if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) {
57
+			require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php');
58
+		} else {
59
+			$msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso');
60
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
61
+		}
62
+	}
63 63
 
64 64
 
65
-    /**
66
-     *    invoice_launch
67
-     *
68
-     * @access    public
69
-     * @return    void
70
-     */
71
-    public function launch_invoice()
72
-    {
73
-        $this->run(null);
74
-        if (EE_Registry::instance()->REQ->is_set('id')) {
75
-            $id = sanitize_key(EE_Registry::instance()->REQ->get('id'));
76
-            $invoice = new Invoice($id);
77
-            $invoice->send_invoice();
78
-        }
79
-    }
65
+	/**
66
+	 *    invoice_launch
67
+	 *
68
+	 * @access    public
69
+	 * @return    void
70
+	 */
71
+	public function launch_invoice()
72
+	{
73
+		$this->run(null);
74
+		if (EE_Registry::instance()->REQ->is_set('id')) {
75
+			$id = sanitize_key(EE_Registry::instance()->REQ->get('id'));
76
+			$invoice = new Invoice($id);
77
+			$invoice->send_invoice();
78
+		}
79
+	}
80 80
 
81 81
 
82
-    /**
83
-     *    download_invoice
84
-     *
85
-     * @access    public
86
-     * @return    void
87
-     */
88
-    public function download_invoice()
89
-    {
90
-        $this->run(null);
91
-        if (EE_Registry::instance()->REQ->is_set('id')) {
92
-            $id = sanitize_key(EE_Registry::instance()->REQ->get('id'));
93
-            $invoice = new Invoice($_REQUEST['id']);
94
-            // send invoice but force download
95
-            $invoice->send_invoice(true);
96
-        }
97
-    }
82
+	/**
83
+	 *    download_invoice
84
+	 *
85
+	 * @access    public
86
+	 * @return    void
87
+	 */
88
+	public function download_invoice()
89
+	{
90
+		$this->run(null);
91
+		if (EE_Registry::instance()->REQ->is_set('id')) {
92
+			$id = sanitize_key(EE_Registry::instance()->REQ->get('id'));
93
+			$invoice = new Invoice($_REQUEST['id']);
94
+			// send invoice but force download
95
+			$invoice->send_invoice(true);
96
+		}
97
+	}
98 98
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@
 block discarded – undo
53 53
      */
54 54
     public function run($WP)
55 55
     {
56
-        if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) {
57
-            require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php');
56
+        if (is_readable(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php')) {
57
+            require_once(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php');
58 58
         } else {
59 59
             $msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso');
60 60
             EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
Please login to merge, or discard this patch.
Paypal_Express/templates/paypal_express_debug_info.template.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
 
3 3
     <h4 class="important-notice">
4 4
         <?php _e(
5
-            'Debug Mode is turned ON. You will be redirected to the PayPal Sandbox environment. Please use your Sandbox PayPal account for the checkout.',
6
-            'event_espresso'
7
-        ); ?></h4>
5
+			'Debug Mode is turned ON. You will be redirected to the PayPal Sandbox environment. Please use your Sandbox PayPal account for the checkout.',
6
+			'event_espresso'
7
+		); ?></h4>
8 8
 
9 9
     <h4><?php _e('How do I test specific error codes?', 'event_espresso'); ?></h4>
10 10
     <p>
11 11
         <?php _e(
12
-            'To trigger an error condition on an amount-related field, 
12
+			'To trigger an error condition on an amount-related field, 
13 13
 			specify a error code value as a number with two digits to the right of the decimal point. 
14 14
 			For example, specify a value of 107.55 to trigger the 10755 error.',
15
-            'event_espresso'
16
-        ); ?>
15
+			'event_espresso'
16
+		); ?>
17 17
     </p>
18 18
     <p>
19 19
         <?php printf(
20
-            __('More details can be found here: %1$s Testing Error Conditions %2$s.', 'event_espresso'),
21
-            '<a href="https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions">',
22
-            '</a>'
23
-        ); ?>
20
+			__('More details can be found here: %1$s Testing Error Conditions %2$s.', 'event_espresso'),
21
+			'<a href="https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions">',
22
+			'</a>'
23
+		); ?>
24 24
     </p>
25 25
 
26 26
 </div>
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
Invoice/templates/invoice_payment_details_content.template.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
     <div class="event-display-boxes">
14 14
 <?php
15 15
 if (! empty($page_title)) {
16
-    echo '<h4 id="invoice_title" class="payment_type_title section-heading">'
17
-         . stripslashes_deep(
18
-             $page_title
19
-         ) . '</h4>';
16
+	echo '<h4 id="invoice_title" class="payment_type_title section-heading">'
17
+		 . stripslashes_deep(
18
+			 $page_title
19
+		 ) . '</h4>';
20 20
 }
21 21
 if (! empty($invoice_url)) {
22
-    ?>
22
+	?>
23 23
     <p>
24 24
         <a href="<?php echo $invoice_url; ?>" class="ee-button-lnk inline-button ee-invoice-lnk" target="_blank">
25 25
             <?php _e('View Invoice', 'event_espresso'); ?>
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
     </p>
28 28
     <?php
29 29
 
30
-    if (isset($page_confirmation_text)) {
31
-        echo '<div class="event-messages ui-state-highlight"><span class="ui-icon ui-icon-alert"></span><p class="instruct">'
32
-             . stripslashes_deep(
33
-                 $page_confirmation_text
34
-             ) . '</p></div>';
35
-    }
30
+	if (isset($page_confirmation_text)) {
31
+		echo '<div class="event-messages ui-state-highlight"><span class="ui-icon ui-icon-alert"></span><p class="instruct">'
32
+			 . stripslashes_deep(
33
+				 $page_confirmation_text
34
+			 ) . '</p></div>';
35
+	}
36 36
 
37
-    if (! empty($page_extra_info)) {
38
-        ?>
37
+	if (! empty($page_extra_info)) {
38
+		?>
39 39
         <div class="address-block">
40 40
             <?php echo wpautop(stripslashes_deep($page_extra_info)); ?>
41 41
         </div>
42 42
         <?php
43
-    }
44
-    ?>
43
+	}
44
+	?>
45 45
     </div>
46 46
     <?php
47 47
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 ?>
13 13
     <div class="event-display-boxes">
14 14
 <?php
15
-if (! empty($page_title)) {
15
+if ( ! empty($page_title)) {
16 16
     echo '<h4 id="invoice_title" class="payment_type_title section-heading">'
17 17
          . stripslashes_deep(
18 18
              $page_title
19
-         ) . '</h4>';
19
+         ).'</h4>';
20 20
 }
21
-if (! empty($invoice_url)) {
21
+if ( ! empty($invoice_url)) {
22 22
     ?>
23 23
     <p>
24 24
         <a href="<?php echo $invoice_url; ?>" class="ee-button-lnk inline-button ee-invoice-lnk" target="_blank">
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
         echo '<div class="event-messages ui-state-highlight"><span class="ui-icon ui-icon-alert"></span><p class="instruct">'
32 32
              . stripslashes_deep(
33 33
                  $page_confirmation_text
34
-             ) . '</p></div>';
34
+             ).'</p></div>';
35 35
     }
36 36
 
37
-    if (! empty($page_extra_info)) {
37
+    if ( ! empty($page_extra_info)) {
38 38
         ?>
39 39
         <div class="address-block">
40 40
             <?php echo wpautop(stripslashes_deep($page_extra_info)); ?>
Please login to merge, or discard this patch.
help_tabs/payment_methods_overview_paypalstandard.help_tab.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@
 block discarded – undo
23 23
 <li>
24 24
 <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br />
25 25
 <?php printf(__('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/>
26
-<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso');?>
26
+<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso'); ?>
27 27
 </li>
28 28
 <li>
29 29
 <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br />
30 30
 <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it should calculate the shipping on each payment (if there are multiple payments for a single transaction, PayPal is permitted to add shipping charges to each payment.)', 'event_espresso'); ?><br/>
31
-<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso');?>
31
+<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?>
32 32
 <li>
33
-<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso');?></strong><br/>
34
-<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso');?><br/>
35
-<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso');?><br/>
36
-<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso');?>
33
+<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/>
34
+<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/>
35
+<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?><br/>
36
+<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso'); ?>
37 37
 </li>
38 38
 <li>
39 39
 <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br />
Please login to merge, or discard this patch.
Paypal_Standard/templates/paypal_standard_intro.template.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 // if this is decaf, which is put on WordPress.org, we need to inform users that
4 4
 // we just put an affiliate link there. See https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ section 12
5 5
 if (apply_filters('FHEE__ee_show_affiliate_links', true)) {
6
-    $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso');
6
+	$closing_tag .= esc_html__(' (affiliate link)', 'event_espresso');
7 7
 }
8 8
 printf(
9
-    esc_html__(
10
-        'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.',
11
-        'event_espresso'
12
-    ),
13
-    '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">',
14
-    $closing_tag
9
+	esc_html__(
10
+		'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.',
11
+		'event_espresso'
12
+	),
13
+	'<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">',
14
+	$closing_tag
15 15
 );
Please login to merge, or discard this patch.
payment_methods/Admin_Only/EE_PMT_Admin_Only.pm.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -16,38 +16,38 @@
 block discarded – undo
16 16
 
17 17
 
18 18
 
19
-    /**
20
-     *
21
-     * @param EE_Payment_Method $pm_instance
22
-     * @return EE_PMT_Admin_Only
23
-     */
24
-    public function __construct($pm_instance = null)
25
-    {
26
-        $this->_pretty_name = __("Admin Only", 'event_espresso');
27
-        $this->_default_button_url = '';
28
-        parent::__construct($pm_instance);
29
-    }
30
-
31
-
32
-
33
-    /**
34
-     * Creates the billing form for this payment method type
35
-     * @param \EE_Transaction $transaction
36
-     * @return NULL
37
-     */
38
-    public function generate_new_billing_form(EE_Transaction $transaction = null)
39
-    {
40
-        return null;
41
-    }
42
-
43
-
44
-
45
-    /**
46
-     * Gets the form for all the settings related to this payment method type
47
-     * @return EE_Payment_Method_Form
48
-     */
49
-    public function generate_new_settings_form()
50
-    {
51
-        return new EE_Payment_Method_Form();
52
-    }
19
+	/**
20
+	 *
21
+	 * @param EE_Payment_Method $pm_instance
22
+	 * @return EE_PMT_Admin_Only
23
+	 */
24
+	public function __construct($pm_instance = null)
25
+	{
26
+		$this->_pretty_name = __("Admin Only", 'event_espresso');
27
+		$this->_default_button_url = '';
28
+		parent::__construct($pm_instance);
29
+	}
30
+
31
+
32
+
33
+	/**
34
+	 * Creates the billing form for this payment method type
35
+	 * @param \EE_Transaction $transaction
36
+	 * @return NULL
37
+	 */
38
+	public function generate_new_billing_form(EE_Transaction $transaction = null)
39
+	{
40
+		return null;
41
+	}
42
+
43
+
44
+
45
+	/**
46
+	 * Gets the form for all the settings related to this payment method type
47
+	 * @return EE_Payment_Method_Form
48
+	 */
49
+	public function generate_new_settings_form()
50
+	{
51
+		return new EE_Payment_Method_Form();
52
+	}
53 53
 }
Please login to merge, or discard this patch.
admin/new/pricing/templates/pricing_type_details_main_meta_box.template.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
             <td>
11 11
                 <?php echo $base_type_select; ?><br/>
12 12
                 <p class="description"><?php
13
-                    _e(
14
-                        'Choosing a basic type allows us to quickly configure a bunch of other options for you.<br/>All events need to have at least one Base Price type option.<br/>Discounts reduce the price of an event, Surcharges increase the price.<br/>Taxes are applied to the final total.',
15
-                        'event_espresso'
16
-                    ); ?></p>
13
+					_e(
14
+						'Choosing a basic type allows us to quickly configure a bunch of other options for you.<br/>All events need to have at least one Base Price type option.<br/>Discounts reduce the price of an event, Surcharges increase the price.<br/>Taxes are applied to the final total.',
15
+						'event_espresso'
16
+					); ?></p>
17 17
             </td>
18 18
         </tr>
19 19
 
@@ -44,20 +44,20 @@  discard block
 block discarded – undo
44 44
                     <?php _e('Fixed', 'event_espresso'); ?>
45 45
                 </label>
46 46
                 <p class="description"><?php
47
-                    _e(
48
-                        'Whether this Price Type will be applied as a percentage or applied as a set fixed amount.',
49
-                        'event_espresso'
50
-                    ); ?></p>
47
+					_e(
48
+						'Whether this Price Type will be applied as a percentage or applied as a set fixed amount.',
49
+						'event_espresso'
50
+					); ?></p>
51 51
                 <?php if ($price_type->base_type() == EEM_Price_Type::base_type_tax) :
52
-                    // base type is tax so let's just let the user know that taxes are always percentage.
53
-                    ?>
52
+					// base type is tax so let's just let the user know that taxes are always percentage.
53
+					?>
54 54
                     <p class="description" style="color:#E44064">
55 55
                         <?php
56
-                            _e(
57
-                                'The selected base type for this price type is "Tax".  Taxes are always assumed to be a percentage.  If you want to use a fixed value for a tax then please change the base type to a surcharge.',
58
-                                'event_espresso'
59
-                            );
60
-                        ?></p>
56
+							_e(
57
+								'The selected base type for this price type is "Tax".  Taxes are always assumed to be a percentage.  If you want to use a fixed value for a tax then please change the base type to a surcharge.',
58
+								'event_espresso'
59
+							);
60
+						?></p>
61 61
                 <?php endif; ?>
62 62
             </td>
63 63
         </tr>
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
                 <p class="description">
72 72
                     <?php _e('The order that Price Types are applied.', 'event_espresso'); ?></p>
73 73
                 <p class="description"><?php
74
-                    _e(
75
-                        'Price types are applied sequentially according to their Order, where higher ordered Price Types will affect lower ordered Price Types.<br/>Price types with equal Orders will be applied in parallel to whatever total precedes them and will not affect each other. Actual Prices will be set to "0" so that they are processed first. Taxes will be always be applied last but their order will still determine if they are applied in parallel or as compound taxes (one tax on top of the other).',
76
-                        'event_espresso'
77
-                    ); ?></p>
74
+					_e(
75
+						'Price types are applied sequentially according to their Order, where higher ordered Price Types will affect lower ordered Price Types.<br/>Price types with equal Orders will be applied in parallel to whatever total precedes them and will not affect each other. Actual Prices will be set to "0" so that they are processed first. Taxes will be always be applied last but their order will still determine if they are applied in parallel or as compound taxes (one tax on top of the other).',
76
+						'event_espresso'
77
+					); ?></p>
78 78
             </td>
79 79
         </tr>
80 80
 
Please login to merge, or discard this patch.
admin/new/pricing/templates/pricing_details_main_meta_box.template.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,11 @@
 block discarded – undo
20 20
                         );
21 21
                         ?>
22 22
                     </p>
23
-                <?php else : ?>
24
-                    <?php echo EEH_Form_Fields::select_input('PRT_ID', $price_types, $price->type(), 'id="PRT_ID"'); ?>
23
+                <?php else {
24
+	: ?>
25
+                    <?php echo EEH_Form_Fields::select_input('PRT_ID', $price_types, $price->type(), 'id="PRT_ID"');
26
+}
27
+?>
25 28
                     <p class="description">
26 29
                         <?php
27 30
                             _e(
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,40 +4,40 @@  discard block
 block discarded – undo
4 4
         <tbody>
5 5
         <tr valign="top">
6 6
             <th><label for="PRT_ID"><?php
7
-                    _e(
8
-                        'Type',
9
-                        'event_espresso'
10
-                    ); ?></label> <?php echo EEH_Template::get_help_tab_link('type_field_info'); ?></th>
7
+					_e(
8
+						'Type',
9
+						'event_espresso'
10
+					); ?></label> <?php echo EEH_Template::get_help_tab_link('type_field_info'); ?></th>
11 11
             <td>
12 12
                 <?php if ($price->type_obj() && $price->type_obj()->base_type() === 1) : ?>
13 13
                     <input type="hidden" name="PRT_ID" id="PRT_ID" value="<?php echo $price->type(); ?>"/>
14 14
                     <p><strong><?php _e('Price', 'event_espresso'); ?></strong></p>
15 15
                     <p class="description">
16 16
                         <?php
17
-                        _e(
18
-                            'This is the default base price. Every new ticket created will start off with this base price.',
19
-                            'event_espresso'
20
-                        );
21
-                        ?>
17
+						_e(
18
+							'This is the default base price. Every new ticket created will start off with this base price.',
19
+							'event_espresso'
20
+						);
21
+						?>
22 22
                     </p>
23 23
                 <?php else : ?>
24 24
                     <?php echo EEH_Form_Fields::select_input('PRT_ID', $price_types, $price->type(), 'id="PRT_ID"'); ?>
25 25
                     <p class="description">
26 26
                         <?php
27
-                            _e(
28
-                                'Price Modifier. Default items will apply to ALL new events you create.',
29
-                                'event_espresso'
30
-                            );
31
-                        ?></p>
27
+							_e(
28
+								'Price Modifier. Default items will apply to ALL new events you create.',
29
+								'event_espresso'
30
+							);
31
+						?></p>
32 32
                 <?php endif; ?>
33 33
             </td>
34 34
         </tr>
35 35
         <tr valign="top">
36 36
             <th><label for="PRC_name"><?php
37
-                    _e(
38
-                        'Name',
39
-                        'event_espresso'
40
-                    ); ?></label> <?php echo EEH_Template::get_help_tab_link('name_field_info'); ?></th>
37
+					_e(
38
+						'Name',
39
+						'event_espresso'
40
+					); ?></label> <?php echo EEH_Template::get_help_tab_link('name_field_info'); ?></th>
41 41
             <td>
42 42
                 <input class="regular-text" type="text" id="PRC_name" name="PRC_name"
43 43
                        value="<?php $price->f('PRC_name'); ?>"/>
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
         </tr>
46 46
         <tr valign="top">
47 47
             <th><label for="PRC_desc"><?php
48
-                    _e(
49
-                        'Description',
50
-                        'event_espresso'
51
-                    ); ?></label> <?php echo EEH_Template::get_help_tab_link('description_field_info'); ?></th>
48
+					_e(
49
+						'Description',
50
+						'event_espresso'
51
+					); ?></label> <?php echo EEH_Template::get_help_tab_link('description_field_info'); ?></th>
52 52
             <td>
53 53
                     <textarea class="regular-text" id="PRC_desc" name="PRC_desc" rows="5"><?php
54
-                        $price->f('PRC_desc');
55
-                    ?></textarea><br/>
54
+						$price->f('PRC_desc');
55
+					?></textarea><br/>
56 56
             </td>
57 57
         </tr>
58 58
         <tr valign="top">
59 59
             <th><label for="PRC_amount"><?php
60
-                    _e(
61
-                        'Amount',
62
-                        'event_espresso'
63
-                    ); ?><?php echo EEH_Template::get_help_tab_link('amount_field_info'); ?></label></th>
60
+					_e(
61
+						'Amount',
62
+						'event_espresso'
63
+					); ?><?php echo EEH_Template::get_help_tab_link('amount_field_info'); ?></label></th>
64 64
             <td>
65 65
                 <input class="small-text ee-numeric" type="text" id="PRC_amount" name="PRC_amount"
66 66
                        value="<?php echo $price->amount(); ?>"/>
Please login to merge, or discard this patch.
caffeinated/admin/new/tickets/Tickets_Admin_Page.core.php 2 patches
Indentation   +308 added lines, -308 removed lines patch added patch discarded remove patch
@@ -12,312 +12,312 @@
 block discarded – undo
12 12
 {
13 13
 
14 14
 
15
-    protected function _init_page_props()
16
-    {
17
-        $this->page_slug = TICKETS_PG_SLUG;
18
-        $this->page_label = TICKETS_LABEL;
19
-        $this->_admin_base_url = TICKETS_ADMIN_URL;
20
-        $this->_admin_base_path = TICKETS_ADMIN;
21
-    }
22
-
23
-
24
-    protected function _ajax_hooks()
25
-    {
26
-    }
27
-
28
-
29
-    protected function _define_page_props()
30
-    {
31
-        $this->_admin_page_title = TICKETS_LABEL;
32
-        $this->_labels = array(
33
-            'buttons' => array(
34
-                'add'    => __('Add New Default Ticket', 'event_espresso'),
35
-                'edit'   => __('Edit Default Ticket', 'event_espresso'),
36
-                'delete' => __('Delete Default Ticket', 'event_espresso'),
37
-            ),
38
-        );
39
-    }
40
-
41
-
42
-    protected function _set_page_routes()
43
-    {
44
-
45
-        $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID'])
46
-            ? $this->_req_data['TKT_ID'] : 0;
47
-
48
-        $this->_page_routes = array(
49
-            'default'         => array(
50
-                'func'       => '_tickets_overview_list_table',
51
-                'capability' => 'ee_read_default_tickets',
52
-            ),
53
-            'trash_ticket'    => array(
54
-                'func'       => '_trash_or_restore_ticket',
55
-                'noheader'   => true,
56
-                'args'       => array('trash' => true),
57
-                'capability' => 'ee_delete_default_ticket',
58
-                'obj_id'     => $tkt_id,
59
-            ),
60
-            'trash_tickets'   => array(
61
-                'func'       => '_trash_or_restore_ticket',
62
-                'noheader'   => true,
63
-                'args'       => array('trash' => true),
64
-                'capability' => 'ee_delete_default_tickets',
65
-            ),
66
-            'restore_ticket'  => array(
67
-                'func'       => '_trash_or_restore_ticket',
68
-                'noheader'   => true,
69
-                'capability' => 'ee_delete_default_ticket',
70
-                'obj_id'     => $tkt_id,
71
-            ),
72
-            'restore_tickets' => array(
73
-                'func'       => '_trash_or_restore_ticket',
74
-                'noheader'   => true,
75
-                'capability' => 'ee_delete_default_tickets',
76
-            ),
77
-            'delete_ticket'   => array(
78
-                'func'       => '_delete_ticket',
79
-                'noheader'   => true,
80
-                'capability' => 'ee_delete_default_ticket',
81
-                'obj_id'     => $tkt_id,
82
-            ),
83
-            'delete_tickets'  => array(
84
-                'func'       => '_delete_ticket',
85
-                'noheader'   => true,
86
-                'capability' => 'ee_delete_default_tickets',
87
-            ),
88
-        );
89
-    }
90
-
91
-
92
-    protected function _set_page_config()
93
-    {
94
-        $this->_page_config = array(
95
-            'default' => array(
96
-                'nav'           => array(
97
-                    'label' => __('Default Tickets', 'event_espresso'),
98
-                    'order' => 10,
99
-                ),
100
-                'list_table'    => 'Tickets_List_Table',
101
-                'require_nonce' => false,
102
-            ),
103
-        );
104
-    }
105
-
106
-
107
-    protected function _add_screen_options()
108
-    {
109
-    }
110
-
111
-    protected function _add_screen_options_default()
112
-    {
113
-        $this->_per_page_screen_option();
114
-    }
115
-
116
-
117
-    protected function _add_feature_pointers()
118
-    {
119
-    }
120
-
121
-    public function load_scripts_styles()
122
-    {
123
-    }
124
-
125
-    public function load_scripts_styles_default()
126
-    {
127
-    }
128
-
129
-    public function admin_footer_scripts()
130
-    {
131
-    }
132
-
133
-    public function admin_init()
134
-    {
135
-    }
136
-
137
-    public function admin_notices()
138
-    {
139
-    }
140
-
141
-
142
-    public function _set_list_table_views_default()
143
-    {
144
-        $this->_views = array(
145
-            'all'     => array(
146
-                'slug'        => 'all',
147
-                'label'       => __('All', 'event_espresso'),
148
-                'count'       => 0,
149
-                'bulk_action' => array(
150
-                    'trash_tickets' => __('Move to Trash', 'event_espresso'),
151
-                ),
152
-            ),
153
-            'trashed' => array(
154
-                'slug'        => 'trashed',
155
-                'label'       => __('Trash', 'event_espresso'),
156
-                'count'       => 0,
157
-                'bulk_action' => array(
158
-                    'restore_tickets' => __('Restore from Trash', 'event_espresso'),
159
-                    'delete_tickets'  => __('Delete Permanently', 'event_espresso'),
160
-                ),
161
-            ),
162
-        );
163
-    }
164
-
165
-
166
-    public function _tickets_overview_list_table()
167
-    {
168
-        $this->_search_btn_label = __('Tickets', 'event_espresso');
169
-        $this->display_admin_list_table_page_with_no_sidebar();
170
-    }
171
-
172
-
173
-    public function get_default_tickets($per_page = 10, $count = false, $trashed = false)
174
-    {
175
-
176
-        $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
177
-        $order = empty($this->_req_data['order']) ? 'ASC' : $order;
178
-
179
-        switch ($orderby) {
180
-            case 'TKT_name':
181
-                $orderby = array('TKT_name' => $order);
182
-                break;
183
-
184
-            case 'TKT_price':
185
-                $orderby = array('TKT_price' => $order);
186
-                break;
187
-
188
-            case 'TKT_uses':
189
-                $orderby = array('TKT_uses' => $order);
190
-                break;
191
-
192
-            case 'TKT_min':
193
-                $orderby = array('TKT_min' => $order);
194
-                break;
195
-
196
-            case 'TKT_max':
197
-                $orderby = array('TKT_max' => $order);
198
-                break;
199
-
200
-            case 'TKT_qty':
201
-                $orderby = array('TKT_qty' => $order);
202
-                break;
203
-        }
204
-
205
-        $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
206
-            ? $this->_req_data['paged'] : 1;
207
-        $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
208
-            ? $this->_req_data['perpage'] : $per_page;
209
-
210
-        $_where = array(
211
-            'TKT_is_default' => 1,
212
-            'TKT_deleted'    => $trashed,
213
-        );
214
-
215
-        $offset = ($current_page - 1) * $per_page;
216
-        $limit = array($offset, $per_page);
217
-
218
-        if (isset($this->_req_data['s'])) {
219
-            $sstr = '%' . $this->_req_data['s'] . '%';
220
-            $_where['OR'] = array(
221
-                'TKT_name'        => array('LIKE', $sstr),
222
-                'TKT_description' => array('LIKE', $sstr),
223
-            );
224
-        }
225
-
226
-        $query_params = array(
227
-            $_where,
228
-            'order_by' => $orderby,
229
-            'limit'    => $limit,
230
-            'group_by' => 'TKT_ID',
231
-        );
232
-
233
-        if ($count) {
234
-            return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
235
-        } else {
236
-            return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
237
-        }
238
-    }
239
-
240
-
241
-    protected function _trash_or_restore_ticket($trash = false)
242
-    {
243
-        $success = 1;
244
-
245
-        $TKT = EEM_Ticket::instance();
246
-
247
-        // checkboxes?
248
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
249
-            // if array has more than one element then success message should be plural
250
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
251
-
252
-            // cycle thru the boxes
253
-            while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
254
-                if ($trash) {
255
-                    if (! $TKT->delete_by_ID($TKT_ID)) {
256
-                        $success = 0;
257
-                    }
258
-                } else {
259
-                    if (! $TKT->restore_by_ID($TKT_ID)) {
260
-                        $success = 0;
261
-                    }
262
-                }
263
-            }
264
-        } else {
265
-            // grab single id and trash
266
-            $TKT_ID = absint($this->_req_data['TKT_ID']);
267
-
268
-            if ($trash) {
269
-                if (! $TKT->delete_by_ID($TKT_ID)) {
270
-                    $success = 0;
271
-                }
272
-            } else {
273
-                if (! $TKT->restore_by_ID($TKT_ID)) {
274
-                    $success = 0;
275
-                }
276
-            }
277
-        }
278
-
279
-        $action_desc = $trash ? 'moved to the trash' : 'restored';
280
-        $this->_redirect_after_action($success, 'Tickets', $action_desc, array());
281
-    }
282
-
283
-
284
-    protected function _delete_ticket()
285
-    {
286
-        $success = 1;
287
-
288
-        $TKT = EEM_Ticket::instance();
289
-
290
-        // checkboxes?
291
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
292
-            // if array has more than one element then success message should be plural
293
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
294
-
295
-            // cycle thru the boxes
296
-            while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
297
-                // delete
298
-                if (! $this->_delete_the_ticket($TKT_ID)) {
299
-                    $success = 0;
300
-                }
301
-            }
302
-        } else {
303
-            // grab single id and trash
304
-            $TKT_ID = absint($this->_req_data['TKT_ID']);
305
-            if (! $this->_delete_the_ticket($TKT_ID)) {
306
-                $success = 0;
307
-            }
308
-        }
309
-
310
-        $action_desc = 'deleted';
311
-        $this->_redirect_after_action($success, 'Tickets', $action_desc, array());
312
-    }
313
-
314
-
315
-    protected function _delete_the_ticket($TKT_ID)
316
-    {
317
-        $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
318
-
319
-        // delete all related prices first
320
-        $tkt->delete_related_permanently('Price');
321
-        return $tkt->delete_permanently();
322
-    }
15
+	protected function _init_page_props()
16
+	{
17
+		$this->page_slug = TICKETS_PG_SLUG;
18
+		$this->page_label = TICKETS_LABEL;
19
+		$this->_admin_base_url = TICKETS_ADMIN_URL;
20
+		$this->_admin_base_path = TICKETS_ADMIN;
21
+	}
22
+
23
+
24
+	protected function _ajax_hooks()
25
+	{
26
+	}
27
+
28
+
29
+	protected function _define_page_props()
30
+	{
31
+		$this->_admin_page_title = TICKETS_LABEL;
32
+		$this->_labels = array(
33
+			'buttons' => array(
34
+				'add'    => __('Add New Default Ticket', 'event_espresso'),
35
+				'edit'   => __('Edit Default Ticket', 'event_espresso'),
36
+				'delete' => __('Delete Default Ticket', 'event_espresso'),
37
+			),
38
+		);
39
+	}
40
+
41
+
42
+	protected function _set_page_routes()
43
+	{
44
+
45
+		$tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID'])
46
+			? $this->_req_data['TKT_ID'] : 0;
47
+
48
+		$this->_page_routes = array(
49
+			'default'         => array(
50
+				'func'       => '_tickets_overview_list_table',
51
+				'capability' => 'ee_read_default_tickets',
52
+			),
53
+			'trash_ticket'    => array(
54
+				'func'       => '_trash_or_restore_ticket',
55
+				'noheader'   => true,
56
+				'args'       => array('trash' => true),
57
+				'capability' => 'ee_delete_default_ticket',
58
+				'obj_id'     => $tkt_id,
59
+			),
60
+			'trash_tickets'   => array(
61
+				'func'       => '_trash_or_restore_ticket',
62
+				'noheader'   => true,
63
+				'args'       => array('trash' => true),
64
+				'capability' => 'ee_delete_default_tickets',
65
+			),
66
+			'restore_ticket'  => array(
67
+				'func'       => '_trash_or_restore_ticket',
68
+				'noheader'   => true,
69
+				'capability' => 'ee_delete_default_ticket',
70
+				'obj_id'     => $tkt_id,
71
+			),
72
+			'restore_tickets' => array(
73
+				'func'       => '_trash_or_restore_ticket',
74
+				'noheader'   => true,
75
+				'capability' => 'ee_delete_default_tickets',
76
+			),
77
+			'delete_ticket'   => array(
78
+				'func'       => '_delete_ticket',
79
+				'noheader'   => true,
80
+				'capability' => 'ee_delete_default_ticket',
81
+				'obj_id'     => $tkt_id,
82
+			),
83
+			'delete_tickets'  => array(
84
+				'func'       => '_delete_ticket',
85
+				'noheader'   => true,
86
+				'capability' => 'ee_delete_default_tickets',
87
+			),
88
+		);
89
+	}
90
+
91
+
92
+	protected function _set_page_config()
93
+	{
94
+		$this->_page_config = array(
95
+			'default' => array(
96
+				'nav'           => array(
97
+					'label' => __('Default Tickets', 'event_espresso'),
98
+					'order' => 10,
99
+				),
100
+				'list_table'    => 'Tickets_List_Table',
101
+				'require_nonce' => false,
102
+			),
103
+		);
104
+	}
105
+
106
+
107
+	protected function _add_screen_options()
108
+	{
109
+	}
110
+
111
+	protected function _add_screen_options_default()
112
+	{
113
+		$this->_per_page_screen_option();
114
+	}
115
+
116
+
117
+	protected function _add_feature_pointers()
118
+	{
119
+	}
120
+
121
+	public function load_scripts_styles()
122
+	{
123
+	}
124
+
125
+	public function load_scripts_styles_default()
126
+	{
127
+	}
128
+
129
+	public function admin_footer_scripts()
130
+	{
131
+	}
132
+
133
+	public function admin_init()
134
+	{
135
+	}
136
+
137
+	public function admin_notices()
138
+	{
139
+	}
140
+
141
+
142
+	public function _set_list_table_views_default()
143
+	{
144
+		$this->_views = array(
145
+			'all'     => array(
146
+				'slug'        => 'all',
147
+				'label'       => __('All', 'event_espresso'),
148
+				'count'       => 0,
149
+				'bulk_action' => array(
150
+					'trash_tickets' => __('Move to Trash', 'event_espresso'),
151
+				),
152
+			),
153
+			'trashed' => array(
154
+				'slug'        => 'trashed',
155
+				'label'       => __('Trash', 'event_espresso'),
156
+				'count'       => 0,
157
+				'bulk_action' => array(
158
+					'restore_tickets' => __('Restore from Trash', 'event_espresso'),
159
+					'delete_tickets'  => __('Delete Permanently', 'event_espresso'),
160
+				),
161
+			),
162
+		);
163
+	}
164
+
165
+
166
+	public function _tickets_overview_list_table()
167
+	{
168
+		$this->_search_btn_label = __('Tickets', 'event_espresso');
169
+		$this->display_admin_list_table_page_with_no_sidebar();
170
+	}
171
+
172
+
173
+	public function get_default_tickets($per_page = 10, $count = false, $trashed = false)
174
+	{
175
+
176
+		$orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
177
+		$order = empty($this->_req_data['order']) ? 'ASC' : $order;
178
+
179
+		switch ($orderby) {
180
+			case 'TKT_name':
181
+				$orderby = array('TKT_name' => $order);
182
+				break;
183
+
184
+			case 'TKT_price':
185
+				$orderby = array('TKT_price' => $order);
186
+				break;
187
+
188
+			case 'TKT_uses':
189
+				$orderby = array('TKT_uses' => $order);
190
+				break;
191
+
192
+			case 'TKT_min':
193
+				$orderby = array('TKT_min' => $order);
194
+				break;
195
+
196
+			case 'TKT_max':
197
+				$orderby = array('TKT_max' => $order);
198
+				break;
199
+
200
+			case 'TKT_qty':
201
+				$orderby = array('TKT_qty' => $order);
202
+				break;
203
+		}
204
+
205
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
206
+			? $this->_req_data['paged'] : 1;
207
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
208
+			? $this->_req_data['perpage'] : $per_page;
209
+
210
+		$_where = array(
211
+			'TKT_is_default' => 1,
212
+			'TKT_deleted'    => $trashed,
213
+		);
214
+
215
+		$offset = ($current_page - 1) * $per_page;
216
+		$limit = array($offset, $per_page);
217
+
218
+		if (isset($this->_req_data['s'])) {
219
+			$sstr = '%' . $this->_req_data['s'] . '%';
220
+			$_where['OR'] = array(
221
+				'TKT_name'        => array('LIKE', $sstr),
222
+				'TKT_description' => array('LIKE', $sstr),
223
+			);
224
+		}
225
+
226
+		$query_params = array(
227
+			$_where,
228
+			'order_by' => $orderby,
229
+			'limit'    => $limit,
230
+			'group_by' => 'TKT_ID',
231
+		);
232
+
233
+		if ($count) {
234
+			return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
235
+		} else {
236
+			return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
237
+		}
238
+	}
239
+
240
+
241
+	protected function _trash_or_restore_ticket($trash = false)
242
+	{
243
+		$success = 1;
244
+
245
+		$TKT = EEM_Ticket::instance();
246
+
247
+		// checkboxes?
248
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
249
+			// if array has more than one element then success message should be plural
250
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
251
+
252
+			// cycle thru the boxes
253
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
254
+				if ($trash) {
255
+					if (! $TKT->delete_by_ID($TKT_ID)) {
256
+						$success = 0;
257
+					}
258
+				} else {
259
+					if (! $TKT->restore_by_ID($TKT_ID)) {
260
+						$success = 0;
261
+					}
262
+				}
263
+			}
264
+		} else {
265
+			// grab single id and trash
266
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
267
+
268
+			if ($trash) {
269
+				if (! $TKT->delete_by_ID($TKT_ID)) {
270
+					$success = 0;
271
+				}
272
+			} else {
273
+				if (! $TKT->restore_by_ID($TKT_ID)) {
274
+					$success = 0;
275
+				}
276
+			}
277
+		}
278
+
279
+		$action_desc = $trash ? 'moved to the trash' : 'restored';
280
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, array());
281
+	}
282
+
283
+
284
+	protected function _delete_ticket()
285
+	{
286
+		$success = 1;
287
+
288
+		$TKT = EEM_Ticket::instance();
289
+
290
+		// checkboxes?
291
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
292
+			// if array has more than one element then success message should be plural
293
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
294
+
295
+			// cycle thru the boxes
296
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
297
+				// delete
298
+				if (! $this->_delete_the_ticket($TKT_ID)) {
299
+					$success = 0;
300
+				}
301
+			}
302
+		} else {
303
+			// grab single id and trash
304
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
305
+			if (! $this->_delete_the_ticket($TKT_ID)) {
306
+				$success = 0;
307
+			}
308
+		}
309
+
310
+		$action_desc = 'deleted';
311
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, array());
312
+	}
313
+
314
+
315
+	protected function _delete_the_ticket($TKT_ID)
316
+	{
317
+		$tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
318
+
319
+		// delete all related prices first
320
+		$tkt->delete_related_permanently('Price');
321
+		return $tkt->delete_permanently();
322
+	}
323 323
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         $limit = array($offset, $per_page);
217 217
 
218 218
         if (isset($this->_req_data['s'])) {
219
-            $sstr = '%' . $this->_req_data['s'] . '%';
219
+            $sstr = '%'.$this->_req_data['s'].'%';
220 220
             $_where['OR'] = array(
221 221
                 'TKT_name'        => array('LIKE', $sstr),
222 222
                 'TKT_description' => array('LIKE', $sstr),
@@ -245,18 +245,18 @@  discard block
 block discarded – undo
245 245
         $TKT = EEM_Ticket::instance();
246 246
 
247 247
         // checkboxes?
248
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
248
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
249 249
             // if array has more than one element then success message should be plural
250 250
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
251 251
 
252 252
             // cycle thru the boxes
253 253
             while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
254 254
                 if ($trash) {
255
-                    if (! $TKT->delete_by_ID($TKT_ID)) {
255
+                    if ( ! $TKT->delete_by_ID($TKT_ID)) {
256 256
                         $success = 0;
257 257
                     }
258 258
                 } else {
259
-                    if (! $TKT->restore_by_ID($TKT_ID)) {
259
+                    if ( ! $TKT->restore_by_ID($TKT_ID)) {
260 260
                         $success = 0;
261 261
                     }
262 262
                 }
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
             $TKT_ID = absint($this->_req_data['TKT_ID']);
267 267
 
268 268
             if ($trash) {
269
-                if (! $TKT->delete_by_ID($TKT_ID)) {
269
+                if ( ! $TKT->delete_by_ID($TKT_ID)) {
270 270
                     $success = 0;
271 271
                 }
272 272
             } else {
273
-                if (! $TKT->restore_by_ID($TKT_ID)) {
273
+                if ( ! $TKT->restore_by_ID($TKT_ID)) {
274 274
                     $success = 0;
275 275
                 }
276 276
             }
@@ -288,21 +288,21 @@  discard block
 block discarded – undo
288 288
         $TKT = EEM_Ticket::instance();
289 289
 
290 290
         // checkboxes?
291
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
291
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
292 292
             // if array has more than one element then success message should be plural
293 293
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
294 294
 
295 295
             // cycle thru the boxes
296 296
             while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
297 297
                 // delete
298
-                if (! $this->_delete_the_ticket($TKT_ID)) {
298
+                if ( ! $this->_delete_the_ticket($TKT_ID)) {
299 299
                     $success = 0;
300 300
                 }
301 301
             }
302 302
         } else {
303 303
             // grab single id and trash
304 304
             $TKT_ID = absint($this->_req_data['TKT_ID']);
305
-            if (! $this->_delete_the_ticket($TKT_ID)) {
305
+            if ( ! $this->_delete_the_ticket($TKT_ID)) {
306 306
                 $success = 0;
307 307
             }
308 308
         }
Please login to merge, or discard this patch.