- Sonepar Metal Note API: CU/AL Tageswerte + Monatsdurchschnitte - Dashboard mit Chart.js Verlaufsdiagramm (30/90/365 Tage) - Trigger: Kupfergehalt (kg/km) = Aderanzahl × Querschnitt × 8,89 - Trigger: Kupferzuschlag (€/m) auf Einkaufspreisen berechnen - CU-Logik: Lieferant-eigener Wert oder aktuellster aus History - Cronjobs: Wöchentlicher API-Abruf + Kupferzuschlag-Neuberechnung - Extrafields: Lieferantenkarte (CU/AL/Datum/Quelle), Produkt (Aderanzahl/Querschnitt/Kupfergehalt) - Admin-Seite mit API-URL, Auto-Fetch, Lieferantenübersicht - Mehrsprachig (de_DE, en_US) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
73 lines
1.7 KiB
PHP
Executable file
73 lines
1.7 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 metallzuschlag/lib/metallzuschlag.lib.php
|
|
* \ingroup metallzuschlag
|
|
* \brief Hilfsfunktionen fuer Metallzuschlag-Modul
|
|
*/
|
|
|
|
/**
|
|
* Admin-Navigation vorbereiten
|
|
*
|
|
* @return array
|
|
*/
|
|
function metallzuschlagAdminPrepareHead()
|
|
{
|
|
global $langs, $conf;
|
|
|
|
$langs->load("metallzuschlag@metallzuschlag");
|
|
|
|
$h = 0;
|
|
$head = array();
|
|
|
|
$head[$h][0] = dol_buildpath("/metallzuschlag/admin/setup.php", 1);
|
|
$head[$h][1] = $langs->trans("Settings");
|
|
$head[$h][2] = 'settings';
|
|
$h++;
|
|
|
|
$head[$h][0] = dol_buildpath("/metallzuschlag/admin/about.php", 1);
|
|
$head[$h][1] = $langs->trans("About");
|
|
$head[$h][2] = 'about';
|
|
$h++;
|
|
|
|
complete_head_from_modules($conf, $langs, null, $head, $h, 'metallzuschlag@metallzuschlag');
|
|
complete_head_from_modules($conf, $langs, null, $head, $h, 'metallzuschlag@metallzuschlag', 'remove');
|
|
|
|
return $head;
|
|
}
|
|
|
|
/**
|
|
* Metallname fuer Anzeige
|
|
*
|
|
* @param string $metal Metall-Kuerzel (CU/AL)
|
|
* @return string Anzeigename
|
|
*/
|
|
function metallzuschlagGetMetalLabel($metal)
|
|
{
|
|
$labels = array(
|
|
'CU' => 'Kupfer (CU)',
|
|
'AL' => 'Aluminium (AL)',
|
|
);
|
|
return isset($labels[$metal]) ? $labels[$metal] : $metal;
|
|
}
|
|
|
|
/**
|
|
* Wert als Preis formatieren
|
|
*
|
|
* @param float $value Wert
|
|
* @return string Formatierter Preis mit Einheit
|
|
*/
|
|
function metallzuschlagFormatPrice($value)
|
|
{
|
|
if (empty($value)) {
|
|
return '-';
|
|
}
|
|
return price($value, 0, '', 1, -1, 2).' €/100kg';
|
|
}
|