oxen_printer 0.4.5 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a918cf905652b41bc32adc6d0c5d3221ad81e99
4
- data.tar.gz: 9457bafe60e2d9d7b3e8bcbaaffcfef1d75b5b53
3
+ metadata.gz: 254a3bc1044f2d2f7d1dfd3655922e32c820ffd4
4
+ data.tar.gz: d626e235f66eb0862557cd3f92237a65af60ee82
5
5
  SHA512:
6
- metadata.gz: 651448244cd3d40400babf94b94ad19ad962edde48c1740dd74f3dfa91c9aefca48d5281b725bd97e1c36662207b38e611cf4b6ce24b3b0c6b6954be8e84feab
7
- data.tar.gz: 05637d38f7738235bc87e5b76ab1e6981ab0a25ecfa59b850edf7e0033116d41c44947c77f33f3b907a06f636f66a170881d3462b402f3a73643616aad54c67e
6
+ metadata.gz: 3ca3466c68c0e609fc0b36e959d9d0c5be4be8c7644b57ddb6dbb7b96a4e3136682876205534dadec9c4f4439bb9b442f4fd9f6d144dce3efef6f5798a0360da
7
+ data.tar.gz: d987b734385f15f64f36637ebd1fdecafd9d85cc3000b77bbd7bd163ec14bced011481fc1bbf19803c691abfcf2f65e9fd97fdfc89213fe5a66694d1e456625e
@@ -0,0 +1,39 @@
1
+ class Oxen::PrintserversController < AbstractResourcesController
2
+ skip_before_filter :authenticate_user!, only: :port
3
+
4
+ def port
5
+ authorize Printserver.new
6
+ unless params[:mac].blank?
7
+ port = Printserver.find_by_mac_addr(params[:mac])
8
+ if !port
9
+ port = 'port not found!'
10
+ else
11
+ port = port.active ? port.port : 'printserver er ikke aktiv!'
12
+ end
13
+ render plain: port
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def set_fab_button_options
20
+
21
+ opt = { items: {}}
22
+ case params[:action]
23
+ when 'edit','update'; opt[:items].merge! list: { ajax: 'get', icon: 'list', class: 'blue', url: "/admin/accounts/#{resource.account.id}" }
24
+ when 'show'; opt[:items].merge! list: { ajax: 'get', icon: 'list', class: 'blue', url: "/admin/accounts/#{resource.account.id}" }
25
+ # when 'index'; opt[:items].merge! list: { ajax: 'get', icon: 'list', class: 'blue', url: "/admin/accounts/#{resource.account.id}" }
26
+ end
27
+
28
+ @fab_button_options = opt
29
+ end
30
+
31
+ # Never trust parameters from the scary internet, only allow the white list through.
32
+ def resource_params
33
+ params[:printserver][:mac_addr] = params[:printserver][:mac_addr].strip.gsub( / /, ':') rescue ''
34
+ params[:printserver][:account_id] = current_user.admin? ? (params[:parent_id] || params[:printserver][:account_id]) : current_user.account.id
35
+ params.require(:printserver).permit(:parent, :parent_id, :account_id, :location, :lokation, :mac_addr, :port, :active)
36
+ end
37
+
38
+
39
+ end
@@ -1,18 +1,21 @@
1
1
  class PrinterMailer < ActionMailer::Base
2
2
  layout 'mailer'
3
3
 
4
- def send_print usr, file, msg=nil
5
- @usr = User.find(usr)
4
+ def send_print usr, file, msg=nil, subj=nil
5
+ @usr = usr
6
6
  fname = case file
7
7
  when /\/pdf.*$/; 'print%s.pdf' % DateTime.now.nsec
8
8
  else 'print%s.label' % DateTime.now.nsec
9
9
  end
10
10
  attachments[fname] = File.read(file) unless file.blank?
11
11
  @logo = @usr.account.logos.first.image.url rescue ""
