|
version 1.3, 2005/03/22 19:01:23 UTC
|
version 1.4, 2005/09/27 18:55:09 UTC
|
|
|
|
| <!--- Name: act_insertPrograms.cfm |
|
| Purpose: This functions as the action file to retreive the organizational information based on the Org ID on the site |
|
| and input the related information as a new dummy organization. The related contacts,services and programs are |
|
| inserted as new records in the dummy organization,contact and OrgtoService OrgtoProgramType tables. |
|
| |
|
| Dated: 03/06/2005 |
|
| Dependancy: URL.Orgid |
|
| Variables: |
|
| Functions: |
|
| Date changed: |
|
| 03/06/2005 Prabin & Neena Created & Documentation |
|
| 03/22/2005 Neena updated the file to use cflocation tags to be directed to edit |
|
| organization page with information. |
|
| ---> |
|
| |
|
| <P>Agencies and Programs |
|
| |
<P> |
| <!--- <a href="../directories/programs.cfm" class="sublink2"> ---> |
<!--- <a href="../directories/programs.cfm" class="sublink2"> ---> |
| <!--- <img src="../images/siteimage/dart.gif" border="0"> </a>---> |
Agencies and Programs <img src="../images/siteimage/dart.gif" border="0"><!--- </a> ---> |
| </p> |
</p> |
| |
|
| |
|
|
|
|
| Select * from Organization where Orgid = #URL.Orgid# |
Select * from Organization where Orgid = #URL.Orgid# |
| </cfquery> |
</cfquery> |
| |
|
| <cfquery name="InsertOrg" datasource="#programsdb#"> |
<!--- <cfquery name="InsertOrg" datasource="#programsdb#"> |
| Insert Into dOrganization |
Update dOrganization |
| (OrganizationName, Phone, Extension, Division, FaxNumber, TimeZone, Address1, EmailName, GeoServiceID, Address2, Hotline, City, StateOrProvince, URL, PostalCode, Country, GraphicURL, Profile) |
Set OrganizationName='#dorg.OrganizationName#', |
| Values ('#dorg.OrganizationName#', |
Phone='#dorg.Phone#', |
| '#dorg.Phone#', |
Extension='#dorg.Extension#', |
| '#dorg.Extension#', |
Division='#dorg.Division#', |
| '#dorg.Division#', |
FaxNumber='#dorg.FaxNumber#', |
| '#dorg.FaxNumber#', |
TimeZone='#dorg.TimeZone#', |
| '#dorg.TimeZone#', |
Address1='#dorg.Address1#', |
| '#dorg.Address1#', |
EmailName='#dorg.EmailName#', |
| '#dorg.EmailName#', |
GeoServiceID='#dorg.GeoServiceID#', |
| #dorg.GeoServiceID#, |
Address2='#dorg.Address2#', |
| '#dorg.Address2#', |
Hotline='#dorg.Hotline#', |
| '#dorg.Hotline#', |
City='#dorg.City#', |
| '#dorg.City#', |
StateOrProvince='#dorg.StateOrProvince#', |
| '#dorg.StateOrProvince#', |
URL='#dorg.URL#', |
| '#dorg.URL#', |
PostalCode='#dorg.PostalCode#', |
| '#dorg.PostalCode#', |
Country='#dorg.Country#', |
| '#dorg.Country#', |
GraphicURL='#dorg.GraphicURL#', |
| '#dorg.GraphicURL#', |
Profile='#dorg.Profile#' |
| '#dorg.Profile#' |
Where OrgID=#URL.OrgID# |
| ) |
|
| </cfquery> |
|
| |
|
| |
</cfquery> ---> |
| |
<!--- |
| <cfquery name="getorgid" datasource="#programsdb#"> |
<cfquery name="getorgid" datasource="#programsdb#"> |
| Select max(orgid) as maxid from dorganization |
Select max(orgid) as maxid from dorganization |
| </cfquery> |
</cfquery> ---> |
| |
|
| <cfset maxorgid = getorgid.maxid> |
<!--- <cfset maxorgid = getorgid.maxid> ---> |
| <!--- Associating the dummy table from dcontacts table with the new orgID in the Contacts table - This query will get all the program type id's that have been |
<!--- Associating the dummy table from dcontacts table with the new orgID in the Contacts table - This query will get all the program type id's that have been |
| associated with the program type.---> |
associated with the program type.---> |
| |
|
|
|
|
| </cfquery> |
</cfquery> |
| |
|
| |
|
| <CFLOOP Query="getcontacts"> |
<!--- Insert notepad Here ---> |
| |
|
| <CFQUERY NAME="insertcontacts" DATASOURCE="#programsdb#"> |
|
| INSERT INTO dContacts(Prefix, FirstName, Middle, LastName, NameSuffix, Title, Primary, WorkPhone, WorkExtension, MobilePhone, FaxNumber, EmailName, Address, City, State, Zip, OrgID) |
|
| Values('#Prefix#','#FirstName#','#Middle#','#LastName#','#NameSuffix#','#Title#','#Primary#','#WorkPhone#','#WorkExtension#','#MobilePhone#','#FaxNumber#','#EmailName#','#Address#','#City#','#State#','#Zip#',#getorgid.maxid#) |
|
| </cfquery> |
|
| </CFLOOP> |
|
| |
|
| <!--- Associating the program types to the organization - This query will get all the program type id's that have been |
|
| associated with the program type.---> |
|
| |
|
| <cfquery name="getOrgProgtype" datasource="#programsdb#"> |
|
| Select * from OrgtoProgramtype |
|
| where Orgid = #URL.Orgid# |
|
| </cfquery> |
|
| |
|
| <cfset ProgList = ValueList(getOrgProgtype.ProgramTypeID)> |
|
| <cfset ProgTypeArray = ListToArray(ProgList)> |
|
| |
|
| <cfif GetOrgProgType.recordcount is not 0> |
|
| |
|
| <cfloop from="1" to="#ArrayLen(ProgTypeArray)#" index="x"> |
|
| <cfquery datasource="#programsdb#"> |
|
| Insert Into dOrgtoprogramtype (OrgID,ProgramTypeID) |
|
| Values(#getorgid.maxID#, #ProgTypeArray[x]#) |
|
| </cfquery> |
|
| </cfloop> |
|
| </cfif> |
|
| |
|
| <!-- section for adding services and relate it to the organization ---> |
|
| <cfquery name="getmaxserviceid" datasource="#programsdb#"> |
|
| SELECT orgid, ServiceID |
|
| FROM OrgtoService |
|
| </cfquery> |
|
| |
|
| <cfquery name="getService" datasource="#programsdb#"> |
|
| SELECT orgid, ServiceID |
|
| FROM OrgtoService |
|
| WHERE Orgid=#URL.orgid# And serviceid Not in (select serviceid from service where approved=1); |
|
| |
|
| </cfquery> |
|
| |
|
| <cfset ServiceList = ValueList(getService.ServiceID)> |
|
| <cfset ServiceArray = ListToArray(ServiceList)> |
|
| |
|
| <cfif getService.recordcount is not 0> |
|
| <cfloop from="1" to="#ArrayLen(ServiceArray)#" index="x"> |
|
| <cfquery datasource="#programsdb#"> |
|
| Insert Into dOrgtoService (OrgID, ServiceID) |
|
| Values(#getorgid.maxID#, #ServiceArray[x]#) |
|
| </cfquery> |
|
| </cfloop> |
|
| </cfif> |
|
| <!--- The Query below gets the new unapproved service names entered by the admin/online user and appends |
|
| the services and the links in the Service and OrgtoService Tables ---> |
|
| |
|
| <cfif #URL.fuseaction# is "editservices"> |
|
| |
|
| <cfquery name="getNewServices" datasource="#programsdb#"> |
|
| SELECT ds.service,ds.type,ds.Approved, os.orgid |
|
| FROM Service AS ds, Orgtoservice AS os |
|
| WHERE os.Orgid=#URL.Orgid# and os.serviceid=ds.serviceid and ds.approved=0; |
|
| </cfquery> |
|
| |
|
| <cfset NewServiceList = ValueList(getNewServices.Service)> |
|
| <cfset NewTypeList = ValueList(getNewServices.Type)> |
|
| <cfset NewServiceArray = ListToArray(NewServiceList)> |
|
| <cfset NewTypeArray = ListToArray(NewTypeList)> |
|
| |
|
| <cfif getNewServices.recordcount is not 0> |
|
| <cfloop from="1" to="#ArrayLen(NewServiceArray)#" index="x"> |
|
| <cfquery name="Addnewservice" datasource="#programsdb#"> |
|
| Insert Into dService(Service,Type,Approved,CenterID) |
|
| Values('#NewServiceArray[x]#','#NewTypeArray[x]#',1,7) |
|
| </cfquery> |
|
| <cfquery name="getserviceid" datasource="#programsdb#"> |
|
| Select max(serviceid) as maxserviceid from dService |
|
| </cfquery> |
|
| <cfquery name="link" datasource="#programsdb#"> |
|
| Insert Into dOrgtoService (OrgID, ServiceID) |
|
| Values(#getorgid.maxID#, #getserviceid.maxserviceid#) |
|
| </cfquery> |
|
| </cfloop> |
|
| </cfif> |
|
| |
|
| </cfif> |
|
| |
|
| <!--- <cfoutput> |
|
| <input type="hidden" name="mainOrgId" value="URL.mainorgid"> |
|
| <input type="hidden" name="orgid" value="#getorgid.maxid#"> |
|
| </cfoutput> |
|
| ---> |
|
| |
|
| |
|
| |
<!--- changes to ORgid ---> |
| <CFIF #URL.fuseaction# IS "GETORG"> |
<CFIF #URL.fuseaction# IS "GETORG"> |
| <cfquery name="provider1" datasource="#programsdb#"> |
<cfquery name="provider1" datasource="#programsdb#"> |
| SELECT * |
SELECT * |
| FROM dOrganization |
FROM dOrganization |
| where orgID = #maxOrgID# |
where orgID = #URL.Orgid# |
| </cfquery> |
</cfquery> |
| |
|
| <cflocation url="addeditprograms.cfm?FuseAction=Editorg&OrgID=#maxorgid#" addToken="No"> |
<cflocation url="addeditprograms.cfm?FuseAction=Editorg&OrgID=#URL.Orgid#" addToken="No"> |
| <!--- <cfoutput><input type="hidden" name="OrgID" value="maxorgid"></cfoutput> |
<!--- <cfoutput><input type="hidden" name="OrgID" value="maxorgid"></cfoutput> |
| <table width="100%" border="0" cellspacing="0" cellpadding="10" name="text"> |
<table width="100%" border="0" cellspacing="0" cellpadding="10" name="text"> |
| <tr> |
<tr> |