Import unitaire, statut publié/pending et validation des idHAL

This commit is contained in:
2026-05-28 17:04:20 +02:00
parent a61619077d
commit d8053ac82e
3 changed files with 246 additions and 25 deletions

View File

@@ -50,6 +50,22 @@ class Thalim_HAL_Importer_Logic {
)) > 0;
}
/**
* Return ['id' => int, 'status' => string] for the post matching this hal_id, or null.
*/
public function get_imported_post($hal_id) {
if (empty($hal_id)) return null;
global $wpdb;
$row = $wpdb->get_row($wpdb->prepare(
"SELECT p.ID, p.post_status FROM {$wpdb->posts} p
INNER JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID
WHERE pm.meta_key = 'hal_id' AND pm.meta_value = %s
LIMIT 1",
$hal_id
));
return $row ? ['id' => (int) $row->ID, 'status' => $row->post_status] : null;
}
/**
* Get category ID for HAL doc type
*/