12
- @msg = msg || "Der er ikke defineret nogen printere til dette job, for dig - så jeg er nødt til at sende dig filen vedhæftet denne email! ;)Du bør kontakte din system administrator og bede om at der bliver oprettet en printer definition til denne printer jobtype, for dig!"
12
+ attachments.inline['logo.png'] = File.read( File.join(Rails.root,'public',@logo)) unless @logo.blank?
13
+
14
+ @msg = msg || "See attached PDF"
15
+ subj ||= "Kontakt administrator! Der mangler en printer definition!"
13
16
 
14
17
  mail from: 'no-reply@wheelstore.space',
15
18
  to: @usr.email,
16
- subject: "Kontakt administrator! Der mangler en printer definition!"
19
+ subject: subj
17
20
  end
18
21
  end
@@ -40,7 +40,7 @@ class OxPrintJob < AbstractResource
40
40
  def perform *args
41
41
  context = args[0].delete(:context)
42
42
  if !download
43
- print_with rendered_on(args)
43
+ print_with rendered_on(args), args
44
44
  else
45
45
  send_with( rendered_on(args), context) if context
46
46
  end
@@ -0,0 +1,21 @@
1
+ class OxPrintserver < AbstractResource
2
+ self.table_name = 'printservers'
3
+ establish_connection ((Rails.env=="development") ? :dev_oxen_tables : :oxen_tables )
4
+
5
+ has_paper_trail
6
+
7
+ belongs_to :account
8
+ has_many :printers, dependent: :destroy
9
+
10
+ validates :mac_addr, presence: true
11
+ validates :port, presence: true
12
+
13
+ scope :active, -> { where(active: true) }
14
+
15
+ def list_title
16
+ location
17
+ end
18
+
19
+
20
+
21
+ end
@@ -1,4 +1,5 @@
1
1
  da:
2
+ print_delivered_by_email: 'Din udskrift er vedhæftet denne email'
2
3
  oxen:
3
4
  printers:
4
5
  form:
@@ -1,6 +1,6 @@
1
1
  #encoding: utf-8
2
2
  class ActionPrinter < ActionView::Base
3
-
3
+
4
4
  include Exceptions
5
5
 
6
6
  attr_accessor :printer, :paper
@@ -15,6 +15,10 @@ class ActionPrinter < ActionView::Base
15
15
  @printer.command
16
16
  end
17
17
 
18
+ def command=val
19
+ @printer.command=val
20
+ end
21
+
18
22
  #
19
23
  # the default rendering is from a string of chars to an html file - statically placed
20
24
  # for who ever knows the exact path to the file, to see
@@ -24,7 +28,7 @@ class ActionPrinter < ActionView::Base
24
28
  # TODO vi får en fejl her når vi begynder at mixe modellerne f.eks. Employee.find_by_sql('select * from products')
25
29
  rc = print_job.printing_class.constantize
26
30
  coll = rc.find_by_sql( print_job.print_sql)
27
- locals = { resource_class: rc, collection: coll, resource: coll.first }
31
+ locals = { resource_class: rc, collection: coll, resource: coll.first, resources: coll }
28
32
  #
29
33
  # TODO args must be mergeable ;)
30
34
  # if args.flatten.compact.any?
@@ -47,14 +51,18 @@ class ActionPrinter < ActionView::Base
47
51
  end
48
52
 
49
53
  # the default print is sending a link to the user who ordered the print
50
- def do_print copies, usr=nil
51
- # move pdf_file_path to a static place where it will not be accidentally deleted from
52
- # static_path = File.join(Rails.root,'public','files','1.pdf')
53
- # var = %x[ mv #{pdf_file_path} #{static_path} 2>&1 ]
54
- # send email to usr with link
55
- # raise MovingFileFailedError.new(var) unless var.blank?
56
- PrinterMailer.send_print(usr,file_path).deliver_now if usr
57
- true
54
+ #
55
+ def do_print print_job, args
56
+ result = nil
57
+ prn = printer
58
+ if prn.nil? or prn.command.blank? or prn.command=="email"
59
+ mail_print print_job, args
60
+ else
61
+ print_print prn, print_job, args
62
+ end
63
+ rescue => e
64
+ logit :error, "Printing failed! The error was #{e.message}"
65
+ false
58
66
  end
