Code Duplication    Length = 5-5 lines in 4 locations

catalog/includes/apps/paypal/hooks/admin/orders/action.php 1 location

@@ 274-278 (lines=5) @@
271
        $capture_total = $this->_app->formatCurrencyRaw($order['total'], $order['currency'], $order['currency_value']);
272
273
        $c_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order['orders_id'] . "' and orders_status_id = '" . (int)OSCOM_APP_PAYPAL_TRANSACTIONS_ORDER_STATUS_ID . "' and comments like 'PayPal App: Capture (%'");
274
        while ( $c = tep_db_fetch_array($c_query) ) {
275
          if ( preg_match('/^PayPal App\: Capture \(([0-9\.]+)\)\n/', $c['comments'], $c_matches) ) {
276
            $capture_total -= $this->_app->formatCurrencyRaw($c_matches[1], $order['currency'], 1);
277
          }
278
        }
279
280
        $result = 'PayPal App: Void (' . $capture_total . ')';
281

catalog/includes/apps/paypal/hooks/admin/orders/tab.php 2 locations

@@ 94-98 (lines=5) @@
91
          $capture_total = $this->_app->formatCurrencyRaw($order['total'], $order['currency'], $order['currency_value']);
92
93
          $c_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order['orders_id'] . "' and orders_status_id = '" . (int)OSCOM_APP_PAYPAL_TRANSACTIONS_ORDER_STATUS_ID . "' and comments like 'PayPal App: Capture (%'");
94
          while ( $c = tep_db_fetch_array($c_query) ) {
95
            if ( preg_match('/^PayPal App\: Capture \(([0-9\.]+)\)\n/', $c['comments'], $c_matches) ) {
96
              $capture_total -= $this->_app->formatCurrencyRaw($c_matches[1], $order['currency'], 1);
97
            }
98
          }
99
100
          if ( $capture_total > 0 ) {
101
            $output .= $this->_app->drawButton($this->_app->getDef('button_dialog_capture'), '#', 'success', 'data-button="paypalButtonDoCapture"', true);
@@ 187-191 (lines=5) @@
184
          $capture_total = $this->_app->formatCurrencyRaw($order['total'], $order['currency'], $order['currency_value']);
185
186
          $c_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order['orders_id'] . "' and orders_status_id = '" . (int)OSCOM_APP_PAYPAL_TRANSACTIONS_ORDER_STATUS_ID . "' and comments like 'PayPal App: Capture (%'");
187
          while ( $c = tep_db_fetch_array($c_query) ) {
188
            if ( preg_match('/^PayPal App\: Capture \(([0-9\.]+)\)\n/', $c['comments'], $c_matches) ) {
189
              $capture_total -= $this->_app->formatCurrencyRaw($c_matches[1], $order['currency'], 1);
190
            }
191
          }
192
193
          if ( $capture_total > 0 ) {
194
            $output .= $this->_app->drawButton($this->_app->getDef('button_dialog_void'), '#', 'warning', 'data-button="paypalButtonDoVoid"', true);

catalog/includes/apps/braintree/hooks/admin/orders/tab.php 1 location

@@ 256-260 (lines=5) @@
253
254
          $r_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order['orders_id'] . "' and orders_status_id = '" . (int)OSCOM_APP_PAYPAL_BRAINTREE_TRANSACTIONS_ORDER_STATUS_ID . "' and comments like 'Braintree App: Refund (%'");
255
256
          while ($r = tep_db_fetch_array($r_query)) {
257
            if (preg_match('/^Braintree App\: Refund \(([0-9\.]+)\)\n/', $r['comments'], $r_matches)) {
258
              $refund_total = $this->_app->formatCurrencyRaw($refund_total - $r_matches[1], $order['currency'], 1);
259
            }
260
          }
261
262
          if ($refund_total > 0) {
263
            $output .= $this->_app->drawButton($this->_app->getDef('button_dialog_refund'), '#', 'error', 'data-button="braintreeButtonRefundTransaction"', true);