vtiger 0.4.2 → 0.4.3

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 CHANGED
@@ -171,7 +171,7 @@ def updateobject(values)
171
171
  # puts "object map is #{object_map.to_s}"
172
172
  tmp=self.json_please(object_map)
173
173
  input_array ={'operation'=>'update','sessionName'=>"#{self.session_name}", 'element'=>tmp} # removed the true
174
- puts "input array:" + input_array.to_s #&username=#{self.username}&accessKey=#{self.md5}
174
+ # puts "input array:" + input_array.to_s #&username=#{self.username}&accessKey=#{self.md5}
175
175
  # scott not working -- JSON.generate(input_array,{'array_nl'=>'true'})
176
176
  result = http_crm_post("operation=update",input_array)
177
177
  # self.session_name=result["result"]["sessionName"]
@@ -128,7 +128,7 @@ module Vtiger
128
128
 
129
129
  return success,self.object_id
130
130
  end
131
- def find_tt_by_contact(contact)
131
+ def find_tt_by_contact(contact)
132
132
  puts "in query tt by contact"
133
133
  action_string=ERB::Util.url_encode("select id,ticket_no from HelpDesk where parent_id = '#{contact}';")
134
134
  # puts "action string:" +action_string
@@ -141,7 +141,21 @@ module Vtiger
141
141
  values.each {|v| ticketlist << v['ticket_no'] }
142
142
  return res["success"],ticketlist
143
143
 
144
- end
144
+ end
145
+ def find_open_tt_by_contact(contact)
146
+ puts "in query tt by contact"
147
+ action_string=ERB::Util.url_encode("select id,ticket_no from HelpDesk where parent_id = '#{contact}' and ticketstatus like 'Open';")
148
+ # puts "action string:" +action_string
149
+ res = http_ask_get(self.endpoint_url+"operation=query&sessionName=#{self.session_name}&query="+action_string)
150
+ puts "TT RES: #{res["result"]} class: #{res["result"].class}"
151
+ values=res["result"] if res["success"]==true #comes back as array
152
+ #puts values.inspect
153
+ # return the account id
154
+ ticketlist=[]
155
+ values.each {|v| ticketlist << v['ticket_no'] }
156
+ return res["success"],ticketlist
157
+
158
+ end
145
159
  def run_rules(test)
146
160
  yield(test)
147
161
  end
data/test/test_vtiger.rb CHANGED
@@ -145,6 +145,21 @@ class TestVtiger < Test::Unit::TestCase
145
145
  assert login,"login should succeed"
146
146
  assert res,"rules should succeed"
147
147
  end
148
+ def test_find_open_trouble_ticket_by_contacts
149
+ cmd = Vtiger::Commands.new()
150
+ challenge=cmd.challenge(@options)
151
+ login=cmd.login(@options)
152
+ hv={}
153
+ # hv[:firstname]='test'
154
+ success,contact_id=cmd.query_element_by_email("scott.sproule@gmail.com","Contacts")
155
+ tt,ticketlist=cmd.find_open_tt_by_contact(contact_id) if success
156
+ puts "trouble ticket is #{tt} ticket number is #{ticketlist}"
157
+ assert challenge,"challenge is false "
158
+ assert success,"could not find contact id with email scott.sproule@gmail.com "
159
+ assert login,"login should succeed"
160
+ assert tt,"open trouble ticket findersshould succeed"
161
+ puts "tickelist is #{ticketlist}"
162
+ end
148
163
  def test_find_trouble_ticket_by_contacts
149
164
  cmd = Vtiger::Commands.new()
150
165
  challenge=cmd.challenge(@options)
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: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Scott Sproule