59
67
 
60
68
  #
@@ -96,12 +104,51 @@ class ActionPrinter < ActionView::Base
96
104
 
97
105
  def send_print_file context
98
106
  context.send_file pdf_file_path, filename: 'oxen_file', type: get_file_type, disposition: "attachment"
107
+ # send_file path, type: asset_content_type, disposition: 'inline', filename: filename
99
108
  # context.cookies['fileDownload'] = 'true'
100
109
  # File.open(pdf_file_path, 'r') do |fp|
101
110
  # context.send_data fp.read.force_encoding('BINARY'), filename: 'oxen_file', type: "application/pdf", disposition: "attachment"
102
111
  # end
103
112
  end
104
113
 
114
+ def mail_print print_job, args
115
+ # move pdf_file_path to a static place where it will not be accidentally deleted from
116
+ # static_path = File.join(Rails.root,'public','files','1.pdf')
117
+ # var = %x[ mv #{pdf_file_path} #{static_path} 2>&1 ]
118
+ # send email to usr with link
119
+ # raise MovingFileFailedError.new(var) unless var.blank?
120
+ msg = args[:message] || "Der er ikke defineret nogen printere til dette job, for dig - så jeg er nødt til at sende dig filen vedhæftet denne email! ;)Du bør kontakte din system administrator og bede om at der bliver oprettet en printer definition til denne printer jobtype, for dig!"
121
+ if print_job.printed_by.nil?
122
+ raise PrintJobPrintingError.new t('action_printer.user_not_found')
123
+ else
124
+ PrinterMailer.send_print(print_job.printed_by,file_path,msg,t('print_delivered_by_email')).deliver_now
125
+ end
126
+ end
127
+
128
+ def print_print prn, print_job, args
129
+ args[:copies] ||= 1
130
+ cmd = build_print_cmd prn, args
131
+ if args[:copies].to_i > 1
132
+ cmdargs = cmd.split(" ")
133
+ f = cmdargs.pop
134
+ cmdargs.push "-n", args[:copies].to_i, f
135
+ cmd = cmdargs.join(" ")
136
+ end
137
+ # Here we start actually printing
138
+ # $1 is the CUPS printer
139
+ # $2 is the PDF file_path_and_name
140
+ # $3 is the PDF filename
141
+ # the command being something along the lines of: lp -d $1 -o media=a4 $2
142
+ return `#{cmd}`
143
+ end
144
+
145
+ def build_print_cmd prn, args
146
+ cups = !prn.printserver ? prn.cups_printer : "#{prn.cups_printer} -h 10.0.0.26:4#{prn.printserver.port}"
147
+ pdf_path = pdf_file_path.split("/")[-1]
148
+ paper = args.delete(:paper) || prn.paper
149
+ prn.command.gsub( /\$1/, cups ).gsub( /\$2/, paper ).gsub( /\$3/, pdf_file_path ).gsub( /\$4/, pdf_path )
150
+ end
151
+
105
152
  def logit( log_type, msg )
106
153
  Rails.logger.send(log_type, "[OXEN] #{Time.now} [#{log_type.to_s}] #{msg}")
107
154
  end
@@ -32,16 +32,15 @@ class CabPrinter < ActionPrinter
32
32
  end
33
33
 
34
34
  # CAB print last command is "A n" where n is the number of copies - an information which we add at print time
35
- def do_print copies=1, usr=nil
35
+ def do_print print_job, args
36
36
  result = nil
37
37
  prn = printer
38
38
  unless prn.command.blank?
39
39
  if prn.command=="email"
