Version 2.4: Verfügbarkeits-Badge für Lieferantenbestellungen
Zeigt pro Produktzeile an ob ein Einkaufspreis beim Lieferanten der Bestellung hinterlegt ist (Grün mit Kürzel = verfügbar, Rot N/A = kein Einkaufspreis). Badge-Styling aller Badges vereinheitlicht (gleiche Größe und Ausrichtung). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c976123d81
commit
4aeb4861c5
4 changed files with 101 additions and 6 deletions
22
ChangeLog.md
22
ChangeLog.md
|
|
@ -1,5 +1,27 @@
|
||||||
# CHANGELOG MODULE SUPPLIERLINK3 FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
|
# CHANGELOG MODULE SUPPLIERLINK3 FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
|
||||||
|
|
||||||
|
## 2.4
|
||||||
|
|
||||||
|
- Verfügbarkeits-Badge in Lieferantenbestellungen: Zeigt pro Produktzeile an, ob ein Einkaufspreis beim Lieferanten der Bestellung hinterlegt ist (Grün = verfügbar mit Kürzel, Rot = kein Einkaufspreis)
|
||||||
|
- Badge-Styling vereinheitlicht: Alle Badges (Verfügbarkeit, Lagerbestand, günstigster Lieferant) haben jetzt einheitliche Größe und vertikale Ausrichtung
|
||||||
|
|
||||||
|
## 2.3
|
||||||
|
|
||||||
|
- Lagerbestand-Badge zeigt Physisch | Theoretisch (Dolibarr-Standard)
|
||||||
|
- Preis-Indikator-Badge in Lieferantenbestellungen (Grün/Orange/Rot)
|
||||||
|
- Günstigster-Lieferant-Badge in Kundenaufträgen/Angeboten
|
||||||
|
- Preisvergleich im Modal mit prozentualer Differenz
|
||||||
|
|
||||||
|
## 2.0
|
||||||
|
|
||||||
|
- Admin-Center komplett überarbeitet
|
||||||
|
- Einstellungen pro Bereich (aktivieren/deaktivieren)
|
||||||
|
- Konfigurierbare Icons (FontAwesome)
|
||||||
|
- Debug-Modus standardmäßig deaktiviert
|
||||||
|
- Zweisprachig (Deutsch/Englisch)
|
||||||
|
- Nachbestellungsliste integriert
|
||||||
|
- Verbesserte Icon-Ausrichtung
|
||||||
|
|
||||||
## 1.0
|
## 1.0
|
||||||
|
|
||||||
Initial version
|
Initial version
|
||||||
|
|
|
||||||
25
README.md
25
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
# SupplierLink3 for [Dolibarr ERP & CRM](https://www.dolibarr.org)
|
# SupplierLink3 for [Dolibarr ERP & CRM](https://www.dolibarr.org)
|
||||||
|
|
||||||
**Version 2.0** | **License: GPL v3** | **Author: Eduard Wisch**
|
**Version 2.4** | **License: GPL v3** | **Author: Eduard Wisch**
|
||||||
|
|
||||||
Dolibarr module for linking supplier webshops with products and displaying stock levels.
|
Dolibarr module for linking supplier webshops with products and displaying stock levels.
|
||||||
|
|
||||||
|
|
@ -20,6 +20,12 @@ Colored badges for quick overview:
|
||||||
- **Gray**: Below desired stock
|
- **Gray**: Below desired stock
|
||||||
- **Green**: Sufficient stock
|
- **Green**: Sufficient stock
|
||||||
|
|
||||||
|
### Supplier Availability Check (Supplier Orders)
|
||||||
|
- Shows per product line whether the supplier of the order has a purchase price for this product
|
||||||
|
- **Green badge** with supplier abbreviation: Purchase price available
|
||||||
|
- **Red badge** with "N/A": No purchase price for this supplier
|
||||||
|
- Prevents ordering products from wrong suppliers
|
||||||
|
|
||||||
### Supported Areas
|
### Supported Areas
|
||||||
- Customer Orders
|
- Customer Orders
|
||||||
- Proposals/Quotes
|
- Proposals/Quotes
|
||||||
|
|
@ -119,6 +125,16 @@ supplierlink3/
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### Version 2.4
|
||||||
|
- Supplier availability badge in supplier orders (green/red per product line)
|
||||||
|
- Unified badge styling (consistent size and alignment)
|
||||||
|
|
||||||
|
### Version 2.3
|
||||||
|
- Physical | Theoretical stock display
|
||||||
|
- Price indicator badge in supplier orders
|
||||||
|
- Cheapest supplier badge in customer orders/proposals
|
||||||
|
- Price comparison in modal with percentage difference
|
||||||
|
|
||||||
### Version 2.0
|
### Version 2.0
|
||||||
- Admin center completely redesigned
|
- Admin center completely redesigned
|
||||||
- Settings per area (enable/disable)
|
- Settings per area (enable/disable)
|
||||||
|
|
@ -126,7 +142,6 @@ supplierlink3/
|
||||||
- Debug mode disabled by default
|
- Debug mode disabled by default
|
||||||
- Bilingual (German/English)
|
- Bilingual (German/English)
|
||||||
- Stock replenishment list integrated
|
- Stock replenishment list integrated
|
||||||
- Improved icon alignment
|
|
||||||
|
|
||||||
### Version 1.0
|
### Version 1.0
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
@ -178,6 +193,12 @@ Farbige Badges für schnelle Übersicht:
|
||||||
- **Grau**: Unter Wunschbestand
|
- **Grau**: Unter Wunschbestand
|
||||||
- **Grün**: Ausreichend auf Lager
|
- **Grün**: Ausreichend auf Lager
|
||||||
|
|
||||||
|
### Lieferanten-Verfügbarkeitsprüfung (Lieferantenbestellungen)
|
||||||
|
- Zeigt pro Produktzeile an, ob beim Lieferanten der Bestellung ein Einkaufspreis hinterlegt ist
|
||||||
|
- **Grünes Badge** mit Lieferanten-Kürzel: Einkaufspreis vorhanden
|
||||||
|
- **Rotes Badge** mit "N/A": Kein Einkaufspreis bei diesem Lieferanten
|
||||||
|
- Verhindert versehentliches Bestellen bei falschem Lieferanten
|
||||||
|
|
||||||
### Unterstützte Bereiche
|
### Unterstützte Bereiche
|
||||||
- Kundenaufträge
|
- Kundenaufträge
|
||||||
- Angebote
|
- Angebote
|
||||||
|
|
|
||||||
|
|
@ -647,7 +647,7 @@ class ActionsSupplierLink3 extends CommonHookActions
|
||||||
}
|
}
|
||||||
|
|
||||||
// Badge mit zwei Werten: Physisch | Theoretisch
|
// Badge mit zwei Werten: Physisch | Theoretisch
|
||||||
$html = '<span class="badge '.$badgeClass.' classfortooltip" title="'.$tooltipFull.'" style="font-size: 11px; white-space: nowrap;">';
|
$html = '<span class="badge '.$badgeClass.' classfortooltip" title="'.$tooltipFull.'" style="font-size: 11px; padding: 2px 6px; vertical-align: middle; line-height: 16px; white-space: nowrap;">';
|
||||||
$html .= '<i class="fas '.$icon.'" style="margin-right: 3px;"></i>';
|
$html .= '<i class="fas '.$icon.'" style="margin-right: 3px;"></i>';
|
||||||
$html .= '<span style="font-weight: bold;">'.(int)$physicalStock.'</span>';
|
$html .= '<span style="font-weight: bold;">'.(int)$physicalStock.'</span>';
|
||||||
$html .= '<span style="opacity: 0.7; margin: 0 2px;">|</span>';
|
$html .= '<span style="opacity: 0.7; margin: 0 2px;">|</span>';
|
||||||
|
|
@ -674,7 +674,7 @@ class ActionsSupplierLink3 extends CommonHookActions
|
||||||
$code = $cheapest['supplier_code'];
|
$code = $cheapest['supplier_code'];
|
||||||
$tooltip = 'Günstigster: '.$cheapest['supplier_name'].' ('.number_format($cheapest['price'], 2, ',', '.').' EUR)';
|
$tooltip = 'Günstigster: '.$cheapest['supplier_name'].' ('.number_format($cheapest['price'], 2, ',', '.').' EUR)';
|
||||||
|
|
||||||
$html = '<span class="badge classfortooltip" style="background-color: #28a745; color: #fff; font-size: 9px; padding: 2px 4px; margin-left: 3px;" ';
|
$html = '<span class="badge classfortooltip" style="background-color: #28a745; color: #fff; font-size: 11px; padding: 2px 6px; margin-left: 3px; vertical-align: middle; line-height: 16px;" ';
|
||||||
$html .= 'title="'.dol_escape_htmltag($tooltip).'">';
|
$html .= 'title="'.dol_escape_htmltag($tooltip).'">';
|
||||||
$html .= dol_escape_htmltag($code);
|
$html .= dol_escape_htmltag($code);
|
||||||
$html .= '</span>';
|
$html .= '</span>';
|
||||||
|
|
@ -682,6 +682,52 @@ class ActionsSupplierLink3 extends CommonHookActions
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prüft ob ein Produkt beim angegebenen Lieferanten bezogen werden kann
|
||||||
|
* und zeigt ein entsprechendes Badge an (Grün = verfügbar, Rot = kein Einkaufspreis)
|
||||||
|
*
|
||||||
|
* @param int $fk_product Produkt-ID
|
||||||
|
* @param int $supplier_id Lieferanten-ID der Bestellung
|
||||||
|
* @return string HTML für Verfügbarkeits-Badge
|
||||||
|
*/
|
||||||
|
private function getSupplierAvailabilityBadge($fk_product, $supplier_id)
|
||||||
|
{
|
||||||
|
// Prüfen ob ein Einkaufspreis bei diesem Lieferanten existiert
|
||||||
|
$sql = "SELECT pfp.ref_fourn, pfp.price, pfp.quantity as min_qty,
|
||||||
|
s.nom as supplier_name, s.name_alias as supplier_alias
|
||||||
|
FROM ".MAIN_DB_PREFIX."product_fournisseur_price pfp
|
||||||
|
INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = pfp.fk_soc
|
||||||
|
WHERE pfp.fk_product = ".(int)$fk_product."
|
||||||
|
AND pfp.fk_soc = ".(int)$supplier_id."
|
||||||
|
ORDER BY pfp.price ASC
|
||||||
|
LIMIT 1";
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||||
|
// Einkaufspreis vorhanden - Grünes Badge mit Lieferanten-Kürzel
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$shortName = !empty($obj->supplier_alias) ? $obj->supplier_alias : $obj->supplier_name;
|
||||||
|
$code = strtoupper(substr(preg_replace('/[^a-zA-Z0-9]/', '', $shortName), 0, 3));
|
||||||
|
|
||||||
|
$tooltip = dol_escape_htmltag($obj->supplier_name.' - '.number_format($obj->price, 2, ',', '.').' EUR (ab '.(int)$obj->min_qty.' Stk.)');
|
||||||
|
|
||||||
|
$html = '<span class="badge classfortooltip" style="background-color: #28a745; color: #fff; font-size: 11px; padding: 2px 6px; margin-right: 4px; vertical-align: middle; line-height: 16px;" ';
|
||||||
|
$html .= 'title="'.$tooltip.'">';
|
||||||
|
$html .= dol_escape_htmltag($code);
|
||||||
|
$html .= '</span>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kein Einkaufspreis - Rotes Warn-Badge
|
||||||
|
$tooltip = dol_escape_htmltag('Kein Einkaufspreis bei diesem Lieferanten hinterlegt!');
|
||||||
|
|
||||||
|
$html = '<span class="badge badge-danger classfortooltip" style="font-size: 11px; padding: 2px 6px; margin-right: 4px; vertical-align: middle; line-height: 16px;" ';
|
||||||
|
$html .= 'title="'.$tooltip.'">';
|
||||||
|
$html .= '<i class="fas fa-exclamation-triangle" style="margin-right: 2px;"></i>N/A';
|
||||||
|
$html .= '</span>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generiert Preis-Indikator-Badge für Lieferantenbestellung
|
* Generiert Preis-Indikator-Badge für Lieferantenbestellung
|
||||||
* Grün = günstigster, Orange = Durchschnitt, Rot = teuerster
|
* Grün = günstigster, Orange = Durchschnitt, Rot = teuerster
|
||||||
|
|
@ -987,11 +1033,14 @@ class ActionsSupplierLink3 extends CommonHookActions
|
||||||
// Preis-Indikator für diesen Lieferanten (Grün/Orange/Rot)
|
// Preis-Indikator für diesen Lieferanten (Grün/Orange/Rot)
|
||||||
$priceIndicator = $this->getPriceIndicatorBadge($line->fk_product, $fk_supplier);
|
$priceIndicator = $this->getPriceIndicatorBadge($line->fk_product, $fk_supplier);
|
||||||
|
|
||||||
|
// Verfügbarkeits-Badge: Kann das Produkt bei diesem Lieferanten bezogen werden?
|
||||||
|
$availabilityBadge = $this->getSupplierAvailabilityBadge($line->fk_product, $fk_supplier);
|
||||||
|
|
||||||
// Lagerbestand-Badge generieren (mit virtuellem Bestand)
|
// Lagerbestand-Badge generieren (mit virtuellem Bestand)
|
||||||
$stockBadgeHtml = $this->getStockBadgeHtml($line->fk_product, $desiredQty, $alertQty);
|
$stockBadgeHtml = $this->getStockBadgeHtml($line->fk_product, $desiredQty, $alertQty);
|
||||||
|
|
||||||
// Neue ref_fourn zusammenbauen:
|
// Neue ref_fourn zusammenbauen:
|
||||||
// [Shop-Icon] [Preis-Indikator] [Lagerbestand] [Artikel-Nummer]
|
// [Shop-Icon] [Verfügbarkeit] [Preis-Indikator] [Lagerbestand] [Artikel-Nummer]
|
||||||
$newref = '<div style="display: inline-flex; align-items: center;">';
|
$newref = '<div style="display: inline-flex; align-items: center;">';
|
||||||
|
|
||||||
// Shop-Icon mit fester Breite
|
// Shop-Icon mit fester Breite
|
||||||
|
|
@ -1001,6 +1050,9 @@ class ActionsSupplierLink3 extends CommonHookActions
|
||||||
}
|
}
|
||||||
$newref .= '</span>';
|
$newref .= '</span>';
|
||||||
|
|
||||||
|
// Verfügbarkeits-Badge (Kürzel grün oder N/A rot)
|
||||||
|
$newref .= $availabilityBadge;
|
||||||
|
|
||||||
// Preis-Indikator (Grün/Orange/Rot Punkt)
|
// Preis-Indikator (Grün/Orange/Rot Punkt)
|
||||||
if (!empty($priceIndicator)) {
|
if (!empty($priceIndicator)) {
|
||||||
$newref .= '<span style="display: inline-block; width: 18px; text-align: center;">'.$priceIndicator.'</span>';
|
$newref .= '<span style="display: inline-block; width: 18px; text-align: center;">'.$priceIndicator.'</span>';
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class modSupplierLink3 extends DolibarrModules
|
||||||
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@supplierlink3'
|
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@supplierlink3'
|
||||||
|
|
||||||
// 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 = '2.3';
|
$this->version = '2.4';
|
||||||
// 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';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue