diff --git a/lib/ProductOpener/Config_obf.pm b/lib/ProductOpener/Config_obf.pm index 4d058f7a46777..0b07dd530658b 100644 --- a/lib/ProductOpener/Config_obf.pm +++ b/lib/ProductOpener/Config_obf.pm @@ -318,6 +318,7 @@ HTML ingredients_that_may_be_from_palm_oil_n ingredients_that_may_be_from_palm_oil states + obsolete ); # for ingredients OCR, we use tesseract-ocr diff --git a/lib/ProductOpener/Config_off.pm b/lib/ProductOpener/Config_off.pm index 05a3fb2cc3863..60040a9c16c7e 100644 --- a/lib/ProductOpener/Config_off.pm +++ b/lib/ProductOpener/Config_off.pm @@ -855,6 +855,7 @@ $options{replace_existing_values_when_importing_those_tags_fields} = { popularity_tags completeness last_image_t + obsolete ); # List of fields that can be imported on the producers platform diff --git a/lib/ProductOpener/Config_opf.pm b/lib/ProductOpener/Config_opf.pm index e2f76af9916e3..d648f46ea1aca 100644 --- a/lib/ProductOpener/Config_opf.pm +++ b/lib/ProductOpener/Config_opf.pm @@ -313,6 +313,7 @@ HTML additives_n additives states + obsolete ); # for ingredients OCR, we use tesseract-ocr diff --git a/lib/ProductOpener/Config_opff.pm b/lib/ProductOpener/Config_opff.pm index 42a032988d50b..45091bfe4493d 100644 --- a/lib/ProductOpener/Config_opff.pm +++ b/lib/ProductOpener/Config_opff.pm @@ -355,6 +355,7 @@ XML pnns_groups_1 pnns_groups_2 states + obsolete ); # for ingredients OCR, we use tesseract-ocr diff --git a/scripts/export_database.pl b/scripts/export_database.pl index d6597448eee1c..6398b42daacbd 100755 --- a/scripts/export_database.pl +++ b/scripts/export_database.pl @@ -276,6 +276,7 @@ sub sanitize_field_content { my $count = 0; my %ingredients = (); + my %exported_products = (); foreach my $collection (@collections) { @@ -298,6 +299,12 @@ sub sanitize_field_content { my $url = "http://world-$lc.$server_domain" . product_url($product_ref); my $code = ($product_ref->{code} // ''); + if ($product_ref->{obsolete}) { + if ($exported_products{$code}) { + next; + } + } + $code eq '' and next; $code < 1 and next; @@ -339,6 +346,13 @@ sub sanitize_field_content { $field_value = sanitize_field_content($field_value, $BAD, "$code barcode -> field $field:"); } + #Obsolete field + if ($field eq "obsolete") { + $field_value = $product_ref->{obsolete} ? 1 : 0; + } + + $field_value //= ""; + # Add field value to CSV file $csv .= $field_value . "\t"; @@ -509,6 +523,7 @@ sub sanitize_field_content { print $OUT $csv; print $RDF $rdf; + $exported_products{$code} = 1; } }