|
|
|
|
File: [Development] / p2rx-programs / act_addservices.cfm
(download)
Revision: 1.1, Wed Mar 9 03:18:14 2005 UTC (4 years, 8 months ago) by neenan Branch: MAIN *** empty log message *** |
<!--- Name: act_addservices.cfm
Purpose: This functions as the action file to insert the information of the services of type resource, expertise or client.
Each time this page is called,the field values are first deleted from the dOrgToService table using a query .
Fresh records are then inserted for each of the services that the user had selected in the dsp_addservices or
dsp_editservices form. The new "Other" services are also inserted in the dservice table and dorgtoservice table.
Date created: 02/23/2005
Dependancy: URL.Orgid
Variables:
Functions:
Date changed:
02/23/2005 Prabin & Neena Created
02/23/2005 Neena Documentation
--->
<cfquery name="getservicelink" datasource="#programsdb#">
Select serviceid
from dorgtoservice
where orgID = #URL.Orgid#
</cfquery>
<cfset OtherServiceList = ValueList(getServicelink.ServiceID)>
<cfset OtherServiceArray = ListToArray(OtherServiceList)>
<cfif getServicelink.recordcount is not 0>
<cfloop from="1" to="#ArrayLen(OtherServiceArray)#" index="x">
<cfquery datasource="#Programsdb#">
Delete from dOrgtoService
where OrgID =#URL.orgid# and ServiceID = #OtherServiceArray[x]#
</cfquery>
</cfloop>
</cfif>
<cfquery name="deletepg" datasource="#programsdb#">
delete
from dOrgToService
Where OrgID = #URL.ORGID#
</cfquery>
<cfset Array = #ListToArray(form.ServiceID)#>
<cfloop from="1" to="#ArrayLen(Array)#" index="x">
<cfquery datasource="#Programsdb#">
Insert Into dOrgtoService (OrgID, ServiceID)
Values(#URL.OrgID#, #Array[x]#)
</cfquery>
</cfloop>
<cfif IsDefined("form.OtherExpertise")>
<!--- <cfif #form.OtherExpertise# is true> --->
<cfquery name="newExp" datasource="#Programsdb#">
Insert into dService(Service,Type, Approved,CenterID)
Values('#form.Other1#','Expertise',1,6)
</cfquery>
<Cfquery name="getmaxServiceID" datasource="#Programsdb#">
Select Max(serviceid) as maxSid from dService
</Cfquery>
<cfquery name="newOrgToService" datasource="#Programsdb#">
Insert into dOrgtoService (OrgID, ServiceID)
Values(#URL.OrgID#, #getMaxServiceid.maxSid#)
</cfquery>
</cfif>
<!--- </cfif> --->
<cfif IsDefined("form.OtherResources")>
<!--- <cfif #form.OtherResources# is true> --->
<cfquery name="newRes" datasource="#Programsdb#">
Insert into dService(Service,Type, Approved,CenterID)
Values('#form.Other2#','Resources',1,6)
</cfquery>
<Cfquery name="getmaxServiceID" datasource="#Programsdb#">
Select Max(serviceid) as maxSid from dService
</Cfquery>
<cfquery name="newOrgToService" datasource="#Programsdb#">
Insert into dOrgtoService (OrgID, ServiceID)
Values(#URL.OrgID#, #getmaxServiceID.maxSid#)
</cfquery>
<!--- </cfif> --->
</cfif>
<cfif IsDefined("form.OtherClients")>
<!--- <cfif #form.OtherClients# is true> --->
<cfquery name="newClient" datasource="#Programsdb#">
Insert into dService(Service,Type, Approved,CenterID)
Values('#form.Other3#','Clients',1,6)
</cfquery>
<Cfquery name="getmaxServiceID" datasource="#Programsdb#">
Select Max(serviceid) as maxSid from dService
</Cfquery>
<cfquery name="newOrgToService" datasource="#Programsdb#">
Insert into dOrgtoService (OrgID, ServiceID)
Values(#URL.OrgID#, #getMaxServiceID.maxSid#)
</cfquery>
</cfif>
| CVS Admin |
Powered by ViewCVS 1.0-dev |