release: v2.8.15 format ALSO periods on separate line
This commit is contained in:
parent
dbdb1c554a
commit
4b608da4c5
11
MDfile/RELEASE_NOTES_v2.8.15.md
Normal file
11
MDfile/RELEASE_NOTES_v2.8.15.md
Normal file
@ -0,0 +1,11 @@
|
||||
# BMC Hub v2.8.15
|
||||
|
||||
## ALSO-perioder på ordrelinjer
|
||||
|
||||
- Viser perioden fra `Actual Charge Interval` på en ny linje under produktnavnet.
|
||||
- Migration 248 retter eksisterende, ikke-eksporterede ALSO-ordrekladder.
|
||||
- Allerede eksporterede ordre ændres ikke.
|
||||
|
||||
## Opgradering
|
||||
|
||||
Kør `migrations/248_also_order_period_line_break.sql` efter deployment.
|
||||
@ -2027,7 +2027,7 @@ class AlsoService:
|
||||
description = line.get("product_name") or line.get("matched_product_name") or "Cloud abonnement"
|
||||
charge_period = _format_charge_period(line.get("charge_interval"))
|
||||
if charge_period:
|
||||
description = f"{description} · Periode: {charge_period}"
|
||||
description = f"{description}\nPeriode: {charge_period}"
|
||||
|
||||
draft_lines.append(
|
||||
{
|
||||
|
||||
26
migrations/248_also_order_period_line_break.sql
Normal file
26
migrations/248_also_order_period_line_break.sql
Normal file
@ -0,0 +1,26 @@
|
||||
BEGIN;
|
||||
|
||||
-- Put the ALSO billing period on its own line for pending order drafts.
|
||||
UPDATE ordre_drafts
|
||||
SET lines_json = (
|
||||
SELECT jsonb_agg(
|
||||
CASE
|
||||
WHEN item->>'source_type' = 'also_cloud'
|
||||
AND COALESCE(item->>'description', '') LIKE '% · Periode: %'
|
||||
THEN jsonb_set(
|
||||
item,
|
||||
'{description}',
|
||||
to_jsonb(replace(item->>'description', ' · Periode: ', E'\nPeriode: '))
|
||||
)
|
||||
ELSE item
|
||||
END
|
||||
ORDER BY ordinality
|
||||
)
|
||||
FROM jsonb_array_elements(lines_json) WITH ORDINALITY AS source(item, ordinality)
|
||||
),
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE sync_status = 'pending'
|
||||
AND invoice_aggregate_key LIKE 'also-cloud-%'
|
||||
AND lines_json::text LIKE '% · Periode: %';
|
||||
|
||||
COMMIT;
|
||||
Loading…
Reference in New Issue
Block a user