Jump to content
Sign in to follow this  
DefelRadar

Purchase Order Account Application Support Forum

Recommended Posts

This is the forum for Purchase Order Account Application. Please post any bugs/mods and we will include them in the next version.

Hello,

 

I'd like to use this contribution in my store but I'm a little confused what are other mods I should use in conjunction with this. There are so many contributions for accepting PO, like "Purchase Orders 1.4.1", "Institutional Purchase Order Payment v1.2 by Nicpon", "Purchase Order V2.3.1 by penfold_99". Could anybody please help me choose which one should I use with "PURCHASE ORDER ACCOUNT APPLICATION". Any help would be greatly appreciated.

 

Thanks in advance,

Irin.

Share this post


Link to post
Share on other sites
Hello,

 

I'd like to use this contribution in my store but I'm a little confused what are other mods I should use in conjunction with this. There are so many contributions for accepting PO, like "Purchase Orders 1.4.1", "Institutional Purchase Order Payment v1.2 by Nicpon", "Purchase Order V2.3.1 by penfold_99". Could anybody please help me choose which one should I use with "PURCHASE ORDER ACCOUNT APPLICATION". Any help would be greatly appreciated.

 

Thanks in advance,

Irin.

Hello,

 

I've installed "PURCHASE ORDER ACCOUNT APPLICATION" contribution. It only adds an option to Create PO Account in Information box. How can I add this option to login.php page. It will be very appropriate on that page, so if anybody is going to create a new account, they can see Create PO Account option. How it can be done?

 

Thanks a lot,

Irin.

Share this post


Link to post
Share on other sites

Hello Irin,

 

there is another oscommerce forum member that has done just what you are looking for. His name is BillSmed and I would PM him and ask him just what he did.

 

Hope this helps.

 

Aaron

 

Hello,

 

I've installed "PURCHASE ORDER ACCOUNT APPLICATION" contribution. It only adds an option to Create PO Account in Information box. How can I add this option to login.php page. It will be very appropriate on that page, so if anybody is going to create a new account, they can see Create PO Account option. How it can be done?

 

Thanks a lot,

Irin.

Share this post


Link to post
Share on other sites
Hello Irin,

 

there is another oscommerce forum member that has done just what you are looking for. His name is BillSmed and I would PM him and ask him just what he did.

 

Hope this helps.

 

Aaron

Thanks for your response, Aaron. Don't worry, I've figured this out already. Just added few new definitions to language file and created a new table with Create PO Account at the top of it on my login.php. :thumbsup:

 

Regards.

Edited by Irin

Share this post


Link to post
Share on other sites

Hello,

 

What contribution should I use with "Purchase Order Account Application" to enable/disable purchase order payment in admin, "Purchase Orders 1.4.1" or "Purchase Order V2.3"? What is a difference between this two contributions?

 

Thanks,

Irin.

Share this post


Link to post
Share on other sites

Irin,

 

I use Purchase Order V2.3 but I would think you could use the PO Account Application with either version.

 

Hello,

 

What contribution should I use with "Purchase Order Account Application" to enable/disable purchase order payment in admin, "Purchase Orders 1.4.1" or "Purchase Order V2.3"? What is a difference between this two contributions?

 

Thanks,

Irin.

Share this post


Link to post
Share on other sites

Thanks nice contribution

 

I have an error when submitting the createPOaccount.php. I am using the contribution standalone and do not have PWA or PO231. I do plan on installing PO231 once i get this fixed.

 

if anyone can help me out...

 

1054 - Unknown column 'purchased_without_account' in 'field list'

select customers_id, customers_email_address, purchased_without_account from customers where customers_email_address = 'testaddress@earthlink.net'

 

 

 

Also: the instructions are missing one define in includes\languages\english.php

define('CATEGORY_POACCOUNT_PASSWORD', 'Account Password');

 

 

Also: this file does not exist in my store -

 

**************edit includes\boxes\filenames.php*****************

before the last ?> add the following

 

// begin Create PO Account

define('FILENAME_CREATEPOACCOUNT', 'createPOaccount.php');

// end Create PO Account

 

is this a problem? or is the named file incorrect? I do not plan on adding the link within the information box so this might be irrelevent.


-Dave

Share this post


Link to post
Share on other sites

For you 1054 sql error ... open createPOaccount.php and find all instances of purchased_without_account ... and delete them all.

 

For the ... edit includes\boxes\filenames.php problem

 

what they meant is catalog/inludes/filenames.php ... and yes you must place the define in filenames or you will get errors and it will not work.

 

define('FILENAME_CREATEPOACCOUNT', 'createPOaccount.php');

Share this post


Link to post
Share on other sites

Thank you for the fast response.

I deleted the two instances of purchased_without_account. I assume I should replace these if I install PWA? Do I replace if I install PO2.3.3 ?

 

I also had to remove the CREDIT CLASS CODE BLOCK.

 

what they meant is catalog/inludes/filenames.php ... and yes you must place the define in filenames or you will get errors and it will not work.

 

define('FILENAME_CREATEPOACCOUNT', 'createPOaccount.php');

 

That would make that step of the insructions redundant, as that define is already in step 1... correct?

 

One last question? How would I go about adding a line on the account application asking for the Company's tax id number? For reference, I have this code in my normal create_account.php which also triggers email alerts....

 

// BOF Separate Pricing Per Customer, added: field for tax id number
if (ACCOUNT_COMPANY == 'true') { 
$company = tep_db_prepare_input($HTTP_POST_VARS['company']);
$company_tax_id = tep_db_prepare_input($HTTP_POST_VARS['company_tax_id']);
}
// EOF Separate Pricing Per Customer, added: field for tax id number

 

// BOF Separate Pricing Per Customer
// if you would like to have an alert in the admin section when either a company name has been entered in
// the appropriate field or a tax id number, or both then uncomment the next line and comment the default
// setting: only alert when a tax_id number has been given
//	if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) { 
  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) { 
  $sql_data_array['customers_group_ra'] = '1';
  }
// EOF Separate Pricing Per Customer

 

 

