Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into keycloak
Browse files Browse the repository at this point in the history
  • Loading branch information
hangy committed Aug 17, 2024
2 parents f5bb6a7 + eaa9539 commit 4e0b65b
Show file tree
Hide file tree
Showing 107 changed files with 2,896 additions and 904 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## [2.41.0](https://github.com/openfoodfacts/openfoodfacts-server/compare/v2.40.0...v2.41.0) (2024-08-13)


### Features

* generate historical events from product revisions ([#10523](https://github.com/openfoodfacts/openfoodfacts-server/issues/10523)) ([42508e1](https://github.com/openfoodfacts/openfoodfacts-server/commit/42508e1e19263079fe1516c2e388df0052eb98fd))
* sync number of product public/pro in CRM ([#10684](https://github.com/openfoodfacts/openfoodfacts-server/issues/10684)) ([026ff6a](https://github.com/openfoodfacts/openfoodfacts-server/commit/026ff6a56c709b88cb633c760b6eb0fcb1bbee7a))


### Bug Fixes

* 3 fixes to make /products/[code1],[code2] work again ([#10669](https://github.com/openfoodfacts/openfoodfacts-server/issues/10669)) ([7fc07fc](https://github.com/openfoodfacts/openfoodfacts-server/commit/7fc07fc864efa7ea13ce74932af7b4f8f2131dd5))
* Automatically unselect images when source image is deleted ([#10692](https://github.com/openfoodfacts/openfoodfacts-server/issues/10692)) ([588897a](https://github.com/openfoodfacts/openfoodfacts-server/commit/588897aee5163c209b53e40ef3c03fafdcf71593))
* **docs:** correct OpenAPI definition by fixing missing reference ([#10659](https://github.com/openfoodfacts/openfoodfacts-server/issues/10659)) ([4f0f10e](https://github.com/openfoodfacts/openfoodfacts-server/commit/4f0f10e2e6a36fa1f699eb22f2e371eb4951df07))
* gen_users_emails.pl ([#10686](https://github.com/openfoodfacts/openfoodfacts-server/issues/10686)) ([00e4c26](https://github.com/openfoodfacts/openfoodfacts-server/commit/00e4c26b099e9523de59defa906be3eaa9fae558))
* Show missing nutrients in Nutri-Score panel ([#10655](https://github.com/openfoodfacts/openfoodfacts-server/issues/10655)) ([a1b11eb](https://github.com/openfoodfacts/openfoodfacts-server/commit/a1b11eb76e02f041d6fa1f50035b9d8d595322a8))
* UTM mobile ([#10665](https://github.com/openfoodfacts/openfoodfacts-server/issues/10665)) ([965041d](https://github.com/openfoodfacts/openfoodfacts-server/commit/965041d7328b1bcad154409db452ac1ffb6c3782))

## [2.40.0](https://github.com/openfoodfacts/openfoodfacts-server/compare/v2.39.0...v2.40.0) (2024-08-08)


Expand Down
Binary file modified html/images/lang/en/labels/keyhole.90x90.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions html/images/lang/en/labels/keyhole.90x90.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions html/js/product-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ function rank_and_display_products(target, products, contributor_prefs) {

/* exported search_products */

function search_products(target, products, search_api_url) {
/* eslint-disable max-params */
function search_products(target, products, search_api_url, contributor_prefs) {

// Retrieve generic search results from the search API

Expand All @@ -476,7 +477,7 @@ function search_products(target, products, search_api_url) {
if (data.products) {

Array.prototype.push.apply(products, data.products);
rank_and_display_products(target, products);
rank_and_display_products(target, products, contributor_prefs);
}
});
}
28 changes: 18 additions & 10 deletions lib/ProductOpener/CRM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ BEGIN {
&update_last_export_date
&update_company_last_logged_in_contact
&update_company_last_import_type
&update_public_products
&update_pro_products
&add_category_to_company
&update_template_download_date
&update_contact_last_login
Expand Down Expand Up @@ -579,12 +581,20 @@ sub change_company_main_contact($org_ref, $user_id) {
return $req_company;
}

sub update_last_import_date($org_id, $time) {
return _update_partner_field(retrieve_org($org_id), 'x_off_last_import_date', _time_to_odoo_date_str($time));
sub update_last_import_date($org_ref, $time) {
return _update_partner_field($org_ref, 'x_off_last_import_date', _time_to_odoo_date_str($time));
}

sub update_last_export_date($org_id, $time) {
return _update_partner_field(retrieve_org($org_id), 'x_off_last_export_date', _time_to_odoo_date_str($time));
sub update_last_export_date($org_ref, $time) {
return _update_partner_field($org_ref, 'x_off_last_export_date', _time_to_odoo_date_str($time));
}

sub update_public_products($org_ref, $number_of_products) {
return _update_partner_field($org_ref, 'x_off_public_products', $number_of_products);
}

sub update_pro_products($org_ref, $number_of_products) {
return _update_partner_field($org_ref, 'x_off_pro_products', $number_of_products);
}

sub update_contact_last_login ($user_ref) {
Expand Down Expand Up @@ -634,8 +644,7 @@ Add a category to a company in Odoo
=cut

sub add_category_to_company($org_id, $label) {
my $org_ref = retrieve_org($org_id);
sub add_category_to_company($org_ref, $label) {
return if not defined $org_ref->{crm_org_id};

my $category_id = $crm_data->{category}{$label};
Expand All @@ -645,7 +654,7 @@ sub add_category_to_company($org_id, $label) {
if $log->is_debug();
return;
}
$log->debug("add_category_to_company", {org_id => $org_id, label => $label, category_id => $category_id})
$log->debug("add_category_to_company", {org_id => $org_ref->{org_id}, label => $label, category_id => $category_id})
if $log->is_debug();
return make_odoo_request('res.partner', 'write',
[[$org_ref->{crm_org_id}], {category_id => [[$commands{link}, $category_id]]}]);
Expand All @@ -661,11 +670,10 @@ must match one of the values in CRM.pm @data_source
=cut

sub update_company_last_import_type($org_id, $label) {
my $org_ref = retrieve_org($org_id);
sub update_company_last_import_type($org_ref, $label) {
return if not defined $org_ref->{crm_org_id};
my $category_id = $crm_data->{category}{$label};
add_category_to_company($org_id, $label);
add_category_to_company($org_ref, $label);
return make_odoo_request('res.partner', 'write',
[[$org_ref->{crm_org_id}], {x_off_last_import_type => $category_id}]);
}
Expand Down
9 changes: 5 additions & 4 deletions lib/ProductOpener/Config_obf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ $flavor = 'obf';
site_name => "Open Beauty Facts",
product_type => "beauty",
og_image_url => "https://world.openbeautyfacts.org/images/misc/openbeautyfacts-logo-en.png",
android_apk_app_link => "https://world.openbeautyfacts.org/images/apps/obf.apk",
android_app_link => "https://play.google.com/store/apps/details?id=org.openbeautyfacts.scanner",
ios_app_link => "https://apps.apple.com/app/open-beauty-facts/id1122926380",
facebook_page_url => "https://www.facebook.com/openbeautyfacts",
android_apk_app_link => "https://world.openbeautyfacts.org/images/apps/obf.apk?utm_source=obf&utf_medium=web",
android_app_link =>
"https://play.google.com/store/apps/details?id=org.openbeautyfacts.scanner&utm_source=obf&utf_medium=web",
ios_app_link => "https://apps.apple.com/app/open-beauty-facts/id1122926380?utm_source=obf&utf_medium=web",
facebook_page_url => "https://www.facebook.com/openbeautyfacts?utm_source=obf&utf_medium=web",
twitter_account => "OpenBeautyFacts",
);

Expand Down
9 changes: 5 additions & 4 deletions lib/ProductOpener/Config_off.pm
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ $flavor = 'off';
site_name => "Open Food Facts",
product_type => "food",
og_image_url => "https://static.openfoodfacts.org/images/logos/off-logo-vertical-white-social-media-preview.png",
android_apk_app_link => "https://world.openfoodfacts.org/files/off.apk",
android_app_link => "https://play.google.com/store/apps/details?id=org.openfoodfacts.scanner",
ios_app_link => "https://apps.apple.com/app/open-food-facts/id588797948",
facebook_page_url => "https://www.facebook.com/OpenFoodFacts",
android_apk_app_link => "https://world.openfoodfacts.org/files/off.apk?utm_source=off&utf_medium=web",
android_app_link =>
"https://play.google.com/store/apps/details?id=org.openfoodfacts.scanner&utm_source=off&utf_medium=web",
ios_app_link => "https://apps.apple.com/app/open-food-facts/id588797948?utm_source=off&utf_medium=web",
facebook_page_url => "https://www.facebook.com/OpenFoodFacts?utm_source=off&utf_medium=web",
facebook_page_url_fr => "https://www.facebook.com/OpenFoodFacts.fr",
twitter_account => "OpenFoodFacts",
twitter_account_fr => "OpenFoodFactsFr",
Expand Down
8 changes: 4 additions & 4 deletions lib/ProductOpener/Config_opf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ $flavor = "opf";
site_name => "Open Products Facts",
product_type => "products",
og_image_url => "https://world.openproductsfacts.org/images/misc/openproductsfacts-logo-en.png",
#android_apk_app_link => "https://world.openbeautyfacts.org/images/apps/obf.apk",
#android_app_link => "https://play.google.com/store/apps/details?id=org.openbeautyfacts.scanner",
#ios_app_link => "https://apps.apple.com/app/open-beauty-facts/id1122926380",
#facebook_page_url => "https://www.facebook.com/openbeautyfacts",
#android_apk_app_link => "https://world.openbeautyfacts.org/images/apps/obf.apk?utm_source=opf&utf_medium=web",
#android_app_link => "https://play.google.com/store/apps/details?id=org.openbeautyfacts.scanner&utm_source=opf&utf_medium=web",
#ios_app_link => "https://apps.apple.com/app/open-beauty-facts/id1122926380?utm_source=opf&utf_medium=web",
#facebook_page_url => "https://www.facebook.com/openbeautyfacts?&utm_source=opf&utf_medium=web",
#twitter_account => "OpenBeautyFacts",
);

Expand Down
6 changes: 3 additions & 3 deletions lib/ProductOpener/Config_opff.pm
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ $flavor = "opff";
product_type => "petfood",
og_image_url => "https://world.openpetfoodfacts.org/images/misc/openpetfoodfacts-logo-en.png",
#android_apk_app_link => "https://world.openbeautyfacts.org/images/apps/obf.apk",
#android_app_link => "https://play.google.com/store/apps/details?id=org.openbeautyfacts.scanner",
#ios_app_link => "https://apps.apple.com/app/open-beauty-facts/id1122926380",
#facebook_page_url => "https://www.facebook.com/openbeautyfacts",
#android_app_link => "https://play.google.com/store/apps/details?id=org.openbeautyfacts.scanner&utm_source=opff&utf_medium=web",
#ios_app_link => "https://apps.apple.com/app/open-beauty-facts/id1122926380?utm_source=opff&utf_medium=web",
#facebook_page_url => "https://www.facebook.com/openbeautyfacts?utm_source=opff&utf_medium=web",
#twitter_account => "OpenBeautyFacts",
);

Expand Down
Loading

0 comments on commit 4e0b65b

Please sign in to comment.