[ic] Order detail missing

Guy Soudant interchange-users@lists.akopia.com
Sun Jun 17 06:36:01 2001


Hi,

I have tested my changed Log_transactions, and it works on my machine. 
Note that this does not mean that it works on your machine. Another thing 
is that I had to restart the IC daemon before it worked.

There is still some obsolete code, but I'll leave that to the 
professionals at RedHat and the readers of this list.

I hope this is usefull to some who face this problem. You can comment out 
any lines which you do not need.

START OF LOG_TRANSACTIONS

#### begin [value mv_order_number] #####
[tmp transaction_record]

	[loop list="transactions orderline userdb"]
	Place table [loop-code] in transaction mode.
	[flag type=transaction table="[loop-code]"]
	[/loop]
[if variable DECREMENT_INVENTORY]
	Will decrement inventory, place table inventory in transaction 
mode.
	[flag type=transaction table="inventory"]
[/if]

[if type=explicit compare=`
		return 1 if ! $Session->{logged_in} or $Session->
{login_table} ne 'userdb';
		return 0;
		`]
	[if session logged_in]
		[userdb function=logout clear=0 clear_cart=0]
	[/if]
	[tmp auto_create]1[/tmp]
	[if type=explicit compare=|
		[userdb
			function=new_account
				assign_username=1
					password='[value zip]'
						verify='[value zip]'
		]
		|]
	Auto-created user [data session username].
	[else]
	Auto-create of user failed.
	[perl] die errmsg("Auto-create of user failed."); [/perl]
	[/else]
	[/if]
[/if]

[comment][perl] Log("Starting report."); [/perl][/comment]

[try]

[seti total_cost][total-cost noformat=1][/seti]
Add main order [value mv_order_number] to transactions:
[import table=transactions type=LINE continue=NOTES]
code: [value mv_order_number]
store_id: __STORE_ID__
order_number: [value mv_order_number]
session: [data session id]
username: [data session username]
shipmode: [value mv_shipmode] ([shipping-desc])
shipping: [shipping noformat=1]
nitems: [nitems]
subtotal: [subtotal noformat=1]
handling: [handling noformat=1]
salestax: [salestax noformat=1]
total_cost: [scratch total_cost]
fname: [value filter=strip name=fname]
lname: [value filter=strip name=lname]
company: [value filter=strip name=company]
address1: [value filter=strip name=address1]
address2: [value filter=strip name=address2]
city: [value filter=strip name=city]
state: [value name=state filter="strip uc"]
zip: [value name=zip filter=word]
country: [value country]
email: [value name=email filter=strip]
phone_day: [value filter=strip name=phone_day]
phone_night: [value filter=strip name=phone_night]
b_company: [value filter=strip name=b_company]
b_fname: [value filter=strip name=b_fname]
b_lname: [value filter=strip name=b_lname]
b_address1: [value filter="strip mac" name=b_address1]
b_address2: [value filter="strip mac" name=b_address2]
b_city: [value filter=strip name=b_city]
b_state: [value filter=strip name=b_state]
b_zip: [value filter=strip name=b_zip]
b_country: [value filter=strip name=b_country]
b_phone: [value filter=strip name=b_phone]
payment_method: [value mv_payment]
payment_mode: [data session payment_mode]
order_id: [data session payment_id]
order_date: [value name=order_date set="[tag time]%Y%m%d %H:%M:%S[/tag]"]
order_ymd: [value name=order_date set="[tag time]%Y%m%d[/tag]"]
order_wday: [value name=order_wday set="[tag time]%u[/tag]"]
status: pending
deleted: 0
archived: 0
complete: 0
comments: [value filter=mac name=gift_note]
affiliate: [data session source]
campaign: [value campaign]
parent: __PARENT__
po_number: [value filter=strip name=po_number] 
[/import]

[if value mv_payment_mode eq purchase_order]
set credit_limit: [seti credit_limit][data
		table=userdb
		col=credit_limit
		key="[data session username]"
		value="-[scratch total_cost]"
		increment=1
	[/seti][/if]

[comment]Past transactions entry.[/comment]

[item-list]Added [item-code] to orderline:
[import table=orderline type=LINE continue=NOTES]
code: [value mv_order_number]-[item-increment]
store_id: __STORE_ID__
order_number: [value mv_order_number]
session: [data session id]
username: [data session username]
shipmode: [item-modifier mv_shipmode]
sku: [item-code]
quantity: [item-quantity]
price: [item-price noformat]
subtotal: [item-subtotal noformat]
mv_mi: [item-modifier mv_mi]
mv_si: [item-modifier mv_si]
mv_mp: [item-modifier mv_mp]
##########################################################################
### Options you want to store in the transactions Db go below. Size and  #
### Color are standard. The other (scale, driver, and decals) are for me #
### personally and are still in here as an example.                      #
##########################################################################
size__MVC_FIELDMUNGE__: [item-modifier size__MVC_FIELDMUNGE__]
color: [item-modifier color]
scale: [item-modifier scale]
driver: [item-modifier driver]
decals: [item-modifier decals]
order_date: [value order_date]
affiliate: [data session source]
campaign: [value campaign]
status: pending
description: [filter mac][item-description][/filter]
[/import]

[if variable DECREMENT_INVENTORY]
Inventory of [item-code] now:
	[data
		table=inventory
		col=quantity
		key="[item-code]"
		increment=1
		value="-[item-quantity]"
	]
[/if]
[/item-list]
[/try]

[catch]
[set mv_route_failed]1[/set]
There was an error adding to the transaction log.
[/catch]

[userdb save]

[if scratch auto_create]
	Logout auto-created user: [userdb function=logout clear=0 
clear_cart=0]
[/if]

[comment][perl] Log("Past add data entry."); [/perl][/comment]

[comment]Past add data entry.[/comment]

#[comment][perl] Log("Past all transaction log."); [/perl][/comment]
[comment]Past all transaction log.[/comment]
[/tmp][perl]
	my $out = $Scratch->{transaction_record};
	$out =~ s/^\s+//mg;
	$out =~ s/\s+$//mg;
	$out =~ s/[\r\n]+/\n/;
	$out =~ s/:\n(1|yes|succe\w+|fail\w+)\n/: $1\n/g;
	return $out;
[/perl]
#### end [value mv_order_number] #####

END OF LOG_TRANSACTIONS

Regards

Guy Soudant