Completed
Branch FET-10120-action-items (a39797)
by
unknown
122:31 queued 107:55
created
core/domain/services/capabilities/CapabilitiesChecker.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use EventEspresso\core\exceptions\InvalidClassException;
6 6
 
7 7
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
8
-    exit('No direct script access allowed');
8
+	exit('No direct script access allowed');
9 9
 }
10 10
 
11 11
 
@@ -21,91 +21,91 @@  discard block
 block discarded – undo
21 21
 class CapabilitiesChecker
22 22
 {
23 23
 
24
-    /**
25
-     * @type \EE_Capabilities $capabilities
26
-     */
27
-    private $capabilities;
28
-
29
-
30
-
31
-    /**
32
-     * CapabilitiesChecker constructor
33
-     *
34
-     * @param \EE_Capabilities $capabilities
35
-     */
36
-    public function __construct(\EE_Capabilities $capabilities)
37
-    {
38
-        $this->capabilities = $capabilities;
39
-    }
40
-
41
-
42
-
43
-    /**
44
-     * @return \EE_Capabilities
45
-     */
46
-    protected function capabilities()
47
-    {
48
-        return $this->capabilities;
49
-    }
50
-
51
-
52
-
53
-    /**
54
-     * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO.
55
-     * If any of the individual capability checks fails, then the command will NOT be executed.
56
-     *
57
-     * @param CapCheckInterface|CapCheckInterface[] $cap_check
58
-     * @return bool
59
-     * @throws InvalidClassException
60
-     * @throws InsufficientPermissionsException
61
-     */
62
-    public function processCapCheck($cap_check)
63
-    {
64
-        if (is_array($cap_check)){
65
-            foreach ($cap_check as $check) {
66
-                $this->processCapCheck($check);
67
-            }
68
-            return true;
69
-        }
70
-        // at this point, $cap_check should be an individual instance of CapCheck
71
-        if ( ! $cap_check instanceof CapCheckInterface) {
72
-            throw new InvalidClassException(
73
-                '\EventEspresso\core\domain\services\capabilities\CapCheckInterface'
74
-            );
75
-        }
76
-        // sometimes cap checks are conditional, and no capabilities are required
77
-        if ($cap_check instanceof PublicCapabilities) {
78
-            return true;
79
-        }
80
-        $capabilities = (array) $cap_check->capability();
81
-        foreach ($capabilities as $capability) {
82
-            if (
83
-                ! $this->capabilities()->current_user_can(
84
-                    $capability,
85
-                    $cap_check->context(),
86
-                    $cap_check->ID()
87
-                )
88
-            ) {
89
-                throw new InsufficientPermissionsException($cap_check->context());
90
-            }
91
-        }
92
-        return true;
93
-    }
94
-
95
-
96
-
97
-    /**
98
-     * @param string $capability - the capability to be checked, like: 'ee_edit_registrations'
99
-     * @param string $context    - what the user is attempting to do, like: 'Edit Registration'
100
-     * @param int    $ID         - (optional) ID for item where current_user_can is being called from
101
-     * @return bool
102
-     * @throws InvalidClassException
103
-     * @throws InsufficientPermissionsException
104
-     */
105
-    public function process($capability, $context, $ID = 0)
106
-    {
107
-        return $this->processCapCheck(new CapCheck($capability, $context, $ID));
108
-    }
24
+	/**
25
+	 * @type \EE_Capabilities $capabilities
26
+	 */
27
+	private $capabilities;
28
+
29
+
30
+
31
+	/**
32
+	 * CapabilitiesChecker constructor
33
+	 *
34
+	 * @param \EE_Capabilities $capabilities
35
+	 */
36
+	public function __construct(\EE_Capabilities $capabilities)
37
+	{
38
+		$this->capabilities = $capabilities;
39
+	}
40
+
41
+
42
+
43
+	/**
44
+	 * @return \EE_Capabilities
45
+	 */
46
+	protected function capabilities()
47
+	{
48
+		return $this->capabilities;
49
+	}
50
+
51
+
52
+
53
+	/**
54
+	 * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO.
55
+	 * If any of the individual capability checks fails, then the command will NOT be executed.
56
+	 *
57
+	 * @param CapCheckInterface|CapCheckInterface[] $cap_check
58
+	 * @return bool
59
+	 * @throws InvalidClassException
60
+	 * @throws InsufficientPermissionsException
61
+	 */
62
+	public function processCapCheck($cap_check)
63
+	{
64
+		if (is_array($cap_check)){
65
+			foreach ($cap_check as $check) {
66
+				$this->processCapCheck($check);
67
+			}
68
+			return true;
69
+		}
70
+		// at this point, $cap_check should be an individual instance of CapCheck
71
+		if ( ! $cap_check instanceof CapCheckInterface) {
72
+			throw new InvalidClassException(
73
+				'\EventEspresso\core\domain\services\capabilities\CapCheckInterface'
74
+			);
75
+		}
76
+		// sometimes cap checks are conditional, and no capabilities are required
77
+		if ($cap_check instanceof PublicCapabilities) {
78
+			return true;
79
+		}
80
+		$capabilities = (array) $cap_check->capability();
81
+		foreach ($capabilities as $capability) {
82
+			if (
83
+				! $this->capabilities()->current_user_can(
84
+					$capability,
85
+					$cap_check->context(),
86
+					$cap_check->ID()
87
+				)
88
+			) {
89
+				throw new InsufficientPermissionsException($cap_check->context());
90
+			}
91
+		}
92
+		return true;
93
+	}
94
+
95
+
96
+
97
+	/**
98
+	 * @param string $capability - the capability to be checked, like: 'ee_edit_registrations'
99
+	 * @param string $context    - what the user is attempting to do, like: 'Edit Registration'
100
+	 * @param int    $ID         - (optional) ID for item where current_user_can is being called from
101
+	 * @return bool
102
+	 * @throws InvalidClassException
103
+	 * @throws InsufficientPermissionsException
104
+	 */
105
+	public function process($capability, $context, $ID = 0)
106
+	{
107
+		return $this->processCapCheck(new CapCheck($capability, $context, $ID));
108
+	}
109 109
 
110 110
 
111 111
 
Please login to merge, or discard this patch.
core/domain/services/action_items/NoPrimaryContactEmailActionItem.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -22,80 +22,80 @@
 block discarded – undo
22 22
 {
23 23
 
24 24
 
25
-    /**
26
-     * @var boolean $email_not_set
27
-     */
28
-    private $email_not_set = false;
25
+	/**
26
+	 * @var boolean $email_not_set
27
+	 */
28
+	private $email_not_set = false;
29 29
 
30 30
 
31 31
 
32
-    public function doConditionCheck()
33
-    {
34
-        $this->email_not_set = empty( \EE_Config::instance()->organization->email )
35
-        && ! (
36
-                isset( $_REQUEST['page'] )
37
-                && $_REQUEST['page'] === 'espresso_general_settings'
38
-            );
39
-    }
32
+	public function doConditionCheck()
33
+	{
34
+		$this->email_not_set = empty( \EE_Config::instance()->organization->email )
35
+		&& ! (
36
+				isset( $_REQUEST['page'] )
37
+				&& $_REQUEST['page'] === 'espresso_general_settings'
38
+			);
39
+	}
40 40
 
41 41
 
42 42
 
43
-    /**
44
-     * @return bool
45
-     */
46
-    public function conditionPassed()
47
-    {
48
-        return $this->email_not_set;
49
-    }
43
+	/**
44
+	 * @return bool
45
+	 */
46
+	public function conditionPassed()
47
+	{
48
+		return $this->email_not_set;
49
+	}
50 50
 
51 51
 
52 52
 
53
-    /**
54
-     * @return string
55
-     */
56
-    public function getActionItemNotice()
57
-    {
58
-        return esc_html__(
59
-            'The "Primary Contact Email Address" for your organization is currently not set, which will negatively affect your ability to send and receive event related emails.',
60
-            'event_espresso'
61
-        );
62
-    }
53
+	/**
54
+	 * @return string
55
+	 */
56
+	public function getActionItemNotice()
57
+	{
58
+		return esc_html__(
59
+			'The "Primary Contact Email Address" for your organization is currently not set, which will negatively affect your ability to send and receive event related emails.',
60
+			'event_espresso'
61
+		);
62
+	}
63 63
 
64 64
 
65 65
 
66
-    /**
67
-     * @return string
68
-     */
69
-    public function getActionItemUrl()
70
-    {
71
-        return \EE_Admin_Page::add_query_args_and_nonce(
72
-            array(),
73
-            GEN_SET_ADMIN_URL
74
-        ) . '#organization_country';
75
-    }
66
+	/**
67
+	 * @return string
68
+	 */
69
+	public function getActionItemUrl()
70
+	{
71
+		return \EE_Admin_Page::add_query_args_and_nonce(
72
+			array(),
73
+			GEN_SET_ADMIN_URL
74
+		) . '#organization_country';
75
+	}
76 76
 
77 77
 
78 78
 
79
-    /**
80
-     * @return string
81
-     */
82
-    public function getActionItemButtonText()
83
-    {
84
-        return esc_html__( 'Add Email Address', 'event_espresso' );
85
-    }
79
+	/**
80
+	 * @return string
81
+	 */
82
+	public function getActionItemButtonText()
83
+	{
84
+		return esc_html__( 'Add Email Address', 'event_espresso' );
85
+	}
86 86
 
87 87
 
88 88
 
89
-    /**
90
-     * @return CapCheckInterface
91
-     */
92
-    public function getCapCheck()
93
-    {
94
-        if ( ! $this->cap_check instanceof CapCheckInterface ) {
95
-            $this->setCapCheck( new CapCheck( 'manage_options', 'Add Primary Contact Email Address' ) );
96
-        }
97
-        return $this->cap_check;
98
-    }
89
+	/**
90
+	 * @return CapCheckInterface
91
+	 */
92
+	public function getCapCheck()
93
+	{
94
+		if ( ! $this->cap_check instanceof CapCheckInterface ) {
95
+			$this->setCapCheck( new CapCheck( 'manage_options', 'Add Primary Contact Email Address' ) );
96
+		}
97
+		return $this->cap_check;
98
+	}
99 99
 
100 100
 
101 101
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\domain\services\capabilities\RequiresCapCheckInterface;
7 7
 use EventEspresso\core\services\action_items\ActionItem;
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 
12 12
 
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function doConditionCheck()
33 33
     {
34
-        $this->email_not_set = empty( \EE_Config::instance()->organization->email )
34
+        $this->email_not_set = empty(\EE_Config::instance()->organization->email)
35 35
         && ! (
36
-                isset( $_REQUEST['page'] )
36
+                isset($_REQUEST['page'])
37 37
                 && $_REQUEST['page'] === 'espresso_general_settings'
38 38
             );
39 39
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         return \EE_Admin_Page::add_query_args_and_nonce(
72 72
             array(),
73 73
             GEN_SET_ADMIN_URL
74
-        ) . '#organization_country';
74
+        ).'#organization_country';
75 75
     }
76 76
 
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function getActionItemButtonText()
83 83
     {
84
-        return esc_html__( 'Add Email Address', 'event_espresso' );
84
+        return esc_html__('Add Email Address', 'event_espresso');
85 85
     }
86 86
 
87 87
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function getCapCheck()
93 93
     {
94
-        if ( ! $this->cap_check instanceof CapCheckInterface ) {
95
-            $this->setCapCheck( new CapCheck( 'manage_options', 'Add Primary Contact Email Address' ) );
94
+        if ( ! $this->cap_check instanceof CapCheckInterface) {
95
+            $this->setCapCheck(new CapCheck('manage_options', 'Add Primary Contact Email Address'));
96 96
         }
97 97
         return $this->cap_check;
98 98
     }
Please login to merge, or discard this patch.
core/domain/services/action_items/NotApprovedRegistrationsActionItem.php 2 patches
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -22,97 +22,97 @@
 block discarded – undo
22 22
 {
23 23
 
24 24
 
25
-    /**
26
-     * @var int $rna_count
27
-     */
28
-    private $rna_count = 0;
29
-
30
-
31
-
32
-    public function doConditionCheck()
33
-    {
34
-        $this->rna_count = absint(
35
-            \EEM_Registration::instance()->count(
36
-                array( array( 'STS_ID' => \EEM_Registration::status_id_not_approved ) ),
37
-                'REG_ID'
38
-            )
39
-        );
40
-    }
41
-
42
-
43
-
44
-    /**
45
-     * @return bool
46
-     */
47
-    public function conditionPassed()
48
-    {
49
-        return $this->rna_count > 0
50
-            && ! (
51
-                isset( $_REQUEST['page'], $_REQUEST['_reg_status'] )
52
-                && (
53
-                    $_REQUEST['page'] === 'espresso_registrations'
54
-                    && $_REQUEST['_reg_status'] === \EEM_Registration::status_id_not_approved
55
-                )
56
-                || (
57
-                    isset( $_REQUEST['action'] )
58
-                    && $_REQUEST['action'] === 'view_registration'
59
-                )
60
-            );
61
-    }
62
-
63
-
64
-
65
-    /**
66
-     * @return string
67
-     */
68
-    public function getActionItemNotice()
69
-    {
70
-        return sprintf(
71
-            _n(
72
-                'There is currently "%1$d" registration with a status of "Not Approved" awaiting your decision. You can either set its status to "Approved" or "Declined".',
73
-                'There are currently "%1$d" registrations with a status of "Not Approved" awaiting your decision. You can either set their status to "Approved" or "Declined".',
74
-                $this->rna_count,
75
-                'event_espresso'
76
-            ),
77
-            $this->rna_count
78
-        );
79
-    }
80
-
81
-
82
-
83
-    /**
84
-     * @return string
85
-     */
86
-    public function getActionItemUrl()
87
-    {
88
-        return \EE_Admin_Page::add_query_args_and_nonce(
89
-            array( '_reg_status' => \EEM_Registration::status_id_not_approved, 'action' => '' ),
90
-            REG_ADMIN_URL
91
-        );
92
-    }
93
-
94
-
95
-
96
-    /**
97
-     * @return string
98
-     */
99
-    public function getActionItemButtonText()
100
-    {
101
-        return esc_html__( 'View Registrations', 'event_espresso' );
102
-    }
103
-
104
-
105
-
106
-    /**
107
-     * @return CapCheckInterface
108
-     */
109
-    public function getCapCheck()
110
-    {
111
-        if ( ! $this->cap_check instanceof CapCheckInterface ) {
112
-            $this->setCapCheck( new CapCheck( 'ee_edit_registrations', 'approve_registrations' ) );
113
-        }
114
-        return $this->cap_check;
115
-    }
25
+	/**
26
+	 * @var int $rna_count
27
+	 */
28
+	private $rna_count = 0;
29
+
30
+
31
+
32
+	public function doConditionCheck()
33
+	{
34
+		$this->rna_count = absint(
35
+			\EEM_Registration::instance()->count(
36
+				array( array( 'STS_ID' => \EEM_Registration::status_id_not_approved ) ),
37
+				'REG_ID'
38
+			)
39
+		);
40
+	}
41
+
42
+
43
+
44
+	/**
45
+	 * @return bool
46
+	 */
47
+	public function conditionPassed()
48
+	{
49
+		return $this->rna_count > 0
50
+			&& ! (
51
+				isset( $_REQUEST['page'], $_REQUEST['_reg_status'] )
52
+				&& (
53
+					$_REQUEST['page'] === 'espresso_registrations'
54
+					&& $_REQUEST['_reg_status'] === \EEM_Registration::status_id_not_approved
55
+				)
56
+				|| (
57
+					isset( $_REQUEST['action'] )
58
+					&& $_REQUEST['action'] === 'view_registration'
59
+				)
60
+			);
61
+	}
62
+
63
+
64
+
65
+	/**
66
+	 * @return string
67
+	 */
68
+	public function getActionItemNotice()
69
+	{
70
+		return sprintf(
71
+			_n(
72
+				'There is currently "%1$d" registration with a status of "Not Approved" awaiting your decision. You can either set its status to "Approved" or "Declined".',
73
+				'There are currently "%1$d" registrations with a status of "Not Approved" awaiting your decision. You can either set their status to "Approved" or "Declined".',
74
+				$this->rna_count,
75
+				'event_espresso'
76
+			),
77
+			$this->rna_count
78
+		);
79
+	}
80
+
81
+
82
+
83
+	/**
84
+	 * @return string
85
+	 */
86
+	public function getActionItemUrl()
87
+	{
88
+		return \EE_Admin_Page::add_query_args_and_nonce(
89
+			array( '_reg_status' => \EEM_Registration::status_id_not_approved, 'action' => '' ),
90
+			REG_ADMIN_URL
91
+		);
92
+	}
93
+
94
+
95
+
96
+	/**
97
+	 * @return string
98
+	 */
99
+	public function getActionItemButtonText()
100
+	{
101
+		return esc_html__( 'View Registrations', 'event_espresso' );
102
+	}
103
+
104
+
105
+
106
+	/**
107
+	 * @return CapCheckInterface
108
+	 */
109
+	public function getCapCheck()
110
+	{
111
+		if ( ! $this->cap_check instanceof CapCheckInterface ) {
112
+			$this->setCapCheck( new CapCheck( 'ee_edit_registrations', 'approve_registrations' ) );
113
+		}
114
+		return $this->cap_check;
115
+	}
116 116
 
117 117
 
118 118
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\domain\services\capabilities\RequiresCapCheckInterface;
7 7
 use EventEspresso\core\services\action_items\ActionItem;
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 
12 12
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     {
34 34
         $this->rna_count = absint(
35 35
             \EEM_Registration::instance()->count(
36
-                array( array( 'STS_ID' => \EEM_Registration::status_id_not_approved ) ),
36
+                array(array('STS_ID' => \EEM_Registration::status_id_not_approved)),
37 37
                 'REG_ID'
38 38
             )
39 39
         );
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
     {
49 49
         return $this->rna_count > 0
50 50
             && ! (
51
-                isset( $_REQUEST['page'], $_REQUEST['_reg_status'] )
51
+                isset($_REQUEST['page'], $_REQUEST['_reg_status'])
52 52
                 && (
53 53
                     $_REQUEST['page'] === 'espresso_registrations'
54 54
                     && $_REQUEST['_reg_status'] === \EEM_Registration::status_id_not_approved
55 55
                 )
56 56
                 || (
57
-                    isset( $_REQUEST['action'] )
57
+                    isset($_REQUEST['action'])
58 58
                     && $_REQUEST['action'] === 'view_registration'
59 59
                 )
60 60
             );
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function getActionItemUrl()
87 87
     {
88 88
         return \EE_Admin_Page::add_query_args_and_nonce(
89
-            array( '_reg_status' => \EEM_Registration::status_id_not_approved, 'action' => '' ),
89
+            array('_reg_status' => \EEM_Registration::status_id_not_approved, 'action' => ''),
90 90
             REG_ADMIN_URL
91 91
         );
92 92
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function getActionItemButtonText()
100 100
     {
101
-        return esc_html__( 'View Registrations', 'event_espresso' );
101
+        return esc_html__('View Registrations', 'event_espresso');
102 102
     }
103 103
 
104 104
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function getCapCheck()
110 110
     {
111
-        if ( ! $this->cap_check instanceof CapCheckInterface ) {
112
-            $this->setCapCheck( new CapCheck( 'ee_edit_registrations', 'approve_registrations' ) );
111
+        if ( ! $this->cap_check instanceof CapCheckInterface) {
112
+            $this->setCapCheck(new CapCheck('ee_edit_registrations', 'approve_registrations'));
113 113
         }
114 114
         return $this->cap_check;
115 115
     }
Please login to merge, or discard this patch.
core/domain/services/action_items/RefundsRequiredActionItem.php 2 patches
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -23,97 +23,97 @@
 block discarded – undo
23 23
 
24 24
 
25 25
 
26
-    /**
27
-     * @var int $transactions_requiring_refund
28
-     */
29
-    private $transactions_requiring_refund = 0;
30
-
31
-
32
-
33
-    public function doConditionCheck()
34
-    {
35
-        $this->transactions_requiring_refund = absint(
36
-            \EEM_Transaction::instance()->count(
37
-                array( array( 'STS_ID' => \EEM_Transaction::overpaid_status_code ) ),
38
-                'TXN_ID'
39
-            )
40
-        );
41
-    }
42
-
43
-
44
-
45
-    /**
46
-     * @return bool
47
-     */
48
-    public function conditionPassed()
49
-    {
50
-        return $this->transactions_requiring_refund > 0
51
-            && ! (
52
-                isset( $_REQUEST['page'], $_REQUEST['status'] )
53
-                && (
54
-                    $_REQUEST['page'] === 'espresso_transactions'
55
-                    && $_REQUEST['status'] === 'overpaid'
56
-                )
57
-                || (
58
-                    isset( $_REQUEST['action'] )
59
-                    && $_REQUEST['action'] === 'view_transaction'
60
-                )
61
-            );
62
-    }
63
-
64
-
65
-
66
-    /**
67
-     * @return string
68
-     */
69
-    public function getActionItemNotice()
70
-    {
71
-        return sprintf(
72
-            _n(
73
-                'There is currently "%1$d" transaction with a status of "Overpaid" that may require a refund.',
74
-                'There are currently "%1$d" transactions with a status of "Overpaid" that may require a refund.',
75
-                $this->transactions_requiring_refund,
76
-                'event_espresso'
77
-            ),
78
-            $this->transactions_requiring_refund
79
-        );
80
-    }
81
-
82
-
83
-
84
-    /**
85
-     * @return string
86
-     */
87
-    public function getActionItemUrl()
88
-    {
89
-        return \EE_Admin_Page::add_query_args_and_nonce(
90
-            array( 'status' => 'overpaid', 'action' => '' ),
91
-            TXN_ADMIN_URL
92
-        );
93
-    }
94
-
95
-
96
-
97
-    /**
98
-     * @return string
99
-     */
100
-    public function getActionItemButtonText()
101
-    {
102
-        return esc_html__( 'View Transactions', 'event_espresso' );
103
-    }
104
-
105
-
106
-
107
-    /**
108
-     * @return CapCheckInterface
109
-     */
110
-    public function getCapCheck()
111
-    {
112
-        if ( ! $this->cap_check instanceof CapCheckInterface ) {
113
-            $this->setCapCheck( new CapCheck( 'ee_edit_payments', 'Issue Refund' ) );
114
-        }
115
-        return $this->cap_check;
116
-    }
26
+	/**
27
+	 * @var int $transactions_requiring_refund
28
+	 */
29
+	private $transactions_requiring_refund = 0;
30
+
31
+
32
+
33
+	public function doConditionCheck()
34
+	{
35
+		$this->transactions_requiring_refund = absint(
36
+			\EEM_Transaction::instance()->count(
37
+				array( array( 'STS_ID' => \EEM_Transaction::overpaid_status_code ) ),
38
+				'TXN_ID'
39
+			)
40
+		);
41
+	}
42
+
43
+
44
+
45
+	/**
46
+	 * @return bool
47
+	 */
48
+	public function conditionPassed()
49
+	{
50
+		return $this->transactions_requiring_refund > 0
51
+			&& ! (
52
+				isset( $_REQUEST['page'], $_REQUEST['status'] )
53
+				&& (
54
+					$_REQUEST['page'] === 'espresso_transactions'
55
+					&& $_REQUEST['status'] === 'overpaid'
56
+				)
57
+				|| (
58
+					isset( $_REQUEST['action'] )
59
+					&& $_REQUEST['action'] === 'view_transaction'
60
+				)
61
+			);
62
+	}
63
+
64
+
65
+
66
+	/**
67
+	 * @return string
68
+	 */
69
+	public function getActionItemNotice()
70
+	{
71
+		return sprintf(
72
+			_n(
73
+				'There is currently "%1$d" transaction with a status of "Overpaid" that may require a refund.',
74
+				'There are currently "%1$d" transactions with a status of "Overpaid" that may require a refund.',
75
+				$this->transactions_requiring_refund,
76
+				'event_espresso'
77
+			),
78
+			$this->transactions_requiring_refund
79
+		);
80
+	}
81
+
82
+
83
+
84
+	/**
85
+	 * @return string
86
+	 */
87
+	public function getActionItemUrl()
88
+	{
89
+		return \EE_Admin_Page::add_query_args_and_nonce(
90
+			array( 'status' => 'overpaid', 'action' => '' ),
91
+			TXN_ADMIN_URL
92
+		);
93
+	}
94
+
95
+
96
+
97
+	/**
98
+	 * @return string
99
+	 */
100
+	public function getActionItemButtonText()
101
+	{
102
+		return esc_html__( 'View Transactions', 'event_espresso' );
103
+	}
104
+
105
+
106
+
107
+	/**
108
+	 * @return CapCheckInterface
109
+	 */
110
+	public function getCapCheck()
111
+	{
112
+		if ( ! $this->cap_check instanceof CapCheckInterface ) {
113
+			$this->setCapCheck( new CapCheck( 'ee_edit_payments', 'Issue Refund' ) );
114
+		}
115
+		return $this->cap_check;
116
+	}
117 117
 }
118 118
 // End of file RefundsRequiredActionItem.php
119 119
 // Location: EventEspresso\core\domain\services\action_items/RefundsRequiredActionItem.php
120 120
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\domain\services\capabilities\RequiresCapCheckInterface;
7 7
 use EventEspresso\core\services\action_items\ActionItem;
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 
12 12
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $this->transactions_requiring_refund = absint(
36 36
             \EEM_Transaction::instance()->count(
37
-                array( array( 'STS_ID' => \EEM_Transaction::overpaid_status_code ) ),
37
+                array(array('STS_ID' => \EEM_Transaction::overpaid_status_code)),
38 38
                 'TXN_ID'
39 39
             )
40 40
         );
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
     {
50 50
         return $this->transactions_requiring_refund > 0
51 51
             && ! (
52
-                isset( $_REQUEST['page'], $_REQUEST['status'] )
52
+                isset($_REQUEST['page'], $_REQUEST['status'])
53 53
                 && (
54 54
                     $_REQUEST['page'] === 'espresso_transactions'
55 55
                     && $_REQUEST['status'] === 'overpaid'
56 56
                 )
57 57
                 || (
58
-                    isset( $_REQUEST['action'] )
58
+                    isset($_REQUEST['action'])
59 59
                     && $_REQUEST['action'] === 'view_transaction'
60 60
                 )
61 61
             );
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     public function getActionItemUrl()
88 88
     {
89 89
         return \EE_Admin_Page::add_query_args_and_nonce(
90
-            array( 'status' => 'overpaid', 'action' => '' ),
90
+            array('status' => 'overpaid', 'action' => ''),
91 91
             TXN_ADMIN_URL
92 92
         );
93 93
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function getActionItemButtonText()
101 101
     {
102
-        return esc_html__( 'View Transactions', 'event_espresso' );
102
+        return esc_html__('View Transactions', 'event_espresso');
103 103
     }
104 104
 
105 105
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getCapCheck()
111 111
     {
112
-        if ( ! $this->cap_check instanceof CapCheckInterface ) {
113
-            $this->setCapCheck( new CapCheck( 'ee_edit_payments', 'Issue Refund' ) );
112
+        if ( ! $this->cap_check instanceof CapCheckInterface) {
113
+            $this->setCapCheck(new CapCheck('ee_edit_payments', 'Issue Refund'));
114 114
         }
115 115
         return $this->cap_check;
116 116
     }
Please login to merge, or discard this patch.