Completed
Branch 2.0.0 (814c19)
by Jimmy
03:05
created
modules/doli-proposals/action/class-doli-proposals-action.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit;
17
+defined('ABSPATH') || exit;
18 18
 
19 19
 /**
20 20
  * Doli Porposals Action.
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	 * @since 2.0.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_action( 'wps_checkout_create_proposal', array( $this, 'checkout_create_proposal' ), 1, 1 );
31
-		add_action( 'wps_checkout_update_proposal', array( $this, 'checkout_update_proposal' ), 1, 1 );
30
+		add_action('wps_checkout_create_proposal', array($this, 'checkout_create_proposal'), 1, 1);
31
+		add_action('wps_checkout_update_proposal', array($this, 'checkout_update_proposal'), 1, 1);
32 32
 
33
-		add_action( 'admin_post_wps_download_proposal', array( $this, 'download_proposal' ) );
33
+		add_action('admin_post_wps_download_proposal', array($this, 'download_proposal'));
34 34
 	}
35 35
 
36 36
 	/**
@@ -40,26 +40,26 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param  Proposal_Model $wp_proposal Les données du devis.
42 42
 	 */
43
-	public function checkout_create_proposal( $wp_proposal ) {
44
-		$doli_proposal_id = Doli_Proposals::g()->wp_to_doli( $wp_proposal );
43
+	public function checkout_create_proposal($wp_proposal) {
44
+		$doli_proposal_id = Doli_Proposals::g()->wp_to_doli($wp_proposal);
45 45
 
46
-		$doli_proposal = Request_Util::post( 'proposals/' . $doli_proposal_id . '/validate', array(
46
+		$doli_proposal = Request_Util::post('proposals/' . $doli_proposal_id . '/validate', array(
47 47
 			'notrigger' => 0,
48
-		) );
48
+		));
49 49
 
50
-		$doli_proposal = Request_Util::post( 'proposals/' . $doli_proposal_id . '/close', array(
50
+		$doli_proposal = Request_Util::post('proposals/' . $doli_proposal_id . '/close', array(
51 51
 			'status'    => 2,
52 52
 			'notrigger' => 0,
53
-		) );
53
+		));
54 54
 
55
-		Request_Util::put( 'documents/builddoc', array(
55
+		Request_Util::put('documents/builddoc', array(
56 56
 			'module_part'   => 'propal',
57 57
 			'original_file' => $doli_proposal->ref . '/' . $doli_proposal->ref . '.pdf',
58
-		) );
58
+		));
59 59
 
60
-		update_post_meta( $wp_proposal->data['id'], '_external_id', $doli_proposal_id );
60
+		update_post_meta($wp_proposal->data['id'], '_external_id', $doli_proposal_id);
61 61
 
62
-		Doli_Proposals::g()->doli_to_wp( $doli_proposal, $wp_proposal );
62
+		Doli_Proposals::g()->doli_to_wp($doli_proposal, $wp_proposal);
63 63
 	}
64 64
 
65 65
 	/**
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param  Proposal_Model $wp_proposal Les données du devis.
71 71
 	 */
72
-	public function checkout_update_proposal( $wp_proposal ) {
73
-		$doli_proposal = Request_Util::put( 'proposals/' . $wp_proposal->data['external_id'], array(
74
-			'mode_reglement_id' => Doli_Payment::g()->convert_to_doli_id( $wp_proposal->data['payment_method'] ),
75
-		) );
72
+	public function checkout_update_proposal($wp_proposal) {
73
+		$doli_proposal = Request_Util::put('proposals/' . $wp_proposal->data['external_id'], array(
74
+			'mode_reglement_id' => Doli_Payment::g()->convert_to_doli_id($wp_proposal->data['payment_method']),
75
+		));
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,29 +81,29 @@  discard block
 block discarded – undo
81 81
 	 * @since 2.0.0
82 82
 	 */
83 83
 	public function download_proposal() {
84
-		check_admin_referer( 'download_proposal' );
84
+		check_admin_referer('download_proposal');
85 85
 
86
-		$proposal_id = ! empty( $_GET['proposal_id'] ) ? (int) $_GET['proposal_id'] : 0;
86
+		$proposal_id = !empty($_GET['proposal_id']) ? (int)$_GET['proposal_id'] : 0;
87 87
 
88
-		if ( ! $proposal_id ) {
88
+		if (!$proposal_id) {
89 89
 			exit;
90 90
 		}
91 91
 
92
-		$contact     = Contact::g()->get( array( 'id' => get_current_user_id() ), true );
93
-		$third_party = Third_Party::g()->get( array( 'id' => $contact->data['third_party_id'] ), true );
94
-		$proposal    = Proposals::g()->get( array( 'id' => $proposal_id ), true );
92
+		$contact     = Contact::g()->get(array('id' => get_current_user_id()), true);
93
+		$third_party = Third_Party::g()->get(array('id' => $contact->data['third_party_id']), true);
94
+		$proposal    = Proposals::g()->get(array('id' => $proposal_id), true);
95 95
 
96
-		if ( ( isset( $third_party->data ) && $proposal->data['parent_id'] != $third_party->data['id'] ) && ! current_user_can( 'administrator' ) ) {
96
+		if ((isset($third_party->data) && $proposal->data['parent_id'] != $third_party->data['id']) && !current_user_can('administrator')) {
97 97
 			exit;
98 98
 		}
99 99
 
100
-		$proposal_file = Request_Util::get( 'documents/download?module_part=propale&original_file=' . $proposal->data['title'] . '/' . $proposal->data['title'] . '.pdf' );
101
-		$content       = base64_decode( $proposal_file->content );
100
+		$proposal_file = Request_Util::get('documents/download?module_part=propale&original_file=' . $proposal->data['title'] . '/' . $proposal->data['title'] . '.pdf');
101
+		$content       = base64_decode($proposal_file->content);
102 102
 
103
-		header( 'Cache-Control: no-cache' );
104
-		header( 'Content-Type: application/pdf' );
105
-		header( 'Content-Disposition: inline; filename="' . $proposal->data['title'] . '.pdf"' );
106
-		header( 'Content-Length: ' . strlen( $content ) );
103
+		header('Cache-Control: no-cache');
104
+		header('Content-Type: application/pdf');
105
+		header('Content-Disposition: inline; filename="' . $proposal->data['title'] . '.pdf"');
106
+		header('Content-Length: ' . strlen($content));
107 107
 
108 108
 		echo $content;
109 109
 
Please login to merge, or discard this patch.
modules/doli-payment/class/class-doli-payment.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit;
17
+defined('ABSPATH') || exit;
18 18
 
19 19
 /**
20 20
  * Doli Payment Class.
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return integer l'ID de dolibarr.
88 88
 	 */
89
-	public function convert_to_doli_id( $payment_method ) {
90
-		$payment_methods_option = get_option( 'wps_payment_methods', Payment::g()->default_options );
91
-		$method                 = $payment_methods_option[ $payment_method ];
89
+	public function convert_to_doli_id($payment_method) {
90
+		$payment_methods_option = get_option('wps_payment_methods', Payment::g()->default_options);
91
+		$method                 = $payment_methods_option[$payment_method];
92 92
 
93
-		$payment_types = Request_Util::get( 'setup/dictionary/payment_types' );
93
+		$payment_types = Request_Util::get('setup/dictionary/payment_types');
94 94
 
95
-		if ( ! empty( $payment_types ) ) {
96
-			foreach ( $payment_types as $element ) {
97
-				if ( $element->code === $method['doli_type'] ) {
95
+		if (!empty($payment_types)) {
96
+			foreach ($payment_types as $element) {
97
+				if ($element->code === $method['doli_type']) {
98 98
 					return $element->id;
99 99
 				}
100 100
 			}
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return string                 Texte lisible.
116 116
 	 */
117
-	public function convert_to_wp( $payment_method ) {
118
-		$payment_methods_option = get_option( 'wps_payment_methods', Payment::g()->default_options );
117
+	public function convert_to_wp($payment_method) {
118
+		$payment_methods_option = get_option('wps_payment_methods', Payment::g()->default_options);
119 119
 
120
-		if ( 'CB' === $payment_method ) {
120
+		if ('CB' === $payment_method) {
121 121
 			return 'paypal';
122
-		} elseif ( 'CHQ' === $payment_method ) {
122
+		} elseif ('CHQ' === $payment_method) {
123 123
 			return 'Cheque';
124
-		} elseif ( 'LIQ' === $payment_method ) {
124
+		} elseif ('LIQ' === $payment_method) {
125 125
 			return 'Espèce';
126 126
 		}
127 127
 	}
Please login to merge, or discard this patch.
modules/doli-payment/filter/class-doli-payment-filter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit;
17
+defined('ABSPATH') || exit;
18 18
 
19 19
 /**
20 20
  * Doli Payment Filter Class.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @since 2.0.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_filter( 'wps_payment_methods', array( $this, 'add_payment_details' ), 10, 1 );
30
+		add_filter('wps_payment_methods', array($this, 'add_payment_details'), 10, 1);
31 31
 	}
32 32
 
33 33
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return array                 Avec l'entrée doli_type en plus.
43 43
 	 */
44
-	public function add_payment_details( $payment_methods ) {
44
+	public function add_payment_details($payment_methods) {
45 45
 		$payment_methods['paypal']['doli_type']          = 'CB';
46 46
 		$payment_methods['stripe']['doli_type']          = 'CB';
47 47
 		$payment_methods['cheque']['doli_type']          = 'CHQ';
Please login to merge, or discard this patch.
wpshop.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit;
17
+defined('ABSPATH') || exit;
18 18
 
19
-DEFINE( 'PLUGIN_WPSHOP_PATH', realpath( plugin_dir_path( __FILE__ ) ) . '/' );
20
-DEFINE( 'PLUGIN_WPSHOP_URL', plugins_url( basename( __DIR__ ) ) . '/' );
21
-DEFINE( 'PLUGIN_WPSHOP_DIR', basename( __DIR__ ) );
19
+DEFINE('PLUGIN_WPSHOP_PATH', realpath(plugin_dir_path(__FILE__)) . '/');
20
+DEFINE('PLUGIN_WPSHOP_URL', plugins_url(basename(__DIR__)) . '/');
21
+DEFINE('PLUGIN_WPSHOP_DIR', basename(__DIR__));
22 22
 
23 23
 // Include EO_Framework.
24 24
 require_once 'core/external/eo-framework/eo-framework.php';
@@ -27,4 +27,4 @@  discard block
 block discarded – undo
27 27
 require_once 'vendor/autoload.php';
28 28
 
29 29
 // Boot your plugin.
30
-\eoxia\Init_Util::g()->exec( PLUGIN_WPSHOP_PATH, basename( __FILE__, '.php' ) );
30
+\eoxia\Init_Util::g()->exec(PLUGIN_WPSHOP_PATH, basename(__FILE__, '.php'));
Please login to merge, or discard this patch.