|
10 | 10 | ||
|
11 | 11 | END FUSEDOC --->
|
12 | 12 | <cftransaction isolation="READ_COMMITTED">
|
13 |
| - <cfif compare(attributes.lname, "")> |
| 13 | + <cfif len(attributes.lname)> |
14 | 14 | <cfquery name="insert_customer_contact" datasource="#application.datasources.main#">
|
15 | 15 | INSERT INTO Emp_Contact (name, lname, emp_contact_type)
|
16 | 16 | VALUES ('#attributes.name#', '#attributes.lname#', 4)
|
17 | 17 | </cfquery>
|
18 |
| - <cfquery name="get_new_emp_id" datasource="#application.datasources.main#"> |
19 |
| - SELECT MAX(emp_id) AS emp_id |
20 |
| - FROM Emp_contact |
21 |
| - </cfquery> |
22 |
| - <cfif compare(attributes.phone, "")> |
| 18 | + <cfif len(attributes.phone)> |
23 | 19 | <cfquery name="insert_contact_phone" datasource="#application.datasources.main#">
|
24 |
| - INSERT INTO phone (phone_number, emp_id, phone_type_id) |
25 |
| - VALUES ('#attributes.phone#', #get_new_emp_id.emp_id#, 1) |
| 20 | + INSERT INTO Phone (phone_number, emp_id, phone_type_id) |
| 21 | + VALUES ('#attributes.phone#', IDENT_CURRENT('Emp_Contact'), 1) |
26 | 22 | </cfquery>
|
27 | 23 | </cfif>
|
28 |
| - <cfif compare(attributes.email, "")> |
| 24 | + <cfif len(attributes.email)> |
29 | 25 | <cfquery name="insert_contact_email" datasource="#application.datasources.main#">
|
30 |
| - INSERT INTO email (email, emp_id, email_type_id) |
31 |
| - VALUES ('#attributes.email#', #get_new_emp_id.emp_id#, 1) |
| 26 | + INSERT INTO Email (email, emp_id, email_type_id) |
| 27 | + VALUES ('#attributes.email#', IDENT_CURRENT('Emp_Contact'), 1) |
32 | 28 | </cfquery>
|
33 | 29 | </cfif>
|
34 | 30 | </cfif>
|
35 |
| - <cfquery name="insert_Customer" datasource="#application.datasources.main#"> |
| 31 | + <cfquery name="insert_customer" datasource="#application.datasources.main#"> |
36 | 32 | INSERT INTO Customer (root_code, description, billable_type_id,
|
37 | 33 | company_id<cfif len(attributes.company_address1)>, company_address1</cfif><cfif len(attributes.company_address2)>, company_address2</cfif><cfif len(attributes.company_city)>, company_city</cfif>, company_state<cfif len(attributes.company_zip)>, company_zip</cfif><cfif len(attributes.lname)>, emp_contact_id</cfif>, active_ind)
|
38 |
| - VALUES ('#new_code#', '#attributes.description#', #attributes.billable_type_id#, |
39 |
| - #attributes.company_id# <cfif len(attributes.company_address1)>, '#attributes.company_address1#'</cfif><cfif len(attributes.company_address2)>, '#attributes.company_address2#'</cfif><cfif len(attributes.company_city)>, '#attributes.company_city#'</cfif>, '#attributes.company_state#'<cfif len(attributes.company_zip)>, '#attributes.company_zip#'</cfif><cfif len(attributes.lname)>, #Get_new_emp_id.emp_id#</cfif>, 1) |
| 34 | + VALUES ('#variables.new_code#', '#attributes.description#', #attributes.billable_type_id#, |
| 35 | + #attributes.company_id# <cfif len(attributes.company_address1)>, '#attributes.company_address1#'</cfif><cfif len(attributes.company_address2)>, '#attributes.company_address2#'</cfif><cfif len(attributes.company_city)>, '#attributes.company_city#'</cfif>, '#attributes.company_state#'<cfif len(attributes.company_zip)>, '#attributes.company_zip#'</cfif><cfif len(attributes.lname)>, IDENT_CURRENT('Emp_Contact')</cfif>, 1) |
40 | 36 | </cfquery>
|
41 | 37 | <cfquery name="company_id" datasource="#application.datasources.main#">
|
42 |
| - INSERT INTO Link_Customer_Company (code, company_id) |
43 |
| - SELECT '#new_code#', company_id |
| 38 | + INSERT INTO Link_Customer_Company (customer_id, code, company_id) |
| 39 | + SELECT IDENT_CURRENT('Customer'), '#variables.new_code#', company_id |
44 | 40 | FROM REF_Company
|
45 | 41 | WHERE company_id IN (<cfif isdefined("attributes.company_id")>#attributes.company_id#<cfelse>#attributes.company_id#</cfif>)
|
46 | 42 | </cfquery>
|
|
0 commit comments