// BOF adapted for Separate Pricing Per Customer
  $sql_data_array['entry_company'] = $company;
  $sql_data_array['entry_company_tax_id'] = $company_tax_id;
  }
// EOF adapted for Separate Pricing Per Customer

 

 

// BOF Separate Pricing Per Customer: alert shop owner of account created by a company
// if you would like to have an email when either a company name has been entered in
// the appropriate field or a tax id number, or both then uncomment the next line and comment the default
// setting: only email when a tax_id number has been given
//	if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) { 
  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) { 
  $alert_email_text = "Please note that " . $firstname . " " . $lastname . " of the company: " . $company . " has created an account.";
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Company account created', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  }
// EOF Separate Pricing Per Customer: alert shop owner of account created by a company


-Dave

Share this post


Link to post
Share on other sites

I spoke a little too soon. I almost got it. By making the minor edits mentioned above, it is working perfectly EXCEPT the confirmation email to the customer is not being sent. The thank you for submitting is being sent, but not the copy of the application. The store owner does recieve the application.

 

Here is what I have in createPOaccount.php. Where did I goober it up?

 

//PWA delete account
	$get_customer_info = tep_db_query("select customers_id, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	$customer_info = tep_db_fetch_array($get_customer_info);
	$customer_id = $customer_info['customers_id'];
	$customer_email_address = $customer_info['customers_email_address'];
	if ($customer_pwa !='1')
	{
	$error = true;

	$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
	} else {
		tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'");
		tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
		tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customer_id . "'");
		tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'");
		tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "'");
		tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . $customer_id . "'");
	}
  }
// END

 

and the Credit class code block that is commented out

 

	  /* ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* BEGIN
 if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
$coupon_code = create_coupon_code();
$insert_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
$insert_id = tep_db_insert_id($insert_query);
$insert_query = tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $email_address . "', now() )");

$email_text .= sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . "\n\n" .
			   sprintf(EMAIL_GV_REDEEM, $coupon_code) . "\n\n" .
			   EMAIL_GV_LINK . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code,'NONSSL', false) .
			   "\n\n";
 }
 if (NEW_SIGNUP_DISCOUNT_COUPON != '') {
$coupon_code = NEW_SIGNUP_DISCOUNT_COUPON;
$coupon_query = tep_db_query("select * from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_code . "'");
$coupon = tep_db_fetch_array($coupon_query);
$coupon_id = $coupon['coupon_id'];
$coupon_desc_query = tep_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . (int)$languages_id . "'");
$coupon_desc = tep_db_fetch_array($coupon_desc_query);
$insert_query = tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id ."', '0', 'Admin', '" . $email_address . "', now() )");
$email_text .= EMAIL_COUPON_INCENTIVE_HEADER .  "\n" .
			   sprintf("%s", $coupon_desc['coupon_description']) ."\n\n" .
			   sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "\n\n" .
			   "\n\n";
 }

// ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* END*/


-Dave

Share this post


Link to post
Share on other sites

The whole contribution is missing stuff. For example a sql file to install all of the new fields for company_type .. number_of_employees ... etc.

The way it is right now you are only going to have the e-mail as a reference.

 

They will all have to be entered into your orders.php if you want the information to be input to your database.

 

You are right about the instructions being repeated in Steps 1 and 2. You just need the one master define in filenames.php

 

For the email I would comment out the code for PWA as you can always add that later. It is probably outdated anyway and a newer version released.

 

After line:

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

 

remove or comment out the whole thing and just put the following:

 

} else {

// check to see if that e-mail address already taken or exists in records

$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");

$check_email = tep_db_fetch_array($check_email_query);

if ($check_email['total'] > 0) {

$error = true;

 

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);

}

}

 

You line after that should read:

 

