Import HAL : match des auteurs sur toutes les formes d'idHAL (résolution en fond via cron)
This commit is contained in:
@@ -561,15 +561,18 @@ class Thalim_HAL_Admin_Page {
|
||||
|
||||
$validity = $this->get_hal_ids_validity(array_keys($this->wp_users_by_hal_id));
|
||||
$invalid_count = count(array_filter($validity, fn($v) => $v === false));
|
||||
// The map may hold several idHAL forms per user (alternate valid forms);
|
||||
// count distinct users for the label, not raw form keys.
|
||||
$distinct_users = count(array_unique(array_map(fn($u) => $u['id'], $this->wp_users_by_hal_id)));
|
||||
?>
|
||||
<details style="margin-bottom:15px;background:#f0f6fc;padding:10px;border-radius:4px;border-left:4px solid #0073aa">
|
||||
<summary style="cursor:pointer;font-weight:bold">
|
||||
Utilisateurs WordPress avec identifiant HAL (<?php echo count($this->wp_users_by_hal_id); ?> utilisateurs<?php
|
||||
if ($invalid_count > 0) echo ', <span style="color:#dc3545">' . $invalid_count . ' invalide(s)</span>';
|
||||
Utilisateurs WordPress avec identifiant HAL (<?php echo $distinct_users; ?> utilisateurs<?php
|
||||
if ($invalid_count > 0) echo ', <span style="color:#dc3545">' . $invalid_count . ' forme(s) invalide(s)</span>';
|
||||
?>) — Cliquer pour déplier
|
||||
</summary>
|
||||
<table class="widefat" style="margin-top:10px;font-size:12px">
|
||||
<thead><tr><th>Utilisateur</th><th>Identifiant HAL</th><th>Validité HAL</th><th>Debug (brut)</th><th>Modifier</th></tr></thead>
|
||||
<thead><tr><th>Utilisateur</th><th>Identifiant HAL (formes)</th><th>Validité HAL</th><th>Debug (brut)</th><th>Modifier</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->wp_users_by_hal_id as $hal_id => $user):
|
||||
$valid = $validity[$hal_id] ?? null;
|
||||
@@ -715,12 +718,20 @@ class Thalim_HAL_Admin_Page {
|
||||
foreach ($users as $user) {
|
||||
$hal_id = get_user_meta($user->ID, 'identifiant_hal', true);
|
||||
if (!empty($hal_id)) {
|
||||
$normalized = strtolower(trim($hal_id));
|
||||
$this->wp_users_by_hal_id[$normalized] = [
|
||||
$entry = [
|
||||
'id' => $user->ID,
|
||||
'name' => $user->display_name,
|
||||
'hal_id' => trim($hal_id), // original value for API filter
|
||||
];
|
||||
// Register the primary form AND every alternate valid idHAL form
|
||||
// of the same person (resolved in the background, read from cache
|
||||
// here — no network call). Lets a publication tagged under an
|
||||
// alternate form still match the member. See Thalim_HAL_Forms_Cache.
|
||||
foreach (Thalim_HAL_Forms_Cache::forms_for_user($user->ID, $hal_id) as $form) {
|
||||
if (!isset($this->wp_users_by_hal_id[$form])) {
|
||||
$this->wp_users_by_hal_id[$form] = $entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user