vtiger 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/vtiger/base.rb +24 -5
- metadata +4 -4
data/lib/vtiger/base.rb
CHANGED
@@ -19,13 +19,23 @@ class CampaignList < ActiveRecord::Base
|
|
19
19
|
def self.scott_connect(dbhost, dbname, dbuser,dbpasswd)
|
20
20
|
CampaignList.set_table_name('vtiger_campaigncontrel')
|
21
21
|
@myconnection =CampaignList.establish_connection(
|
22
|
-
:adapter => "
|
22
|
+
:adapter => "mysql",
|
23
23
|
:host => dbhost,
|
24
24
|
:username => dbuser,
|
25
25
|
:password => dbpasswd,
|
26
26
|
:database => dbname
|
27
27
|
)
|
28
28
|
end
|
29
|
+
def self.scott_connect2(dbhost, dbname, dbuser,dbpasswd)
|
30
|
+
# CampaignList.set_table_name('vtiger_campaigncontrel')
|
31
|
+
@myconnection =CampaignList.establish_connection(
|
32
|
+
:adapter => "mysql",
|
33
|
+
:host => dbhost,
|
34
|
+
:username => dbuser,
|
35
|
+
:password => dbpasswd,
|
36
|
+
:database => dbname
|
37
|
+
)
|
38
|
+
end
|
29
39
|
def self.convert(mysql_res)
|
30
40
|
rows=[]
|
31
41
|
mysql_res.each_hash { |h| rows << h
|
@@ -45,8 +55,10 @@ class CampaignList < ActiveRecord::Base
|
|
45
55
|
mysql_results=CampaignList.connection.execute("select vtiger_account.email1 as 'email', vtiger_account.accountname, vtiger_campaignaccountrel.campaignid from vtiger_account left join vtiger_campaignaccountrel on vtiger_account.accountid=vtiger_campaignaccountrel.accountid where vtiger_campaignaccountrel.campaignid=#{id} and emailoptout=0;;")
|
46
56
|
CampaignList.convert(mysql_results)
|
47
57
|
end
|
48
|
-
def self.find_contacts_by_customfield(field)
|
49
|
-
|
58
|
+
def self.find_contacts_by_customfield(field,value)
|
59
|
+
puts "field: #{field} value #{value}"
|
60
|
+
mysql_results=CampaignList.connection.execute("select vtiger_contactdetails.contactid as 'id',vtiger_contactdetails.email as 'email',#{field} as 'tsipid' from vtiger_contactdetails left join vtiger_contactscf on vtiger_contactdetails.contactid=vtiger_contactscf.contactid where #{field} like '#{value}%';")
|
61
|
+
# puts "after campaign #{mysql_results}"
|
50
62
|
CampaignList.convert(mysql_results)
|
51
63
|
end
|
52
64
|
end
|
@@ -240,6 +252,13 @@ def accessdatabase(dbhost, dbname, dbuser,dbpasswd)
|
|
240
252
|
CampaignList.scott_connect(dbhost, dbname, dbuser,dbpasswd)
|
241
253
|
|
242
254
|
|
255
|
+
end
|
256
|
+
def accessdatabase2(dbhost, dbname, dbuser,dbpasswd)
|
257
|
+
#select vtiger_contactdetails.email, vtiger_contactdetails.firstname, vtiger_contactdetails.lastname, vtiger_campaigncontrel.campaignid from vtiger_contactdetails left join vtiger_campaigncontrel on vtiger_contactdetails.contactid=vtiger_campaigncontrel.contactid where vtiger_campaigncontrel.campaignid='14' and emailoptout=0;
|
258
|
+
#self.campaigndb=CampaignList.new
|
259
|
+
CampaignList.scott_connect2(dbhost, dbname, dbuser,dbpasswd)
|
260
|
+
|
261
|
+
|
243
262
|
end
|
244
263
|
def get_list_from_campaign(campaignid,type)
|
245
264
|
#self.campaigndb.find_contacts_by_campaign(self.campaigndb,campaignid)
|
@@ -253,9 +272,9 @@ def get_contacts_from_campaign(campaignid)
|
|
253
272
|
CampaignList.find_contacts_by_campaign(campaignid)
|
254
273
|
|
255
274
|
end
|
256
|
-
def get_contacts_by_cf(field)
|
275
|
+
def get_contacts_by_cf(field,value)
|
257
276
|
#self.campaigndb.find_contacts_by_campaign(self.campaigndb,campaignid)
|
258
|
-
CampaignList.find_contacts_by_customfield(field)
|
277
|
+
CampaignList.find_contacts_by_customfield(field,value)
|
259
278
|
end
|
260
279
|
end #clase base
|
261
280
|
end #moduble
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vtiger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 2
|
10
|
+
version: 0.7.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Scott Sproule
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-20 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|