Completed
Branch dependabot/composer/wp-graphql... (9d68cf)
by
unknown
13:28 queued 10:22
created
4_2_0_stages/EE_DMS_4_2_0_question_group_questions.dmsstage.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -6,42 +6,42 @@
 block discarded – undo
6 6
 
7 7
 class EE_DMS_4_2_0_question_group_questions extends EE_Data_Migration_Script_Stage_Table
8 8
 {
9
-    private $_qgq_table;
10
-    public function __construct()
11
-    {
12
-        global $wpdb;
13
-        $this->_pretty_name = esc_html__("Question Group Questions", "event_espresso");
14
-        $this->_old_table = $wpdb->prefix . "esp_question";
15
-        $this->_qgq_table = $wpdb->prefix . "esp_question_group_question";
16
-        parent::__construct();
17
-    }
18
-    protected function _migrate_old_row($old_row)
19
-    {
20
-        // foreach question_group_question entry with this QST_ID, we want to set its
21
-        // QSG_order equal to this question's QST_order
22
-        global $wpdb;
23
-        $updated = $wpdb->update(
24
-            $this->_qgq_table,
25
-            array('QGQ_order' => $old_row['QST_order']),
26
-            array('QST_ID' => $old_row['QST_ID']),
27
-            array('%d',// QGQ_order
28
-                    ),
29
-            array('%d',// QST_ID
30
-                    )
31
-        );
32
-        if (false === $updated) {
33
-            $this->add_error(
34
-                sprintf(
35
-                    esc_html__(
36
-                        "Error in updating table %s setting QGQ_order = %d where QST_ID = %d",
37
-                        'event_espresso'
38
-                    ),
39
-                    $this->_qgq_table,
40
-                    $old_row['QST_order'],
41
-                    $old_row['QST_ID']
42
-                )
43
-            );
44
-        }
45
-        // nothing to map really
46
-    }
9
+	private $_qgq_table;
10
+	public function __construct()
11
+	{
12
+		global $wpdb;
13
+		$this->_pretty_name = esc_html__("Question Group Questions", "event_espresso");
14
+		$this->_old_table = $wpdb->prefix . "esp_question";
15
+		$this->_qgq_table = $wpdb->prefix . "esp_question_group_question";
16
+		parent::__construct();
17
+	}
18
+	protected function _migrate_old_row($old_row)
19
+	{
20
+		// foreach question_group_question entry with this QST_ID, we want to set its
21
+		// QSG_order equal to this question's QST_order
22
+		global $wpdb;
23
+		$updated = $wpdb->update(
24
+			$this->_qgq_table,
25
+			array('QGQ_order' => $old_row['QST_order']),
26
+			array('QST_ID' => $old_row['QST_ID']),
27
+			array('%d',// QGQ_order
28
+					),
29
+			array('%d',// QST_ID
30
+					)
31
+		);
32
+		if (false === $updated) {
33
+			$this->add_error(
34
+				sprintf(
35
+					esc_html__(
36
+						"Error in updating table %s setting QGQ_order = %d where QST_ID = %d",
37
+						'event_espresso'
38
+					),
39
+					$this->_qgq_table,
40
+					$old_row['QST_order'],
41
+					$old_row['QST_ID']
42
+				)
43
+			);
44
+		}
45
+		// nothing to map really
46
+	}
47 47
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
     {
12 12
         global $wpdb;
13 13
         $this->_pretty_name = esc_html__("Question Group Questions", "event_espresso");
14
-        $this->_old_table = $wpdb->prefix . "esp_question";
15
-        $this->_qgq_table = $wpdb->prefix . "esp_question_group_question";
14
+        $this->_old_table = $wpdb->prefix."esp_question";
15
+        $this->_qgq_table = $wpdb->prefix."esp_question_group_question";
16 16
         parent::__construct();
17 17
     }
18 18
     protected function _migrate_old_row($old_row)
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
             $this->_qgq_table,
25 25
             array('QGQ_order' => $old_row['QST_order']),
26 26
             array('QST_ID' => $old_row['QST_ID']),
27
-            array('%d',// QGQ_order
27
+            array('%d', // QGQ_order
28 28
                     ),
29
-            array('%d',// QST_ID
29
+            array('%d', // QST_ID
30 30
                     )
31 31
         );
32 32
         if (false === $updated) {
Please login to merge, or discard this patch.
4_6_0_stages/EE_DMS_4_6_0_question_types.dmsstage.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     {
26 26
         global $wpdb;
27 27
         $this->_pretty_name = esc_html__('Question Types', 'event_espresso');
28
-        $this->_old_table = $wpdb->prefix . 'esp_question';
28
+        $this->_old_table = $wpdb->prefix.'esp_question';
29 29
         $this->_question_type_conversions = array(
30 30
             'MULTIPLE'          => 'CHECKBOX',
31 31
             'SINGLE'                => 'RADIO_BTN'
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         // rows counted before migrating any rows, need to ALSO be counted after a bunch of rows were counted
35 35
         // so we need to include both the migrated rows as well as the non-migrated rows
36 36
         $QST_types_to_count = array_merge(array_keys($this->_question_type_conversions), $this->_question_type_conversions);
37
-        $this->_extra_where_sql = "WHERE QST_type IN ('" . implode("', '", $QST_types_to_count) . "')" ;
37
+        $this->_extra_where_sql = "WHERE QST_type IN ('".implode("', '", $QST_types_to_count)."')";
38 38
         parent::__construct();
39 39
     }
40 40
 
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
     protected function _migrate_old_row($question)
46 46
     {
47 47
         global $wpdb;
48
-        if ($question['QST_ID'] && isset($this->_question_type_conversions[ $question['QST_type'] ])) {
48
+        if ($question['QST_ID'] && isset($this->_question_type_conversions[$question['QST_type']])) {
49 49
             $success = $wpdb->update(
50 50
                 $this->_old_table,
51
-                array( 'QST_type' => $this->_question_type_conversions[ $question['QST_type'] ] ),  // data
52
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
53
-                array( '%s' ),   // data format
54
-                array( '%d' )  // where format
51
+                array('QST_type' => $this->_question_type_conversions[$question['QST_type']]), // data
52
+                array('QST_ID' => $question['QST_ID']), // where
53
+                array('%s'), // data format
54
+                array('%d')  // where format
55 55
             );
56
-            if (! $success) {
56
+            if ( ! $success) {
57 57
                 $this->add_error(
58 58
                     sprintf(
59 59
                         esc_html__('Could not update question type %1$s for question ID=%2$d because "%3$s"', 'event_espresso'),
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,57 +11,57 @@
 block discarded – undo
11 11
  */
12 12
 class EE_DMS_4_6_0_question_types extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14
-    protected $_question_type_conversions = array();
14
+	protected $_question_type_conversions = array();
15 15
 
16 16
 
17 17
 
18
-    /**
19
-     * Just initializes the status of the migration
20
-     *
21
-     * @return EE_DMS_4_6_0_question_types
22
-     */
23
-    public function __construct()
24
-    {
25
-        global $wpdb;
26
-        $this->_pretty_name = esc_html__('Question Types', 'event_espresso');
27
-        $this->_old_table = $wpdb->prefix . 'esp_question';
28
-        $this->_question_type_conversions = array(
29
-            'MULTIPLE'          => 'CHECKBOX',
30
-            'SINGLE'                => 'RADIO_BTN'
31
-        );
32
-        // when fetching rows, because we automatically use a limit and offset
33
-        // rows counted before migrating any rows, need to ALSO be counted after a bunch of rows were counted
34
-        // so we need to include both the migrated rows as well as the non-migrated rows
35
-        $QST_types_to_count = array_merge(array_keys($this->_question_type_conversions), $this->_question_type_conversions);
36
-        $this->_extra_where_sql = "WHERE QST_type IN ('" . implode("', '", $QST_types_to_count) . "')" ;
37
-        parent::__construct();
38
-    }
18
+	/**
19
+	 * Just initializes the status of the migration
20
+	 *
21
+	 * @return EE_DMS_4_6_0_question_types
22
+	 */
23
+	public function __construct()
24
+	{
25
+		global $wpdb;
26
+		$this->_pretty_name = esc_html__('Question Types', 'event_espresso');
27
+		$this->_old_table = $wpdb->prefix . 'esp_question';
28
+		$this->_question_type_conversions = array(
29
+			'MULTIPLE'          => 'CHECKBOX',
30
+			'SINGLE'                => 'RADIO_BTN'
31
+		);
32
+		// when fetching rows, because we automatically use a limit and offset
33
+		// rows counted before migrating any rows, need to ALSO be counted after a bunch of rows were counted
34
+		// so we need to include both the migrated rows as well as the non-migrated rows
35
+		$QST_types_to_count = array_merge(array_keys($this->_question_type_conversions), $this->_question_type_conversions);
36
+		$this->_extra_where_sql = "WHERE QST_type IN ('" . implode("', '", $QST_types_to_count) . "')" ;
37
+		parent::__construct();
38
+	}
39 39
 
40
-    /**
41
-     * @param array $question an associative array where keys are column names and values are their values.
42
-     * @return null
43
-     */
44
-    protected function _migrate_old_row($question)
45
-    {
46
-        global $wpdb;
47
-        if ($question['QST_ID'] && isset($this->_question_type_conversions[ $question['QST_type'] ])) {
48
-            $success = $wpdb->update(
49
-                $this->_old_table,
50
-                array( 'QST_type' => $this->_question_type_conversions[ $question['QST_type'] ] ),  // data
51
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
52
-                array( '%s' ),   // data format
53
-                array( '%d' )  // where format
54
-            );
55
-            if (! $success) {
56
-                $this->add_error(
57
-                    sprintf(
58
-                        esc_html__('Could not update question type %1$s for question ID=%2$d because "%3$s"', 'event_espresso'),
59
-                        wp_json_encode($question['QST_type']),
60
-                        $question['QST_ID'],
61
-                        $wpdb->last_error
62
-                    )
63
-                );
64
-            }
65
-        }
66
-    }
40
+	/**
41
+	 * @param array $question an associative array where keys are column names and values are their values.
42
+	 * @return null
43
+	 */
44
+	protected function _migrate_old_row($question)
45
+	{
46
+		global $wpdb;
47
+		if ($question['QST_ID'] && isset($this->_question_type_conversions[ $question['QST_type'] ])) {
48
+			$success = $wpdb->update(
49
+				$this->_old_table,
50
+				array( 'QST_type' => $this->_question_type_conversions[ $question['QST_type'] ] ),  // data
51
+				array( 'QST_ID' => $question['QST_ID'] ),  // where
52
+				array( '%s' ),   // data format
53
+				array( '%d' )  // where format
54
+			);
55
+			if (! $success) {
56
+				$this->add_error(
57
+					sprintf(
58
+						esc_html__('Could not update question type %1$s for question ID=%2$d because "%3$s"', 'event_espresso'),
59
+						wp_json_encode($question['QST_type']),
60
+						$question['QST_ID'],
61
+						$wpdb->last_error
62
+					)
63
+				);
64
+			}
65
+		}
66
+	}
67 67
 }
Please login to merge, or discard this patch.
4_6_0_stages/EE_DMS_4_6_0_state_system_question.dmsstage.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         global $wpdb;
25 25
         $this->_pretty_name = esc_html__('State - System Question', 'event_espresso');
26
-        $this->_old_table = $wpdb->prefix . 'esp_question';
26
+        $this->_old_table = $wpdb->prefix.'esp_question';
27 27
         $this->_extra_where_sql = "WHERE QST_system = 'state'";
28 28
         parent::__construct();
29 29
     }
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
             global $wpdb;
42 42
             $success = $wpdb->update(
43 43
                 $this->_old_table,
44
-                array( 'QST_type' => 'STATE' ),  // data
45
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
46
-                array( '%s' ),   // data format
47
-                array( '%d' )  // where format
44
+                array('QST_type' => 'STATE'), // data
45
+                array('QST_ID' => $question['QST_ID']), // where
46
+                array('%s'), // data format
47
+                array('%d')  // where format
48 48
             );
49
-            if (! $success) {
49
+            if ( ! $success) {
50 50
                 $this->add_error(
51 51
                     sprintf(
52 52
                         esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,48 +11,48 @@
 block discarded – undo
11 11
  */
12 12
 class EE_DMS_4_6_0_state_system_question extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14
-    /**
15
-     * Just initializes the status of the migration
16
-     *
17
-     * @return EE_DMS_4_6_0_state_system_question
18
-     */
19
-    public function __construct()
20
-    {
21
-        global $wpdb;
22
-        $this->_pretty_name = esc_html__('State - System Question', 'event_espresso');
23
-        $this->_old_table = $wpdb->prefix . 'esp_question';
24
-        $this->_extra_where_sql = "WHERE QST_system = 'state'";
25
-        parent::__construct();
26
-    }
14
+	/**
15
+	 * Just initializes the status of the migration
16
+	 *
17
+	 * @return EE_DMS_4_6_0_state_system_question
18
+	 */
19
+	public function __construct()
20
+	{
21
+		global $wpdb;
22
+		$this->_pretty_name = esc_html__('State - System Question', 'event_espresso');
23
+		$this->_old_table = $wpdb->prefix . 'esp_question';
24
+		$this->_extra_where_sql = "WHERE QST_system = 'state'";
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29 29
 
30
-    /**
31
-     * updates the question with the new question type
32
-     * @param array $question an associative array where keys are column names and values are their values.
33
-     * @return null
34
-     */
35
-    protected function _migrate_old_row($question)
36
-    {
37
-        if ($question['QST_ID'] && $question['QST_system'] == 'state') {
38
-            global $wpdb;
39
-            $success = $wpdb->update(
40
-                $this->_old_table,
41
-                array( 'QST_type' => 'STATE' ),  // data
42
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
43
-                array( '%s' ),   // data format
44
-                array( '%d' )  // where format
45
-            );
46
-            if (! $success) {
47
-                $this->add_error(
48
-                    sprintf(
49
-                        esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
50
-                        wp_json_encode($question['QST_system']),
51
-                        $question['QST_ID'],
52
-                        $wpdb->last_error
53
-                    )
54
-                );
55
-            }
56
-        }
57
-    }
30
+	/**
31
+	 * updates the question with the new question type
32
+	 * @param array $question an associative array where keys are column names and values are their values.
33
+	 * @return null
34
+	 */
35
+	protected function _migrate_old_row($question)
36
+	{
37
+		if ($question['QST_ID'] && $question['QST_system'] == 'state') {
38
+			global $wpdb;
39
+			$success = $wpdb->update(
40
+				$this->_old_table,
41
+				array( 'QST_type' => 'STATE' ),  // data
42
+				array( 'QST_ID' => $question['QST_ID'] ),  // where
43
+				array( '%s' ),   // data format
44
+				array( '%d' )  // where format
45
+			);
46
+			if (! $success) {
47
+				$this->add_error(
48
+					sprintf(
49
+						esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
50
+						wp_json_encode($question['QST_system']),
51
+						$question['QST_ID'],
52
+						$wpdb->last_error
53
+					)
54
+				);
55
+			}
56
+		}
57
+	}
58 58
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/4_6_0_stages/EE_DMS_4_6_0_payments.dmsstage.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -11,44 +11,44 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class EE_DMS_4_6_0_payments extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14
-    protected $_payment_method_table;
15
-    public function __construct()
16
-    {
17
-        global $wpdb;
18
-        $this->_old_table = $wpdb->prefix . 'esp_payment';
19
-        $this->_payment_method_table = $wpdb->prefix . 'esp_payment_method';
20
-        $this->_pretty_name = esc_html__('Payment-Payment Method Relations', 'event_espresso');
21
-        parent::__construct();
22
-    }
23
-    protected function _migrate_old_row($payment_row)
24
-    {
25
-        global $wpdb;
26
-        // get the payment method's ID
27
-        $PMD_ID = apply_filters('FHEE__EE_DMS_4_6_0_payments__migrate_old_row__PMD_ID', $this->_get_payment_method_id_by_gateway_name($payment_row['PAY_gateway'], $payment_row['PAY_method']));
28
-        if (! $PMD_ID) {
29
-            $this->add_error(sprintf(esc_html__('Could not find payment method with PMD_type = \'%1$s\' when migrating payment row %2$s so just assigned it an unknown payment method', 'event_espresso'), $payment_row['PAY_gateway'], $this->_json_encode($payment_row)));
30
-            $PMD_ID = 0;
31
-        }
32
-        $new_values = array(
33
-            'PMD_ID' => $PMD_ID,
34
-            'PAY_source' => ( $payment_row['PAY_via_admin'] ? 'ADMIN' : 'CART' ) );
35
-        $wheres = array( 'PAY_ID' => $payment_row['PAY_ID'] );
36
-        $new_value_datatypes = array( '%d', '%s' );
37
-        $where_datatypes = array( '%d' );
38
-        $success = $wpdb->update(
39
-            $this->_old_table,
40
-            $new_values,
41
-            $wheres,
42
-            $new_value_datatypes,
43
-            $where_datatypes
44
-        );
45
-        if (! $success) {
46
-            $this->add_error(sprintf(esc_html__('Couldnt set %1$s row in table %2$s where %3$s', 'event_espresso'), $this->_json_encode($new_values), $this->_old_table, $this->_json_encode($wheres)));
47
-        }
48
-    }
49
-    /**
50
-     *
51
-     *  array(
14
+	protected $_payment_method_table;
15
+	public function __construct()
16
+	{
17
+		global $wpdb;
18
+		$this->_old_table = $wpdb->prefix . 'esp_payment';
19
+		$this->_payment_method_table = $wpdb->prefix . 'esp_payment_method';
20
+		$this->_pretty_name = esc_html__('Payment-Payment Method Relations', 'event_espresso');
21
+		parent::__construct();
22
+	}
23
+	protected function _migrate_old_row($payment_row)
24
+	{
25
+		global $wpdb;
26
+		// get the payment method's ID
27
+		$PMD_ID = apply_filters('FHEE__EE_DMS_4_6_0_payments__migrate_old_row__PMD_ID', $this->_get_payment_method_id_by_gateway_name($payment_row['PAY_gateway'], $payment_row['PAY_method']));
28
+		if (! $PMD_ID) {
29
+			$this->add_error(sprintf(esc_html__('Could not find payment method with PMD_type = \'%1$s\' when migrating payment row %2$s so just assigned it an unknown payment method', 'event_espresso'), $payment_row['PAY_gateway'], $this->_json_encode($payment_row)));
30
+			$PMD_ID = 0;
31
+		}
32
+		$new_values = array(
33
+			'PMD_ID' => $PMD_ID,
34
+			'PAY_source' => ( $payment_row['PAY_via_admin'] ? 'ADMIN' : 'CART' ) );
35
+		$wheres = array( 'PAY_ID' => $payment_row['PAY_ID'] );
36
+		$new_value_datatypes = array( '%d', '%s' );
37
+		$where_datatypes = array( '%d' );
38
+		$success = $wpdb->update(
39
+			$this->_old_table,
40
+			$new_values,
41
+			$wheres,
42
+			$new_value_datatypes,
43
+			$where_datatypes
44
+		);
45
+		if (! $success) {
46
+			$this->add_error(sprintf(esc_html__('Couldnt set %1$s row in table %2$s where %3$s', 'event_espresso'), $this->_json_encode($new_values), $this->_old_table, $this->_json_encode($wheres)));
47
+		}
48
+	}
49
+	/**
50
+	 *
51
+	 *  array(
52 52
             'PP' => esc_html__( 'PayPal', 'event_espresso' ),
53 53
             'CC' => esc_html__( 'Credit Card', 'event_espresso' ),
54 54
             'DB'=>  esc_html__("Debit Card", 'event_espresso'),
@@ -57,44 +57,44 @@  discard block
 block discarded – undo
57 57
             'BK'=>  esc_html__("Bank", 'event_espresso'),
58 58
             'IV'=>  esc_html__("Invoice", 'event_espresso'),
59 59
             'MO'=>  esc_html__("Money Order", 'event_espresso'),
60
-     * @global type $wpdb
61
-     * @param int $id
62
-     * @return string
63
-     */
64
-    protected function _get_payment_method_id_by_gateway_name($gateway_name, $old_pay_method_column)
65
-    {
66
-        global $wpdb;
67
-        // convert from old known PAY_method values to their corresponding
68
-        // PMD_type or default PMD_name
69
-        switch ($old_pay_method_column) {
70
-            case 'PP':
71
-                $pmd_type = 'Paypal_Standard';
72
-                break;
73
-            case 'CC':
74
-                $pmd_type = 'Credit_Card';
75
-                break;
76
-            case 'DB':
77
-                $pmd_type = 'Debit_Card';
78
-                break;
79
-            case 'CHQ':
80
-                $pmd_type = 'Check';
81
-                break;
82
-            case 'CSH':
83
-                $pmd_type = 'Cash';
84
-                break;
85
-            case 'BK':
86
-                $pmd_type = 'Bank';
87
-                break;
88
-            case 'IV':
89
-                $pmd_type = 'Invoice';
90
-                break;
91
-            case 'MO':
92
-                $pmd_type = 'Money_Order';
93
-                break;
94
-            default:
95
-                $pmd_type = $gateway_name;
96
-        }
97
-        $pmd_name = str_replace("_", " ", $pmd_type);
98
-        return $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM " . $wpdb->prefix . "esp_payment_method WHERE PMD_type = %s OR PMD_name = %s", $pmd_type, $pmd_name));
99
-    }
60
+	 * @global type $wpdb
61
+	 * @param int $id
62
+	 * @return string
63
+	 */
64
+	protected function _get_payment_method_id_by_gateway_name($gateway_name, $old_pay_method_column)
65
+	{
66
+		global $wpdb;
67
+		// convert from old known PAY_method values to their corresponding
68
+		// PMD_type or default PMD_name
69
+		switch ($old_pay_method_column) {
70
+			case 'PP':
71
+				$pmd_type = 'Paypal_Standard';
72
+				break;
73
+			case 'CC':
74
+				$pmd_type = 'Credit_Card';
75
+				break;
76
+			case 'DB':
77
+				$pmd_type = 'Debit_Card';
78
+				break;
79
+			case 'CHQ':
80
+				$pmd_type = 'Check';
81
+				break;
82
+			case 'CSH':
83
+				$pmd_type = 'Cash';
84
+				break;
85
+			case 'BK':
86
+				$pmd_type = 'Bank';
87
+				break;
88
+			case 'IV':
89
+				$pmd_type = 'Invoice';
90
+				break;
91
+			case 'MO':
92
+				$pmd_type = 'Money_Order';
93
+				break;
94
+			default:
95
+				$pmd_type = $gateway_name;
96
+		}
97
+		$pmd_name = str_replace("_", " ", $pmd_type);
98
+		return $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM " . $wpdb->prefix . "esp_payment_method WHERE PMD_type = %s OR PMD_name = %s", $pmd_type, $pmd_name));
99
+	}
100 100
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
     public function __construct()
16 16
     {
17 17
         global $wpdb;
18
-        $this->_old_table = $wpdb->prefix . 'esp_payment';
19
-        $this->_payment_method_table = $wpdb->prefix . 'esp_payment_method';
18
+        $this->_old_table = $wpdb->prefix.'esp_payment';
19
+        $this->_payment_method_table = $wpdb->prefix.'esp_payment_method';
20 20
         $this->_pretty_name = esc_html__('Payment-Payment Method Relations', 'event_espresso');
21 21
         parent::__construct();
22 22
     }
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
         global $wpdb;
26 26
         // get the payment method's ID
27 27
         $PMD_ID = apply_filters('FHEE__EE_DMS_4_6_0_payments__migrate_old_row__PMD_ID', $this->_get_payment_method_id_by_gateway_name($payment_row['PAY_gateway'], $payment_row['PAY_method']));
28
-        if (! $PMD_ID) {
28
+        if ( ! $PMD_ID) {
29 29
             $this->add_error(sprintf(esc_html__('Could not find payment method with PMD_type = \'%1$s\' when migrating payment row %2$s so just assigned it an unknown payment method', 'event_espresso'), $payment_row['PAY_gateway'], $this->_json_encode($payment_row)));
30 30
             $PMD_ID = 0;
31 31
         }
32 32
         $new_values = array(
33 33
             'PMD_ID' => $PMD_ID,
34
-            'PAY_source' => ( $payment_row['PAY_via_admin'] ? 'ADMIN' : 'CART' ) );
35
-        $wheres = array( 'PAY_ID' => $payment_row['PAY_ID'] );
36
-        $new_value_datatypes = array( '%d', '%s' );
37
-        $where_datatypes = array( '%d' );
34
+            'PAY_source' => ($payment_row['PAY_via_admin'] ? 'ADMIN' : 'CART') );
35
+        $wheres = array('PAY_ID' => $payment_row['PAY_ID']);
36
+        $new_value_datatypes = array('%d', '%s');
37
+        $where_datatypes = array('%d');
38 38
         $success = $wpdb->update(
39 39
             $this->_old_table,
40 40
             $new_values,
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             $new_value_datatypes,
43 43
             $where_datatypes
44 44
         );
45
-        if (! $success) {
45
+        if ( ! $success) {
46 46
             $this->add_error(sprintf(esc_html__('Couldnt set %1$s row in table %2$s where %3$s', 'event_espresso'), $this->_json_encode($new_values), $this->_old_table, $this->_json_encode($wheres)));
47 47
         }
48 48
     }
@@ -95,6 +95,6 @@  discard block
 block discarded – undo
95 95
                 $pmd_type = $gateway_name;
96 96
         }
97 97
         $pmd_name = str_replace("_", " ", $pmd_type);
98
-        return $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM " . $wpdb->prefix . "esp_payment_method WHERE PMD_type = %s OR PMD_name = %s", $pmd_type, $pmd_name));
98
+        return $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM ".$wpdb->prefix."esp_payment_method WHERE PMD_type = %s OR PMD_name = %s", $pmd_type, $pmd_name));
99 99
     }
100 100
 }
Please login to merge, or discard this patch.
data_migration_scripts/4_6_0_stages/EE_DMS_4_6_0_transactions.dmsstage.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -11,51 +11,51 @@
 block discarded – undo
11 11
  */
12 12
 class EE_DMS_4_6_0_transactions extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14
-    protected $_transaction_table;
15
-    protected $_payment_method_table;
16
-    public function __construct()
17
-    {
18
-        global $wpdb;
19
-        $this->_old_table = $wpdb->prefix . 'esp_extra_meta';
20
-        $this->_transaction_table = $wpdb->prefix . 'esp_transaction';
21
-        $this->_payment_method_table = $wpdb->prefix . 'esp_payment_method';
22
-        $this->_pretty_name = esc_html__('Transaction Payment Method Relations', 'event_espresso');
23
-        $this->_extra_where_sql = "WHERE EXM_key = 'gateway' AND EXM_type = 'Transaction'";
24
-        parent::__construct();
25
-    }
26
-    protected function _migrate_old_row($extra_meta_row)
27
-    {
28
-        global $wpdb;
29
-        // get the payment method's ID
30
-        $PMD_ID = $this->_get_payment_method_id_by_gateway_name($extra_meta_row['EXM_value']);
31
-        if (! $PMD_ID) {
32
-            $this->add_error(sprintf(esc_html__('Could not find payment method with PMD_type = \'%1$s\' when migrating extra meta row %2$s', 'event_espresso'), $extra_meta_row['EXM_value'], $this->_json_encode($extra_meta_row)));
33
-            return;
34
-        }
35
-        $new_values = array( 'PMD_ID' => $PMD_ID );
36
-        $wheres = array( 'TXN_ID' => $extra_meta_row['OBJ_ID'] );
37
-        $new_value_datatypes = array( '%d' );
38
-        $where_datatypes = array( '%d' );
39
-        $success = $wpdb->update(
40
-            $this->_transaction_table,
41
-            $new_values,
42
-            $wheres,
43
-            $new_value_datatypes,
44
-            $where_datatypes
45
-        );
46
-        if (! $success) {
47
-            $this->add_error(sprintf(esc_html__('Couldnt set %1$s row in table %2$s where %3$s', 'event_espresso'), $this->_json_encode($new_values), $this->_transaction_table, $this->_json_encode($wheres)));
48
-        }
49
-    }
50
-    /**
51
-     *
52
-     * @global type $wpdb
53
-     * @param int $id
54
-     * @return string
55
-     */
56
-    protected function _get_payment_method_id_by_gateway_name($gateway_name)
57
-    {
58
-        global $wpdb;
59
-        return $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM " . $wpdb->prefix . "esp_payment_method WHERE PMD_type = %s", $gateway_name));
60
-    }
14
+	protected $_transaction_table;
15
+	protected $_payment_method_table;
16
+	public function __construct()
17
+	{
18
+		global $wpdb;
19
+		$this->_old_table = $wpdb->prefix . 'esp_extra_meta';
20
+		$this->_transaction_table = $wpdb->prefix . 'esp_transaction';
21
+		$this->_payment_method_table = $wpdb->prefix . 'esp_payment_method';
22
+		$this->_pretty_name = esc_html__('Transaction Payment Method Relations', 'event_espresso');
23
+		$this->_extra_where_sql = "WHERE EXM_key = 'gateway' AND EXM_type = 'Transaction'";
24
+		parent::__construct();
25
+	}
26
+	protected function _migrate_old_row($extra_meta_row)
27
+	{
28
+		global $wpdb;
29
+		// get the payment method's ID
30
+		$PMD_ID = $this->_get_payment_method_id_by_gateway_name($extra_meta_row['EXM_value']);
31
+		if (! $PMD_ID) {
32
+			$this->add_error(sprintf(esc_html__('Could not find payment method with PMD_type = \'%1$s\' when migrating extra meta row %2$s', 'event_espresso'), $extra_meta_row['EXM_value'], $this->_json_encode($extra_meta_row)));
33
+			return;
34
+		}
35
+		$new_values = array( 'PMD_ID' => $PMD_ID );
36
+		$wheres = array( 'TXN_ID' => $extra_meta_row['OBJ_ID'] );
37
+		$new_value_datatypes = array( '%d' );
38
+		$where_datatypes = array( '%d' );
39
+		$success = $wpdb->update(
40
+			$this->_transaction_table,
41
+			$new_values,
42
+			$wheres,
43
+			$new_value_datatypes,
44
+			$where_datatypes
45
+		);
46
+		if (! $success) {
47
+			$this->add_error(sprintf(esc_html__('Couldnt set %1$s row in table %2$s where %3$s', 'event_espresso'), $this->_json_encode($new_values), $this->_transaction_table, $this->_json_encode($wheres)));
48
+		}
49
+	}
50
+	/**
51
+	 *
52
+	 * @global type $wpdb
53
+	 * @param int $id
54
+	 * @return string
55
+	 */
56
+	protected function _get_payment_method_id_by_gateway_name($gateway_name)
57
+	{
58
+		global $wpdb;
59
+		return $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM " . $wpdb->prefix . "esp_payment_method WHERE PMD_type = %s", $gateway_name));
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
     public function __construct()
17 17
     {
18 18
         global $wpdb;
19
-        $this->_old_table = $wpdb->prefix . 'esp_extra_meta';
20
-        $this->_transaction_table = $wpdb->prefix . 'esp_transaction';
21
-        $this->_payment_method_table = $wpdb->prefix . 'esp_payment_method';
19
+        $this->_old_table = $wpdb->prefix.'esp_extra_meta';
20
+        $this->_transaction_table = $wpdb->prefix.'esp_transaction';
21
+        $this->_payment_method_table = $wpdb->prefix.'esp_payment_method';
22 22
         $this->_pretty_name = esc_html__('Transaction Payment Method Relations', 'event_espresso');
23 23
         $this->_extra_where_sql = "WHERE EXM_key = 'gateway' AND EXM_type = 'Transaction'";
24 24
         parent::__construct();
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
         global $wpdb;
29 29
         // get the payment method's ID
30 30
         $PMD_ID = $this->_get_payment_method_id_by_gateway_name($extra_meta_row['EXM_value']);
31
-        if (! $PMD_ID) {
31
+        if ( ! $PMD_ID) {
32 32
             $this->add_error(sprintf(esc_html__('Could not find payment method with PMD_type = \'%1$s\' when migrating extra meta row %2$s', 'event_espresso'), $extra_meta_row['EXM_value'], $this->_json_encode($extra_meta_row)));
33 33
             return;
34 34
         }
35
-        $new_values = array( 'PMD_ID' => $PMD_ID );
36
-        $wheres = array( 'TXN_ID' => $extra_meta_row['OBJ_ID'] );
37
-        $new_value_datatypes = array( '%d' );
38
-        $where_datatypes = array( '%d' );
35
+        $new_values = array('PMD_ID' => $PMD_ID);
36
+        $wheres = array('TXN_ID' => $extra_meta_row['OBJ_ID']);
37
+        $new_value_datatypes = array('%d');
38
+        $where_datatypes = array('%d');
39 39
         $success = $wpdb->update(
40 40
             $this->_transaction_table,
41 41
             $new_values,
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             $new_value_datatypes,
44 44
             $where_datatypes
45 45
         );
46
-        if (! $success) {
46
+        if ( ! $success) {
47 47
             $this->add_error(sprintf(esc_html__('Couldnt set %1$s row in table %2$s where %3$s', 'event_espresso'), $this->_json_encode($new_values), $this->_transaction_table, $this->_json_encode($wheres)));
48 48
         }
49 49
     }
@@ -56,6 +56,6 @@  discard block
 block discarded – undo
56 56
     protected function _get_payment_method_id_by_gateway_name($gateway_name)
57 57
     {
58 58
         global $wpdb;
59
-        return $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM " . $wpdb->prefix . "esp_payment_method WHERE PMD_type = %s", $gateway_name));
59
+        return $wpdb->get_var($wpdb->prepare("SELECT PMD_ID FROM ".$wpdb->prefix."esp_payment_method WHERE PMD_type = %s", $gateway_name));
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
4_6_0_stages/EE_DMS_4_6_0_country_system_question.dmsstage.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         global $wpdb;
25 25
         $this->_pretty_name = esc_html__('Country - System Question', 'event_espresso');
26
-        $this->_old_table = $wpdb->prefix . 'esp_question';
26
+        $this->_old_table = $wpdb->prefix.'esp_question';
27 27
         $this->_extra_where_sql = "WHERE QST_system = 'country'";
28 28
         parent::__construct();
29 29
     }
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
             global $wpdb;
42 42
             $success = $wpdb->update(
43 43
                 $this->_old_table,
44
-                array( 'QST_type' => 'COUNTRY' ),  // data
45
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
46
-                array( '%s' ),   // data format
47
-                array( '%d' )  // where format
44
+                array('QST_type' => 'COUNTRY'), // data
45
+                array('QST_ID' => $question['QST_ID']), // where
46
+                array('%s'), // data format
47
+                array('%d')  // where format
48 48
             );
49
-            if (! $success) {
49
+            if ( ! $success) {
50 50
                 $this->add_error(
51 51
                     sprintf(
52 52
                         esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,48 +11,48 @@
 block discarded – undo
11 11
  */
12 12
 class EE_DMS_4_6_0_country_system_question extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14
-    /**
15
-     * Just initializes the status of the migration
16
-     *
17
-     * @return EE_DMS_4_6_0_country_system_question
18
-     */
19
-    public function __construct()
20
-    {
21
-        global $wpdb;
22
-        $this->_pretty_name = esc_html__('Country - System Question', 'event_espresso');
23
-        $this->_old_table = $wpdb->prefix . 'esp_question';
24
-        $this->_extra_where_sql = "WHERE QST_system = 'country'";
25
-        parent::__construct();
26
-    }
14
+	/**
15
+	 * Just initializes the status of the migration
16
+	 *
17
+	 * @return EE_DMS_4_6_0_country_system_question
18
+	 */
19
+	public function __construct()
20
+	{
21
+		global $wpdb;
22
+		$this->_pretty_name = esc_html__('Country - System Question', 'event_espresso');
23
+		$this->_old_table = $wpdb->prefix . 'esp_question';
24
+		$this->_extra_where_sql = "WHERE QST_system = 'country'";
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29 29
 
30
-    /**
31
-     * updates the question with the new question type
32
-     * @param array $question an associative array where keys are column names and values are their values.
33
-     * @return null
34
-     */
35
-    protected function _migrate_old_row($question)
36
-    {
37
-        if ($question['QST_ID'] && $question['QST_system'] == 'country') {
38
-            global $wpdb;
39
-            $success = $wpdb->update(
40
-                $this->_old_table,
41
-                array( 'QST_type' => 'COUNTRY' ),  // data
42
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
43
-                array( '%s' ),   // data format
44
-                array( '%d' )  // where format
45
-            );
46
-            if (! $success) {
47
-                $this->add_error(
48
-                    sprintf(
49
-                        esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
50
-                        wp_json_encode($question['QST_system']),
51
-                        $question['QST_ID'],
52
-                        $wpdb->last_error
53
-                    )
54
-                );
55
-            }
56
-        }
57
-    }
30
+	/**
31
+	 * updates the question with the new question type
32
+	 * @param array $question an associative array where keys are column names and values are their values.
33
+	 * @return null
34
+	 */
35
+	protected function _migrate_old_row($question)
36
+	{
37
+		if ($question['QST_ID'] && $question['QST_system'] == 'country') {
38
+			global $wpdb;
39
+			$success = $wpdb->update(
40
+				$this->_old_table,
41
+				array( 'QST_type' => 'COUNTRY' ),  // data
42
+				array( 'QST_ID' => $question['QST_ID'] ),  // where
43
+				array( '%s' ),   // data format
44
+				array( '%d' )  // where format
45
+			);
46
+			if (! $success) {
47
+				$this->add_error(
48
+					sprintf(
49
+						esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
50
+						wp_json_encode($question['QST_system']),
51
+						$question['QST_ID'],
52
+						$wpdb->last_error
53
+					)
54
+				);
55
+			}
56
+		}
57
+	}
58 58
 }
Please login to merge, or discard this patch.
4_5_0_stages/EE_DMS_4_5_0_invoice_settings.dmsstage.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
     protected function _migration_step($num_items = 1)
55 55
     {
56 56
         // if this isn't set then something is really wrong
57
-        if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) {
57
+        if ( ! EE_Config::instance()->gateway instanceof EE_Gateway_Config) {
58 58
             throw new EE_Error(esc_html__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso'));
59 59
         }
60 60
         $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null;
61
-        if (! $invoice_settings) {
61
+        if ( ! $invoice_settings) {
62 62
             $this->add_error(esc_html__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso'));
63 63
         } else {
64 64
             $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions'];
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
                 );
94 94
             }
95 95
             $templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
96
-            $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true);
97
-            $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true);
96
+            $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', null, false, false, true);
97
+            $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', null, false, false, true);
98 98
             if ($overridden_invoice_body || $overridden_receipt_body) {
99 99
                 new PersistentAdminNotice(
100 100
                     'invoice_overriding_templates',
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -16,97 +16,97 @@
 block discarded – undo
16 16
  */
17 17
 class EE_DMS_4_5_0_invoice_settings extends EE_Data_Migration_Script_Stage
18 18
 {
19
-    /**
20
-     * Just initializes the status of the migration
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->_pretty_name = esc_html__('Update Invoice Gateway Settings', 'event_espresso');
25
-        parent::__construct();
26
-    }
19
+	/**
20
+	 * Just initializes the status of the migration
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->_pretty_name = esc_html__('Update Invoice Gateway Settings', 'event_espresso');
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29 29
 
30
-    /**
31
-     * _count_records_to_migrate
32
-     * Counts the records to migrate; the public version may cache it
33
-     *
34
-     * @access protected
35
-     * @return int
36
-     */
37
-    protected function _count_records_to_migrate()
38
-    {
39
-        return 1;
40
-    }
30
+	/**
31
+	 * _count_records_to_migrate
32
+	 * Counts the records to migrate; the public version may cache it
33
+	 *
34
+	 * @access protected
35
+	 * @return int
36
+	 */
37
+	protected function _count_records_to_migrate()
38
+	{
39
+		return 1;
40
+	}
41 41
 
42 42
 
43 43
 
44
-    /**
45
-     *    _migration_step
46
-     *
47
-     * @access protected
48
-     * @param int $num_items
49
-     * @throws EE_Error
50
-     * @return int number of items ACTUALLY migrated
51
-     * @throws InvalidDataTypeException
52
-     */
53
-    protected function _migration_step($num_items = 1)
54
-    {
55
-        // if this isn't set then something is really wrong
56
-        if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) {
57
-            throw new EE_Error(esc_html__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso'));
58
-        }
59
-        $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null;
60
-        if (! $invoice_settings) {
61
-            $this->add_error(esc_html__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso'));
62
-        } else {
63
-            $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions'];
64
-            $invoice_settings['template_invoice_payee_name'] = $invoice_settings['payable_to'];
65
-            $invoice_settings['template_invoice_address'] = $invoice_settings['payment_address'];
66
-            $invoice_settings['template_invoice_email'] = '';
67
-            $invoice_settings['template_invoice_tax_number'] = '';
68
-            unset($invoice_settings['pdf_instructions']);
69
-            unset($invoice_settings['payable_to']);
70
-            unset($invoice_settings['payment_address']);
71
-            EE_Config::instance()->gateway->payment_settings['Invoice'] = $invoice_settings;
72
-            EE_Config::instance()->update_espresso_config(false, false);
44
+	/**
45
+	 *    _migration_step
46
+	 *
47
+	 * @access protected
48
+	 * @param int $num_items
49
+	 * @throws EE_Error
50
+	 * @return int number of items ACTUALLY migrated
51
+	 * @throws InvalidDataTypeException
52
+	 */
53
+	protected function _migration_step($num_items = 1)
54
+	{
55
+		// if this isn't set then something is really wrong
56
+		if (! EE_Config::instance()->gateway instanceof EE_Gateway_Config) {
57
+			throw new EE_Error(esc_html__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso'));
58
+		}
59
+		$invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : null;
60
+		if (! $invoice_settings) {
61
+			$this->add_error(esc_html__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso'));
62
+		} else {
63
+			$invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions'];
64
+			$invoice_settings['template_invoice_payee_name'] = $invoice_settings['payable_to'];
65
+			$invoice_settings['template_invoice_address'] = $invoice_settings['payment_address'];
66
+			$invoice_settings['template_invoice_email'] = '';
67
+			$invoice_settings['template_invoice_tax_number'] = '';
68
+			unset($invoice_settings['pdf_instructions']);
69
+			unset($invoice_settings['payable_to']);
70
+			unset($invoice_settings['payment_address']);
71
+			EE_Config::instance()->gateway->payment_settings['Invoice'] = $invoice_settings;
72
+			EE_Config::instance()->update_espresso_config(false, false);
73 73
 
74
-            // @todo: check 'invoice_css' too because we can't easily affect that so we might need to set a persistent notice
75
-            // (why is it tough to change? because we want to update the receipt and invoice message template, but
76
-            // message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to
77
-            // update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code;
78
-            // also we don't want to build a dependency on the messages code because it is likely to change soon
79
-            if (
80
-                isset($invoice_settings['invoice_css'])
81
-                && ! in_array($invoice_settings['invoice_css'], ['', 'simple.css'])
82
-            ) {
83
-                new PersistentAdminNotice(
84
-                    'invoice_css_not_updated',
85
-                    sprintf(
86
-                        esc_html__(
87
-                            'You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.',
88
-                            'event_espresso'
89
-                        ),
90
-                        $invoice_settings['invoice_css']
91
-                    )
92
-                );
93
-            }
94
-            $templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
95
-            $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true);
96
-            $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true);
97
-            if ($overridden_invoice_body || $overridden_receipt_body) {
98
-                new PersistentAdminNotice(
99
-                    'invoice_overriding_templates',
100
-                    esc_html__(
101
-                        'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.',
102
-                        'event_espresso'
103
-                    ),
104
-                    true
105
-                );
106
-            }
107
-        }
108
-        // regardless of whether it worked or not, we ought to continue the migration
109
-        $this->set_completed();
110
-        return 1;
111
-    }
74
+			// @todo: check 'invoice_css' too because we can't easily affect that so we might need to set a persistent notice
75
+			// (why is it tough to change? because we want to update the receipt and invoice message template, but
76
+			// message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to
77
+			// update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code;
78
+			// also we don't want to build a dependency on the messages code because it is likely to change soon
79
+			if (
80
+				isset($invoice_settings['invoice_css'])
81
+				&& ! in_array($invoice_settings['invoice_css'], ['', 'simple.css'])
82
+			) {
83
+				new PersistentAdminNotice(
84
+					'invoice_css_not_updated',
85
+					sprintf(
86
+						esc_html__(
87
+							'You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.',
88
+							'event_espresso'
89
+						),
90
+						$invoice_settings['invoice_css']
91
+					)
92
+				);
93
+			}
94
+			$templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
95
+			$overridden_invoice_body = EEH_Template::locate_template($templates_relative_path . 'invoice_body.template.php', null, false, false, true);
96
+			$overridden_receipt_body = EEH_Template::locate_template($templates_relative_path . 'receipt_body.template.php', null, false, false, true);
97
+			if ($overridden_invoice_body || $overridden_receipt_body) {
98
+				new PersistentAdminNotice(
99
+					'invoice_overriding_templates',
100
+					esc_html__(
101
+						'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overridden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.',
102
+						'event_espresso'
103
+					),
104
+					true
105
+				);
106
+			}
107
+		}
108
+		// regardless of whether it worked or not, we ought to continue the migration
109
+		$this->set_completed();
110
+		return 1;
111
+	}
112 112
 }
Please login to merge, or discard this patch.
4_9_0_stages/EE_DMS_4_9_0_Email_System_Question.dmsstage.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         global $wpdb;
25 25
         $this->_pretty_name = esc_html__('Email - System Question', 'event_espresso');
26
-        $this->_old_table = $wpdb->prefix . 'esp_question';
26
+        $this->_old_table = $wpdb->prefix.'esp_question';
27 27
         $this->_extra_where_sql = "WHERE QST_system = 'email'";
28 28
         parent::__construct();
29 29
     }
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
             global $wpdb;
42 42
             $success = $wpdb->update(
43 43
                 $this->_old_table,
44
-                array( 'QST_type' => 'EMAIL' ),  // data
45
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
46
-                array( '%s' ),   // data format
47
-                array( '%d' )  // where format
44
+                array('QST_type' => 'EMAIL'), // data
45
+                array('QST_ID' => $question['QST_ID']), // where
46
+                array('%s'), // data format
47
+                array('%d')  // where format
48 48
             );
49
-            if (! $success) {
49
+            if ( ! $success) {
50 50
                 $this->add_error(
51 51
                     sprintf(
52 52
                         esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,48 +11,48 @@
 block discarded – undo
11 11
  */
12 12
 class EE_DMS_4_9_0_Email_System_Question extends EE_Data_Migration_Script_Stage_Table
13 13
 {
14
-    /**
15
-     * Just initializes the status of the migration
16
-     *
17
-     * @return EE_DMS_4_9_0_Email_System_Question
18
-     */
19
-    public function __construct()
20
-    {
21
-        global $wpdb;
22
-        $this->_pretty_name = esc_html__('Email - System Question', 'event_espresso');
23
-        $this->_old_table = $wpdb->prefix . 'esp_question';
24
-        $this->_extra_where_sql = "WHERE QST_system = 'email'";
25
-        parent::__construct();
26
-    }
14
+	/**
15
+	 * Just initializes the status of the migration
16
+	 *
17
+	 * @return EE_DMS_4_9_0_Email_System_Question
18
+	 */
19
+	public function __construct()
20
+	{
21
+		global $wpdb;
22
+		$this->_pretty_name = esc_html__('Email - System Question', 'event_espresso');
23
+		$this->_old_table = $wpdb->prefix . 'esp_question';
24
+		$this->_extra_where_sql = "WHERE QST_system = 'email'";
25
+		parent::__construct();
26
+	}
27 27
 
28 28
 
29 29
 
30
-    /**
31
-     * updates the question with the new question type
32
-     * @param array $question an associative array where keys are column names and values are their values.
33
-     * @return null
34
-     */
35
-    protected function _migrate_old_row($question)
36
-    {
37
-        if ($question['QST_ID'] && $question['QST_system'] == 'email') {
38
-            global $wpdb;
39
-            $success = $wpdb->update(
40
-                $this->_old_table,
41
-                array( 'QST_type' => 'EMAIL' ),  // data
42
-                array( 'QST_ID' => $question['QST_ID'] ),  // where
43
-                array( '%s' ),   // data format
44
-                array( '%d' )  // where format
45
-            );
46
-            if (! $success) {
47
-                $this->add_error(
48
-                    sprintf(
49
-                        esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
50
-                        wp_json_encode($question['QST_system']),
51
-                        $question['QST_ID'],
52
-                        $wpdb->last_error
53
-                    )
54
-                );
55
-            }
56
-        }
57
-    }
30
+	/**
31
+	 * updates the question with the new question type
32
+	 * @param array $question an associative array where keys are column names and values are their values.
33
+	 * @return null
34
+	 */
35
+	protected function _migrate_old_row($question)
36
+	{
37
+		if ($question['QST_ID'] && $question['QST_system'] == 'email') {
38
+			global $wpdb;
39
+			$success = $wpdb->update(
40
+				$this->_old_table,
41
+				array( 'QST_type' => 'EMAIL' ),  // data
42
+				array( 'QST_ID' => $question['QST_ID'] ),  // where
43
+				array( '%s' ),   // data format
44
+				array( '%d' )  // where format
45
+			);
46
+			if (! $success) {
47
+				$this->add_error(
48
+					sprintf(
49
+						esc_html__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
50
+						wp_json_encode($question['QST_system']),
51
+						$question['QST_ID'],
52
+						$wpdb->last_error
53
+					)
54
+				);
55
+			}
56
+		}
57
+	}
58 58
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Message_Template.class.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     public function set_group_template_id($GRP_ID = false)
44 44
     {
45
-        if (! $GRP_ID) {
45
+        if ( ! $GRP_ID) {
46 46
             throw new EE_Error(esc_html__('Missing required value for the message template group id', 'event_espresso'));
47 47
         }
48 48
         $this->set('GRP_ID', $GRP_ID);
Please login to merge, or discard this patch.
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -12,173 +12,173 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Message_Template extends EE_Base_Class
14 14
 {
15
-    /**
16
-     * @param array  $props_n_values
17
-     * @param string $timezone
18
-     * @return EE_Message_Template|mixed
19
-     */
20
-    public static function new_instance($props_n_values = array(), $timezone = '')
21
-    {
22
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
23
-        return $has_object ? $has_object : new self($props_n_values, false, $timezone);
24
-    }
25
-
26
-
27
-    /**
28
-     * @param array  $props_n_values
29
-     * @param string $timezone
30
-     * @return EE_Message_Template
31
-     */
32
-    public static function new_instance_from_db($props_n_values = array(), $timezone = '')
33
-    {
34
-        return new self($props_n_values, true, $timezone);
35
-    }
36
-
37
-
38
-    /**
39
-     * @param bool $GRP_ID
40
-     * @throws EE_Error
41
-     */
42
-    public function set_group_template_id($GRP_ID = false)
43
-    {
44
-        if (! $GRP_ID) {
45
-            throw new EE_Error(esc_html__('Missing required value for the message template group id', 'event_espresso'));
46
-        }
47
-        $this->set('GRP_ID', $GRP_ID);
48
-    }
49
-
50
-
51
-    /**
52
-     * get Group ID
53
-     *
54
-     * @access public
55
-     * @return int
56
-     */
57
-    public function GRP_ID()
58
-    {
59
-        return $this->get('GRP_ID');
60
-    }
61
-
62
-
63
-    /**
64
-     * get User ID
65
-     *
66
-     * @access public
67
-     * @return int
68
-     */
69
-    public function user()
70
-    {
71
-        return $this->get_first_related('Message_Template_Group')->get('MTP_user_id');
72
-    }
73
-
74
-
75
-    /**
76
-     * get Message Messenger
77
-     *
78
-     * @access public
79
-     * @return string
80
-     */
81
-    public function messenger()
82
-    {
83
-        return $this->get_first_related('Message_Template_Group')->messenger();
84
-    }
85
-
86
-
87
-    /**
88
-     * get Message Messenger OBJECT
89
-     *
90
-     * @access public
91
-     * @return object Messenger Object for the given messenger
92
-     */
93
-    public function messenger_obj()
94
-    {
95
-        return $this->get_first_related('Message_Template_Group')->messenger_obj();
96
-    }
97
-
98
-
99
-    /**
100
-     * get Message Type
101
-     *
102
-     * @access public
103
-     * @return string
104
-     */
105
-    public function message_type()
106
-    {
107
-        return $this->get_first_related('Message_Template_Group')->message_type();
108
-    }
109
-
110
-
111
-    /**
112
-     * get Message type OBJECT
113
-     *
114
-     * @access public
115
-     * @return object  Message Type object for the given message type
116
-     */
117
-    public function message_type_obj()
118
-    {
119
-        return $this->get_first_related('Message_Template_Group')->message_type_obj();
120
-    }
121
-
122
-
123
-    /**
124
-     * This returns the set context array configured in the message type object
125
-     *
126
-     * @access public
127
-     * @return array array of contexts and their configuration.
128
-     */
129
-    public function contexts_config()
130
-    {
131
-        return $this->get_first_related('Message_Template_Group')->contexts_config();
132
-    }
133
-
134
-
135
-    /**
136
-     * This returns the context_label for contexts as set in the message type object
137
-     *
138
-     * @access public
139
-     * @return string label for "context"
140
-     */
141
-    public function context_label()
142
-    {
143
-        return $this->get_first_related('Message_Template_Group')->context_label();
144
-    }
145
-
146
-
147
-    /**
148
-     * this returns if the template group this template belongs to is global
149
-     *
150
-     * @return boolean true if it is, false if it isn't
151
-     */
152
-    public function is_global()
153
-    {
154
-        return $this->get_first_related('Message_Template_Group')->is_global();
155
-    }
156
-
157
-
158
-    /**
159
-     * this returns if the template group this template belongs to is active (i.e. turned "on" or not)
160
-     *
161
-     * @return boolean true if it is, false if it isn't
162
-     */
163
-    public function is_active()
164
-    {
165
-        return $this->get_first_related('Message_Template_Group')->is_active();
166
-    }
167
-
168
-
169
-    /**
170
-     * This will return an array of shortcodes => labels from the messenger and message_type objects associated with
171
-     * this template.
172
-     *
173
-     * @access public
174
-     * @param string $context what context we're going to return shortcodes for
175
-     * @param array  $fields  what fields we're returning valid shortcodes for.  If empty then we assume all fields are
176
-     *                        to be merged and returned.
177
-     * @return mixed (array|bool) an array of shortcodes in the format array( '[shortcode] => 'label') OR FALSE if no
178
-     *               shortcodes found.
179
-     */
180
-    public function get_shortcodes($context, $fields = array())
181
-    {
182
-        return $this->get_first_related('Message_Template_Group')->get_shortcodes($context, $fields);
183
-    }
15
+	/**
16
+	 * @param array  $props_n_values
17
+	 * @param string $timezone
18
+	 * @return EE_Message_Template|mixed
19
+	 */
20
+	public static function new_instance($props_n_values = array(), $timezone = '')
21
+	{
22
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
23
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone);
24
+	}
25
+
26
+
27
+	/**
28
+	 * @param array  $props_n_values
29
+	 * @param string $timezone
30
+	 * @return EE_Message_Template
31
+	 */
32
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '')
33
+	{
34
+		return new self($props_n_values, true, $timezone);
35
+	}
36
+
37
+
38
+	/**
39
+	 * @param bool $GRP_ID
40
+	 * @throws EE_Error
41
+	 */
42
+	public function set_group_template_id($GRP_ID = false)
43
+	{
44
+		if (! $GRP_ID) {
45
+			throw new EE_Error(esc_html__('Missing required value for the message template group id', 'event_espresso'));
46
+		}
47
+		$this->set('GRP_ID', $GRP_ID);
48
+	}
49
+
50
+
51
+	/**
52
+	 * get Group ID
53
+	 *
54
+	 * @access public
55
+	 * @return int
56
+	 */
57
+	public function GRP_ID()
58
+	{
59
+		return $this->get('GRP_ID');
60
+	}
61
+
62
+
63
+	/**
64
+	 * get User ID
65
+	 *
66
+	 * @access public
67
+	 * @return int
68
+	 */
69
+	public function user()
70
+	{
71
+		return $this->get_first_related('Message_Template_Group')->get('MTP_user_id');
72
+	}
73
+
74
+
75
+	/**
76
+	 * get Message Messenger
77
+	 *
78
+	 * @access public
79
+	 * @return string
80
+	 */
81
+	public function messenger()
82
+	{
83
+		return $this->get_first_related('Message_Template_Group')->messenger();
84
+	}
85
+
86
+
87
+	/**
88
+	 * get Message Messenger OBJECT
89
+	 *
90
+	 * @access public
91
+	 * @return object Messenger Object for the given messenger
92
+	 */
93
+	public function messenger_obj()
94
+	{
95
+		return $this->get_first_related('Message_Template_Group')->messenger_obj();
96
+	}
97
+
98
+
99
+	/**
100
+	 * get Message Type
101
+	 *
102
+	 * @access public
103
+	 * @return string
104
+	 */
105
+	public function message_type()
106
+	{
107
+		return $this->get_first_related('Message_Template_Group')->message_type();
108
+	}
109
+
110
+
111
+	/**
112
+	 * get Message type OBJECT
113
+	 *
114
+	 * @access public
115
+	 * @return object  Message Type object for the given message type
116
+	 */
117
+	public function message_type_obj()
118
+	{
119
+		return $this->get_first_related('Message_Template_Group')->message_type_obj();
120
+	}
121
+
122
+
123
+	/**
124
+	 * This returns the set context array configured in the message type object
125
+	 *
126
+	 * @access public
127
+	 * @return array array of contexts and their configuration.
128
+	 */
129
+	public function contexts_config()
130
+	{
131
+		return $this->get_first_related('Message_Template_Group')->contexts_config();
132
+	}
133
+
134
+
135
+	/**
136
+	 * This returns the context_label for contexts as set in the message type object
137
+	 *
138
+	 * @access public
139
+	 * @return string label for "context"
140
+	 */
141
+	public function context_label()
142
+	{
143
+		return $this->get_first_related('Message_Template_Group')->context_label();
144
+	}
145
+
146
+
147
+	/**
148
+	 * this returns if the template group this template belongs to is global
149
+	 *
150
+	 * @return boolean true if it is, false if it isn't
151
+	 */
152
+	public function is_global()
153
+	{
154
+		return $this->get_first_related('Message_Template_Group')->is_global();
155
+	}
156
+
157
+
158
+	/**
159
+	 * this returns if the template group this template belongs to is active (i.e. turned "on" or not)
160
+	 *
161
+	 * @return boolean true if it is, false if it isn't
162
+	 */
163
+	public function is_active()
164
+	{
165
+		return $this->get_first_related('Message_Template_Group')->is_active();
166
+	}
167
+
168
+
169
+	/**
170
+	 * This will return an array of shortcodes => labels from the messenger and message_type objects associated with
171
+	 * this template.
172
+	 *
173
+	 * @access public
174
+	 * @param string $context what context we're going to return shortcodes for
175
+	 * @param array  $fields  what fields we're returning valid shortcodes for.  If empty then we assume all fields are
176
+	 *                        to be merged and returned.
177
+	 * @return mixed (array|bool) an array of shortcodes in the format array( '[shortcode] => 'label') OR FALSE if no
178
+	 *               shortcodes found.
179
+	 */
180
+	public function get_shortcodes($context, $fields = array())
181
+	{
182
+		return $this->get_first_related('Message_Template_Group')->get_shortcodes($context, $fields);
183
+	}
184 184
 }
Please login to merge, or discard this patch.