head	1.2;
access;
symbols
	yes-v1-stable:1.1;
locks; strict;
comment	@# @;


1.2
date	2010.12.13.08.56.20;	author cvs;	state dead;
branches;
next	1.1;

1.1
date	2007.11.05.08.19.00;	author cvs;	state Exp;
branches;
next	;


desc
@@


1.2
log
@raus
@
text
@<?
require_once('includes/configure.php');
$db = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
mysql_select_db(DB_DATABASE, $db);

# Letzte benutzte Group ID in configuration ermitteln
# (da andere Anbieter keinen Eintrag in der configuration_group machen und es so zu Überschneidungen kommt)
$sql = 'SELECT MAX(`configuration_group_id`) AS `group_id` FROM `configuration` ';
$result = mysql_query($sql, $db);
$row = mysql_fetch_assoc($result);

# Gruppen-ID
$group_id = ($row['group_id'] + 1);

# Eintrag für UOS-Einstellungsgruppe
if (!mysql_error($db)) {
  $sql = 'SELECT `configuration_group_id` FROM
          `configuration_group` WHERE
          `configuration_group_title` = "UOS Settings"';
  $result = mysql_query($sql, $db);
  if (mysql_num_rows($result) > 0){
    list ($group_id) = mysql_fetch_row($result);
  }
  if (mysql_num_rows($result) <= 0){
    $sql = 'INSERT INTO `configuration_group` SET
            `configuration_group_id`          = "'.$group_id.'",
            `configuration_group_title`       = "UOS Settings",
            `configuration_group_description` = "Additional Options for UOS Modules",
            `sort_order`                      = "66",
            `visible`                         = "1"
            ';
    $result = mysql_query($sql, $db);
    $group_id = mysql_insert_id();
  } else {
    $sql = 'UPDATE `configuration_group` SET
            `configuration_group_title`       = "UOS Settings",
            `configuration_group_description` = "Additional Options for UOS Modules",
            `sort_order`                      = "'.$group_id.'",
            `visible`                         = "1"
            WHERE
            `configuration_group_id`          = "'.$group_id.'"
            ';
    $result = mysql_query($sql, $db);
  }
} else {
  echo "Fehler bei Einstellungsgruppe";
  exit;
}

# Config-Eintrag Bestellstatusmails an Kunden
if (!mysql_error($db)) {
  $sql = 'SELECT `configuration_id` FROM
          `configuration` WHERE
          `configuration_group_id` = "'.$group_id.'" AND
          `configuration_key`      = "MODULE_UOS_SETTING_ORDERSTATUS_CHANGE_MAILS_TO_CUSTOMER"';
  $result = mysql_query($sql, $db);
  if (mysql_num_rows($result) <= 0){
    $sql = 'INSERT INTO `configuration` SET
           `configuration_id`         = NULL,
           `configuration_key`        = "MODULE_UOS_SETTING_ORDERSTATUS_CHANGE_MAILS_TO_CUSTOMER",
           `configuration_value`      = "True",
           `configuration_group_id`   = "'.$group_id.'",
           `sort_order`               = "1",
           `date_added`               = NOW(),
           `use_function`             = NULL,
           `set_function`             = "xtc_cfg_select_option(array(\'True\', \'False\'),"
            ';
    $result = mysql_query($sql, $db);
  } else {
    $sql = 'UPDATE `configuration` SET
           `configuration_value`      = "True",
           `sort_order`               = "1",
           `date_added`               = NOW(),
           `use_function`             = NULL,
           `set_function`             = "xtc_cfg_select_option(array(\'True\', \'False\'),"
           WHERE
           `configuration_key`        = "MODULE_UOS_SETTING_ORDERSTATUS_CHANGE_MAILS_TO_CUSTOMER" AND
           `configuration_group_id`   = "'.$group_id.'"
            ';
    $result = mysql_query($sql, $db);
  }
} else {
  echo "Fehler bei Bestellstatusmails";
  exit;
}

