Bug 31137: Only display label printer profiles when editing labels

This patch filters the printer profiles in the label edition template so you may only choose Printer Profiles created for Labels.

To test
1 Create a new Printer Profile in Patron Cards
2 Edit a Label template, pick the Printer Profile you just created.
3 Save the Label Template. You get an error 500
4 apply patch, restart services
5 Edit a Label template and check that you can't pick the Printer Profile you created in Patron Cards

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Adolfo Rodríguez 2022-07-12 09:20:45 +02:00 committed by Tomas Cohen Arazi
parent 098866cab0
commit e7d0b2ab47
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 1 additions and 1 deletions

View File

@ -46,7 +46,7 @@ my $units = get_unit_values();
if ($op eq 'edit') {
$label_template = C4::Labels::Template->retrieve(template_id => $template_id);
$profile_list = get_all_profiles({ fields => [ qw( profile_id printer_name paper_bin ) ], filters => { template_id => [ $template_id, '' ] } } );
$profile_list = get_all_profiles({ fields => [ qw( profile_id printer_name paper_bin ) ], filters => { template_id => [ $template_id, '' ], creator => 'Labels'} } );
push @$profile_list, {paper_bin => 'N/A', profile_id => 0, printer_name => 'No Profile'};
foreach my $profile (@$profile_list) {
if ($profile->{'profile_id'} == $label_template->get_attr('profile_id')) {