1 neenan 1.1
2
3 <P>
4 <a href="../directories/programs.cfm" class="sublink2">
5 Agencies and Programs <img src="../images/siteimage/dart.gif" border="0"></a>
6 </p>
7
8
9 <cfquery name="dorg" datasource="#programsdb#">
10 Select * from Organization where Orgid = #URL.Orgid#
11 </cfquery>
12
13 <cfquery name="InsertOrg" datasource="#programsdb#">
14 Insert Into dOrganization
15 (OrganizationName, Phone, Extension, Division, FaxNumber, TimeZone, Address1, EmailName, GeoServiceID, Address2, Hotline, City, StateOrProvince, URL, PostalCode, Country, GraphicURL, Profile)
16 Values ('#dorg.OrganizationName#',
17 '#dorg.Phone#',
18 '#dorg.Extension#',
19 '#dorg.Division#',
20 '#dorg.FaxNumber#',
21 '#dorg.TimeZone#',
22 neenan 1.1 '#dorg.Address1#',
23 '#dorg.EmailName#',
24 #dorg.GeoServiceID#,
25 '#dorg.Address2#',
26 '#dorg.Hotline#',
27 '#dorg.City#',
28 '#dorg.StateOrProvince#',
29 '#dorg.URL#',
30 '#dorg.PostalCode#',
31 '#dorg.Country#',
32 '#dorg.GraphicURL#',
33 '#dorg.Profile#'
34 )
35 </cfquery>
36
37 <cfquery name="getorgid" datasource="#programsdb#">
38 Select max(orgid) as maxid from dorganization
39 </cfquery>
40
41 <cfset maxorgid = getorgid.maxid>
42 <!--- 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
43 neenan 1.1 associated with the program type.--->
44
45 <cfquery name="getcontacts" datasource="#programsdb#">
46 Select * from contacts where Orgid = #URL.Orgid#
47 </cfquery>
48
49
50 <CFLOOP Query="getcontacts">
51
52 <CFQUERY NAME="insertcontacts" DATASOURCE="#programsdb#">
53 INSERT INTO dContacts(Prefix, FirstName, Middle, LastName, NameSuffix, Title, Primary, WorkPhone, WorkExtension, MobilePhone, FaxNumber, EmailName, Address, City, State, Zip, OrgID)
54 Values('#Prefix#','#FirstName#','#Middle#','#LastName#','#NameSuffix#','#Title#','#Primary#','#WorkPhone#','#WorkExtension#','#MobilePhone#','#FaxNumber#','#EmailName#','#Address#','#City#','#State#','#Zip#',#getorgid.maxid#)
55 </cfquery>
56 </CFLOOP>
57
58 <!--- Associating the program types to the organization - This query will get all the program type id's that have been
59 associated with the program type.--->
60
61 <cfquery name="getOrgProgtype" datasource="#programsdb#">
62 Select * from OrgtoProgramtype
63 where Orgid = #URL.Orgid#
64 neenan 1.1 </cfquery>
65
66 <cfset ProgList = ValueList(getOrgProgtype.ProgramTypeID)>
67 <cfset ProgTypeArray = ListToArray(ProgList)>
68
69 <cfif GetOrgProgType.recordcount is not 0>
70
71 <cfloop from="1" to="#ArrayLen(ProgTypeArray)#" index="x">
72 <cfquery datasource="#programsdb#">
73 Insert Into dOrgtoprogramtype (OrgID,ProgramTypeID)
74 Values(#getorgid.maxID#, #ProgTypeArray[x]#)
75 </cfquery>
76 </cfloop>
77 </cfif>
78
79 <!-- section for adding services and relate it to the organization --->
80 <cfquery name="getmaxserviceid" datasource="#programsdb#">
81 SELECT orgid, ServiceID
82 FROM OrgtoService
83 </cfquery>
84
85 neenan 1.1 <cfquery name="getService" datasource="#programsdb#">
86 SELECT orgid, ServiceID
87 FROM OrgtoService
88 WHERE Orgid=#URL.orgid# And serviceid Not in (select serviceid from service where approved=1);
89
90 </cfquery>
91
92 <cfset ServiceList = ValueList(getService.ServiceID)>
93 <cfset ServiceArray = ListToArray(ServiceList)>
94
95 <cfif getService.recordcount is not 0>
96 <cfloop from="1" to="#ArrayLen(ServiceArray)#" index="x">
97 <cfquery datasource="#programsdb#">
98 Insert Into dOrgtoService (OrgID, ServiceID)
99 Values(#getorgid.maxID#, #ServiceArray[x]#)
100 </cfquery>
101 </cfloop>
102 </cfif>
103 <!--- The Query below gets the new unapproved service names entered by the admin/online user and appends
104 the services and the links in the Service and OrgtoService Tables --->
105
106 neenan 1.1 <cfif #URL.fuseaction# is "editservices">
107
108 <cfquery name="getNewServices" datasource="#programsdb#">
109 SELECT ds.service,ds.type,ds.Approved, os.orgid
110 FROM Service AS ds, Orgtoservice AS os
111 WHERE os.Orgid=#URL.Orgid# and os.serviceid=ds.serviceid and ds.approved=0;
112 </cfquery>
113
114 <cfset NewServiceList = ValueList(getNewServices.Service)>
115 <cfset NewTypeList = ValueList(getNewServices.Type)>
116 <cfset NewServiceArray = ListToArray(NewServiceList)>
117 <cfset NewTypeArray = ListToArray(NewTypeList)>
118
119 <cfif getNewServices.recordcount is not 0>
120 <cfloop from="1" to="#ArrayLen(NewServiceArray)#" index="x">
121 <cfquery name="Addnewservice" datasource="#programsdb#">
122 Insert Into dService(Service,Type,Approved,CenterID)
123 Values('#NewServiceArray[x]#','#NewTypeArray[x]#',1,7)
124 </cfquery>
125 <cfquery name="getserviceid" datasource="#programsdb#">
126 Select max(serviceid) as maxserviceid from dService
127 neenan 1.1 </cfquery>
128 <cfquery name="link" datasource="#programsdb#">
129 Insert Into dOrgtoService (OrgID, ServiceID)
130 Values(#getorgid.maxID#, #getserviceid.maxserviceid#)
131 </cfquery>
132 </cfloop>
133 </cfif>
134
135 </cfif>
136
137 <!--- <cfoutput>
138 <input type="hidden" name="mainOrgId" value="URL.mainorgid">
139 <input type="hidden" name="orgid" value="#getorgid.maxid#">
140 </cfoutput>
141 --->
142
143
144 <CFIF #URL.fuseaction# IS "GETORG">
145 <cfquery name="provider1" datasource="#programsdb#">
146 SELECT *
147 FROM dOrganization
148 neenan 1.1 where orgID = #maxOrgID#
149 </cfquery>
150
|