40
- prn.delete
41
- return super
40
+ return super print_job, args
42
41
  else
43
- if copies.to_i > 0
44
- cpcmd = `echo 'A #{copies.to_i}\n' >> #{label_file_path}`
42
+ if args[:copies].to_i > 0
43
+ cpcmd = `echo 'A #{args[:copies].to_i}\n' >> #{label_file_path}`
45
44
  label_path = label_file_path.split("/")[-1]
46
45
  pap = paper || prn.paper
47
46
  cmd = prn.command.gsub(/\$1/, prn.cups_printer).gsub(/\$2/, label_file_path)
@@ -13,36 +13,6 @@ class PdfPrinter < ActionPrinter
13
13
  false
14
14
  end
15
15
 
16
- def do_print copies, usr=nil
17
- result = nil
18
- prn = printer
19
- unless prn.command.blank?
20
- if prn.command=="email"
21
- prn.delete
22
- return super
23
- else
24
- pdf_path = pdf_file_path.split("/")[-1]
25
- pap = paper || prn.paper
26
- cmd = prn.command.gsub( /\$1/, prn.cups_printer ).gsub( /\$2/, pap ).gsub( /\$3/, pdf_file_path ).gsub( /\$4/, pdf_path )
27
- if copies > 1
28
- cmdargs = cmd.split(" ")
29
- f = cmdargs.pop
30
- cmdargs.push "-n", copies, f
31
- cmd = cmdargs.join(" ")
32
- end
33
- # Here we start actually printing
34
- # $1 is the CUPS printer
35
- # $2 is the PDF file_path_and_name
36
- # $3 is the PDF filename
37
- # the command being something along the lines of: lp -d $1 -o media=a4 $2
38
- return `#{cmd}`
39
- end
40
- end
41
- rescue => e
42
- logit :error, "Printing failed! The error was #{e.message}"
43
- false
44
- end
45
-
46
16
  def file_path
47
17
  pdf_file_path
48
18
  end
@@ -1,3 +1,3 @@
1
1
  module OxenPrinter
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.7"
3
3
  end
data/lib/print_drivers.rb CHANGED
@@ -49,14 +49,31 @@ module PrintDrivers
49
49
  # print_with will use the action_printer to build the print
50
50
  # and return the resulting filepath
51
51
  #
52
- def print_with action_printer
52
+ def print_with action_printer, args
53
53
  update_column(:state, "printing")
54
- if action_printer && action_printer.do_print(copies,printed_by_id)
55
- update_column(:state, 'done')
56
- action_printer.file_path
54
+ args = set_default_args args
55
+ status = case args[:medium]
56
+ when "email"
57
+ if action_printer
58
+ printed_by.email = args[:email_to]
59
+ action_printer.printer.command="email"
60
+ action_printer.do_print(self,args)
61
+ update_column(:state, 'done')
62
+ action_printer.file_path
63
+ else
64
+ update_column(:state, 'error printing')
65
+ raise PrintJobPrintingError.new t('print_drivers.print_with.email_error')
66
+ end
67
+ when "printer"
68
+ if action_printer && action_printer.do_print(self,args)
69
+ update_column(:state, 'done')
70
+ action_printer.file_path
71
+ else
72
+ update_column(:state, 'error printing')
73
+ raise PrintJobPrintingError.new I18n.t('print_drivers.print_with.print_error')
74
+ end
57
75
  else
58
- update_column(:state, 'error printing')
59
- raise PrintJobPrintingError
76
+ raise PrintJobPrintingError.new I18n.t('print_drivers.print_with.case_error');
60
77
  end
61
78
  end
62
79
 
@@ -71,6 +88,13 @@ module PrintDrivers
71
88
  end
72
89
  end
73
90
 
91
+ def set_default_args args
92
+ args[0][:print] ||= {}
93
+ args[0][:print][:copies] ||= 1
94
+ args[0][:print][:medium] ||= "printer"
95
+ args[0][:print]
96
+ end
97
+
74
98
  # q%{