# Config-Eintrag Kundeninfos in Statusmails
if (!mysql_error($db)) {
  $sql = 'SELECT `configuration_id` FROM
          `configuration` WHERE
          `configuration_group_id` = "'.$group_id.'" AND
          `configuration_key`      = "MODULE_UOS_SETTING_ORDERSTATUS_CHANGE_MAILS_WITH_CUSTOMERINFOS"';
  $result = mysql_query($sql, $db);
  if (mysql_num_rows($result) <= 0){
    $sql = 'INSERT INTO `configuration` SET
           `configuration_id`         = NULL,
           `configuration_key`        = "MODULE_UOS_SETTING_ORDERSTATUS_CHANGE_MAILS_WITH_CUSTOMERINFOS",
           `configuration_value`      = "True",
           `configuration_group_id`   = "'.$group_id.'",
           `sort_order`               = "2",
           `date_added`               = NOW(),
           `use_function`             = NULL,
           `set_function`             = "xtc_cfg_select_option(array(\'True\', \'False\'),"
            ';
    $result = mysql_query($sql, $db);
  } else {
    $sql = 'UPDATE `configuration` SET
           `configuration_value`      = "True",
           `sort_order`               = "2",
           `date_added`               = NOW(),
           `use_function`             = NULL,
           `set_function`             = "xtc_cfg_select_option(array(\'True\', \'False\'),"
           WHERE
           `configuration_key`        = "MODULE_UOS_SETTING_ORDERSTATUS_CHANGE_MAILS_WITH_CUSTOMERINFOS" AND
           `configuration_group_id`   = "'.$group_id.'"
            ';
    $result = mysql_query($sql, $db);
  }
} else {
  echo "Fehler bei Kundeninfos";
  exit;
}

# Config-Eintrag Bestellstatus einmalig
if (!mysql_error($db)) {
  $sql = 'SELECT `configuration_id` FROM
          `configuration` WHERE
          `configuration_group_id` = "'.$group_id.'" AND
          `configuration_key`      = "MODULE_UOS_SETTING_ORDERSTATUS_DOUBLE_CHECK"';
  $result = mysql_query($sql, $db);
  if (mysql_num_rows($result) <= 0){
    $sql = 'INSERT INTO `configuration` SET
           `configuration_id`         = NULL,
           `configuration_key`        = "MODULE_UOS_SETTING_ORDERSTATUS_DOUBLE_CHECK",
           `configuration_value`      = "True",
           `configuration_group_id`   = "'.$group_id.'",
           `sort_order`               = "3",
           `date_added`               = NOW(),
           `use_function`             = NULL,
           `set_function`             = "xtc_cfg_select_option(array(\'True\', \'False\'),"
            ';
    $result = mysql_query($sql, $db);
  } else {
    $sql = 'UPDATE `configuration` SET
           `configuration_value`      = "True",
           `sort_order`               = "3",
           `date_added`               = NOW(),
           `use_function`             = NULL,
           `set_function`             = "xtc_cfg_select_option(array(\'True\', \'False\'),"
           WHERE
           `configuration_key`        = "MODULE_UOS_SETTING_ORDERSTATUS_DOUBLE_CHECK" AND
           `configuration_group_id`   = "'.$group_id.'"
            ';
    $result = mysql_query($sql, $db);
  }
} else {
  echo "Fehler bei Bestellstatus";
  exit;
}

# Config-Eintrag Abbruchstatus
if (!mysql_error($db)) {
  $sql = 'SELECT `configuration_id` FROM
          `configuration` WHERE
          `configuration_group_id` = "'.$group_id.'" AND
          `configuration_key`      = "MODULE_UOS_SETTING_ORDERSTATUS_USER_ABORT"';
  $result = mysql_query($sql, $db);
  if (mysql_num_rows($result) <= 0){
    $sql = 'INSERT INTO `configuration` SET
           `configuration_id`         = NULL,
           `configuration_key`        = "MODULE_UOS_SETTING_ORDERSTATUS_USER_ABORT",
           `configuration_value`      = "1",
           `configuration_group_id`   = "'.$group_id.'",
           `sort_order`               = "4",
           `date_added`               = NOW(),
           `use_function`             = "xtc_get_order_status_name",
           `set_function`             = "xtc_cfg_pull_down_order_statuses("
            ';
    $result = mysql_query($sql, $db);
  } else {
    $sql = 'UPDATE `configuration` SET
           `configuration_value`      = "1",
           `sort_order`               = "4",
           `date_added`               = NOW(),
           `use_function`             = "xtc_get_order_status_name",
           `set_function`             = "xtc_cfg_pull_down_order_statuses("
           WHERE
           `configuration_key`        = "MODULE_UOS_SETTING_ORDERSTATUS_USER_ABORT" AND
           `configuration_group_id`   = "'.$group_id.'"
            ';
    $result = mysql_query($sql, $db);
  }
} else {
  echo "Fehler bei Abbruchstatus";
  exit;
}

$db_link = & $db;
require_once('inc/xtc_db_fetch_array.inc.php');
require_once('inc/xtc_db_query.inc.php');
require_once('includes/classes/class.uos.php');
$uos = & new uos();
$status_user_abort = $uos->setNewOrderStatus('Abbruch Kunde UOS', 'Customer Abort UOS');
if ($status_user_abort < 0){
  echo "Fehler bei New Order Status => 'Abbruch Kunde UOS'";  
  exit;
}

# Config-Eintrag FSockOpen
if (!mysql_error($db)) {
  $sql = 'SELECT `configuration_id` FROM
          `configuration` WHERE
          `configuration_group_id` = "'.$group_id.'" AND
          `configuration_key`      = "MODULE_UOS_SETTING_USE_FSOCKOPEN"';
  $result = mysql_query($sql, $db);
  if (mysql_num_rows($result) <= 0){
    $sql = 'INSERT INTO `configuration` SET
           `configuration_id`         = NULL,
           `configuration_key`        = "MODULE_UOS_SETTING_USE_FSOCKOPEN",
           `configuration_value`      = "False",
           `configuration_group_id`   = "'.$group_id.'",
           `sort_order`               = "2",
           `date_added`               = NOW(),
           `use_function`             = NULL,
           `set_function`             = "xtc_cfg_select_option(array(\'True\', \'False\'),"
            ';
    $result = mysql_query($sql, $db);
  } else {
    $sql = 'UPDATE `configuration` SET
           `configuration_value`      = "False",
           `sort_order`               = "2",
           `date_added`               = NOW(),
           `use_function`             = NULL,
           `set_function`             = "xtc_cfg_select_option(array(\'True\', \'False\'),"
           WHERE
           `configuration_key`        = "MODULE_UOS_SETTING_USE_FSOCKOPEN" AND
           `configuration_group_id`   = "'.$group_id.'"
            ';
    $result = mysql_query($sql, $db);
  }
} else {
  echo "Fehler bei FSockOpen";
  exit;
}

# Spalte für UOS-Kunden-ID
if (!mysql_error($db)) {
  $sql = 'SHOW COLUMNS FROM `customers` LIKE "customers_uosid"';
  $result = mysql_query($sql, $db);
  if (mysql_num_rows($result) <= 0){
    $sql = 'ALTER TABLE `customers` ADD `customers_uosid` INT( 11 ) NOT NULL DEFAULT "0"';
    $result = mysql_query($sql, $db);
  }
} else {
  echo "Fehler bei Kundenspalte";
  exit;
}

# Alles erfolgreich
if (!mysql_error($db)){
  echo 'Installation complete!<br>';
} else {
  echo 'Installation not complete!<br>';
}


?>
@


1.1
log
@UOS
@
text
@@

