diff --git a/C4/Letters.pm b/C4/Letters.pm
index 3221e1f612..dd8291aac0 100644
--- a/C4/Letters.pm
+++ b/C4/Letters.pm
@@ -1848,7 +1848,13 @@ sub _get_tt_params {
singular => 'illrequest',
plural => 'illrequests',
pk => 'illrequest_id'
- }
+ },
+ preservation_train_items => {
+ module => 'Koha::Preservation::Train::Items',
+ singular => 'train_item',
+ plural => 'train_items',
+ pk => 'train_item_id'
+ },
};
foreach my $table ( keys %$tables ) {
diff --git a/Koha/Preservation/Train/Item.pm b/Koha/Preservation/Train/Item.pm
index 413e18410b..b6c65de52b 100644
--- a/Koha/Preservation/Train/Item.pm
+++ b/Koha/Preservation/Train/Item.pm
@@ -62,6 +62,18 @@ sub catalogue_item {
return Koha::Item->_new_from_dbic($item_rs);
}
+=head3 train
+
+Return the train object for this item
+
+=cut
+
+sub train {
+ my ( $self ) = @_;
+ my $rs = $self->_result->train;
+ return Koha::Preservation::Train->_new_from_dbic($rs);
+}
+
=head3 attributes
Getter and setter for the attributes
diff --git a/api/v1/swagger/definitions/preservation_processing.yaml b/api/v1/swagger/definitions/preservation_processing.yaml
index 62ef2d8a9a..4ae51d9257 100644
--- a/api/v1/swagger/definitions/preservation_processing.yaml
+++ b/api/v1/swagger/definitions/preservation_processing.yaml
@@ -8,6 +8,11 @@ properties:
name:
description: name of the processing
type: string
+ letter_code:
+ description: Letter code of the letter to use for printing slips
+ type:
+ - string
+ - "null"
attributes:
description: attributes of the processing
items:
diff --git a/api/v1/swagger/paths/preservation_trains.yaml b/api/v1/swagger/paths/preservation_trains.yaml
index 6e316e6c32..fca0cda0be 100644
--- a/api/v1/swagger/paths/preservation_trains.yaml
+++ b/api/v1/swagger/paths/preservation_trains.yaml
@@ -168,6 +168,7 @@
- items.attributes
- items.attributes+strings
- items.attributes.processing_attribute
+ - items.processing
- default_processing
- default_processing.attributes
collectionFormat: csv
diff --git a/debian/templates/apache-shared-intranet.conf b/debian/templates/apache-shared-intranet.conf
index 75f495eb38..b4fe0ea226 100644
--- a/debian/templates/apache-shared-intranet.conf
+++ b/debian/templates/apache-shared-intranet.conf
@@ -21,6 +21,7 @@ RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
RewriteRule ^/cgi-bin/koha/erm/.*$ /cgi-bin/koha/erm/erm.pl [PT]
+RewriteCond %{REQUEST_URI} !^/cgi-bin/koha/preservation/.*.pl$
RewriteRule ^/cgi-bin/koha/preservation/.*$ /cgi-bin/koha/preservation/home.pl [PT]
Alias "/api" "/usr/share/koha/api"
diff --git a/installer/data/mysql/atomicupdate/bug_33547.pl b/installer/data/mysql/atomicupdate/bug_33547.pl
new file mode 100755
index 0000000000..980153fe30
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_33547.pl
@@ -0,0 +1,37 @@
+use Modern::Perl;
+
+return {
+ bug_number => "33547",
+ description => "Add a new notice template 'PRES_TRAIN_ITEM'",
+ up => sub {
+ my ($args) = @_;
+ my ($dbh, $out) = @$args{qw(dbh out)};
+
+ unless ( column_exists('preservation_processings', 'letter_code') ) {
+ $dbh->do(q{
+ ALTER TABLE preservation_processings
+ ADD COLUMN `letter_code` varchar(20) DEFAULT NULL COMMENT 'Foreign key to the letters table' AFTER `name`
+ });
+ }
+
+ my $notice_template = q{[%~ SET train = train_item.train ~%]
+[%~ SET item = train_item.catalogue_item ~%]
+Train name: [% train.name %]
+Sent on: [% train.sent_on | $KohaDates %]
+
+[% train.default_processing.name %]
+
+Item number #[% train_item.user_train_item_id %]
+
+[% FOREACH item_attribute IN train_item.attributes %]
+ [% item_attribute.processing_attribute.name %]: [% item_attribute.value %]
+[% END %]};
+
+ $dbh->do(q{
+ INSERT IGNORE INTO letter
+ (module,code,branchcode,name,is_html,title,content,message_transport_type,lang)
+ VALUES
+ ('preservation','PRES_TRAIN_ITEM','','Train item slip',0,'Train item slip',?, 'print','default')}, undef, $notice_template);
+ say $out "Added new letter 'PRES_TRAIN_ITEM' (print)";
+ },
+};
diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml
index 8d368e659e..b9ac82e621 100644
--- a/installer/data/mysql/en/mandatory/sample_notices.yml
+++ b/installer/data/mysql/en/mandatory/sample_notices.yml
@@ -2384,3 +2384,25 @@ tables:
- "[% IF ( biblio.items.count > 0 ) %]
Items:
[% FOREACH item IN biblio.items %]- [% Branches.GetName( item.holdingbranch ) | html %]"
- "[% IF ( item.location ) %], [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %][% END %][% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %][% item.barcode | html %]
[% END %]
[% END %]"
- "
[% END %]"
+
+ - module: preservation
+ code: PRES_TRAIN_ITEM
+ branchcode: ""
+ name: "Train item slip"
+ is_html: 0
+ title: "Train item slip"
+ message_transport_type: print
+ lang: default
+ content:
+ - "[%~ SET train = train_item.train ~%]"
+ - "[%~ SET item = train_item.catalogue_item ~%]"
+ - "Train name: [% train.name %]"
+ - "Sent on: [% train.sent_on | $KohaDates %]"
+ - ""
+ - "[% train.default_processing.name %]"
+ - ""
+ - "Item number #[% train_item.user_train_item_id %]"
+ - ""
+ - "[% FOREACH item_attribute IN train_item.attributes %]"
+ - " [% item_attribute.processing_attribute.name %]: [% item_attribute.value %]"
+ - "[% END %]"
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index c99e69e2b7..ae30fd3478 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -4849,6 +4849,7 @@ DROP TABLE IF EXISTS `preservation_processings`;
CREATE TABLE `preservation_processings` (
`processing_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`name` varchar(80) NOT NULL COMMENT 'name of the processing',
+ `letter_code` varchar(20) DEFAULT NULL COMMENT 'Foreign key to the letters table',
PRIMARY KEY (`processing_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt
index 3969527783..14771f064e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/preservation/home.tt
@@ -34,6 +34,7 @@
const authorised_value_categories = [% To.json(AuthorisedValues.GetCategories()) | $raw %].map(c => c.category);
const db_columns = [% To.json(db_columns) | $raw %];
const api_mappings = [% To.json(api_mappings) | $raw %];
+ const notice_templates = [% To.json(notice_templates || []) | $raw %];
const csrf_token = "[% Koha.GenerateCSRF | $raw %]";
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
index 9d773dd96a..79e660255c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
@@ -168,6 +168,7 @@
Interlibrary loans
Order acquisition
Patrons
+ Preservation
Serials (new issue)
Suggestions
Point of sale
@@ -225,6 +226,7 @@
[% CASE 'reserves' %]Holds
[% CASE 'ill' %]Interlibrary loans
[% CASE 'members' %]Patrons
+ [% CASE 'preservation' %]Preservation
[% CASE 'serial' %]Serials (new issue)
[% CASE 'suggestions' %]Suggestions
[% CASE 'pos' %]Point of sale
@@ -389,6 +391,11 @@
[% ELSE %]
[% END %]
+ [% IF ( module == "preservation" ) %]
+
+ [% ELSE %]
+
+ [% END %]
[% IF ( module == "serial" ) %]
[% ELSE %]
diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue
index 6504cb6a0b..b839893977 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue
+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue
@@ -21,6 +21,20 @@
/>
{{ $__("Required") }}
+
+
+
+