Code Duplication    Length = 27-30 lines in 2 locations

catalog/includes/modules/payment/sage_pay_direct.php 1 location

@@ 67-93 (lines=27) @@
64
      }
65
    }
66
67
    function update_status() {
68
      global $order;
69
70
      $OSCOM_Db = Registry::get('Db');
71
72
      if ( ($this->enabled == true) && ($this->hasCards() == false) ) {
73
        $this->enabled = false;
74
      }
75
76
      if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_SAGE_PAY_DIRECT_ZONE > 0) ) {
77
        $check_flag = false;
78
        $Qcheck = $OSCOM_Db->get('zones_to_geo_zones', 'zone_id', ['geo_zone_id' => MODULE_PAYMENT_SAGE_PAY_DIRECT_ZONE, 'zone_country_id' => $order->billing['country']['id']], 'zone_id');
79
        while ($Qcheck->fetch()) {
80
          if ($Qcheck->valueInt('zone_id') < 1) {
81
            $check_flag = true;
82
            break;
83
          } elseif ($Qcheck->valueInt('zone_id') == $order->billing['zone_id']) {
84
            $check_flag = true;
85
            break;
86
          }
87
        }
88
89
        if ($check_flag == false) {
90
          $this->enabled = false;
91
        }
92
      }
93
    }
94
95
    function javascript_validation() {
96
      return false;

catalog/includes/modules/payment/cod.php 1 location

@@ 32-61 (lines=30) @@
29
      }
30
    }
31
32
    function update_status() {
33
      global $order;
34
35
      $OSCOM_Db = Registry::get('Db');
36
37
      if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_COD_ZONE > 0) ) {
38
        $check_flag = false;
39
        $Qcheck = $OSCOM_Db->get('zones_to_geo_zones', 'zone_id', ['geo_zone_id' => MODULE_PAYMENT_COD_ZONE, 'zone_country_id' => $order->delivery['country']['id']], 'zone_id');
40
        while ($Qcheck->fetch()) {
41
          if ($Qcheck->valueInt('zone_id') < 1) {
42
            $check_flag = true;
43
            break;
44
          } elseif ($Qcheck->valueInt('zone_id') == $order->delivery['zone_id']) {
45
            $check_flag = true;
46
            break;
47
          }
48
        }
49
50
        if ($check_flag == false) {
51
          $this->enabled = false;
52
        }
53
      }
54
55
// disable the module if the order only contains virtual products
56
      if ($this->enabled == true) {
57
        if ($order->content_type == 'virtual') {
58
          $this->enabled = false;
59
        }
60
      }
61
    }
62
63
    function javascript_validation() {
64
      return false;