[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

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

   1  <?php
   2  /**

   3   * @package money order payment module

   4   * @copyright Copyright 2003-2006 Zen Cart Development Team

   5   * @copyright Portions Copyright 2003 osCommerce

   6   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   7   * @version $Id: moneyorder.php 4960 2006-11-20 01:46:46Z drbyte $

   8   */
   9  
  10    class moneyorder {
  11      var $code, $title, $description, $enabled;
  12  
  13  // class constructor

  14      function moneyorder() {
  15        global $order;
  16  
  17        $this->code = 'moneyorder';
  18        $this->title = MODULE_PAYMENT_MONEYORDER_TEXT_TITLE;
  19        if (IS_ADMIN_FLAG === true && (MODULE_PAYMENT_MONEYORDER_PAYTO == 'the Store Owner/Website Name' || MODULE_PAYMENT_MONEYORDER_PAYTO == '')) $this->title .= '<span class="alert"> (not configured - needs pay-to)</span>';
  20        $this->description = MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION;
  21        $this->sort_order = MODULE_PAYMENT_MONEYORDER_SORT_ORDER;
  22        $this->enabled = ((MODULE_PAYMENT_MONEYORDER_STATUS == 'True') ? true : false);
  23  
  24        if ((int)MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID > 0) {
  25          $this->order_status = MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID;
  26        }
  27  
  28        if (is_object($order)) $this->update_status();
  29      
  30        $this->email_footer = MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER;
  31      }
  32  
  33  // class methods

  34      function update_status() {
  35        global $order, $db;
  36  
  37        if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_MONEYORDER_ZONE > 0) ) {
  38          $check_flag = false;
  39          $check = $db->Execute("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");
  40          while (!$check->EOF) {
  41            if ($check->fields['zone_id'] < 1) {
  42              $check_flag = true;
  43              break;
  44            } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
  45              $check_flag = true;
  46              break;
  47            }
  48            $check->MoveNext();
  49          }
  50  
  51          if ($check_flag == false) {
  52            $this->enabled = false;
  53          }
  54        }
  55      }
  56  
  57      function javascript_validation() {
  58        return false;
  59      }
  60  
  61      function selection() {
  62        return array('id' => $this->code,
  63                     'module' => $this->title);
  64      }
  65  
  66      function pre_confirmation_check() {
  67        return false;
  68      }
  69  
  70      function confirmation() {
  71        return array('title' => MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION);
  72      }
  73  
  74      function process_button() {
  75        return false;
  76      }
  77  
  78      function before_process() {
  79        return false;
  80      }
  81  
  82      function after_process() {
  83        return false;
  84      }
  85  
  86      function get_error() {
  87        return false;
  88      }
  89  
  90      function check() {
  91        global $db;
  92        if (!isset($this->_check)) {
  93          $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_MONEYORDER_STATUS'");
  94          $this->_check = $check_query->RecordCount();
  95        }
  96        return $this->_check;
  97      }
  98  
  99      function install() {
 100        global $db;
 101        $db->Execute("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', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now());");
 102        $db->Execute("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', 'the Store Owner/Website Name', 'Who should payments be made payable to?', '6', '1', now());");
 103        $db->Execute("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())");
 104        $db->Execute("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', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
 105        $db->Execute("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', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
 106      }
 107  
 108      function remove() {
 109        global $db;
 110        $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
 111      }
 112  
 113      function keys() {
 114        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');
 115      }
 116    }
 117  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics