vtiger 0.5.0 → 0.5.1
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 +14 -12
- data/lib/vtiger/commands.rb +2 -2
- metadata +3 -3
data/lib/vtiger/base.rb
CHANGED
@@ -14,11 +14,11 @@ require 'active_record'
|
|
14
14
|
end.join '&'
|
15
15
|
end
|
16
16
|
end
|
17
|
-
class CampaignList
|
17
|
+
class CampaignList < ActiveRecord::Base
|
18
18
|
|
19
|
-
def scott_connect(dbhost, dbname, dbuser,dbpasswd)
|
20
|
-
|
21
|
-
@myconnection =
|
19
|
+
def self.scott_connect(dbhost, dbname, dbuser,dbpasswd)
|
20
|
+
CampaignList.set_table_name('vtiger_campaigncontrel')
|
21
|
+
@myconnection =CampaignList.establish_connection(
|
22
22
|
:adapter => "mysql",
|
23
23
|
:host => dbhost,
|
24
24
|
:username => dbuser,
|
@@ -26,15 +26,16 @@ class CampaignList #< ActiveRecord::Base
|
|
26
26
|
:database => dbname
|
27
27
|
)
|
28
28
|
end
|
29
|
-
def convert(mysql_res)
|
29
|
+
def self.convert(mysql_res)
|
30
30
|
rows=[]
|
31
31
|
mysql_res.each_hash { |h| rows << h
|
32
|
-
|
32
|
+
# puts "h is #{h} #{h.inspect} #{h.class}"
|
33
|
+
}
|
33
34
|
rows
|
34
35
|
end
|
35
|
-
def find_contacts_by_campaign(
|
36
|
-
mysql_results
|
37
|
-
|
36
|
+
def self.find_contacts_by_campaign(id)
|
37
|
+
mysql_results=CampaignList.connection.execute("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=#{id} and emailoptout=0;")
|
38
|
+
CampaignList.convert(mysql_results)
|
38
39
|
end
|
39
40
|
end
|
40
41
|
module Vtiger
|
@@ -205,13 +206,14 @@ def updateobject(values)
|
|
205
206
|
end
|
206
207
|
def accessdatabase(dbhost, dbname, dbuser,dbpasswd)
|
207
208
|
#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;
|
208
|
-
self.campaigndb=CampaignList.new
|
209
|
-
|
209
|
+
#self.campaigndb=CampaignList.new
|
210
|
+
CampaignList.scott_connect(dbhost, dbname, dbuser,dbpasswd)
|
210
211
|
|
211
212
|
|
212
213
|
end
|
213
214
|
def get_contacts_from_campaign(campaignid)
|
214
|
-
self.campaigndb.find_contacts_by_campaign(self.campaigndb,campaignid)
|
215
|
+
#self.campaigndb.find_contacts_by_campaign(self.campaigndb,campaignid)
|
216
|
+
CampaignList.find_contacts_by_campaign(campaignid)
|
215
217
|
|
216
218
|
end
|
217
219
|
end #clase base
|
data/lib/vtiger/commands.rb
CHANGED
@@ -150,7 +150,7 @@ def get_campaigns
|
|
150
150
|
action_string=ERB::Util.url_encode("select id,campaignname from Campaigns;")
|
151
151
|
# puts "action string:" +action_string
|
152
152
|
res = http_ask_get(self.endpoint_url+"operation=query&sessionName=#{self.session_name}&query="+action_string)
|
153
|
-
|
153
|
+
# puts "TT RES: #{res["result"]} class: #{res["result"].class}"
|
154
154
|
values=res["result"] if res["success"]==true #comes back as array
|
155
155
|
#puts values.inspect
|
156
156
|
# return the account id
|
@@ -163,7 +163,7 @@ end
|
|
163
163
|
action_string=ERB::Util.url_encode("select id,ticket_no from HelpDesk where parent_id = '#{contact}' and ticketstatus like 'Open';")
|
164
164
|
# puts "action string:" +action_string
|
165
165
|
res = http_ask_get(self.endpoint_url+"operation=query&sessionName=#{self.session_name}&query="+action_string)
|
166
|
-
|
166
|
+
# puts "TT RES: #{res["result"]} class: #{res["result"].class}"
|
167
167
|
values=res["result"] if res["success"]==true #comes back as array
|
168
168
|
#puts values.inspect
|
169
169
|
# return the account id
|
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: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Scott Sproule
|