- Menü unter Einkauf > Lieferantenbestellungen statt eigenes Top-Menü - ADL-Buttons auf Produkt-Lieferantenpreisen per Hook (pricesuppliercard) - Admin-Seite: Großhändler-Schnellübersicht mit Version-Check - Dashboard: Shop-öffnen-Button (LI-Action) - Neue Datei: class/actions_idsconnect.class.php Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
187 lines
6 KiB
PHP
Executable file
187 lines
6 KiB
PHP
Executable file
<?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/idsconnectindex.php
|
|
* \ingroup idsconnect
|
|
* \brief IDS Connect Übersichtsseite
|
|
*/
|
|
|
|
// 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");
|
|
}
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|
dol_include_once('/idsconnect/class/idssupplier.class.php');
|
|
dol_include_once('/idsconnect/class/idslog.class.php');
|
|
dol_include_once('/idsconnect/lib/idsconnect.lib.php');
|
|
|
|
/**
|
|
* @var Conf $conf
|
|
* @var DoliDB $db
|
|
* @var Translate $langs
|
|
* @var User $user
|
|
*/
|
|
|
|
$langs->loadLangs(array("idsconnect@idsconnect"));
|
|
|
|
// Berechtigungsprüfung
|
|
if (!$user->hasRight('idsconnect', 'read')) {
|
|
accessforbidden();
|
|
}
|
|
|
|
// Meldungen aus GET
|
|
$msg = GETPOST('msg', 'alphanohtml');
|
|
$errmsg = GETPOST('error', 'alphanohtml');
|
|
if ($msg) {
|
|
setEventMessages($msg, null, 'mesgs');
|
|
}
|
|
if ($errmsg) {
|
|
setEventMessages($errmsg, null, 'errors');
|
|
}
|
|
|
|
|
|
/*
|
|
* View
|
|
*/
|
|
|
|
llxHeader("", $langs->trans("IdsconnectArea"), '', '', 0, 0, '', '', '', 'mod-idsconnect page-index');
|
|
|
|
print load_fiche_titre($langs->trans("IdsconnectArea"), '', 'fa-plug');
|
|
|
|
// Testmodus-Banner
|
|
idsconnectShowTestModeBanner();
|
|
|
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
|
|
|
// ============================================================
|
|
// Großhändler-Übersicht mit Aktionsbuttons
|
|
// ============================================================
|
|
$supplierObj = new IdsSupplier($db);
|
|
$suppliers = $supplierObj->fetchAll(0);
|
|
|
|
print '<table class="noborder centpercent">';
|
|
print '<tr class="liste_titre">';
|
|
print '<th colspan="3">'.$langs->trans("IdsconnectSuppliers");
|
|
if (is_array($suppliers)) {
|
|
print '<span class="badge marginleftonlyshort">'.count($suppliers).'</span>';
|
|
}
|
|
print '</th></tr>';
|
|
|
|
if (is_array($suppliers) && count($suppliers) > 0) {
|
|
foreach ($suppliers as $sup) {
|
|
print '<tr class="oddeven">';
|
|
print '<td>';
|
|
print '<a href="'.DOL_URL_ROOT.'/custom/idsconnect/supplier_card.php?id='.$sup->id.'">';
|
|
print '<strong>'.htmlspecialchars($sup->label).'</strong>';
|
|
print '</a>';
|
|
print ' <span class="opacitymedium">('.htmlspecialchars($sup->ref).')</span>';
|
|
if (!$sup->active) {
|
|
print ' <span class="badge badge-secondary">inaktiv</span>';
|
|
}
|
|
if ($sup->testmode) {
|
|
print ' <span class="badge badge-warning">Test</span>';
|
|
}
|
|
print '</td>';
|
|
print '<td class="right nowrap">';
|
|
if ($sup->active && $user->hasRight('idsconnect', 'use')) {
|
|
print '<a class="butAction butActionSmall" href="'.DOL_URL_ROOT.'/custom/idsconnect/launch.php?supplier_id='.$sup->id.'&ids_action=WKE&token='.newToken().'" target="_blank">';
|
|
print $langs->trans("IdsconnectReceiveCart");
|
|
print '</a> ';
|
|
print '<a class="butAction butActionSmall" href="'.DOL_URL_ROOT.'/custom/idsconnect/launch.php?supplier_id='.$sup->id.'&ids_action=LI&token='.newToken().'" target="_blank">';
|
|
print $langs->trans("IdsconnectOpenShop");
|
|
print '</a> ';
|
|
}
|
|
print '</td>';
|
|
print '</tr>';
|
|
}
|
|
} else {
|
|
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">';
|
|
print $langs->trans("IdsconnectNoSuppliers");
|
|
print '</td></tr>';
|
|
}
|
|
|
|
print '</table>';
|
|
|
|
if ($user->hasRight('idsconnect', 'config')) {
|
|
print '<div class="tabsAction">';
|
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/custom/idsconnect/supplier_card.php?action=create">'.$langs->trans("IdsconnectNewSupplier").'</a>';
|
|
print '</div>';
|
|
}
|
|
|
|
print '</div><div class="fichetwothirdright">';
|
|
|
|
// ============================================================
|
|
// Letzte Transaktionen
|
|
// ============================================================
|
|
$logObj = new IdsLog($db);
|
|
$logs = $logObj->fetchLast(15);
|
|
|
|
print '<table class="noborder centpercent">';
|
|
print '<tr class="liste_titre">';
|
|
print '<th>'.$langs->trans("IdsconnectLogDate").'</th>';
|
|
print '<th>'.$langs->trans("IdsconnectLogSupplier").'</th>';
|
|
print '<th>'.$langs->trans("IdsconnectLogAction").'</th>';
|
|
print '<th>'.$langs->trans("IdsconnectLogStatus").'</th>';
|
|
print '</tr>';
|
|
|
|
if (is_array($logs) && count($logs) > 0) {
|
|
foreach ($logs as $log) {
|
|
$sup = new IdsSupplier($db);
|
|
$sup->fetch($log->fk_supplier);
|
|
|
|
$detail_url = DOL_URL_ROOT.'/custom/idsconnect/log_detail.php?id='.$log->id;
|
|
print '<tr class="oddeven">';
|
|
print '<td class="nowrap"><a href="'.$detail_url.'">'.dol_print_date($log->date_creation, 'dayhour').'</a></td>';
|
|
print '<td>'.htmlspecialchars($sup->label ?: '-').'</td>';
|
|
print '<td>'.$log->getActionLabel().' <span class="opacitymedium">('.$log->direction.')</span></td>';
|
|
print '<td>'.$log->getStatusLabel().'</td>';
|
|
print '</tr>';
|
|
}
|
|
} else {
|
|
print '<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("IdsconnectLogNoEntries").'</td></tr>';
|
|
}
|
|
|
|
print '</table>';
|
|
|
|
if ($user->hasRight('idsconnect', 'read')) {
|
|
print '<div class="tabsAction">';
|
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/custom/idsconnect/log_list.php">'.$langs->trans("IdsconnectLog").'</a>';
|
|
print '</div>';
|
|
}
|
|
|
|
print '</div></div>';
|
|
|
|
llxFooter();
|
|
$db->close();
|