75
99
  # Problem with CUPS printer definitions - losing knowledge of attached printers
76
100
  #
data/lib/print_engine.rb CHANGED
@@ -10,7 +10,6 @@
10
10
 
11
11
  # http://rarlindseysmash.com/posts/config-and-generators-in-gems
12
12
  #
13
-
14
13
  #
15
14
  #
16
15
  # ARGS # first value is default
@@ -54,12 +53,88 @@ module PrintEngine
54
53
 
55
54
  include Exceptions
56
55
 
56
+ #
57
+ #
58
+ # # list_title
59
+ # def list_title
60
+ # self.respond_to?( "name") ? self.name : "please define list_title on model (#{self.class.to_s})!"
61
+ # end
62
+ #
63
+ # # implement on relevant models
64
+ def find_template template, paper="A4"
65
+ raise 'you have to implement "def find_template(paper)" on your Model'
66
+ # 'label.html.haml'
67
+ end
68
+ #
69
+ #
70
+ #
71
+ # def set_print_defaults options
72
+ # options[:context] ||= ""
73
+ # options[:print_job][:download] = options[:print][:medium]=="download" || false
74
+ # options[:print_job][:print_driver] = spot_the_driver(options)
75
+ # options[:print_job][:paper] = options[:paper] || "A4"
76
+ # options[:print_job][:view_template_path] = find_template( options[:template], options[:paper] ) || params[:print_job][:view_template_path]
77
+ # options
78
+ # end
79
+ #
80
+
81
+ def print_label(options={})
82
+
83
+ options[:context] ||= ""
84
+ options[:print] ||= {}
85
+ options[:print][:collation] = 'record'
86
+ options[:print][:paper] ||= 'label'
87
+ options[:print][:output_type] ||= 'raw'
88
+
89
+ options = self.class.set_print_job_defaults [self], options
90
+ options[:print_job][:print_driver] = options[:print][:print_driver] || :cab
91
+ options[:print_job][:paper] = options[:print][:paper] || "label"
92
+ options[:print_job][:print_format] = options[:print][:collation] || 'record'
93
+ options[:print_job][:view_template_path] = "stock_items/print/zebra_stock_items_label.html.haml"
94
+
95
+ pj = self.class.print [self], options
96
+ end
97
+
98
+
99
+ # options[:print][:printer_name] = options[:print][:printer_name] || ''
100
+ # options[:user] = options[:user] || current_user
101
+
102
+
103
+ def print_record(options={})
104
+
105
+ options[:context] ||= ""
106
+ options[:print] ||= {}
107
+ options[:print][:collation] = 'record'
108
+ options[:print][:paper] ||= 'A4'
109
+ options[:print][:output_type] ||= 'pdf'
110
+
111
+ options = self.class.set_print_job_defaults [self], options
112
+ options[:print_job][:print_driver] = options[:print][:print_driver] || :pdf
113
+ options[:print_job][:paper] = options[:print][:paper] || "A4"
114
+ options[:print_job][:print_format] = options[:print][:collation] || 'record'
115
+ options[:print_job][:view_template_path] = "stock_items/print/slip.html.haml"
116
+
117
+ pj = self.class.print [self], options
118
+ end
119
+
120
+
121
+
57
122
  def self.included(base)
58
123
 
59
124
  #
60
125
  def base.print_list(options={})
126
+ raise NoContextFound.new('ViewContext missing!') if options[:context].blank?
127
+ options[:print] ||= {}
128
+ options[:print][:collation] = 'list'
129
+ options[:print][:paper] ||= 'A4'
130
+ options[:print][:output_type] ||= 'pdf'
131
+
61
132
  options = set_print_job_defaults options[:resources], options
133
+ options[:print_job][:print_driver] = options[:print][:print_driver] || :pdf
134
+ options[:print_job][:paper] = options[:print][:paper] || "A4"
62
135
  options[:print_job][:print_format] = options[:print][:collation] || 'list'
