Browse Source

Bug 26618: (QA follow-up) Update messages syntax

As highlighted, we were not using the standard form of message passing
here. This patch updates the template and controller to adopt the more
usual syntax.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
Martin Renvoize 7 months ago
committed by Jonathan Druart
parent
commit
7369fa5e50
  1. 10
      C4/RotatingCollections.pm
  2. 18
      koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt

10
C4/RotatingCollections.pm

@ -473,7 +473,8 @@ sub TransferCollection {
); # Queue transfer
push @{$messages},
{
type => 'enqueu',
type => 'alert',
code => 'enqueued',
item => $item_object,
found_transfer => $found_transfer
};
@ -492,7 +493,12 @@ sub TransferCollection {
}
}
elsif ( $_->isa('Koha::Exceptions::Item::Transfer::Limit') ) {
push @{$messages}, { type => 'failure', item => $item_object };
push @{$messages},
{
type => 'error',
code => 'limits',
item => $item_object
};
}
else {
$_->rethrow();

18
koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt

@ -21,16 +21,14 @@
[% IF ( messages ) %]
[% FOREACH message IN messages %]
[%- SWITCH message.type -%]
[%- CASE 'failure' %]
<div class="dialog error">
<p>Cannot transfer item [% message.item.itemnumber | html %] due to transfer limits</p>
</div>
[%- CASE 'enqueu' -%]
<div class="dialog message">
<p>Item [% message.item.itemnumber | html %] queued behind [% message.found_transfer.reason | html %] transfer to [% Branches.GetName(message.found_transfer.tobranch) | html %]</p>
</div>
[% END %]
<div class="dialog [% m.type | html %]">
[%- SWITCH message.code -%]
[%- CASE 'limits' %]
<p>Cannot transfer item [% message.item.itemnumber | html %] due to transfer limits</p>
[%- CASE 'enqueued' -%]
<p>Item [% message.item.itemnumber | html %] queued behind [% message.found_transfer.reason | html %] transfer to [% Branches.GetName(message.found_transfer.tobranch) | html %]</p>
[% END %]
</div>
[% END %]
[% END %]

Loading…
Cancel
Save