Skip to content

Commit

Permalink
feat: Agena3000 integration (#6594)
Browse files Browse the repository at this point in the history
* feat: integration of Agena3000 imports

* small refactor for agena3000

* remove extra database-

* fix issues with pdf images #6587 #6592

* Update lib/ProductOpener/Images.pm

Co-authored-by: Alex Garel <alex@garel.org>

* rename variable

Co-authored-by: Alex Garel <alex@garel.org>
  • Loading branch information
stephanegigandet and alexgarel authored Apr 15, 2022
1 parent 477bfd9 commit a6841ea
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 287 deletions.
1 change: 1 addition & 0 deletions lib/ProductOpener/Config_off.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,7 @@ $options{nova_groups_tags} = {
# Otherwise the org will be created and the source authorized for that org.

$options{import_sources} = {
'agena3000' => "Agena3000",
'codeonline' => "CodeOnline Food",
'equadis' => "Equadis",
'database-usda' => "USDA Global Branded Food Products Database",
Expand Down
28 changes: 14 additions & 14 deletions lib/ProductOpener/Display.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7621,21 +7621,21 @@ CSS

if (defined $product_ref->{data_sources_tags}) {
foreach my $data_source_tagid (@{$product_ref->{data_sources_tags}}) {
if ($data_source_tagid =~ /^database/) {
$data_source_tagid =~ s/-/_/g;

if ($data_source_tagid eq "database_equadis") {
$template_data_ref->{"data_source_database_equadis"}
= sprintf(lang("data_source_database_equadis"),
'<a href="/editor/' . $product_ref->{owner} . '">' . $org_ref->{name} . '</a>',
'<a href="/data-source/database-equadis">Equadis</a>');
if ($data_source_tagid =~ /^database-/) {
my $database_id = $';
my $database_name = deep_get(\%options, "import_sources", $database_id);

# Data sources like Agena3000, CodeOnline, Equadis
if (defined $database_name) {
$template_data_ref->{"data_source_database_provider"} =
f_lang("f_data_source_database_provider", {
manufacturer => '<a href="/editor/' . $product_ref->{owner} . '">' . $org_ref->{name} . '</a>',
provider => '<a href="/data-source/' . $data_source_tagid . '">' . $database_name . '</a>',
});
}
elsif ($data_source_tagid eq "database_codeonline") {
$template_data_ref->{"data_source_database_codeonline"}
= sprintf(lang("data_source_database"),
'<a href="/editor/' . $product_ref->{owner} . '">' . $org_ref->{name} . '</a>',
'<a href="/data-source/database-codeonline">CodeOnline Food</a>');


# For CodeOnline, display an extra note about the producers platform
if ($database_id eq "codeonline") {
$template_data_ref->{"data_source_database_note_about_the_producers_platform"} = lang("data_source_database_note_about_the_producers_platform");
$template_data_ref->{"data_source_database_note_about_the_producers_platform"} =~ s/<producers_platform_url>/$producers_platform_url/g;
}
Expand Down
Loading

0 comments on commit a6841ea

Please sign in to comment.