dolibarr.idsconnect/log_list.php
data d91f9dbc9a IDS Connect v2.1 - WKE + WKS mit Sonepar live getestet
- WKE-Flow (Warenkorb empfangen): Sonepar-Integration komplett funktionsfähig
  inkl. PriceBasis-Handling, Namespace-Stripping, OCI-Unterstützung
- WKS-Flow (Warenkorb senden): Lieferantenbestellung → Shop mit vorausgefüllten
  Artikeln, IDS Connect 2.0 XML-Format
- Callback v2.0: NOLOGIN-Seite statt Redirect, 7 Datenquellen, Debug-Daten
- URL-Handling: user_base_url-Tracking für Cross-Domain-Szenarien
- Sicherheit: CSRF, HMAC-SHA256 Tokens, XXE-Schutz, PIN für WKS
- Mock-Server für lokale Tests
- Dokumentation mit Roadmap (fehlende Features, Möglichkeiten)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:37:15 +01:00

137 lines
4.4 KiB
PHP

<?php
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*/
/**
* \file idsconnect/log_list.php
* \ingroup idsconnect
* \brief Transaktionslog anzeigen
*/
// Dolibarr laden
$res = 0;
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
$tmp2 = realpath(__FILE__);
$i = strlen($tmp) - 1;
$j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--;
$j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
if (!$res && file_exists("../main.inc.php")) {
$res = @include "../main.inc.php";
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
dol_include_once('/idsconnect/class/idslog.class.php');
dol_include_once('/idsconnect/class/idssupplier.class.php');
dol_include_once('/idsconnect/lib/idsconnect.lib.php');
/**
* @var DoliDB $db
* @var Translate $langs
* @var User $user
*/
$langs->loadLangs(array("idsconnect@idsconnect"));
if (!$user->hasRight('idsconnect', 'read')) {
accessforbidden();
}
$supplier_id = GETPOSTINT('supplier_id');
/*
* View
*/
llxHeader('', $langs->trans("IdsconnectLogList"), '', '', 0, 0, '', '', '', 'mod-idsconnect page-log_list');
// Wenn für einen bestimmten Supplier: Tabs anzeigen
if ($supplier_id > 0) {
$supplier = new IdsSupplier($db);
$supplier->fetch($supplier_id);
if ($supplier->id > 0) {
$head = idsconnectSupplierPrepareHead($supplier);
print dol_get_fiche_head($head, 'log', $langs->trans("IdsconnectSupplierCard").' - '.htmlspecialchars($supplier->label), -1, 'fa-plug');
}
} else {
print load_fiche_titre($langs->trans("IdsconnectLogList"), '', 'fa-list-alt');
}
$logObj = new IdsLog($db);
$logs = $logObj->fetchLast(100, $supplier_id);
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("ID").'</th>';
print '<th>'.$langs->trans("IdsconnectLogDate").'</th>';
print '<th>'.$langs->trans("IdsconnectLogSupplier").'</th>';
print '<th>'.$langs->trans("IdsconnectLogUser").'</th>';
print '<th>'.$langs->trans("IdsconnectLogAction").'</th>';
print '<th>'.$langs->trans("IdsconnectLogDirection").'</th>';
print '<th>'.$langs->trans("IdsconnectLogStatus").'</th>';
print '<th>'.$langs->trans("IP").'</th>';
print '</tr>';
if (is_array($logs) && count($logs) > 0) {
foreach ($logs as $log) {
$sup = new IdsSupplier($db);
$sup->fetch($log->fk_supplier);
$userObj = new User($db);
$userObj->fetch($log->fk_user);
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/custom/idsconnect/log_detail.php?id='.$log->id.'">'.$log->id.'</a></td>';
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/custom/idsconnect/log_detail.php?id='.$log->id.'">'.dol_print_date($log->date_creation, 'dayhour').'</a></td>';
print '<td>';
if ($sup->id > 0) {
print '<a href="'.DOL_URL_ROOT.'/custom/idsconnect/supplier_card.php?id='.$sup->id.'">'.htmlspecialchars($sup->label).'</a>';
}
print '</td>';
print '<td>'.($userObj->id > 0 ? $userObj->getNomUrl(1) : '-').'</td>';
print '<td>'.$log->getActionLabel().'</td>';
print '<td>'.$log->direction.'</td>';
print '<td>'.$log->getStatusLabel().'</td>';
print '<td class="small">'.htmlspecialchars($log->ip_address ?: '-').'</td>';
print '</tr>';
// Detail-Zeile bei Fehler
if ($log->status == 'error' && !empty($log->error_message)) {
print '<tr class="oddeven"><td></td><td colspan="7">';
print '<span class="opacitymedium small">Fehler: '.htmlspecialchars($log->error_message).'</span>';
print '</td></tr>';
}
}
} else {
print '<tr class="oddeven"><td colspan="8" class="opacitymedium">'.$langs->trans("IdsconnectLogNoEntries").'</td></tr>';
}
print '</table>';
if ($supplier_id > 0) {
print dol_get_fiche_end();
}
llxFooter();
$db->close();