136
+ options[:print_job][:view_template_path] = "stock_items/print/pdf_stock_items_list.html.haml"
137
+
63
138
  pj = print options[:resources], options
64
139
  end
65
140
 
@@ -73,17 +148,25 @@ module PrintEngine
73
148
  # If creating the PrintJob is successful, cycle will be called in print_job.rb
74
149
  # and the PrintJob will be enqueued in the delayed_job queue called 'printing'.
75
150
  # cycle_error will be called in print_job.rb if it cannot be enqueued sucessfully.
151
+ # print[medium] # 'display' | 'email' | 'printer' | 'download'
152
+ # print[output_type] # 'html' | 'pdf' | 'text'
153
+ # print[printer] # what printer to send output to
154
+ # print[email_to] # email address
155
+ # print[message] # body of email
156
+ # print[range] # which pages should print
157
+ # print[copies] # number of copies
158
+
76
159
  def base.print( resources, params )
77
160
  pj = create_print_job( resources, params )
78
161
  if Rails.env=='development' or pj.download
79
162
  return pj.perform params
80
163
  else
81
164
  user = User.find(pj.printed_by_id)
82
- BackgroundPrinterJob.perform_later pj, queue: "printing", account_id: user.account.id
165
+ BackgroundPrinterJob.perform_later pj, queue: "printing", account_id: user.account.id, print: params[:print]
83
166
  # Delayed::Job.enqueue pj, :queue => 'printing'
84
167
  # pj.cycle if Delayed::Job.enqueue pj, :queue => 'printing'
85
168
  # If you comment out above line and use below line with pj.perform instead, you thereby surpass delayed_job, and thus don't have to wait for it
86
- # pj.perform
169
+ # pj.perform queue: "printing", account_id: user.account.id, print: params[:print]
87
170
  return pj
88
171
  end
89
172
  end
@@ -131,19 +214,21 @@ module PrintEngine
131
214
  #
132
215
  # find the best printer for the job
133
216
  def base.default_printer usr, printer_name, paper=nil
134
- if printer_name=="default"
217
+ if printer_name!="default"
218
+ return Printer.find(printer_name) if printer_name.to_i.to_s == printer_name
219
+ Printer.active.find_by( 'name like ?', "%#{printer_name.downcase}%") or raise NoPreferredPrintersFound.new('Printer with name not found!')
220
+ else
221
+ raise NoPreferredPrintersFound.new('No printers found!') if usr.printers.empty?
135
222
  if paper.nil?
136
- printer = (usr.printers.empty? ? nil : usr.printers.active.preferred_printer.first) or raise NoPreferredPrintersFound.new('No preferred printers found!')
223
+ usr.printers.active.preferred_printer.first or raise NoPreferredPrintersFound.new('No preferred printers found!')
137
224
  else
138
- printer = (usr.printers.empty? ? nil : (usr.printers.active.preferred_printer.on_paper(paper).first || usr.printers.on_paper(paper).first ) ) or raise NoPreferredPrintersFound.new('No preferred printers found!')
225
+ usr.printers.active.preferred_printer.on_paper(paper).first || usr.printers.on_paper(paper).first or raise NoPreferredPrintersFound.new('No preferred printers found!')
139
226
  end
140
- else
141
- printer = Printer.active.find_by( 'name like ?', "%#{printer_name.downcase}%")
142
227
  end
143
- # usr.printers.where{ (printownerables.preferred==true) & (printownerables.preferred==true) }
144
-
145
- # raise PrintJobPrinterNotAvailableError
146
- printer || Printer.first
228
+ # # usr.printers.where{ (printownerables.preferred==true) & (printownerables.preferred==true) }
229
+ #
230
+ # # raise PrintJobPrinterNotAvailableError
231
+ # printer || Printer.first
147
232
  end
148
233
 
