[ic] writing to multiple tables

Ted Baxter interchange-users@interchange.redhat.com
Tue Jan 29 16:40:01 2002


Here's the situation
I have a catalog recipients db and a notes db

Is what I want to happen is when I create a new recipient to automatically
add a note to the noted db

So far I have...


[calc]
	$CGI->{catrecipient}=1;
	$CGI->{noshow}=1;

	if($CGI->{customer}) {
		$CGI->{item_id} = $CGI->{customer};
	}
	if(! $CGI->{item_id} and $Session->{arg}) {
		$CGI->{item_id} = $CGI->{customer} = $Session->{arg};
	}
	$CGI->{customer} = $CGI->{item_id} if ! $CGI->{customer};
	return if ! $CGI->{item_id};
	if(! $CGI->{mv_data_table}) {
		$CGI->{ui_hide_key} = 0;
		$CGI->{mv_data_table} = 'catalogs';
	}
	if(! $CGI->{ui_return_to}) {
		$CGI->{ui_return_to} = join "\0",
									'__UI_BASE__/search',
									"customer=$CGI->{item_id}",
								;

	}
	if($CGI->{institut}) {
		$CGI->{intitut} = $CGI->{institut};
	}
	if($CGI->{address1}) {
		$CGI->{address1} = $CGI->{address1};
	}
	if($CGI->{address2}) {
		$CGI->{address2} = $CGI->{address2};
	}
	if($CGI->{city}) {
		$CGI->{city} = $CGI->{city};
	}
	if($CGI->{state}) {
		$CGI->{state} = $CGI->{state};
	}
	if($CGI->{country}) {
		$CGI->{country} = $CGI->{country};
	}
	if($CGI->{zip}) {
		$CGI->{zip} = $CGI->{zip};
	}
	return;
[/calc]


[set ui_class]Contacts[/set]
[seti page_title]Create new contact][/seti]
[seti page_banner]Create new contact[/seti]
[set help_name]contact.new[/set]
[set icon_name]icon_contact.gif[/set]

@_UI_STD_HEAD_@
<P>

[table-editor
	cgi=1
	table=catalogs
	ui_new_item=1
	ui_data_fields="code, name_title, fname, lname, suffix,  title, department,
areacode, phone_day, fax, email, weblinks, district, institut, address1,
address2, city, state, zip, country, b_institut,b_fname, b_lname,
b_address1, b_address2, b_city, b_state, b_zip, b_country, b_phone,
show_catalog, show_qty, show_recurring, lastchecked, catalogs, comment,
completed, updated, created, salesrep, createdby, sourcecode, accounts"
	ui_break_before="name_title, title,  address1, b_institut, show_catalog,
catalogs, comment, completed"
	ui_break_before_label="name_title=<center>Name</center>,
title=<center>Personal Details/Funding Data</center>,
address1=<center>General/Shipping Address</center>,
b_institut=<center>Billing Address (if different from ship to
address)</center>, show_catalog=<center>Showcase Catalog Info.</center>,
catalogs=<center>Specialty Catalog Inquiry</center>,
comment=<center>Comment</center>, completed=<center>User Input</center>"
	override.createdby=`$Session->{username}`
	widget.createdby=hidden_text
	override.institut=`$CGI->{institut}`
	override.address1=`$CGI->{address1}`
	override.address2=`$CGI->{address2}`
	override.city=`$CGI->{city}`
	override.state=`$CGI->{state}`
	override.country=`$CGI->{country}`
	override.zip=`$CGI->{zip}`
	override.updated=1
	widget.updated=hidden_text
	override.sourcecode="LSI"
	widget.sourcecode=hidden_text
	passed.accounts=`$Scratch->{acc}`
	widget.accounts=combo
]


@_UI_STD_FOOTER_@
<!-- page: @@MV_PAGE@@

-->

And I want to blindly add something like...

[calc]
	$CGI->{mv_data_table} = 'contactnotes';
	$CGI->{ui_new_item} = 1;
	$CGI->{override.contactno} = 'catalogs::code';
	$CGI->{override.note} = 'showcase catalog(s) has been sent to this
recipient';
	$CGI->{override.source} = 'catalogs';
	$CGI->{override.date} = '$Tag->time{%Y%B%d}';
	return;
[/calc]

Any help would be greatly appreciated

Thanks in Advanced!

Ted B.