All pastes #1471 Raw Edit

Cyberchen

public php v1 · immutable
#1471 ·published 2004-10-14 21:33 UTC
rendered paste body
<?php/*  $Id: postfinance.php,v 2 05/06/2004 $  osCommerce, Open Source E-Commerce Solutions  http://www.oscommerce.com  Adapté par Ex-perience Informatique Delémont  Copyright (c) 2002 osCommerce  Released under the GNU General Public License*/  class postfinance {    var $code, $title, $description, $enabled;// class constructor    function postfinance() {      global $order;      $this->code = 'postfinance';      $this->title = MODULE_PAYMENT_POSTFINANCE_TEXT_TITLE;      $this->description = MODULE_PAYMENT_POSTFINANCE_TEXT_DESCRIPTION;      $this->sort_order = MODULE_PAYMENT_POSTFINANCE_SORT_ORDER;      $this->enabled = ((MODULE_PAYMENT_POSTFINANCE_STATUS == 'True') ? true : false);      if ((int)MODULE_PAYMENT_POSTFINANCE_ORDER_STATUS_ID > 0) {        $this->order_status = MODULE_PAYMENT_POSTFINANCE_ORDER_STATUS_ID;      }      if (is_object($order)) $this->update_status();      $this->form_action_url = 'postfinance_process.php';    }// class methods    function update_status() {      global $order;      if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_POSTFINANCE_ZONE > 0) ) {        $check_flag = false;        $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_POSTFINANCE_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");        while ($check = tep_db_fetch_array($check_query)) {          if ($check['zone_id'] < 1) {            $check_flag = true;            break;          } elseif ($check['zone_id'] == $order->billing['zone_id']) {            $check_flag = true;            break;          }        }        if ($check_flag == false) {          $this->enabled = false;        }      }    }    function javascript_validation() {      return false;    }    function selection() {      return array('id' => $this->code,                   'module' => $this->title);    }    function pre_confirmation_check() {      return false;    }    function confirmation() {      return false;    }    function process_button() {global $HTTP_POST_VARS, $HTTP_SERVER_VARS, $customer_id, $currencies, $currency, $order, $osCsid, $sidretour, $customers_id;      switch (MODULE_PAYMENT_POSTFINANCE_CURRENCY) {        case 'Default Currency':          $sec_currency = DEFAULT_CURRENCY;          break;        case 'Any Currency':        default:          $sec_currency = $currency;          break;      }	$MontCom = number_format($order->info['total'] * $currencies->get_value($currency), $currencies->get_decimal_places($currency), '.', '');// les 4 premiers parametres sont obligatoires      $process_button_string = tep_draw_hidden_field('txtShopID', MODULE_PAYMENT_POSTFINANCE_MERCHANT_ID) .      			       						 tep_draw_hidden_field('txtShopPara', $txtShopPara) .                                tep_draw_hidden_field('txtOrderTotal', $MontCom) .                               tep_draw_hidden_field('txtLangVersion', MODULE_PAYMENT_POSTFINANCE_LANGUAGE) .                               tep_draw_hidden_field('txtArtCurrency', MODULE_PAYMENT_POSTFINANCE_CURRENCY) .                               tep_draw_hidden_field('txtOrderIDShop', $customer_id) .// les suivants sont optionnels			      									tep_draw_hidden_field('txtBLastName', $order->billing['lastname']) .			      									tep_draw_hidden_field('txtBFirstName', $order->billing['firstname']) .                              tep_draw_hidden_field('txtBAddr1', $order->billing['street_address']) .                              tep_draw_hidden_field('txtBZipCode', $order->billing['postcode']) .                              tep_draw_hidden_field('txtBCity', $order->billing['city']) .                              tep_draw_hidden_field('txtBTel', $order->customer['telephone']) .                              tep_draw_hidden_field('txtBEmail', $order->customer['email_address']);                              tep_draw_hidden_field(tep_session_name(),tep_session_id());      return $process_button_string;    }    function before_process() {      return false;    }    function after_process() {      return false;    }    function get_error() {      return false;    }    function check() {      if (!isset($this->_check)) {        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_POSTFINANCE_STATUS'");        $this->_check = tep_db_num_rows($check_query);      }      return $this->_check;    }    function install() {      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 ('Activer le module PostFinance', 'MODULE_PAYMENT_POSTFINANCE_STATUS', 'True', 'Voulez-vous accepter les paiement par postcard?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");      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 ('Langue utilisée pour le masque de paiement', 'MODULE_PAYMENT_POSTFINANCE_LANGUAGE', '4108', 'Choisissez la langue désirée pour le masque de paiement, français (4108), anglais (2057), italien (2064), allemand (2055)', '6', '1', 'tep_cfg_select_option(array(\'4108\', \'2057\', \'2064\', \'2055\'), ', now())");      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('ID Shop (Transmis par la Poste', 'MODULE_PAYMENT_POSTFINANCE_MERCHANT_ID', '000000', 'Identification de votre shop', '6', '2', now())");      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Ordre de tri', 'MODULE_PAYMENT_POSTFINANCE_SORT_ORDER', '0', 'ordre de tri pour l\'affichage (Le plus petit nombre est montré en premier)', '6', '0', now())");      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Devise', 'MODULE_PAYMENT_POSTFINANCE_CURRENCY', 'CHF', 'Devise utilisée pour les transactions', '6', '0', now())");      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 ('Etat de la commande', 'MODULE_PAYMENT_POSTFINANCE_ORDER_STATUS_ID', '0', 'Sélectionner l\'état de la commande que vous voulez par défault.', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");      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 ('Zone', 'MODULE_PAYMENT_POSTFINANCE_ZONE', '0', 'Si une zone est sélectionnée activer ce module uniquement pour cette zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");     }    function remove() {      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");    }    function keys() {      return array('MODULE_PAYMENT_POSTFINANCE_STATUS', 'MODULE_PAYMENT_POSTFINANCE_LANGUAGE', 'MODULE_PAYMENT_POSTFINANCE_MERCHANT_ID', 'MODULE_PAYMENT_POSTFINANCE_CURRENCY', 'MODULE_PAYMENT_POSTFINANCE_ORDER_STATUS_ID', 'MODULE_PAYMENT_POSTFINANCE_SORT_ORDER', 'MODULE_PAYMENT_POSTFINANCE_ZONE');    }  }?>