Skip to content

Commit

Permalink
fix: Add a new sheet for categories to the import spreadsheet template (
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSussex authored Mar 28, 2024
1 parent 1a49cc0 commit 5dcfef1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cgi/generate_sample_import_file.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use ProductOpener::Producers qw/generate_import_export_columns_groups_for_select2/;
use ProductOpener::Tags qw/%language_fields %tags_fields/;
use ProductOpener::Food qw/default_unit_for_nid/;
use ProductOpener::TaxonomySuggestions qw/:all/;

use Apache2::RequestRec ();
use Apache2::Const ();
Expand All @@ -54,6 +55,8 @@

my $workbook = Excel::Writer::XLSX->new(\*STDOUT);
my $worksheet = $workbook->add_worksheet();
my $worksheet_categories = $workbook->add_worksheet(lang("categories"));

my %formats = (
normal => $workbook->add_format(border => 1, bold => 1),
mandatory => $workbook->add_format(
Expand Down Expand Up @@ -249,4 +252,11 @@
}
}

my $tagtype = "categories";
my @category_entries = ProductOpener::TaxonomySuggestions::generate_sorted_list_of_taxonomy_entries($tagtype, $lc, {});
foreach my $i (0 .. $#category_entries) {
my $category_entry = display_taxonomy_tag($lc, $tagtype, $category_entries[$i]);
$worksheet_categories->write($i, 0, $category_entry);
}

exit(0);
1 change: 1 addition & 0 deletions lib/ProductOpener/TaxonomySuggestions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ BEGIN {
@EXPORT_OK = qw(
&get_taxonomy_suggestions_with_synonyms
&get_taxonomy_suggestions
&generate_sorted_list_of_taxonomy_entries
); # symbols to export on request
%EXPORT_TAGS = (all => [@EXPORT_OK]);
}
Expand Down

0 comments on commit 5dcfef1

Please sign in to comment.