vtiger 0.7.4 → 0.7.6

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.
@@ -55,7 +55,15 @@ Can now directly access Vtiger DB to run some queries. See base.rb campaignlist
55
55
 
56
56
  find userid from vtiger_users (supposed to be in preferences section)
57
57
  select username,accessKey from vtiger_users;
58
-
58
+ == USAGE with new factory
59
+ api ={
60
+ :username => 'admin',
61
+ :key => 'xxxx',
62
+ # :username => 'admin',
63
+ # :key => 'xxxx',
64
+ :url => 'democrm.estormtech.com',
65
+ }
66
+ cmd = Vtiger::Commands.vtiger_factory(api)
59
67
 
60
68
  tokens are stored in
61
69
  vtiger_ws_userauthtoken
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/ruby
2
+ usage=<<EOF_USAGE
3
+ # == Synopsis
4
+ # Add a email to vtiger
5
+ # == Usage
6
+ # add_email.rb -u vtiger_url -n username -k access_key -c cc -t emailbody -e entity
7
+ #
8
+ # == Useful commands
9
+ # add_email.rb -u democrm.estormtech.com -c test -n scott -k xxxxx
10
+ # == Author
11
+ # Scott Sproule --- Ficonab.com (scott.sproule@ficonab.com)
12
+ # == Copyright
13
+ # Copyright (c) 2007 Ficonab Pte. Ltd.
14
+ # See license for license details
15
+ EOF_USAGE
16
+ require 'yaml'
17
+ require 'rubygems'
18
+ gem 'vtiger'
19
+ require 'vtiger'
20
+ require 'optparse'
21
+ require 'java' if RUBY_PLATFORM =~ /java/
22
+
23
+ #testing of chagnes
24
+
25
+ arg_hash=Vtiger::Options.parse_options(ARGV)
26
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
27
+ require 'pp'
28
+ options = arg_hash
29
+ # set up variables using hash
30
+
31
+ puts "vtiger add email #{Time.now}"
32
+ puts "vtiger url: #{arg_hash[:url]} "
33
+ puts "vtiger contact: #{arg_hash[:contact]} "
34
+ cmd = Vtiger::Commands.new()
35
+ cmd.challenge(options)
36
+ cmd.login(options)
37
+ #estorm account id is 3x218 on ipmirror
38
+ res=cmd.add_email('3x218',arg_hash[:element_type],arg_hash[:title],arg_hash[:subject],"2011-06-02","scott.sproule@estormtech.com","eka.mardiarti@estormtech.com","cc" , "9:00",{}) # returned 3x314
39
+ # consumer_session.close
40
+ # puts "#{result}"
41
+ # sleep(1)
42
+
43
+
44
+
45
+ puts '-------------finished processing!!!'
@@ -158,6 +158,7 @@ end
158
158
  # puts "input array:" + input_array.to_s #&username=#{self.username}&accessKey=#{self.md5}
159
159
  # scott not working -- JSON.generate(input_array,{'array_nl'=>'true'})
160
160
  result = http_crm_post("operation=create",input_array)
161
+ # puts "ADD OBJEcT #{result.inspect}"
161
162
  # self.session_name=result["result"]["sessionName"]
162
163
  # puts JSON.pretty_generate(result)
163
164
  success=result['success']
@@ -56,9 +56,12 @@ module Vtiger
56
56
  # 'tsipid'=>"1234"
57
57
  add_object(object_map,hashv,'HelpDesk')
58
58
  end
