mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-06-20 01:44:42 +02:00
affichage de modif qui cache les champs déjà remplis
This commit is contained in:
parent
2628b1c7f7
commit
f11ab48bb9
8 changed files with 166 additions and 115 deletions
|
@ -26,9 +26,39 @@ class Motocultrice
|
|||
'addr:street',
|
||||
'contact:website',
|
||||
'contact:mastodon',
|
||||
'image',
|
||||
'image',
|
||||
'note'
|
||||
];
|
||||
|
||||
// quand un commerce a fermé, on peut supprimer ces tags
|
||||
public $obsolete_tags = ["phone", "website", "email", "description", "brand", "opening_hours",
|
||||
"check_date:opening_hours", "internet_access",
|
||||
"indoor_seating", "takeaway", "female", "male", "unisex",
|
||||
"ref:FR:NAF", "ref:FR:FINESS", "ref:FR:SIRET", "ref:FR:SIREN", "ref:vatin",
|
||||
"healthcare", "dispensing", "lawyer", "vending", "vending_machine",
|
||||
"self_service", "second_hand", "branch", "delivery", "start_date",
|
||||
"beauty", "facebook", "tobacco", "bulk_purchase",
|
||||
"drive_through", "pastry", "stroller", "fax", "trade", "network",
|
||||
"mobile", "sport", "produce", "lottery", "supermarket", "information",
|
||||
"tourism", "government", "brewery"
|
||||
];
|
||||
public $tags_to_remove = ["diet:", "contact:", "name:", "payment:", "delivery:", "type:FR:", "ref:FR:SDIS:",
|
||||
"brand:", "fuel:", "service:", "description:", "operator:", "tickets:", "healthcare:"
|
||||
];
|
||||
public $tags_to_convert = ["shop" => "was:shop",
|
||||
"information" => "was:information",
|
||||
"office" => "was:office",
|
||||
"amenity" => "was:amenity",
|
||||
"craft" => "was:craft",
|
||||
"operator" => "was:operator",
|
||||
"clothes" => "was:clothes",
|
||||
"cuisine" => "was:cuisine",
|
||||
"official_name" => "was:official_name",
|
||||
"short_name" => "was:short_name",
|
||||
"alt_name" => "was:alt_name"
|
||||
|
||||
];
|
||||
|
||||
private $more_tags = ['image', 'ref:FR:SIRET'];
|
||||
public function __construct(
|
||||
private HttpClientInterface $client,
|
||||
|
@ -41,6 +71,11 @@ class Motocultrice
|
|||
$has_ask_angela = false;
|
||||
$remove_ask_angela = false;
|
||||
$has_opening_hours = false;
|
||||
// $has_phone = false;
|
||||
// $has_contact_phone = false;
|
||||
|
||||
// $has_email = false;
|
||||
// $has_contact_email = false;
|
||||
|
||||
|
||||
$modified_request_post = [];
|
||||
|
@ -171,12 +206,14 @@ QUERY;
|
|||
foreach ($osm_object_data['node']['tag'] as $attribute) {
|
||||
$osm_object_data['node']['tags_converted'][$attribute['@attributes']['k']] = $attribute['@attributes']['v'];
|
||||
}
|
||||
$osm_object_data['node']['tags_converted'] = $this->migrate_tags($osm_object_data['node']['tags_converted']);
|
||||
return $osm_object_data['node'];
|
||||
}
|
||||
if(isset($osm_object_data['way'])){
|
||||
foreach ($osm_object_data['way']['tag'] as $attribute) {
|
||||
$osm_object_data['way']['tags_converted'][$attribute['@attributes']['k']] = $attribute['@attributes']['v'];
|
||||
}
|
||||
$osm_object_data['way']['tags_converted'] = $this->migrate_tags($osm_object_data['way']['tags_converted']);
|
||||
return $osm_object_data['way'];
|
||||
}
|
||||
|
||||
|
@ -184,6 +221,29 @@ QUERY;
|
|||
}
|
||||
|
||||
|
||||
public function migrate_tags($osm_object_data) {
|
||||
|
||||
// migrer email vers contact:email
|
||||
if(isset($osm_object_data['email']) && !isset($osm_object_data['contact:email'])){
|
||||
$osm_object_data['contact:email'] = $osm_object_data['email'];
|
||||
unset($osm_object_data['email']);
|
||||
}
|
||||
// migrer phone vers contact:phone
|
||||
if(isset($osm_object_data['phone']) && !isset($osm_object_data['contact:phone'])){
|
||||
$osm_object_data['contact:phone'] = $osm_object_data['phone'];
|
||||
unset($osm_object_data['phone']);
|
||||
}
|
||||
// migrer website vers contact:website
|
||||
if(isset($osm_object_data['website']) && !isset($osm_object_data['contact:website'])){
|
||||
$osm_object_data['contact:website'] = $osm_object_data['website'];
|
||||
unset($osm_object_data['website']);
|
||||
}
|
||||
|
||||
return $osm_object_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function uuid_create() {
|
||||
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
// 32 bits for "time_low"
|
||||
|
@ -212,7 +272,7 @@ QUERY;
|
|||
$essentialTags = [
|
||||
'name',
|
||||
'opening_hours',
|
||||
'phone',
|
||||
// 'phone',
|
||||
'contact:email',
|
||||
'contact:phone',
|
||||
'website',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue