Location: PHPKode > projects > PhpRechnung > phpRechnung/addressbook/new.php
<?php
/*	new.php

	phpInvoice - 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");
require_once("../include/company_settings.inc.php");
CheckUser();
CheckSession();

if(isset($_REQUEST['page']))
{
	$page = $_REQUEST['page'];
	$smarty->assign("page",$page);
}
if(isset($_REQUEST['infoID']))
{
	$infoID = $_REQUEST['infoID'];
	$smarty->assign("infoID","$infoID");
}
if(isset($_REQUEST['Customer']))
{
	$Customer = $_REQUEST['Customer'];
	$smarty->assign("Customer","$Customer");
}

if(isset($_REQUEST['PrintName']))
{
	$PrintName = $_REQUEST['PrintName'];
	$smarty->assign("PRINT_NAME","$PrintName");
}
if(isset($_REQUEST['Prefix']))
{
	$Prefix = $_REQUEST['Prefix'];
	$smarty->assign("PREFIX","$Prefix");
}
if(isset($_REQUEST['Firstname']))
{
	$Firstname = $_REQUEST['Firstname'];
	$smarty->assign("FIRSTNAME","$Firstname");
}
if(isset($_REQUEST['Lastname']))
{
	$Lastname = $_REQUEST['Lastname'];
	$smarty->assign("LASTNAME","$Lastname");
}
if(isset($_REQUEST['Title1']))
{
	$Title1 = $_REQUEST['Title1'];
	$smarty->assign("TITLE","$Title1");
}
if(isset($_REQUEST['Company']))
{
	$Company = $_REQUEST['Company'];
	$smarty->assign("COMPANY","$Company");
}
if(isset($_REQUEST['Department']))
{
	$Department = $_REQUEST['Department'];
	$smarty->assign("DEPARTMENT","$Department");
}
if(isset($_REQUEST['Address']))
{
	$Address = $_REQUEST['Address'];
	$smarty->assign("ADDRESS","$Address");
}
if(isset($_REQUEST['Country']))
{
	$Country = $_REQUEST['Country'];
	$smarty->assign("COUNTRY","$Country");
}
if(isset($_REQUEST['Postalcode']))
{
	$Postalcode = $_REQUEST['Postalcode'];
	$smarty->assign("POSTALCODE","$Postalcode");
}
if(isset($_REQUEST['City']))
{
	$City = $_REQUEST['City'];
	$smarty->assign("CITY","$City");
}
if(isset($_REQUEST['Stateprov']))
{
	$Stateprov = $_REQUEST['Stateprov'];
	$smarty->assign("STATEPROV","$Stateprov");
}
if(isset($_REQUEST['Position1']))
{
	$Position1 = $_REQUEST['Position1'];
	$smarty->assign("POSITION","$Position1");
}
if(isset($_REQUEST['Initials']))
{
	$Initials = $_REQUEST['Initials'];
	$smarty->assign("INITIALS","$Initials");
}
if(isset($_REQUEST['Salutation']))
{
	$Salutation = $_REQUEST['Salutation'];
	$smarty->assign("SALUTATION","$Salutation");
}
if(isset($_REQUEST['Phonehome']))
{
	$Phonehome = $_REQUEST['Phonehome'];
	$smarty->assign("PHONEHOME","$Phonehome");
}
if(isset($_REQUEST['Phoneoffi']))
{
	$Phoneoffi = $_REQUEST['Phoneoffi'];
	$smarty->assign("PHONEOFFI","$Phoneoffi");
}
if(isset($_REQUEST['Phoneothe']))
{
	$Phoneothe = $_REQUEST['Phoneothe'];
	$smarty->assign("PHONEOTHE","$Phoneothe");
}
if(isset($_REQUEST['Phonework']))
{
	$Phonework = $_REQUEST['Phonework'];
	$smarty->assign("PHONEWORK","$Phonework");
}
if(isset($_REQUEST['Mobile']))
{
	$Mobile = $_REQUEST['Mobile'];
	$smarty->assign("MOBILE","$Mobile");
}
if(isset($_REQUEST['Pager']))
{
	$Pager = $_REQUEST['Pager'];
	$smarty->assign("PAGER","$Pager");
}
if(isset($_REQUEST['Fax']))
{
	$Fax = $_REQUEST['Fax'];
	$smarty->assign("FAX","$Fax");
}
if(isset($_REQUEST['Email']))
{
	$Email = $_REQUEST['Email'];
	$smarty->assign("EMAIL","$Email");
}
if(isset($_REQUEST['Url']))
{
	$Url = $_REQUEST['Url'];
	$smarty->assign("URL","$Url");
}
if(isset($_REQUEST['Note']))
{
	$Note = $_REQUEST['Note'];
	$smarty->assign("NOTE","$Note");
}
if(isset($_REQUEST['AltField1']))
{
	$AltField1 = $_REQUEST['AltField1'];
	$smarty->assign("ALTFIELD1","$AltField1");
}
if(isset($_REQUEST['AltField2']))
{
	$AltField2 = $_REQUEST['AltField2'];
	$smarty->assign("ALTFIELD2","$AltField2");
}
if(isset($_REQUEST['Url2']))
{
	$Url2 = $_REQUEST['Url2'];
	$smarty->assign("URL2","$Url2");
}
if(isset($_REQUEST['Email2']))
{
	$Email2 = $_REQUEST['Email2'];
	$smarty->assign("EMAIL2","$Email2");
}
if(isset($_REQUEST['Category']))
{
	$Category = $_REQUEST['Category'];
	$smarty->assign("NR_CATEGORY","$Category");
}
if(isset($_REQUEST['MethodOfPayment']))
{
	$MethodOfPayment = $_REQUEST['MethodOfPayment'];
	$smarty->assign("NR_METHOD_OF_PAYMENT","$MethodOfPayment");
}
if(isset($_REQUEST['Message']))
{
	$Message = $_REQUEST['Message'];
	$smarty->assign("MESSAGE","$Message");
}
if(isset($_REQUEST['Birthday']))
{
	$Birthday = $_REQUEST['Birthday'];
	$smarty->assign("BIRTHDAY","$Birthday");
}

if(isset($_REQUEST['PrintName1']))
{
	$PrintName1 = $_REQUEST['PrintName1'];
	$smarty->assign("PrintName1","$PrintName1");
}
if(isset($_REQUEST['Date_From1']))
{
	$Date_From1 = $_REQUEST['Date_From1'];
	$smarty->assign("Date_From1","$Date_From1");
}
if(isset($_REQUEST['Date_Till1']))
{
	$Date_Till1 = $_REQUEST['Date_Till1'];
	$smarty->assign("Date_Till1","$Date_Till1");
}
if(isset($_REQUEST['CustomerID']))
{
	$CustomerID = $_REQUEST['CustomerID'];
	$smarty->assign("CustomerID","$CustomerID");
}
if(isset($_REQUEST['Prefix1']))
{
	$Prefix1 = $_REQUEST['Prefix1'];
	$smarty->assign("Prefix1","$Prefix1");
}
if(isset($_REQUEST['Firstname1']))
{
	$Firstname1 = $_REQUEST['Firstname1'];
	$smarty->assign("Firstname1","$Firstname1");
}
if(isset($_REQUEST['Lastname1']))
{
	$Lastname1 = $_REQUEST['Lastname1'];
	$smarty->assign("Lastname1","$Lastname1");
}
if(isset($_REQUEST['Title11']))
{
	$Title11 = $_REQUEST['Title11'];
	$smarty->assign("Title11","$Title11");
}
if(isset($_REQUEST['Company1']))
{
	$Company1 = $_REQUEST['Company1'];
	$smarty->assign("Company1","$Company1");
}
if(isset($_REQUEST['Department1']))
{
	$Department1 = $_REQUEST['Department1'];
	$smarty->assign("Department1","$Department1");
}
if(isset($_REQUEST['Address1']))
{
	$Address1 = $_REQUEST['Address1'];
	$smarty->assign("Address1","$Address1");
}
if(isset($_REQUEST['Country1']))
{
	$Country1 = $_REQUEST['Country1'];
	$smarty->assign("Country1","$Country1");
}
if(isset($_REQUEST['Postalcode1']))
{
	$Postalcode1 = $_REQUEST['Postalcode1'];
	$smarty->assign("Postalcode1","$Postalcode1");
}
if(isset($_REQUEST['City1']))
{
	$City1 = $_REQUEST['City1'];
	$smarty->assign("City1","$City1");
}
if(isset($_REQUEST['Stateprov1']))
{
	$Stateprov1 = $_REQUEST['Stateprov1'];
	$smarty->assign("Stateprov1","$Stateprov1");
}
if(isset($_REQUEST['Position11']))
{
	$Position11 = $_REQUEST['Position11'];
	$smarty->assign("Position11","$Position11");
}
if(isset($_REQUEST['Initials1']))
{
	$Initials1 = $_REQUEST['Initials1'];
	$smarty->assign("Initials1","$Initials1");
}
if(isset($_REQUEST['Salutation1']))
{
	$Salutation1 = $_REQUEST['Salutation1'];
	$smarty->assign("Salutation1","$Salutation1");
}
if(isset($_REQUEST['Phonehome1']))
{
	$Phonehome1 = $_REQUEST['Phonehome1'];
	$smarty->assign("Phonehome1","$Phonehome1");
}
if(isset($_REQUEST['Phoneoffi1']))
{
	$Phoneoffi1 = $_REQUEST['Phoneoffi1'];
	$smarty->assign("Phoneoffi1","$Phoneoffi1");
}
if(isset($_REQUEST['Phoneothe1']))
{
	$Phoneothe1 = $_REQUEST['Phoneothe1'];
	$smarty->assign("Phoneothe1","$Phoneothe1");
}
if(isset($_REQUEST['Phonework1']))
{
	$Phonework1 = $_REQUEST['Phonework1'];
	$smarty->assign("Phonework1","$Phonework1");
}
if(isset($_REQUEST['Mobile1']))
{
	$Mobile1 = $_REQUEST['Mobile1'];
	$smarty->assign("Mobile1","$Mobile1");
}
if(isset($_REQUEST['Pager1']))
{
	$Pager1 = $_REQUEST['Pager1'];
	$smarty->assign("Pager1","$Pager1");
}
if(isset($_REQUEST['Fax1']))
{
	$Fax1 = $_REQUEST['Fax1'];
	$smarty->assign("Fax1","$Fax1");
}
if(isset($_REQUEST['Email1']))
{
	$Email1 = $_REQUEST['Email1'];
	$smarty->assign("Email1","$Email1");
}
if(isset($_REQUEST['Url1']))
{
	$Url1 = $_REQUEST['Url1'];
	$smarty->assign("Url1","$Url1");
}
if(isset($_REQUEST['Note1']))
{
	$Note1 = $_REQUEST['Note1'];
	$smarty->assign("Note1","$Note1");
}
if(isset($_REQUEST['AltField11']))
{
	$AltField11 = $_REQUEST['AltField11'];
	$smarty->assign("AltField11","$AltField11");
}
if(isset($_REQUEST['AltField21']))
{
	$AltField21 = $_REQUEST['AltField21'];
	$smarty->assign("AltField21","$AltField21");
}
if(isset($_REQUEST['AltField31']))
{
	$AltField31 = $_REQUEST['AltField31'];
	$smarty->assign("AltField31","$AltField31");
}
if(isset($_REQUEST['AltField41']))
{
	$AltField41 = $_REQUEST['AltField41'];
	$smarty->assign("AltField41","$AltField41");
}
if(isset($_REQUEST['Category1']))
{
	$Category1 = $_REQUEST['Category1'];
	$smarty->assign("Category1","$Category1");
}
if(isset($_REQUEST['MethodOfPayment1']))
{
	$MethodOfPayment1 = $_REQUEST['MethodOfPayment1'];
	$smarty->assign("MathodOfPayment1","$MethodOfPayment1");
}
if(isset($_REQUEST['Birthday1']))
{
	$Birthday1 = $_REQUEST['Birthday1'];
	$smarty->assign("Birthday1","$Birthday1");
}
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($_REQUEST['BankName']))
{
	$BankName = $_REQUEST['BankName'];
	$smarty->assign("BANKNAME","$BankName");
}
if(isset($_REQUEST['BankAccount']))
{
	$BankAccount = $_REQUEST['BankAccount'];
	$smarty->assign("BANKACCOUNT","$BankAccount");
}
if(isset($_REQUEST['BankNumber']))
{
	$BankNumber = $_REQUEST['BankNumber'];
	$smarty->assign("BANKNUMBER","$BankNumber");
}
if(isset($_REQUEST['BankIban']))
{
	$BankIban = $_REQUEST['BankIban'];
	$smarty->assign("BANKIBAN","$BankIban");
}
if(isset($_REQUEST['BankBic']))
{
	$BankBic = $_REQUEST['BankBic'];
	$smarty->assign("BANKBIC","$BankBic");
}
if(isset($_POST['TaxFree']))
{
	$TaxFree = $_POST['TaxFree'];
	$smarty->assign("TAXFREE","$TaxFree");
}
if(isset($_POST['Taxnr']))
{
	$Taxnr = $_POST['Taxnr'];
	$smarty->assign("TAXNR","$Taxnr");
}
if(isset($_POST['BusinessTaxnr']))
{
	$BusinessTaxnr = $_POST['BusinessTaxnr'];
	$smarty->assign("BUSINESSTAXNR","$BusinessTaxnr");
}
if(isset($_REQUEST['UserActive']))
{
	$UserActive = $_REQUEST['UserActive'];
	$smarty->assign("USERACTIVE","$UserActive");
}
if(isset($_REQUEST['UserName']))
{
	$UserName = $_REQUEST['UserName'];
	$smarty->assign("USERNAME","$UserName");
}
if(isset($_REQUEST['UserLanguage']))
{
	$UserLanguage = $_REQUEST['UserLanguage'];
	$smarty->assign("LANGUAGE","$UserLanguage");
}

$Searchstring = "CustomerID=$CustomerID&amp;Prefix1=$Prefix1&amp;Title11=$Title11&amp;Firstname1=$Firstname1&amp;Initials1=$Initials1&amp;Lastname1=$Lastname1&amp;Phonehome1=$Phonehome1&amp;Salutation1=$Salutation1&amp;Mobile1=$Mobile1&amp;Address1=$Address1&amp;Fax1=$Fax1&amp;Stateprov1=$Stateprov1&amp;Email1=$Email1&amp;Postalcode1=$Postalcode1&amp;City1=$City1&amp;Url1=$Url1&amp;Company1=$Company1&amp;Phonework1=$Phonework1&amp;Department1=$Department1&amp;Phoneoffi1=$Phoneoffi1&amp;Position11=$Position11&amp;Phoneothe1=$Phoneothe1&amp;Pager1=$Pager1&amp;Note1=$Note1&amp;Altfield11=$AltField11&amp;Altfield21=$AltField21&amp;Altfield31=$AltField31&amp;Altfield41=$AltField41&amp;Country1=$Country1&amp;Date_From1=$Date_From1&amp;Date_Till1=$Date_Till1&amp;Birthday1=$Birthday1&amp;Category1=$Category1&amp;MethodOfPayment1=$MethodOfPayment1&amp;PrintName1=$PrintName1";
$smarty->assign("Searchstring","$Searchstring");

$smarty->assign("CompanyCountry","$CompanyCountry");

// Assign needed text from selected language file
//
$smarty->assign("Title","$a[addressbook] - $a[new]");
$smarty->assign("Print_Name","$a[print_name]");
$smarty->assign("Prefix","$a[prefix]");
$smarty->assign("CTitle","$a[title]");
$smarty->assign("Firstname","$a[firstname]");
$smarty->assign("Lastname","$a[lastname]");
$smarty->assign("Initials","$a[initials]");
$smarty->assign("Phonehome","$a[phonehome]");
$smarty->assign("Salutation","$a[salutation]");
$smarty->assign("Mobile","$a[mobile]");
$smarty->assign("Address","$a[address]");
$smarty->assign("Fax","$a[fax]");
$smarty->assign("Stateprov","$a[stateprov]");
$smarty->assign("Email","$a[email]");
$smarty->assign("Postalcode","$a[postalcode]");
$smarty->assign("City","$a[city]");
$smarty->assign("Url","$a[url]");
$smarty->assign("Company","$a[company]");
$smarty->assign("Phonework","$a[phonework]");
$smarty->assign("Department","$a[department]");
$smarty->assign("Phoneoffi","$a[phoneoffi]");
$smarty->assign("CPosition","$a[position1]");
$smarty->assign("Phoneothe","$a[phoneothe]");
$smarty->assign("Pager","$a[pager]");
$smarty->assign("Note","$a[note]");
$smarty->assign("AltField1","$a[altfield1]");
$smarty->assign("AltField2","$a[altfield2]");
$smarty->assign("Url2","$a[url2]");
$smarty->assign("Email2","$a[email2]");
$smarty->assign("Country","$a[country]");
$smarty->assign("CDate","$a[date]");
$smarty->assign("Birthday","$a[birthday]");
$smarty->assign("Category","$a[category]");
$smarty->assign("Envelope","$a[envelope]");
$smarty->assign("Select_All","$a[select_all]");
$smarty->assign("CustMethodOfPayment","$a[cust_method_of_payment]");
$smarty->assign("CustMessage","$a[message]");
$smarty->assign("Choose_Message","$a[choose_message]");
$smarty->assign("Select_Report","$a[select_report]");
$smarty->assign("Date_From","$a[date_from]");
$smarty->assign("Date_Till","$a[date_till]");
$smarty->assign("Customer_No","$a[customer_no]");
$smarty->assign("NewEntry","$a[new_entry]");
$smarty->assign("Bank_Name","$a[bank_name]");
$smarty->assign("Bank_Account","$a[bank_account]");
$smarty->assign("Bank_Number","$a[bank_number]");
$smarty->assign("Bank_Iban","$a[bank_iban]");
$smarty->assign("Bank_Bic","$a[bank_bic]");
$smarty->assign("Tax_Free","$a[company_tax_free]");
$smarty->assign("Tax_No","$a[company_taxnr]");
$smarty->assign("Business_Tax_No","$a[business_taxnr]");
$smarty->assign("User_Active","$a[user_active]");
$smarty->assign("Username","$a[username]");
$smarty->assign("Password","$a[password]");
$smarty->assign("Repeat_Password","$a[repeat_password]");
$smarty->assign("Language","$a[language]");

// Get the choice array from language file
//
$smarty->assign("choice_yes_no",array($choice_yes_no));

// Put avaiable languages in $choose_language array
//
$lang = asort($language);
$smarty->assign("choose_language",array($language));

// Database connection
//
DBConnect();

// Get the category and payment descriptions from database
//
$query1 = $db->GetAll("SELECT CATEGORYID, DESCRIPTION FROM {$TBLName}category ORDER BY DESCRIPTION ASC");
$query2 = $db->GetAll("SELECT METHODOFPAYID, DESCRIPTION FROM {$TBLName}methodofpay ORDER BY DESCRIPTION ASC");

// If an error has occurred, display the error message
//
if ((!$query1) || (!$query2))
	print$db->ErrorMsg();
else
	foreach($query1 as $result1)
	{
		$CategoryData[] = $result1;
	}
	$smarty->assign("CategoryData",$CategoryData);

	foreach($query2 as $result2)
	{
		$PaymentData[] = $result2;
	}
	$smarty->assign("PaymentData",$PaymentData);
	
	$query3 = $db->GetAll("SELECT MESSAGEID, DESCRIPTION FROM {$TBLName}message ORDER BY DESCRIPTION ASC");

	foreach($query3 as $result3)
	{
		$MessageData[] = $result3;
	}
	$smarty->assign("MessageData",$MessageData);

	// Get the last entry from address
	//
	$query4 = $db->GetRow("SELECT MAX(MYID) AS MAX_MYID FROM {$TBLName}addressbook");
	if (!$query4)
		print $db->ErrorMsg();
	else
		$MyID = $query4['MAX_MYID'];

	$smarty->assign("MyID",$MyID);
	
$smarty->display('addressbook/new.tpl');

unset($_SESSION['NewID']);

?>
Return current item: PhpRechnung