149
234
  def base.set_resource_sql(resources,params)
@@ -159,70 +244,5 @@ module PrintEngine
159
244
  end
160
245
 
161
246
  end
162
- #
163
- #
164
- # # list_title
165
- # def list_title
166
- # self.respond_to?( "name") ? self.name : "please define list_title on model (#{self.class.to_s})!"
167
- # end
168
- #
169
- # # implement on relevant models
170
- def find_template template, paper="A4"
171
- raise 'you have to implement "def find_template(paper)" on your Model'
172
- # 'label.html.haml'
173
- end
174
- #
175
- #
176
- #
177
- # def set_print_defaults options
178
- # options[:context] ||= ""
179
- # options[:print_job][:download] = options[:print][:medium]=="download" || false
180
- # options[:print_job][:print_driver] = spot_the_driver(options)
181
- # options[:print_job][:paper] = options[:paper] || "A4"
182
- # options[:print_job][:view_template_path] = find_template( options[:template], options[:paper] ) || params[:print_job][:view_template_path]
183
- # options
184
- # end
185
- #
186
-
187
- def print_label(options={})
188
-
189
- options[:context] ||= ""
190
- options[:print] ||= {}
191
- options[:print][:collation] = 'record'
192
- options[:print][:paper] ||= 'label'
193
- options[:print][:output_type] ||= 'raw'
194
-
195
- options = self.class.set_print_job_defaults [self], options
196
- options[:print_job][:print_driver] = options[:print][:print_driver] || :cab
197
- options[:print_job][:paper] = options[:print][:paper] || "label"
198
- options[:print_job][:print_format] = options[:print][:collation] || 'record'
199
- options[:print_job][:view_template_path] = "stock_items/print/zebra_stock_items_label.html.haml"
200
-
201
- pj = self.class.print [self], options
202
- end
203
-
204
-
205
- # options[:print][:printer_name] = options[:print][:printer_name] || ''
206
- # options[:user] = options[:user] || current_user
207
-
208
-
209
- def print_record(options={})
210
-
211
- options[:context] ||= ""
212
- options[:print] ||= {}
213
- options[:print][:collation] = 'record'
214
- options[:print][:paper] ||= 'A4'
215
- options[:print][:output_type] ||= 'pdf'
216
-
217
- options = self.class.set_print_job_defaults [self], options
218
- options[:print_job][:print_driver] = options[:print][:print_driver] || :pdf
219
- options[:print_job][:paper] = options[:print][:paper] || "A4"
220
- options[:print_job][:print_format] = options[:print][:collation] || 'record'
221
- options[:print_job][:view_template_path] = "stock_items/print/slip.html.haml"
222
-
223
- pj = self.class.print [self], options
224
- end
225
-
226
-
227
247
 
228
248
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxen_printer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Walther H Diechmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oxen_job
@@ -69,11 +69,13 @@ files:
69
69
  - app/assets/javascripts/oxen_printer.js
70
70
  - app/controllers/oxen/print_jobs_controller.rb
71
71
  - app/controllers/oxen/printers_controller.rb
72
+ - app/controllers/oxen/printservers_controller.rb
72
73
  - app/jobs/background_printer_job.rb
73
74
  - app/mailers/printer_mailer.rb
74
75
  - app/models/ox_print_job.rb
75
76
  - app/models/ox_printable.rb
76
77
  - app/models/ox_printer.rb
78
+ - app/models/ox_printserver.rb
77
79
  - app/models/ox_template.rb
78
80
  - app/policies/oxen/print_job_policy.rb
79
81
  - app/views/layouts/1mailer.html.haml
@@ -160,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
162
  version: '0'
161
163
  requirements: []
162
164
  rubyforge_project:
163
- rubygems_version: 2.4.5
165
+ rubygems_version: 2.2.2
164
166
  signing_key:
165
167
  specification_version: 4
166
168
  summary: oxen_printer provides printer and print_job management.