if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {

 

 

Now go down to the Credit Class Block. Just before the block make sure you have the following:

 

$email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;

 

After the Credit Class Block replace:

tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

with this:

tep_mail($name, $email_address, EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

As for adding company tax id ... it looks like you already have it installed unless I am mistaken. Just copy the code out of your create_account.php to the createPOaccount.php. It should be pretty easy as the two files are almost identical .. except for any mods you have added.

 

Than you can just add the info to the catalog/includes/languages/english/createPOaccount.php

 

Something like this:

 

FIND:

<b>Applicant Information</b>

 

Company : ' . $company . '

 

Add Below:

 

Tax ID #: ' . $company_tax_id . '

 

Now it should be sent with the rest of the e-mail variables.

 

 

If you are not getting email .. it is not a problem with your store .. it is the code. I will try to look at this contribution if I get some time .. as I have only looked at it briefly.

Share this post


Link to post
Share on other sites

Hello!

 

I had the 1054 sql error, and I deleted the PWA lines in the createPOaccount.php, because I don't have it installed, thanks for the tip!

 

But now I got a problem with the application form... I filled every fields but I get an error as I submit:

 

Your Date of Birth must be in this format: MM/DD/YYYY (eg 05/21/1970)

 

I think it has something to do with this code...

 

	if (ACCOUNT_DOB == 'true') {
  if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {
	$error = true;

	$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
  }
}

 

I don't know where to look to correct this error. Thanks in advance!

Share this post


Link to post
Share on other sites

insomniac2, Thank you very much. I really appreciate your help.

 

I wll dig into this again this eve and see how it goes.

 

FYI - when I test the application, I DO have the customer information appear as a new customer with all the fields completed except for the tax id thing (I think).. therefore, all the information that will be required to actually process orders is in the database I assume. Yes, some of the information collected by the poAP ends up only in the application email, but that is satisfactory for processing the credit aplication, as things like references do not necessarily "have" to be databased, though thats always convenient... just thinking out loud here... :)

 

Would you reccomend installing PO2.3.3 ? Has anyone had good success with PO2.3.3 or the two contributions combined?

 

Regards, Dave


-Dave

Share this post


Link to post
Share on other sites
Hello!

 

I had the 1054 sql error, and I deleted the PWA lines in the createPOaccount.php, because I don't have it installed, thanks for the tip!

 

But now I got a problem with the application form... I filled every fields but I get an error as I submit:

 

Your Date of Birth must be in this format: MM/DD/YYYY (eg 05/21/1970)

 

I don't know where to look to correct this error. Thanks in advance!

 

The first thing I thought is why are you asking for DOB? That was one of the first things I disabled in the store configuration.

 

Unless you need the DOB for a specific reason I would suggest not even asking for it- thinking from the customers perspective. Just my .02

 

now if your selling adult toys or pron, ok :D... heh j/k


-Dave

Share this post


Link to post
Share on other sites
The first thing I thought is why are you asking for DOB? That was one of the first things I disabled in the store configuration.

 

Unless you need the DOB for a specific reason I would suggest not even asking for it- thinking from the customers perspective. Just my .02

 

now if your selling adult toys or pron, ok :D... heh j/k

 

 

Mouahaha! I had not setup this yet!! I disabled it, and now it works... Thanks again!

Share this post


Link to post
Share on other sites

insomniac2,

 

some feedback...

 

Turns out the emails were working fine without the need for the above nl2br edit after the credit class block. The message got spam filtered somhow...argh.sorry. So no need to change the current code

 

Now, when I made the change to the PWA section as you suggested, a very nasty result occured crashing the store... I mean boom. I undid the changes and things came back undamaged. The error message was first just a 404 page not found, then something to the effect of unable to conncect to the sql db...line 20.... on a refresh. Sorry, I did not copy the error message.

 

I would suggest to others NOT make that edit without further testing first.

 

Oh, one other note: The data entered into the "Company Type" field is not being parsed to the confirmation emails sent to the owner and customer. Minor detail.

 

In catalog/createPOaccount.php

 

Company Type :  ' . $companytype . '

 

should be corrected to:

 

Company Type :  ' . $company_type . '

 

Please correct me if I am wrong.

 

I appreciate the help. I'm going to take a look at PO2.3.3 now

 

Dave


-Dave

Share this post


Link to post
Share on other sites

Also the $country is not working. It show the country_id instead of the name.

 

You have to make sure you have .. or add the tep_get_country_name function:

 

if it's not in your includes/functions/general here it is below:

 

////

// Alias function to tep_get_countries()

function tep_get_country_name($country_id) {

$country_array = tep_get_countries($country_id);

 

return $country_array['countries_name'];

}

 

 

Now in createPOaccount.php just above this:

 

tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

ADD: $country_name = tep_get_country_name($country);

 

 

Then in the language file switch

Country : ' . $country . '

 

to

 

Country : ' . $country_name . '

 

 

And instead of having all the variables buried in the language file I would sooner have them directly in the main file. Their is a good mod called:

 

Automatic Notify Admin Of New Account v1.05

 

I have it working in the createPOaccount file .. which I renamed to business_account.php for a wider scope .. not just for PO etc.

The code is much cleaner and easier to work with right in the main file.

 

but anyway here is an example of the code in my file for reference:

 

// BEGIN Automatic Notify Admin Of New Account v1.05

$country_name = tep_get_country_name($country);

 

if (EMAIL_USE_HTML == 'false' ) {

$admin_email_text =

str_pad(EMAIL_CLIENT_ID, 20) . $customer_id . "\n" .

str_pad(EMAIL_CLIENT_ACCNT, 20) . $account . "\n" .

str_pad(EMAIL_CLIENT_NAME, 20) . $firstname . ' ' . $lastname . "\n" .

str_pad(EMAIL_CLIENT_MAIL, 20) . $email_address . "\n" .

str_pad(EMAIL_CLIENT_PHONE, 20) . $telephone . "\n" .

str_pad(EMAIL_CLIENT_MOBILE_PHONE, 20) . $cellphone . "\n" .

str_pad(EMAIL_CLIENT_FAX, 20) . $fax . "\n" .

str_pad(EMAIL_CLIENT_ADDRESS, 20) . $street_address . "\n" .

str_pad(EMAIL_CLIENT_SUBURB, 20) . $suburb . "\n" .

str_pad(EMAIL_CLIENT_CITY, 20) . $city . "\n" .

str_pad(EMAIL_CLIENT_STATE, 20) . $state . "\n" .

str_pad(EMAIL_CLIENT_COUNTRY, 20) . $country_name . "\n" .

str_pad(EMAIL_CLIENT_ZIP, 20) . $postcode . "\n";

} else {

$admin_email_text =

'<table border="0" width="100%" id="table1">' .

'<tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_ID . '</b></td><td width="80%">' . $customer_id . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_ACCNT . '</b></td><td width="80%">' . $account . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_NAME . '</b></td><td width="80%">' . $firstname . ' ' . $lastname . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_MAIL . '</b></td><td width="80%"><a href="mailto:' . $email_address . '">' . $email_address . "</a></td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_PHONE . '</b></td><td width="80%">' . $telephone . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_MOBILE_PHONE . '</b></td><td width="80%">' . $cellphone . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_FAX . '</b></td><td width="80%">' . $fax . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_ADDRESS . '</b></td><td width="80%">' . $street_address . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_SUBURB . '</b></td><td width="80%">' . $suburb . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_CITY . '</b></td><td width="80%">' . $city . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_STATE . '</b></td><td width="80%">' . $state . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_COUNTRY . '</b></td><td width="80%">' . $country_name . "</td>" .

'</tr><tr>' .

'<td width="20%"><b>' . EMAIL_CLIENT_ZIP . '</b></td><td width="80%">' . $postcode . "</td>" .

'</tr>' .

'</table>';

}

// END Automatic Notify Admin Of New Account v1.05

 

Of course some of the variables above are specific to my custom fields and won't work for anyone .. so only use as an example.

Share this post


Link to post
Share on other sites
Also the $country is not working. It show the country_id instead of the name.

 

You have to make sure you have .. or add the tep_get_country_name function:

 

if it's not in your includes/functions/general here it is below:

 

////

// Alias function to tep_get_countries()

function tep_get_country_name($country_id) {

$country_array = tep_get_countries($country_id);

 

return $country_array['countries_name'];

}

Now in createPOaccount.php just above this:

 

tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

ADD: $country_name = tep_get_country_name($country);

Then in the language file switch

Country : ' . $country . '

 

to

 

Country : ' . $country_name . '

 

When I did this the result is a "blank" entry on the email. Can you double check the code please?

 

Thank you


-Dave

Share this post


Link to post
Share on other sites

Just noticed that emails being sent by this addon contain the field name properly, but is now not including the data. So emails arrive like

Company :
Tax ID #:
Address :
City :
State :

instead of

Company : Foo Co.
Tax ID #: 123456789
Address : 123 ABC
City : Mytown
State : TX

 

Could someone look at the code and tell me what may be the issue?

EMAIL_TEXT2 is the block not including the $data

 

/catalog/createPOaccount.php

<?php
/*
$Id: createPOaccount.php,v 1.65 2003/06/09 23:03:54 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
// needs to be included earlier to set the success message in the messageStack
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATEPOACCOUNT);
$process = false;
if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
$process = true;
if (ACCOUNT_GENDER == 'true') {
 if (isset($_POST['gender'])) {
 $gender = tep_db_prepare_input($_POST['gender']);
 } else {
 $gender = false;
 }
}
// BOF Separate Pricing Per Customer, added: field for tax id number
if (ACCOUNT_COMPANY == 'true') {
$company = tep_db_prepare_input($_POST['company']);
$company = ucwords(strtolower($company)); // Capitalize First Letter MOD 9/5/2007
$company_tax_id = tep_db_prepare_input($_POST['company_tax_id']);
}
// EOF Separate Pricing Per Customer, added: field for tax id number
$creditrequest = tep_db_prepare_input($_POST['creditrequest']);
$street_address = tep_db_prepare_input($_POST['street_address']);
$street_address = ucwords(strtolower($street_address)); // Capitalize First Letter MOD 9/5/2007
$city = tep_db_prepare_input($_POST['city']);
$city = ucwords(strtolower($city)); // Capitalize First Letter MOD 9/5/2007


if (ACCOUNT_STATE == 'true') {
 $state = tep_db_prepare_input($_POST['state']);
 if (isset($_POST['zone_id'])) {
 $zone_id = tep_db_prepare_input($_POST['zone_id']);
 } else {
 $zone_id = false;
 }
}
$postcode = tep_db_prepare_input($_POST['postcode']);
$firstname = tep_db_prepare_input($_POST['firstname']);
$firstname = ucwords(strtolower($firstname)); // Capitalize First Letter MOD 9/5/2007
$lastname = tep_db_prepare_input($_POST['lastname']);
$lastname = ucwords(strtolower($lastname)); // Capitalize First Letter MOD 9/5/2007
$email_address = tep_db_prepare_input($_POST['email_address']);
$country = tep_db_prepare_input($_POST['country']);
$telephone = tep_db_prepare_input($_POST['telephone']);
$fax = tep_db_prepare_input($_POST['fax']);
$time_in_business = tep_db_prepare_input($_POST['time_in_business']);
$company_type = tep_db_prepare_input($_POST['company_type']);
$number_of_employees = tep_db_prepare_input($_POST['number_of_employees']);
$credit_ref1 = tep_db_prepare_input($_POST['credit_ref1']);
$credit_ref1address = tep_db_prepare_input($_POST['credit_ref1address']);
$credit_ref1city = tep_db_prepare_input($_POST['credit_ref1city']);
$credit_ref1state = tep_db_prepare_input($_POST['credit_ref1state']);
$credit_ref1phone = tep_db_prepare_input($_POST['credit_ref1phone']);
$credit_ref1fax = tep_db_prepare_input($_POST['credit_ref1fax']);
$credit_ref2 = tep_db_prepare_input($_POST['credit_ref2']);
$credit_ref2address = tep_db_prepare_input($_POST['credit_ref2address']);
$credit_ref2city = tep_db_prepare_input($_POST['credit_ref2city']);
$credit_ref2state = tep_db_prepare_input($_POST['credit_ref2state']);
$credit_ref2phone = tep_db_prepare_input($_POST['credit_ref2phone']);
$credit_ref2fax = tep_db_prepare_input($_POST['credit_ref2fax']);
$credit_ref3 = tep_db_prepare_input($_POST['credit_ref3']);
$credit_ref3address = tep_db_prepare_input($_POST['credit_ref3address']);
$credit_ref3city = tep_db_prepare_input($_POST['credit_ref3city']);
$credit_ref3state = tep_db_prepare_input($_POST['credit_ref3state']);
$credit_ref3phone = tep_db_prepare_input($_POST['credit_ref3phone']);
$credit_ref3fax = tep_db_prepare_input($_POST['credit_ref3fax']);
$contacttelephone = tep_db_prepare_input($_POST['contacttelephone']);

if (isset($_POST['newsletter'])) {
 $newsletter = tep_db_prepare_input($_POST['newsletter']);
} else {
 $newsletter = false;
}
$password = tep_db_prepare_input($_POST['password']);
$confirmation = tep_db_prepare_input($_POST['confirmation']);
$error = false;
if (ACCOUNT_GENDER == 'true') {
 if ( ($gender != 'm') && ($gender != 'f') ) {
 $error = true;
 $messageStack->add('create_account', ENTRY_GENDER_ERROR);
 }
}
if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
 $error = true;
 $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
}
if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
 $error = true;
 $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
}
if (ACCOUNT_DOB == 'true') {
 if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {
 $error = true;
 $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
 }
}
if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
 $error = true;
 $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
} elseif (tep_validate_email($email_address) == false) {
 $error = true;
 $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
} else {
 $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
 $check_email = tep_db_fetch_array($check_email_query);
if ($check_email['total'] > 0)
{ //PWA delete account , purchased_without_account
 $get_customer_info = tep_db_query("select customers_id, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
$customer_info = tep_db_fetch_array($get_customer_info);
$customer_id = $customer_info['customers_id'];
$customer_email_address = $customer_info['customers_email_address'];
//$customer_pwa = $customer_info['purchased_without_account'];
if ($customer_pwa !='1')
{
 $error = true;
 $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
 } else {
tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . $customer_id . "'");
}
 }
// END
}
if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
 $error = true;
 $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
}
if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
 $error = true;
 $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
}
if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
 $error = true;
 $messageStack->add('create_account', ENTRY_CITY_ERROR);
}
if (is_numeric($country) == false) {
 $error = true;
 $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
}
if (ACCOUNT_STATE == 'true') {
 $zone_id = 0;
 $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
 $check = tep_db_fetch_array($check_query);
 $entry_state_has_zones = ($check['total'] > 0);
 if ($entry_state_has_zones == true) {
 $zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')");
 if (tep_db_num_rows($zone_query) == 1) {
	 $zone = tep_db_fetch_array($zone_query);
	 $zone_id = $zone['zone_id'];
 } else {
	 $error = true;
	 $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
 }
 } else {
 if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
	 $error = true;
	 $messageStack->add('create_account', ENTRY_STATE_ERROR);
 }
 }
}
if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
 $error = true;
 $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
}

if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH) {
 $error = true;
 $messageStack->add('create_account', ENTRY_PASSWORD_ERROR);
} elseif ($password != $confirmation) {
 $error = true;
 $messageStack->add('create_account', ENTRY_PASSWORD_ERROR_NOT_MATCHING);
}
if ($error == false) {
 $sql_data_array = array('customers_firstname' => $firstname,
						 'customers_lastname' => $lastname,
						 'customers_email_address' => $email_address,
						 'customers_telephone' => $telephone,
						 'customers_fax' => $fax,
						 'customers_newsletter' => $newsletter,
						 'customers_password' => tep_encrypt_password($password));
 if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
 if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);
// BOF Separate Pricing Per Customer
 // if you would like to have an alert in the admin section when either a company name has been entered in
 // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
 // setting: only alert when a tax_id number has been given
// if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) {
if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) {
 $sql_data_array['customers_group_ra'] = '1';
 }
// EOF Separate Pricing Per Customer
 tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);
 $customer_id = tep_db_insert_id();
 $sql_data_array = array('customers_id' => $customer_id,
						 'entry_firstname' => $firstname,
						 'entry_lastname' => $lastname,
						 'entry_street_address' => $street_address,
						 'entry_postcode' => $postcode,
						 'entry_city' => $city,
						 'entry_country_id' => $country);
 if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
// BOF adapted for Separate Pricing Per Customer
if (ACCOUNT_COMPANY == 'true') {
 $sql_data_array['entry_company'] = $company;
 $sql_data_array['entry_company_tax_id'] = $company_tax_id;
 }
// EOF adapted for Separate Pricing Per Customer
 if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
 if (ACCOUNT_STATE == 'true') {
 if ($zone_id > 0) {
	 $sql_data_array['entry_zone_id'] = $zone_id;
	 $sql_data_array['entry_state'] = '';
 } else {
	 $sql_data_array['entry_zone_id'] = '0';
	 $sql_data_array['entry_state'] = $state;
 }
 }
 tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
 $address_id = tep_db_insert_id();
 tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
 tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");
 if (SESSION_RECREATE == 'True') {
 tep_session_recreate();
 }
 $customer_first_name = $firstname;
 $customer_default_address_id = $address_id;
 $customer_country_id = $country;
 $customer_zone_id = $zone_id;
 tep_session_register('customer_id');
 tep_session_register('customer_first_name');
 tep_session_register('customer_default_address_id');
 tep_session_register('customer_country_id');
 tep_session_register('customer_zone_id');
// restore cart contents
 $cart->restore_contents();
// build the message content
 $name = $firstname . ' ' . $lastname;
 if (ACCOUNT_GENDER == 'true') {
	 if ($gender == 'm') {
	 $email_text = sprintf(EMAIL_GREET_MR, $lastname);
	 } else {
	 $email_text = sprintf(EMAIL_GREET_MS, $lastname);
	 }
 } else {
 $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
 }
//	 $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
 $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_USERNAME . EMAIL_PASSWORD . EMAIL_WARNING;

$country_name = tep_get_country_name($country); // modified by BFD to show country name rather than country ID
 tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
//	 tep_mail($name, $email_address, EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // <-replcement
// BOF Separate Pricing Per Customer: alert shop owner of account created by a company
 // if you would like to have an email when either a company name has been entered in
 // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
 // setting: only email when a tax_id number has been given
// if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) {
 if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) {
 $alert_email_text = "Please note that " . $firstname . " " . $lastname . " of the company: " . $company . " has created an account.";
 tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Company account created', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }
// EOF Separate Pricing Per Customer: alert shop owner of account created by a company

 $email_text2 = EMAIL_TEXT2;
 tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_text2, $name, $email_address);
 tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text2, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 tep_redirect(tep_href_link(FILENAME_CREATE_POACCOUNT_SUCCESS, '', 'SSL'));
}
}

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATEPOACCOUNT, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
/*** Begin Header Tags SEO ***/
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<?php
}
/*** End Header Tags SEO ***/
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php require('includes/form_check.js.php'); ?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('create_account', tep_href_link(FILENAME_CREATEPOACCOUNT, '', 'SSL'), 'post', 'onsubmit="return check_form(create_account);"') . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
 <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	 <tr>
	 <td class="pageHeading"><h1><?php echo HEADING_TITLE; ?></h1></td>
	 <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	 </tr>
 </table></td>
 </tr>
 <tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr>
 <td class="smallText"><br><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></td>
 </tr>
 <tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