59
- def add_email(options,status,title,hashv)
60
- puts "in add email ticket NOT COMPLETE"
61
- object_map= { 'assigned_user_id'=>"#{self.userid}",'ticketstatus'=>"#{status}", 'ticket_title'=>"#{title}"}
59
+ def add_email(parentid,parent_type,description,subject,date_start,from,to,cc, time_start, hashv)
60
+ puts "in add email"
61
+ object_map= { 'assigned_user_id'=>"#{self.userid}",'parent_id'=>"#{parentid}", 'parent_type'=> "#{parent_type}",
62
+ 'description' => "#{description}",'subject'=>"#{subject}", 'time'=> "#{time_start}", 'date_start'=>"#{date_start}" ,
63
+ 'saved_toid' => "#{to}", 'ccmail' => "#{cc}",'from_email'=> "#{from}"
64
+ }
62
65
  object_map=object_map.merge hashv
63
66
  # 'tsipid'=>"1234"
64
67
  add_object(object_map,hashv,'Emails')
@@ -266,6 +269,17 @@ def large_find_items_by_date_and_key_null(element,date,key, extraparam=nil)
266
269
  countstring="select count(*) from #{element} where createdtime like '#{y}%' and #{key} < '0' and emailoptout=0"
267
270
  succ, values =self.large_query(countstring,querystring)
268
271
  end
272
+ def large_find_items_by_date(element,date, extraparam=nil)
273
+ # NEED TO ADD QUERY SIZE CAPABILIIES
274
+
275
+ queryparams=''
276
+ queryparams=",#{extraparam}" if extraparam!=nil
277
+ t=Time.parse(date)
278
+ y=t.strftime('%Y-%m-%d')
279
+ querystring="select id#{queryparams} from #{element} where createdtime like '#{y}%' and emailoptout=0"
280
+ countstring="select count(*) from #{element} where createdtime like '#{y}%' and emailoptout=0"
281
+ succ, values =self.large_query(countstring,querystring)
282
+ end
269
283
  def large_find_items(element, extraparam=nil)
270
284
  # NEED TO ADD QUERY SIZE CAPABILIIES
271
285
 
@@ -56,7 +56,8 @@ module Vtiger
56
56
  puts "filename #{val}" }
57
57
  opts.on_tail("-h","--help", "get help message") { |val| temp_hash[:help ] = true
58
58
  puts opts }
59
-
59
+ opts.on("-s","--subject VAL", String) {|val| temp_hash[:subject ] = val
60
+ puts "subject #{val}" }
60
61
  opts.parse(params)
61
62
  # puts " in HTTP #{hostname} port #{port} url: #{url}"
62
63
 
@@ -42,6 +42,17 @@ class TestVtiger < Test::Unit::TestCase
42
42
  assert suc,"success should be true"
43
43
  puts "list is #{list}"
44
44
  end
45
+ def test_add_email
46
+ setup
47
+ cmd = Vtiger::Commands.new()
48
+ challenge=cmd.challenge(@options)
49
+ puts "challenge is: #{challenge}"
50
+ login=cmd.login(@options)
51
+ puts "login is #{login}"
52
+ res=cmd.add_email('3x314',"Accounts","hopefully this is the email","subject is","2011-06-02",from, to,cc ,"9:00",{}) # returned 3x314
53
+ puts "ADD EMAIL: res is: #{res.inspect}"
54
+ end
55
+
45
56
  def test_accountlist2
46
57
  setup
47
58
  cmd = Vtiger::Commands.new()
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: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 4
10
- version: 0.7.4
9
+ - 6
10
+ version: 0.7.6
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-26 00:00:00 +08:00
18
+ date: 2011-06-30 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -24,6 +24,7 @@ email: scott.sproule@estormtech.com
24
24
  executables:
25
25
  - add_contact.rb
26
26
  - add_lead.rb
27
+ - add_email.rb
27
28
  - describe_object.rb
28
29
  - list_types.rb
29
30
  - query.rb
@@ -45,6 +46,7 @@ files:
45
46
  - test/test_secret.rb
46
47
  - test/test_vtiger.rb
47
48
  - bin/add_contact.rb
49
+ - bin/add_email.rb
48
50
  - bin/add_lead.rb
49
51
  - bin/add_trouble_ticket.rb
50
52
  - bin/describe_object.rb