Code Duplication    Length = 39-39 lines in 2 locations

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

@@ 181-219 (lines=39) @@
178
        if (($last_status['Payment Status'] == 'authorized') || ($last_status['Payment Status'] == 'submitted_for_settlement')) {
179
          $v_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 'Braintree App: Void (%' or comments like 'Braintree App: Refund (%') limit 1");
180
181
          if ( !tep_db_num_rows($v_query) ) {
182
            $output .= $this->_app->drawButton($this->_app->getDef('button_dialog_void'), '#', 'warning', 'data-button="braintreeButtonDoVoid"', true);
183
184
            $dialog_title = tep_output_string_protected($this->_app->getDef('dialog_void_title'));
185
            $dialog_body = $this->_app->getDef('dialog_void_body');
186
            $void_link = tep_href_link(FILENAME_ORDERS, 'page=' . $HTTP_GET_VARS['page'] . '&oID=' . $order['orders_id'] . '&action=edit&tabaction=doVoid');
187
            $dialog_button_void = addslashes($this->_app->getDef('dialog_void_button_void'));
188
            $dialog_button_cancel = addslashes($this->_app->getDef('dialog_void_button_cancel'));
189
190
            $output .= <<<EOD
191
<div id="braintree-dialog-void" title="{$dialog_title}">
192
  <p>{$dialog_body}</p>
193
</div>
194
195
<script>
196
$(function() {
197
  $('#braintree-dialog-void').dialog({
198
    autoOpen: false,
199
    resizable: false,
200
    modal: true,
201
    buttons: {
202
      "{$dialog_button_void}": function() {
203
        window.location = '{$void_link}';
204
      },
205
      "{$dialog_button_cancel}": function() {
206
        $(this).dialog('close');
207
      }
208
    }
209
  });
210
211
  $('a[data-button="braintreeButtonDoVoid"]').click(function(e) {
212
    e.preventDefault();
213
214
    $('#braintree-dialog-void').dialog('open');
215
  });
216
});
217
</script>
218
EOD;
219
          }
220
        }
221
      }
222

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

@@ 193-231 (lines=39) @@
190
            }
191
          }
192
193
          if ( $capture_total > 0 ) {
194
            $output .= $this->_app->drawButton($this->_app->getDef('button_dialog_void'), '#', 'warning', 'data-button="paypalButtonDoVoid"', true);
195
196
            $dialog_title = tep_output_string_protected($this->_app->getDef('dialog_void_title'));
197
            $dialog_body = $this->_app->getDef('dialog_void_body');
198
            $void_link = tep_href_link(FILENAME_ORDERS, 'page=' . $HTTP_GET_VARS['page'] . '&oID=' . $order['orders_id'] . '&action=edit&tabaction=doVoid');
199
            $dialog_button_void = addslashes($this->_app->getDef('dialog_void_button_void'));
200
            $dialog_button_cancel = addslashes($this->_app->getDef('dialog_void_button_cancel'));
201
202
            $output .= <<<EOD
203
<div id="paypal-dialog-void" title="{$dialog_title}">
204
  <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>{$dialog_body}</p>
205
</div>
206
207
<script>
208
$(function() {
209
  $('#paypal-dialog-void').dialog({
210
    autoOpen: false,
211
    resizable: false,
212
    modal: true,
213
    buttons: {
214
      "{$dialog_button_void}": function() {
215
        window.location = '{$void_link}';
216
      },
217
      "{$dialog_button_cancel}": function() {
218
        $(this).dialog('close');
219
      }
220
    }
221
  });
222
223
  $('a[data-button="paypalButtonDoVoid"]').click(function(e) {
224
    e.preventDefault();
225
226
    $('#paypal-dialog-void').dialog('open');
227
  });
228
});
229
</script>
230
EOD;
231
          }
232
        }
233
      }
234