Skip to content

Commit

Permalink
upgrade to GOBL v0.207.0
Browse files Browse the repository at this point in the history
  • Loading branch information
beliolfa committed Dec 12, 2024
1 parent 9c5beb2 commit fe53dd5
Show file tree
Hide file tree
Showing 22 changed files with 84 additions and 205 deletions.
2 changes: 1 addition & 1 deletion components/bill/invoice/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// HasHeaderQR returns a boolean indicating whether the envelope has some QR codes to be displayed in the header or not.
func HasHeaderQR(env *gobl.Envelope) bool {
hasVerifactu, _, _ := es.HasVerifactuQR(env)
hasVerifactu, _ := es.HasVerifactuQR(env)
hasTicketBAI, _, _ := es.HasTicketBAIQR(env)
return hasVerifactu || hasTicketBAI
}
4 changes: 2 additions & 2 deletions components/bill/invoice/line_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ func prepareLineSupport(inv *bill.Invoice) *lineSupport {
}
}
for _, row := range inv.Discounts {
if row.Ref != "" {
if row.Code != "" {
ls.refs = true
}
}
for _, row := range inv.Charges {
if row.Ref != "" {
if row.Code != "" {
ls.refs = true
}
}
Expand Down
13 changes: 6 additions & 7 deletions components/bill/invoice/lines.templ
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package invoice

import (
"fmt"

"github.com/invopop/gobl/bill"
"github.com/invopop/gobl.html/components/t"
"github.com/invopop/gobl.html/components/regimes/mx"
"github.com/invopop/gobl.html/components/t"
"github.com/invopop/gobl/bill"
)

templ lines(inv *bill.Invoice) {
Expand Down Expand Up @@ -191,8 +190,8 @@ templ discountRow(row *bill.Discount, ls *lineSupport) {
</td>
if ls.refs {
<td class="ref">
if row.Ref != "" {
{ row.Ref }
if row.Code != "" {
{ row.Code.String() }
} else {
<!-- empty -->
}
Expand Down Expand Up @@ -262,8 +261,8 @@ templ chargeRow(row *bill.Charge, ls *lineSupport) {
</td>
if ls.refs {
<td class="ref">
if row.Ref != "" {
{ row.Ref }
if row.Code != "" {
{ row.Code.String() }
} else {
<!-- empty -->
}
Expand Down
33 changes: 16 additions & 17 deletions components/bill/invoice/lines_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/bill/invoice/payment.templ
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ templ paymentInstructions(inst *pay.Instructions) {
@t.T(".ref")
</span>
<span class="value">
{ inst.Ref }
{ inst.Ref.String() }
</span>
</li>
}
Expand Down
4 changes: 2 additions & 2 deletions components/bill/invoice/payment_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions components/bill/invoice/summary.templ
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/invopop/gobl/cal"
"github.com/invopop/gobl/cbc"
"github.com/invopop/gobl/currency"
"github.com/invopop/gobl/tax"
"strings"
)

Expand Down Expand Up @@ -150,7 +149,7 @@ func currencyName(ctx context.Context, cur currency.Code) string {
return i18n.T(ctx, "billing.invoice.summary.currency_value", i18n.M{"desc": name, "code": cur})
}

func mapTaxExtension(ctx context.Context, k cbc.Key, v tax.ExtValue) string {
func mapTaxExtension(ctx context.Context, k cbc.Key, v cbc.Code) string {
// find the key translation
label := i18n.T(ctx, ".ext_map."+k.String())
if strings.HasPrefix(label, "!") { // if match found
Expand Down
19 changes: 9 additions & 10 deletions components/bill/invoice/summary_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 0 additions & 23 deletions components/bill/invoice/totals.templ
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,6 @@ templ totalsBaseRows(inv *bill.Invoice, totals *bill.Totals) {
}

templ totalsPayableRows(inv *bill.Invoice, totals *bill.Totals) {
if totals.Outlays != nil {
for _, o := range inv.Outlays {
<tr class="outlay">
<th>
@t.T(".outlay", i18n.M{"i": o.Index, "txt": outlayText(o)})
</th>
<td>
@t.LM(o.Amount)
</td>
</tr>
}
}
<tr class="payable strong">
<th>
if inv.Type.In(bill.InvoiceTypeCreditNote) {
Expand Down Expand Up @@ -204,14 +192,3 @@ func advanceMap(adv *pay.Advance) i18n.M {
}
return i18n.M{"date": date, "txt": txt}
}

func outlayText(outlay *bill.Outlay) string {
txt := outlay.Description
if outlay.Code != "" {
txt = outlay.Code + " " + txt
}
if outlay.Date != nil {
txt += " " + outlay.Date.String()
}
return txt
}
35 changes: 0 additions & 35 deletions components/bill/invoice/totals_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fe53dd5

Please sign in to comment.