<?php
/*
edit.php
phpRechnung - is easy-to-use Web-based multilingual accounting software.
Copyright (C) 2001 - 2008 Edy Corak < phprechnung at ecorak dot net >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once("../include/phprechnung.inc.php");
require_once("../include/smarty.inc.php");
CheckUser();
CheckAdminGroup1();
CheckSession();
if(isset($_REQUEST['settingID']))
{
$settingID = $_REQUEST['settingID'];
$smarty->assign("settingID","$settingID");
}
if(isset($_REQUEST['page']))
{
$page = $_REQUEST['page'];
$smarty->assign("page","$page");
}
if(isset($_REQUEST['Order']))
{
$Order = $_REQUEST['Order'];
$smarty->assign("Order","$Order");
}
if(isset($_REQUEST['Sort']))
{
$Sort = $_REQUEST['Sort'];
$smarty->assign("Sort","$Sort");
}
if(isset($_REQUEST['Mark']))
{
$Mark = $_REQUEST['Mark'];
$smarty->assign("Mark","$Mark");
}
if(isset($_POST['PrintCompanyData']))
{
$PrintCompanyData = $_POST['PrintCompanyData'];
}
if(isset($_POST['PrintPositionName']))
{
$PrintPositionName = $_POST['PrintPositionName'];
}
if(isset($_POST['CompanyLogo']))
{
$CompanyLogo = $_POST['CompanyLogo'];
}
if(isset($_POST['CompanyLogoWidth']))
{
$CompanyLogoWidth = $_POST['CompanyLogoWidth'];
}
if(isset($_POST['CompanyLogoHeight']))
{
$CompanyLogoHeight = $_POST['CompanyLogoHeight'];
}
if(isset($_POST['EmailInternal']))
{
$EmailInternal = $_POST['EmailInternal'];
}
if(isset($_POST['EmailUseSignature']))
{
$EmailUseSignature = $_POST['EmailUseSignature'];
}
if(isset($_POST['EmailSignature']))
{
$EmailSignature = $_POST['EmailSignature'];
}
if(isset($_POST['StockActive']))
{
$StockActive = $_POST['StockActive'];
}
if(isset($_POST['Reminder']))
{
$Reminder = $_POST['Reminder'];
}
if(isset($_POST['ReminderDays']))
{
$ReminderDays = $_POST['ReminderDays'];
}
if(isset($_POST['ReminderPrice']))
{
$ReminderPrice = $_POST['ReminderPrice'];
}
if(isset($_POST['EntrysPerPage']))
{
$EntrysPerPage = $_POST['EntrysPerPage'];
}
if(isset($_POST['SessionSec']))
{
$SessionSec = $_POST['SessionSec'];
}
$smarty->assign("Title","$a[settings] - $a[edit]");
$smarty->assign("Basic_Settings","$a[basic_settings]");
$smarty->assign("Company_Settings","$a[company_settings]");
$smarty->assign("PDF_Settings","$a[pdf_settings]");
$smarty->assign("Print_Company_Data","$a[print_company_data]");
$smarty->assign("Print_Position_Name","$a[print_position_name]");
$smarty->assign("Company_Logo","$a[company_logo]");
$smarty->assign("Company_Logo_Width","$a[company_logo_width]");
$smarty->assign("Company_Logo_Height","$a[company_logo_height]");
$smarty->assign("Email_Internal","$a[email_internal]");
$smarty->assign("Email_Use_Signature","$a[email_use_signature]");
$smarty->assign("Email_Signature","$a[email_signature]");
$smarty->assign("Stock_Active","$a[stock_active]");
$smarty->assign("Use_Reminder","$a[reminder]");
$smarty->assign("Reminder_Price","$a[reminder_price]");
$smarty->assign("Reminder_Days","$a[reminder_days]");
$smarty->assign("Entries_Per_Page","$a[entries_per_page]");
$smarty->assign("Session_Sec","$a[session_sec]");
// Get the arrays from language file
//
$smarty->assign("choice_yes_no",array($choice_yes_no));
// Database connection
//
DBConnect();
// Get entrys from setting table
//
$query = $db->GetAll("SELECT PRINT_COMPANY_DATA, PRINT_POSITION_NAME, COMPANY_LOGO, COMPANY_LOGO_WIDTH, COMPANY_LOGO_HEIGHT,
EMAIL_INTERNAL, EMAIL_USE_SIGNATURE, EMAIL_SIGNATURE, INVENTORY_CHECK_ACTIVE, REMINDER, REMINDER_DAYS, REMINDER_PRICE,
ENTRYS_PER_PAGE, COMPANY_CURRENCY, SESSION_SEC, SETTINGID FROM {$TBLName}setting WHERE SETTINGID=$settingID");
// If an error has occurred, display the error message
//
if (!$query)
print($db->ErrorMsg());
else
foreach($query as $f)
{
if ($PrintCompanyData == "")
{
$smarty->assign("PrintCompanyData","$f[PRINT_COMPANY_DATA]");
}
else
{
$smarty->assign("PrintCompanyData","$PrintCompanyData");
}
if ($PrintPositionName == "")
{
$smarty->assign("PrintPositionName","$f[PRINT_POSITION_NAME]");
}
else
{
$smarty->assign("PrintPositionName","$PrintPositionName");
}
if (empty($CompanyLogo))
{
$smarty->assign("CompanyLogo","$f[COMPANY_LOGO]");
}
else
{
$smarty->assign("CompanyLogo","$CompanyLogo");
}
if (empty($CompanyLogoWidth))
{
$smarty->assign("CompanyLogoWidth","$f[COMPANY_LOGO_WIDTH]");
}
else
{
$smarty->assign("CompanyLogoWidth","$CompanyLogoWidth");
}
if (empty($CompanyLogoHeight))
{
$smarty->assign("CompanyLogoHeight","$f[COMPANY_LOGO_HEIGHT]");
}
else
{
$smarty->assign("CompanyLogoHeight","$CompanyLogoHeight");
}
if ($EmailInternal == "")
{
$smarty->assign("EmailInternal","$f[EMAIL_INTERNAL]");
}
else
{
$smarty->assign("EmailInternal","$EmailInternal");
}
if ($EmailUseSignature == "")
{
$smarty->assign("EmailUseSignature","$f[EMAIL_USE_SIGNATURU]");
}
else
{
$smarty->assign("EmailUseSignature","$EmailUseSignature");
}
if (empty($EmailSignature))
{
$smarty->assign("EmailSignature","$f[EMAIL_SIGNATURE]");
}
else
{
$smarty->assign("EmailSignature","$EmailSignature");
}
if ($StockActive == "")
{
$smarty->assign("StockActive","$f[INVENTORY_CHECK_ACTIVE]");
}
else
{
$smarty->assign("StockActive","$StockActive");
}
if ($Reminder == "")
{
$smarty->assign("Reminder","$f[REMINDER]");
}
else
{
$smarty->assign("Reminder","$Reminder");
}
if (empty($ReminderDays))
{
$smarty->assign("ReminderDays","$f[REMINDER_DAYS]");
}
else
{
$smarty->assign("ReminderDays","$ReminderDays");
}
if (empty($ReminderPrice))
{
$smarty->assign("ReminderPrice","$f[REMINDER_PRICE]");
}
else
{
$smarty->assign("ReminderPrice","$ReminderPrice");
}
if (empty($EntrysPerPage))
{
$smarty->assign("EntrysPerPage","$f[ENTRYS_PER_PAGE]");
}
else
{
$smarty->assign("EntrysPerPage","$EntrysPerPage");
}
if (empty($SessionSec))
{
$smarty->assign("SessionSec","$f[SESSION_SEC]");
}
else
{
$smarty->assign("SessionSec","$SessionSec");
}
$smarty->assign("Currency","$f[COMPANY_CURRENCY]");
}
$smarty->display('config/edit.tpl');
?>