[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/modules/payment/ -> moneyorder.php (source)

   1  <?php
   2  /*

   3  $Id: moneyorder.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    class moneyorder {
  14      var $code, $title, $description, $enabled;
  15  
  16  // class constructor

  17      function moneyorder() {
  18        global $order;
  19  
  20        $this->code = 'moneyorder';
  21        $this->title = MODULE_PAYMENT_MONEYORDER_TEXT_TITLE;
  22        $this->description = MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION;
  23        $this->sort_order = MODULE_PAYMENT_MONEYORDER_SORT_ORDER;
  24        $this->enabled = ((MODULE_PAYMENT_MONEYORDER_STATUS == 'True') ? true : false);
  25  
  26        if ((int)MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID > 0) {
  27          $this->order_status = MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID;
  28        }
  29  
  30        if (is_object($order)) $this->update_status();
  31      
  32        $this->email_footer = MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER;
  33      }
  34  
  35  // class methods

  36      function update_status() {
  37        global $order;
  38  
  39        if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_MONEYORDER_ZONE > 0) ) {
  40          $check_flag = false;
  41          $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_MONEYORDER_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
  42          while ($check = tep_db_fetch_array($check_query)) {
  43            if ($check['zone_id'] < 1) {
  44              $check_flag = true;
  45              break;
  46            } elseif ($check['zone_id'] == $order->billing['zone_id']) {
  47              $check_flag = true;
  48              break;
  49            }
  50          }
  51  
  52          if ($check_flag == false) {
  53            $this->enabled = false;
  54          }
  55        }
  56      }
  57  
  58      function javascript_validation() {
  59        return false;
  60      }
  61  
  62      function selection() {
  63        return array('id' => $this->code,
  64                     'module' => $this->title);
  65      }
  66  
  67      function pre_confirmation_check() {
  68        return false;
  69      }
  70  
  71      function confirmation() {
  72        return array('title' => MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION);
  73      }
  74  
  75      function process_button() {
  76        return false;
  77      }
  78  
  79      function before_process() {
  80        return false;
  81      }
  82  
  83      function after_process() {
  84        return false;
  85      }
  86  
  87      function get_error() {
  88        return false;
  89      }
  90  
  91      function check() {
  92        if (!isset($this->_check)) {
  93          $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_MONEYORDER_STATUS'");
  94          $this->_check = tep_db_num_rows($check_query);
  95        }
  96        return $this->_check;
  97      }
  98  
  99      function install() {
 100        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Check/Money Order Module', 'MODULE_PAYMENT_MONEYORDER_STATUS', 'True', 'Do you want to accept Check/Money Order payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now());");
 101        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Make Payable to:', 'MODULE_PAYMENT_MONEYORDER_PAYTO', '', 'Who should payments be made payable to?', '6', '1', now());");
 102        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_MONEYORDER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
 103        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_MONEYORDER_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
 104        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 105      }
 106  
 107      function remove() {
 108        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
 109      }
 110  
 111      function keys() {
 112        return array('MODULE_PAYMENT_MONEYORDER_STATUS', 'MODULE_PAYMENT_MONEYORDER_ZONE', 'MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYORDER_SORT_ORDER', 'MODULE_PAYMENT_MONEYORDER_PAYTO');
 113      }
 114    }
 115  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7