<?php
if ($messageStack->size('create_account') > 0) {
?>
 <tr>
 <td><?php echo $messageStack->output('create_account'); ?></td>
 </tr>
 <tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
<?php
}
?>
 <tr>
 <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	 <tr>		
	 <td class="main"><b><?php echo CATEGORY_COMPANY; ?></b></td>				
	 <td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>
	 </tr>
 </table></td>
 </tr>
 <tr>
 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	 <tr class="infoBoxContents">
	 <td><table border="0" cellspacing="2" cellpadding="2">
		 <tr>
		 <td class="main"><?php echo ENTRY_COMPANY; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('company') . ' ' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>
		 </tr>
<!-- BOF Separate Pricing Per Customer: field for tax id number -->
		 <tr>
		 <td class="main"><?php echo ENTRY_COMPANY_TAX_ID; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('company_tax_id') . ' ' . (tep_not_null(ENTRY_COMPANY_TAX_ID_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TAX_ID_TEXT . '</span>': ''); ?></td>
		 </tr>
<!-- EOF Separate Pricing Per Customer: field for tax id number -->
		 <tr>
		 <td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('street_address') . ' ' . (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CITY; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('city') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
		 </tr>
<?php
if (ACCOUNT_STATE == 'true') {
?>
		 <tr>
		 <td class="main"><?php echo ENTRY_STATE; ?></td>
		 <td class="main">
<?php
if ($process == true) {
 if ($entry_state_has_zones == true) {
 $zones_array = array();
 $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");
 while ($zones_values = tep_db_fetch_array($zones_query)) {
	 $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
 }
 echo tep_draw_pull_down_menu('state', $zones_array);
 } else {
 echo tep_draw_input_field('state');
 }
} else {
 echo tep_draw_input_field('state');
}
if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;
?>
		 </td>
		 </tr>
<?php
}
?>
		 <tr>
		 <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('postcode') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
		 <td class="main"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('fax') . ' ' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REQUEST; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('creditrequest') . ' ' . (tep_not_null(ENTRY_CREDIT_REQUEST_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REQUEST_TEXT . '</span>': ''); ?></td>			
		 </td>			
		 <tr>
		 <td class="main"><?php echo ENTRY_TIME_IN_BUSINESS; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('time_in_business') . ' ' . (tep_not_null(ENTRY_TIME_IN_BUSINESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_TIME_IN_BUSINESS_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_COMPANY_TYPE; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('company_type') . ' ' . (tep_not_null(ENTRY_COMPANY_TYPE_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TYPE_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_NUMBER_OF_EMPLOYESS; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('number_of_employees') . ' ' . (tep_not_null(ENTRY_NUMBER_OF_EMPLOYESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_NUMBER_OF_EMPLOYESS_TEXT . '</span>': ''); ?></td>
		 </tr>			
		 </table></td>
	 </tr>
 </table></td>
 </tr>
 <tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr>
 <td class="main"><b><?php echo ENTRY_CREDIT_REF; ?></b></td>
 </tr>
 <tr>
 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	 <tr class="infoBoxContents">
	 <td><table border="0" cellspacing="2" cellpadding="2">
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF1; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref1') . ' ' . (tep_not_null(ENTRY_CREDIT_REF1_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF1_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF1ADDRESS; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref1address') . ' ' . (tep_not_null(ENTRY_CREDIT_REF1ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF1ADDRESS_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF1CITY; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref1city') . ' ' . (tep_not_null(ENTRY_CREDIT_REF1CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF1CITY_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF1STATE; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref1state') . ' ' . (tep_not_null(ENTRY_CREDIT_REF1STATE_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF1STATE_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF1PHONE; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref1phone') . ' ' . (tep_not_null(ENTRY_CREDIT_REF1PHONE_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF1PHONE_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF1FAX; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref1fax') . ' ' . (tep_not_null(ENTRY_CREDIT_REF1FAX_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF1FAX_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td></td>
		 <td></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF2; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref2') . ' ' . (tep_not_null(ENTRY_CREDIT_REF2_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF2_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF2ADDRESS; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref2address') . ' ' . (tep_not_null(ENTRY_CREDIT_REF2ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF2ADDRESS_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF2CITY; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref2city') . ' ' . (tep_not_null(ENTRY_CREDIT_REF2CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF2CITY_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF2STATE; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref2state') . ' ' . (tep_not_null(ENTRY_CREDIT_REF2STATE_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF2STATE_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF2PHONE; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref2phone') . ' ' . (tep_not_null(ENTRY_CREDIT_REF2PHONE_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF2PHONE_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF2FAX; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref2fax') . ' ' . (tep_not_null(ENTRY_CREDIT_REF2FAX_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF2FAX_TEXT . '</span>': ''); ?></td>			
		 </tr>
		 <tr>
		 <td></td>
		 <td></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF3; ?></td>			
		 <td class="main"><?php echo tep_draw_input_field('credit_ref3') . ' ' . (tep_not_null(ENTRY_CREDIT_REF3_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF3_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF3ADDRESS; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref3address') . ' ' . (tep_not_null(ENTRY_CREDIT_REF3ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF3ADDRESS_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF3CITY; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref3city') . ' ' . (tep_not_null(ENTRY_CREDIT_REF3CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF3CITY_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF3STATE; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref3state') . ' ' . (tep_not_null(ENTRY_CREDIT_REF3STATE_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF3STATE_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_CREDIT_REF3PHONE; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref3phone') . ' ' . (tep_not_null(ENTRY_CREDIT_REF3PHONE_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF3PHONE_TEXT . '</span>': ''); ?></td>
		 <td class="main"><?php echo '     ' . ENTRY_CREDIT_REF3FAX; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('credit_ref3fax') . ' ' . (tep_not_null(ENTRY_CREDIT_REF3FAX_TEXT) ? '<span class="inputRequirement">' . ENTRY_CREDIT_REF3FAX_TEXT . '</span>': ''); ?></td>			
		 </tr>
		 </table></td>
	 </tr>
 </table></td>
 </tr>
 <tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr>
 <td class="main"><b><?php echo ENTRY_ACCOUNT_PAYABLE; ?></b></td>
 </tr>
 <tr>
 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	 <tr class="infoBoxContents">
	 <td><table border="0" cellspacing="2" cellpadding="2">
		 <tr>
		 <td class="main"><?php echo ENTRY_GENDER; ?></td>
		 <td class="main"><?php echo tep_draw_radio_field('gender', 'm') . '  ' . MALE . '  ' . tep_draw_radio_field('gender', 'f') . '  ' . FEMALE . ' ' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_FIRST_NAME; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('firstname') . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_LAST_NAME; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('lastname') . ' ' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('email_address') . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
		 <td class="main"><?php echo tep_draw_input_field('contacttelephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
		 </tr>
	 </table></td>
	 </tr>
 </table></td>
 </tr>	
 <tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr>
 <td class="main"><b><?php echo CATEGORY_OPTIONS; ?></b></td>
 </tr>
 <tr>
 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	 <tr class="infoBoxContents">
	 <td><table border="0" cellspacing="2" cellpadding="2">
		 <tr>
		 <td class="main"><?php echo ENTRY_NEWSLETTER; ?></td>
		 <td class="main"><?php echo tep_draw_checkbox_field('newsletter', '1') . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>
		 </tr>
	 </table></td>
	 </tr>
 </table></td>
 </tr>
 <tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr>
 <td class="main"><b><?php echo CATEGORY_POACCOUNT_PASSWORD; ?></b></td>
 </tr>
 <tr>
 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	 <tr class="infoBoxContents">
	 <td><table border="0" cellspacing="2" cellpadding="2">
		 <tr>
		 <td class="main"><?php echo ENTRY_PASSWORD; ?></td>
		 <td class="main"><?php echo tep_draw_password_field('password') . ' ' . (tep_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_TEXT . '</span>': ''); ?></td>
		 </tr>
		 <tr>
		 <td class="main"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>
		 <td class="main"><?php echo tep_draw_password_field('confirmation') . ' ' . (tep_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>': ''); ?></td>
		 </tr>
	 </table></td>
	 </tr>
 </table></td>
 </tr>
 <tr>
	 <td class="main"><?php echo ENTRY_CREDIT_TERMS_TEXT ?></td>		
 </tr>						
 <tr>
 <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr>
 <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	 <tr class="infoBoxContents">
	 <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		 <tr>
		 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>			
		 <td><?php echo tep_image_submit('button_submit.gif', IMAGE_BUTTON_SUBMIT); ?></td>
		 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		 </tr>
	 </table></td>
	 </tr>
 </table></td>
 </tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php include(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php include(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

then /catalog/languages/english/createPOaccount.php

<?php
/*
$Id: createPOaccount.php,v 1.11 2003/07/05 13:58:31 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
define('NAVBAR_TITLE', 'Purchase Order Account Application');
define('HEADING_TITLE', 'Purchase Order Account Application');
define('TEXT_ORIGIN_LOGIN', '<font color="#FF0000"><small><b>NOTE:</b></font></small> If you already have an account with us, please login at the <a href="%s"><u>login page</u></a>.');
define('EMAIL_SUBJECT', 'PO Account Application');
define('EMAIL_GREET_MR', 'Dear Mr. %s,' . "\n\n");
define('EMAIL_GREET_MS', 'Dear Ms. %s,' . "\n\n");
define('EMAIL_GREET_NONE', 'Dear %s,' . "\n\n");
define('EMAIL_WELCOME', 'Welcome to <b>' . STORE_NAME . '</b>. Thank you for creating your Account!' . "\n\n");
define('EMAIL_TEXT', 'Congratulations! Your purchase order account application has been successfully submitted for review! We will contact you within 1 business day to update you on your purchase order account status. <strong>To insure account setup accuracy and to expedite the processing of your order, you can also FAX a copy of your Purchase Order to xxx-xxx-xxxx.</strong>' . "\n\n" . 'If you have any questions about your account, our products or our website, please <a href="' . tep_href_link(FILENAME_CONTACT_US) . '"><u>contact us</u></a> or you may speak with a Customer Support representative by calling xxx-xxx-xxxx Mon-Sat 8am to 6pm CST.' . "\n\n" . 'We are sending you a copy of your Purchase Order Account Application to review and retain for your records. If you find errors in your application please reply to this email so we can adjust your application accordingly. We look forward to assisting you in the near future.' . "\n\n");
define('EMAIL_CONTACT', 'Visit <a title="www.xxxxxxx.com"href="https://www.xxxxxxxxx.com/login.php"><u>https://www.xxxxxxxxx.com/login</u></a> to login to your Account' . "\n\n" . ' *** PLEASE SAVE OR PRINT THIS EMAIL FOR FUTURE REFERENCE *** ' . "\n\n");
define('EMAIL_USERNAME', 'Your username is: ' . stripslashes($_POST['email_address']) . "\n"); // add email
define('EMAIL_PASSWORD', 'Your password is: ' . stripslashes($_POST['password']) . "\n\n\n"); //add pw
define('EMAIL_WARNING', '<small><b>Note:</b> We respect your privacy. You are receiving this email only if you created an account at www.pavepatch.com OR you signed up for our quarterly newsletter. If you did not OPT-IN to our mailing list by checking the SUBSCRIBE TO NEWSLETTER option, you will NOT receive further emails after your order is fulfilled. You can change your subscription settings at any time by logging in to <a href="https://www.pavepatch.com/login.php" title="Login to My Account">"My Account"</a>.</small>' . "\n\n" . '<small>If you did not create an account or signup to be a member, please send an email to the store owner at: ' . STORE_OWNER_EMAIL_ADDRESS . '.</small>' . "\n");

// replaced below: Country : ' . $country . '
define('EMAIL_TEXT2', '
Application For Purchase Order Credit Account with
xxx xxxxxxxxxxxxxx xxxxxxxxxxxxxx
www.xxxxxxxxx.com
1234 xxxxxxxxxxxx
City, TX xxxxxx
USA
<b>Applicant Information</b>
Company : ' . $company . '
Tax ID #: ' . $company_tax_id . '
Address : ' . $street_address . '
City : ' . $city . '
State : ' . $state . '
Zip Code : ' . $postcode . '
Country : ' . $country_name . '
Phone Number : ' . $telephone . '
Fax : ' . $fax . '
Credit Amount Requested : $' . $creditrequest . '
Company Type : ' . $company_type . '
Length of Time in Business : ' . $time_in_business .'
Number of Employees : ' . $number_of_employees . '
<b> Credit References </b>
Credit Reference 1 : ' . $credit_ref1 . '
Address : ' . $credit_ref1address . '
City : ' . $credit_ref1city . '
State : ' . $credit_ref1state . '
Phone : ' . $credit_ref1phone . '
Fax : ' . $credit_ref1fax . '
Credit Reference 2 : ' . $credit_ref2 . '
Address : ' . $credit_ref2address . '
City : ' . $credit_ref2city . '
State : ' . $credit_ref2state . '
Phone : ' . $credit_ref2phone . '
Fax : ' . $credit_ref2fax . '
Bank Name : ' . $credit_ref3 . '
Account : ' . $credit_ref3address . '
City : ' . $credit_ref3city . '
State : ' . $credit_ref3state . '
Phone : ' . $credit_ref3phone . '
Fax : ' . $credit_ref3fax . '
<b>Accounts Payable Contact</b>
Name : ' . $firstname . ' ' . $lastname . '
Email Address : ' . $email_address . '
Phone Number : ' . $contacttelephone . '
<b>Terms: NET 30</b>
<b>A FINANCE CHARGE</b> of 1.5% per month (APR 18%) will be added to all outstanding
amounts after 30 days from date of invoice.
If this account is referred to a third party collection agency all associated
collection cost will be paid by you, the customer.
Authorization is granted to make credit inquires with the references listed.
<b>I HAVE READ THE ABOVE AND AGREE TO COMPLY WITH THE TERMS FOR PAYMENT AND OTHER
STATED CONDITIONS AND ACKNOWLEDGE RECEIPT OF A COPY OF THIS APPLICATION.</b>
Authorized Signature: ' . $firstname . ' ' . $lastname . '
');
?>

 

where xxxxx's are edited for privacy. Thank you for any help you can offer.


-Dave

Share this post


Link to post
Share on other sites

yes it does, thank you Burt. - Not exactly sure how to sort it but I've seen plenty of threads on the topic and will give it a look. Thank you for the heads up. After posting I browsed this thread further, and my initial thought is to move the email body and data fields from the language file to within the main file as an earlier post suggests, but for different reasons. Not sure if that will do it but will give it a try. This shop is 2.2rc2a on php 5.2.17 if that helps point to an obvious source of the issue or solution. Thanks! @@burt


-Dave

Share this post


Link to post
Share on other sites

no, still at 5.2.17. But the last time I had someone use this PO module was when I was on a previous php3.x server :) I made the switch to 5.2.17 back a year or two ago, but never noticed this minor issue during all the other debugging. Going to refresh up on register globals now. I am my own host if this is a server config issue... Thx @@burt


-Dave

Share this post


Link to post
Share on other sites

@@burt

Again thank you for the direction. I believe I've sorted it by restructuring the code in language file, like

 

define('EMAIL_TEXT2', '
Application For Purchase Order Credit Account with

<b>Applicant Information</b>
Company : ' . stripslashes($_POST['company']) . '
Tax ID #: ' . stripslashes($_POST['company_tax_id']) . '
Address : ' . stripslashes($_POST['street_address']) . '
City : ' . stripslashes($_POST['city']) . '
State : ' . stripslashes($_POST['state']) . '
Zip Code : ' . stripslashes($_POST['postcode']) . '
Country : ' . stripslashes($_POST['country_name']) . '
Phone Number : ' . stripslashes($_POST['telephone']) . '
Fax : ' . stripslashes($_POST['fax']) . '
Credit Amount Requested : $' . stripslashes($_POST['creditrequest']) . '
Company Type : ' . stripslashes($_POST['company_type']) . '
Length of Time in Business : ' . stripslashes($_POST['time_in_business']) . '
Number of Employees : ' . stripslashes($_POST['number_of_employees']) . '
<b> Credit References </b>
Credit Reference 1 : ' . stripslashes($_POST['credit_ref1']) . '
Address : ' . stripslashes($_POST['credit_ref1address']) . '
City : ' . stripslashes($_POST['credit_ref1city']) . '
State : ' . stripslashes($_POST['credit_ref1state']) . '
Phone : ' . stripslashes($_POST['credit_ref1phone']) . '
Fax : ' . stripslashes($_POST['credit_ref1fax']) . '
Credit Reference 2 : ' . stripslashes($_POST['credit_ref2']) . '
Address : ' . stripslashes($_POST['credit_ref2address']) . '
City : ' . stripslashes($_POST['credit_ref2city']) . '
State : ' . stripslashes($_POST['credit_ref2state']) . '
Phone : ' . stripslashes($_POST['credit_ref2phone']) . '
Fax : ' . stripslashes($_POST['credit_ref2fax']) . '
Bank Name : ' . stripslashes($_POST['credit_ref3']) . '
Account : ' . stripslashes($_POST['credit_ref3address']) . '
City : ' . stripslashes($_POST['credit_ref3city']) . '
State : ' . stripslashes($_POST['credit_ref3state']) . '
Phone : ' . stripslashes($_POST['credit_ref3phone']) . '
Fax : ' . stripslashes($_POST['credit_ref3fax']) . '
<b>Accounts Payable Contact</b>
Name : ' . stripslashes($_POST['firstname']) . ' ' . stripslashes($_POST['lastname']) . '
Email Address : ' . stripslashes($_POST['email_address']) . '
Phone Number : ' . stripslashes($_POST['contacttelephone']) . '
<b>Terms: NET 30</b>
<b>A FINANCE CHARGE</b> of 1.5% per month (APR 18%) will be added to all outstanding
amounts after 30 days from date of invoice.
If this account is referred to a third party collection agency all associated
collection cost will be paid by you, the customer.
Authorization is granted to make credit inquires with the references listed.
<b>I HAVE READ THE ABOVE AND AGREE TO COMPLY WITH THE TERMS FOR PAYMENT AND OTHER
STATED CONDITIONS AND ACKNOWLEDGE RECEIPT OF A COPY OF THIS APPLICATION.</b>
Authorized Signature: ' . stripslashes($_POST['firstname']) . ' ' . stripslashes($_POST['lastname']) . '
');

 

Seems to work perfectly now.

 

One question - Are the stripslashes needed? I wasn't sure

 

Thanks!


-Dave

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×