lucadeal 0.5.2 → 0.5.4

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
  SHA256:
3
- metadata.gz: 010b355d37f7fdd2fa49fa9000923fbaac7791bbda971760b8c862daa4ab2664
4
- data.tar.gz: e6a2cc3bbef17ee547ba669b22f1390782e6567b753da98288a760106fb31215
3
+ metadata.gz: 2949b0572b91897e61ac23dddef865f9779493a682dea931f761c7dcad6c6d67
4
+ data.tar.gz: 220961320a93dfd9f32481d667ebce0ef44848f12735972e085a315f5cccf673
5
5
  SHA512:
6
- metadata.gz: beb6f9aa0a2c02f4726faab2b7aa9d398c1256dd106a5c5595ce1f48da757c9699577661be6fb2de5bab8b19da9a147716000cae4400c0f004e90375bf371801
7
- data.tar.gz: ad20fd6cdc1c2f056206398a4266a89b7523be8aabed79c2a80d53f001205d23e3830c55b4baf8e5db186cf86dce04236aea296fd07c511658af90e3ec06ff26
6
+ metadata.gz: b23afc420d0a0f3389a6e18c1687a0df15afebef13d1328e3afd8e55837790548b1160f0e9586c279304e50cf2524523b03c714f054f6e8dfe36b55d30b1b382
7
+ data.tar.gz: 22273a0acfaaad332070fa2a7235f3709cd2571325f04293122800c62a979336dbff201fa3311a8d5dcfc50d5a583adb99e968c27744b5824ba5e86090712884
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## LucaDeal 0.5.4
2
+
3
+ * Fix: missing CONST visibility.
4
+
5
+ ## LucaDeal 0.5.3
6
+
7
+ * Implement `luca-deal invoices print --sample` option.
8
+
1
9
  ## LucaDeal 0.5.2
2
10
 
3
11
  * Fix: Setup project dir for `luca-deal invoice mail`
data/exe/luca-deal CHANGED
@@ -432,6 +432,7 @@ when /invoices?/, 'i'
432
432
  OptionParser.new do |opt|
433
433
  opt.banner = 'Usage: luca-deal invoices print [options] <invoice_id | year month>'
434
434
  opt.on('--pdf', 'output PDF invoices. wkhtmlpdf is required') { |_v| params[:output] = :pdf }
435
+ opt.on('--sample', 'Replace recepient info with issuer info') { |_v| params[:sample] = true }
435
436
  args = opt.parse(ARGV)
436
437
  LucaCmd.check_dir(REQUIRED_DIR) do
437
438
  LucaCmd::Invoice.print(args, params)
data/lib/luca_deal/fee.rb CHANGED
@@ -66,7 +66,7 @@ module LucaDeal
66
66
  end
67
67
 
68
68
  def deliver_mail(attachment_type = nil, mode: nil, skip_no_item: true)
69
- attachment_type = CONST.config.dig('fee', 'attachment') || :html
69
+ attachment_type = LucaRecord::CONST.config.dig('fee', 'attachment') || :html
70
70
  fees = self.class.asof(@date.year, @date.month)
71
71
  raise "No report for #{@date.year}/#{@date.month}" if fees.count.zero?
72
72
 
@@ -75,7 +75,7 @@ module LucaDeal
75
75
  next if skip_no_item && dat['items'].empty?
76
76
 
77
77
  mail = compose_mail(dat, mode: mode, attachment: attachment_type.to_sym)
78
- LucaSupport::Mail.new(mail, CONST.pjdir).deliver
78
+ LucaSupport::Mail.new(mail, LucaRecord::CONST.pjdir).deliver
79
79
  self.class.add_status!(path, 'mail_delivered') if mode.nil?
80
80
  end
81
81
  end
@@ -100,9 +100,9 @@ module LucaDeal
100
100
 
101
101
  mail = Mail.new
102
102
  mail.to = dat.dig('customer', 'to') if mode.nil?
103
- mail.subject = CONST.config.dig('fee', 'mail_subject') || 'Your Report is available'
103
+ mail.subject = LucaRecord::CONST.config.dig('fee', 'mail_subject') || 'Your Report is available'
104
104
  if mode == :preview
105
- mail.cc = CONST.config.dig('mail', 'preview') || CONST.config.dig('mail', 'from')
105
+ mail.cc = LucaRecord::CONST.config.dig('mail', 'preview') || LucaRecord::CONST.config.dig('mail', 'from')
106
106
  mail.subject = '[preview] ' + mail.subject
107
107
  end
108
108
  mail.text_part = Mail::Part.new(body: render_erb(search_template('fee-report-mail.txt.erb')), charset: 'UTF-8')
@@ -226,7 +226,7 @@ module LucaDeal
226
226
  # TODO: load labels from CONST.config before country defaults
227
227
  #
228
228
  def export_labels
229
- case CONST.confg['country']
229
+ case LucaRecord::CONST.confg['country']
230
230
  when 'jp'
231
231
  {
232
232
  debit: { fee: '支払手数料', tax: '支払手数料', deduction: '未払費用' },
@@ -244,9 +244,9 @@ module LucaDeal
244
244
  #
245
245
  def set_company
246
246
  {}.tap do |h|
247
- h['name'] = CONST.config.dig('company', 'name')
248
- h['address'] = CONST.config.dig('company', 'address')
249
- h['address2'] = CONST.config.dig('company', 'address2')
247
+ h['name'] = LucaRecord::CONST.config.dig('company', 'name')
248
+ h['address'] = LucaRecord::CONST.config.dig('company', 'address')
249
+ h['address2'] = LucaRecord::CONST.config.dig('company', 'address2')
250
250
  end
251
251
  end
252
252
 
@@ -280,9 +280,9 @@ module LucaDeal
280
280
  # load Tax Rate from config.
281
281
  #
282
282
  def load_tax_rate(name)
283
- return 0 if CONST.config.dig('tax_rate', name).nil?
283
+ return 0 if LucaRecord::CONST.config.dig('tax_rate', name).nil?
284
284
 
285
- BigDecimal(take_current(CONST.config['tax_rate'], name).to_s)
285
+ BigDecimal(take_current(LucaRecord::CONST.config['tax_rate'], name).to_s)
286
286
  end
287
287
 
288
288
  # Fees are unique contract_id in each month
@@ -47,14 +47,14 @@ module LucaDeal
47
47
  if id
48
48
  dat = self.class.find(id)
49
49
  @company = set_company
50
- invoice_vars(dat)
50
+ invoice_vars(dat, params[:sample])
51
51
  File.open(attachment_name(dat, filetype), 'w') do |f|
52
52
  f.puts render_invoice(filetype)
53
53
  end
54
54
  else
55
55
  self.class.asof(@date.year, @date.month) do |dat, _|
56
56
  @company = set_company
57
- invoice_vars(dat)
57
+ invoice_vars(dat, params[:sample])
58
58
  File.open(attachment_name(dat, filetype), 'w') do |f|
59
59
  f.puts render_invoice(filetype)
60
60
  end
@@ -410,8 +410,8 @@ module LucaDeal
410
410
 
411
411
  # set variables for ERB template
412
412
  #
413
- def invoice_vars(invoice_dat)
414
- @customer = invoice_dat['customer']
413
+ def invoice_vars(invoice_dat, sample = false)
414
+ @customer = sample ? @company : invoice_dat['customer']
415
415
  @items = readable(invoice_dat['items'])
416
416
  @subtotal = readable(invoice_dat['subtotal'])
417
417
  @issue_date = invoice_dat['issue_date']
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaDeal
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucadeal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-16 00:00:00.000000000 Z
11
+ date: 2024-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucarecord