Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove warning in KnowledgePanelsReportProblem.pm, remove report problem card from pro platform #10112

Merged
merged 4 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lib/ProductOpener/KnowledgePanels.pm
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,24 @@ sub create_knowledge_panels ($product_ref, $target_lc, $target_cc, $options_ref)

create_health_card_panel($product_ref, $target_lc, $target_cc, $options_ref);
create_environment_card_panel($product_ref, $target_lc, $target_cc, $options_ref);
create_report_problem_card_panel($product_ref, $target_lc, $target_cc, $options_ref);
my $has_report_problem_card;
if (not $options_ref->{producers_platform}) {
$has_report_problem_card = create_report_problem_card_panel($product_ref, $target_lc, $target_cc, $options_ref);
}
my $has_contribution_card = create_contribution_card_panel($product_ref, $target_lc, $target_cc, $options_ref);

# Create the root panel that contains the panels we want to show directly on the product page
create_panel_from_json_template(
"root",
"api/knowledge-panels/root.tt.json",
{has_contribution_card => $has_contribution_card},
$product_ref, $target_lc, $target_cc, $options_ref
{
has_report_problem_card => $has_report_problem_card,
has_contribution_card => $has_contribution_card
},
$product_ref,
$target_lc,
$target_cc,
$options_ref
);
return;
}
Expand Down
7 changes: 3 additions & 4 deletions lib/ProductOpener/KnowledgePanelsReportProblem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ sub create_report_problem_card_panel ($product_ref, $target_lc, $target_cc, $opt
$log->debug("create contribution card panel", {code => $product_ref->{code}}) if $log->is_debug();

my @panels = ();
my $panel_data_ref = {};

# TODO: add a panel to display the consumer service contact information if we have it
# for the owner of the product. Otherwise, warn that we don't make or sell the product
Expand All @@ -92,7 +91,7 @@ sub create_report_problem_card_panel ($product_ref, $target_lc, $target_cc, $opt
create_panel_from_json_template(
"incomplete_or_incorrect_data",
"api/knowledge-panels/report_problem/incomplete_or_incorrect_data.tt.json",
$panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref
{}, $product_ref, $target_lc, $target_cc, $options_ref
);
push(@panels, "incomplete_or_incorrect_data");

Expand All @@ -107,7 +106,7 @@ sub create_report_problem_card_panel ($product_ref, $target_lc, $target_cc, $opt
create_panel_from_json_template(
"fr_report_product_signalconso",
"api/knowledge-panels/report_problem/fr_report_product_signalconso.tt.json",
$panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref
{}, $product_ref, $target_lc, $target_cc, $options_ref
);
push(@panels, "fr_report_product_signalconso");
}
Expand All @@ -117,7 +116,7 @@ sub create_report_problem_card_panel ($product_ref, $target_lc, $target_cc, $opt
"api/knowledge-panels/report_problem/report_problem_card.tt.json",
$panel_data_ref, $product_ref, $target_lc, $target_cc, $options_ref);

return;
return 1;
}

1;
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"html": `
Vous avez rencontré un problème avec ce produit : <b>étiquetage non conforme, produit périmé encore en vente,
présence d'un corps étranger, etc.</b> ?<br>
Faites un signalement à l'entreprise et à la répression des fraudes sur SignalConso, un outil de la
Direction générale de la concurrence, de la consommation et de la répression des fraudes (DGCCRF).
Faites un signalement à l'entreprise et à la répression des fraudes sur <a href="https://signal.conso.gouv.fr/fr/alimentaire-codebarres/faire-un-signalement?gtin=[% product.code %]&utm_source=openfoodfacts&utm_campaign=product_page_panel">SignalConso</a>,
un outil de la Direction générale de la concurrence, de la consommation et de la répression des fraudes (DGCCRF).
`
},
},
Expand Down
4 changes: 3 additions & 1 deletion templates/api/knowledge-panels/root.tt.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
"panel_id": "environment_card",
},
},
[% IF panel.has_report_problem_card %]
{
"element_type": "panel",
"panel_element": {
"panel_id": "report_problem_card",
},
},
},
[% END %]
[% IF panel.has_contribution_card %]
{
"element_type": "panel",
Expand Down
8 changes: 4 additions & 4 deletions templates/web/pages/product/product_page.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ <h2 id="match_title">[% lang('matching_with_your_preferences') %]</h2>
<div class="large-12 column">
<div class="card">
<div class="card-section">



<h2 id="product_other_information" class="text-medium">[% lang('product_other_information') %]</h2>
<div class="row">
<div class="small-12 columns">
Expand All @@ -243,8 +240,10 @@ <h2 id="product_other_information" class="text-medium">[% lang('product_other_in
</div>
</div>
</section>
[% END %]
[% END %]

<!-- Report problem card, if not on the platform for producers -->
[% IF ! server_options_producers_platform %]
<section class="row" id="report_problem">
<div class="large-12 column">
<div class="card">
Expand All @@ -254,6 +253,7 @@ <h2 id="product_other_information" class="text-medium">[% lang('product_other_in
</div>
</div>
</section>
[% END %]

<!-- Platform for producers: data quality issues and improvements opportunities -->
[% IF server_options_producers_platform %]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3257,6 +3257,8 @@ <h3 class="panel_title_card">Transportation</h3>
<!-- other fields -->


<!-- Report problem card, if not on the platform for producers -->

<section class="row" id="report_problem">
<div class="large-12 column">
<div class="card">
Expand Down Expand Up @@ -3375,6 +3377,7 @@ <h2 class="panel_title_card text-medium">Report a problem</h2>
</div>
</section>


<!-- Platform for producers: data quality issues and improvements opportunities -->


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3257,6 +3257,8 @@ <h3 class="panel_title_card">Transportation</h3>
<!-- other fields -->


<!-- Report problem card, if not on the platform for producers -->

<section class="row" id="report_problem">
<div class="large-12 column">
<div class="card">
Expand Down Expand Up @@ -3375,6 +3377,7 @@ <h2 class="panel_title_card text-medium">Report a problem</h2>
</div>
</section>


<!-- Platform for producers: data quality issues and improvements opportunities -->


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3852,6 +3852,8 @@ <h3 class="panel_title_card">Threatened species</h3>
<!-- other fields -->


<!-- Report problem card, if not on the platform for producers -->

<section class="row" id="report_problem">
<div class="large-12 column">
<div class="card">
Expand Down Expand Up @@ -3970,6 +3972,7 @@ <h2 class="panel_title_card text-medium">Report a problem</h2>
</div>
</section>


<!-- Platform for producers: data quality issues and improvements opportunities -->


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3453,6 +3453,8 @@ <h3 class="panel_title_card">Espèces menacées</h3>
<!-- other fields -->


<!-- Report problem card, if not on the platform for producers -->

<section class="row" id="report_problem">
<div class="large-12 column">
<div class="card">
Expand Down Expand Up @@ -3612,8 +3614,8 @@ <h2 class="panel_title_card text-medium">Signaler un problème</h2>

Vous avez rencontré un problème avec ce produit : <b>étiquetage non conforme, produit périmé encore en vente,
présence d'un corps étranger, etc.</b> ?<br>
Faites un signalement à l'entreprise et à la répression des fraudes sur SignalConso, un outil de la
Direction générale de la concurrence, de la consommation et de la répression des fraudes (DGCCRF).
Faites un signalement à l'entreprise et à la répression des fraudes sur <a href="//signal.conso.gouv.fr/fr/alimentaire-codebarres/faire-un-signalement?gtin=3300000000002&utm_source=openfoodfacts&utm_campaign=product_page_panel">SignalConso</a>,
un outil de la Direction générale de la concurrence, de la consommation et de la répression des fraudes (DGCCRF).

</div>

Expand Down Expand Up @@ -3648,6 +3650,7 @@ <h2 class="panel_title_card text-medium">Signaler un problème</h2>
</div>
</section>


<!-- Platform for producers: data quality issues and improvements opportunities -->


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3467,6 +3467,8 @@ <h3 class="panel_title_card">Espèces menacées</h3>
<!-- other fields -->


<!-- Report problem card, if not on the platform for producers -->

<section class="row" id="report_problem">
<div class="large-12 column">
<div class="card">
Expand Down Expand Up @@ -3626,8 +3628,8 @@ <h2 class="panel_title_card text-medium">Signaler un problème</h2>

Vous avez rencontré un problème avec ce produit : <b>étiquetage non conforme, produit périmé encore en vente,
présence d'un corps étranger, etc.</b> ?<br>
Faites un signalement à l'entreprise et à la répression des fraudes sur SignalConso, un outil de la
Direction générale de la concurrence, de la consommation et de la répression des fraudes (DGCCRF).
Faites un signalement à l'entreprise et à la répression des fraudes sur <a href="//signal.conso.gouv.fr/fr/alimentaire-codebarres/faire-un-signalement?gtin=3300000000001&utm_source=openfoodfacts&utm_campaign=product_page_panel">SignalConso</a>,
un outil de la Direction générale de la concurrence, de la consommation et de la répression des fraudes (DGCCRF).

</div>

Expand Down Expand Up @@ -3662,6 +3664,7 @@ <h2 class="panel_title_card text-medium">Signaler un problème</h2>
</div>
</section>


<!-- Platform for producers: data quality issues and improvements opportunities -->


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3482,6 +3482,8 @@ <h3 class="panel_title_card">Threatened species</h3>
<!-- other fields -->


<!-- Report problem card, if not on the platform for producers -->

<section class="row" id="report_problem">
<div class="large-12 column">
<div class="card">
Expand Down Expand Up @@ -3600,6 +3602,7 @@ <h2 class="panel_title_card text-medium">Report a problem</h2>
</div>
</section>


<!-- Platform for producers: data quality issues and improvements opportunities -->


Expand Down
Loading