Skip to content

DEICH-5969 make use of unused address column as branch 'navnetrekk'

Petter Goksøyr Åsen requested to merge DEICH-5969 into master

Currently, the name of the branch ('navnetrekk') is generated dynamically in some templates as "Deichman {branchname}", but this does not work out well for "Demo Linderud", which becomes "Deichman Demo Linderud".

This commit introduces a simple solution, by making use of an unused column branches.branchaddress1 as 'navnetrekk', which then can be used in the templates.

The edit branches view in koha is updated with renaming branchaddress1 to navnetrekk, to make it clear. Also removes remaining address columns from edit view, as they should not be used.

The following SQL queries must be run to populate the column and to migrate the templates:

-- Use column branches.branchaddress1 as 'navnetrekk', defaulting to 'Deichman {branchname}'
-- Update known exception: 'Demo Linderud'
UPDATE branches SET branchaddress1=CONCAT('Deichman ', branchname);
UPDATE branches SET branchaddress1='Demo Linderud' WHERE branchcode='flin';

-- Update templates (will update HOLD_PICKUP)
UPDATE letter
  SET content=REPLACE(content, 'Deichman [% data.branch.branchname %]', '[% data.branch.branchaddress1 %]');

Closes DEICH-5969

Edited by Petter Goksøyr Åsen

Merge request reports