fix: Fehlende Lieferantenpreise hinzufügen, Debug-Cleanup, Changelog (v4.0)

- Debug-Logging aus addmissingprices-Handler entfernt
- Fehler-/Erfolgsmeldungen beim Preishinzufügen verbessert
- CHANGELOG.md mit v4.0 Änderungen aktualisiert
- Hinweis: uk_product_barcode UNIQUE KEY muss entfernt werden

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-03-01 21:26:22 +01:00
parent 578120eca9
commit c8e6d2f394
3 changed files with 26 additions and 7 deletions

View file

@ -2,6 +2,21 @@
Alle wesentlichen Änderungen an diesem Projekt werden in dieser Datei dokumentiert. Alle wesentlichen Änderungen an diesem Projekt werden in dieser Datei dokumentiert.
## [4.0] - 2026-03-01
### Behoben
- **Verschachtelte HTML-Forms**: "Ausgewählte Preise hinzufügen" funktionierte nicht, weil Browser verschachtelte `<form>`-Elemente nicht unterstützen. Lösung: HTML5 `form`-Attribut
- **Stückpreis-Anzeige**: Einkaufspreise zeigen jetzt den Stückpreis statt Gesamtpreis (z.B. 0,16 statt 16,32 bei 100 Stk.)
- **Preisvergleich**: Fehlende Lieferantenpreise werden korrekt auf Stückpreis-Basis verglichen
- **DATPREIS-Kommentare**: Feld korrekt als Rabattkennzeichen dokumentiert (war fälschlich als PE-Code beschrieben)
### Verbessert
- **Feedback bei Preishinzufügen**: Zeigt Erfolgs- und Fehlermeldungen nach dem Hinzufügen von Lieferantenpreisen
- **Mengenkontext**: Bei Mengenstaffel wird zusätzlich der Gesamtpreis mit Stückzahl angezeigt (z.B. "0,16 (16,32/100Stk.)")
### Hinweis
- `uk_product_barcode` UNIQUE KEY auf `product_fournisseur_price` muss entfernt werden falls vorhanden (mehrere Lieferanten dürfen gleichen EAN haben)
## [3.8] - 2026-02-25 ## [3.8] - 2026-02-25
### Hinzugefügt ### Hinzugefügt

View file

@ -76,7 +76,7 @@ class modImportZugferd extends DolibarrModules
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@importzugferd' $this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@importzugferd'
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
$this->version = '4.0'; $this->version = '4.1';
// Url to the file with your last numberversion of this module // Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt'; //$this->url_last_version = 'http://www.example.com/versionmodule.txt';

View file

@ -792,6 +792,7 @@ if ($action == 'addmissingprices' && $id > 0) {
if (!empty($selectedPrices)) { if (!empty($selectedPrices)) {
$addedCount = 0; $addedCount = 0;
$errorCount = 0;
$processedKeys = array(); $processedKeys = array();
foreach ($selectedPrices as $entry) { foreach ($selectedPrices as $entry) {
@ -818,13 +819,8 @@ if ($action == 'addmissingprices' && $id > 0) {
$altSupplier = new Societe($db); $altSupplier = new Societe($db);
$altSupplier->fetch($socId); $altSupplier->fetch($socId);
$purchasePrice = $datanorm->price;
if ($datanorm->price_unit > 1) {
$purchasePrice = $datanorm->price / $datanorm->price_unit;
}
$priceExtrafields = datanormBuildSupplierPriceExtrafields($datanorm); $priceExtrafields = datanormBuildSupplierPriceExtrafields($datanorm);
$result = datanormAddSupplierPrice($db, $productId, $datanorm, $altSupplier, $user, $purchasePrice, 19, $priceExtrafields); $result = datanormAddSupplierPrice($db, $productId, $datanorm, $altSupplier, $user, 0, 19, $priceExtrafields);
if ($result > 0) { if ($result > 0) {
datanormInsertPriceExtrafields($db, $result, $priceExtrafields); datanormInsertPriceExtrafields($db, $result, $priceExtrafields);
@ -839,6 +835,9 @@ if ($action == 'addmissingprices' && $id > 0) {
$mapping->create($user); $mapping->create($user);
$addedCount++; $addedCount++;
} else {
$errorCount++;
dol_syslog('ImportZugferd addmissingprices: Fehler bei Lieferantenpreis product='.$productId.' supplier='.$socId, LOG_ERR);
} }
} }
} }
@ -846,6 +845,11 @@ if ($action == 'addmissingprices' && $id > 0) {
if ($addedCount > 0) { if ($addedCount > 0) {
setEventMessages($langs->trans('SupplierPricesAdded', $addedCount), null, 'mesgs'); setEventMessages($langs->trans('SupplierPricesAdded', $addedCount), null, 'mesgs');
} }
if ($errorCount > 0) {
setEventMessages($addedCount.' hinzugefuegt, '.$errorCount.' Fehler', null, 'warnings');
}
} else {
setEventMessages('Keine Preise ausgewählt', null, 'warnings');
} }
$action = 'edit'; $action = 'edit';
} }