Resolved conflicts using server version

This commit is contained in:
Eduard Wisch 2025-12-10 12:51:09 +01:00
commit 381358a7d4
8 changed files with 40 additions and 10 deletions

0
.idea/.gitignore vendored Normal file → Executable file
View file

2
.idea/modules.xml Normal file → Executable file
View file

@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/SupplierLink3.iml" filepath="$PROJECT_DIR$/.idea/SupplierLink3.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/supplierlink3.iml" filepath="$PROJECT_DIR$/.idea/supplierlink3.iml" />
</modules>
</component>
</project>

0
.idea/php.xml Normal file → Executable file
View file

8
.idea/supplierlink3.iml Executable file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

1
.idea/vcs.xml Normal file → Executable file
View file

@ -2,5 +2,6 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/main" vcs="Git" />
</component>
</project>

BIN
bin/module_supplierlink3-1.0.zip Executable file

Binary file not shown.

BIN
bin/module_supplierlink3-1.1.zip Executable file

Binary file not shown.

View file

@ -409,13 +409,12 @@ class ActionsSupplierLink3 extends CommonHookActions
$line = $parameters['line'];
// Lieferanten-ID aus dem Bestell-Objekt holen, nicht aus der Zeile!
// Lieferanten-ID aus dem Bestell-Objekt holen
if (!empty($object->socid)) {
$fk_supplier = $object->socid;
// Extrafeld-Wert vom Lieferanten laden
$sql = "SELECT shop_url";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_extrafields";
$sql = "SELECT shop_url FROM ".MAIN_DB_PREFIX."societe_extrafields";
$sql .= " WHERE fk_object = ".(int)$fk_supplier;
$resql = $this->db->query($sql);
@ -423,24 +422,45 @@ class ActionsSupplierLink3 extends CommonHookActions
if ($resql && $this->db->num_rows($resql) > 0) {
$obj = $this->db->fetch_object($resql);
// Prüfen ob shop_url gesetzt ist
if (isset($obj->shop_url) && $obj->shop_url !== '' && $obj->shop_url !== null) {
$shop_url = trim($obj->shop_url);
// Nur wenn die URL nicht leer ist
if (!empty($shop_url)) {
// Artikelnummer an die URL anhängen
$full_url = rtrim($shop_url, '/') . '/' . $line->ref_fourn;
// Lagerbestand und Wunschbestand abfragen
$sqlStock = "SELECT stock, desiredstock
FROM ".MAIN_DB_PREFIX."product
WHERE rowid = ".(int)$line->fk_product;
// Link erstellen
$resStock = $this->db->query($sqlStock);
$qtyStock = 0;
$desiredQty = 0;
if ($resStock && $this->db->num_rows($resStock) > 0) {
$objStock = $this->db->fetch_object($resStock);
$qtyStock = (float) $objStock->stock;
$desiredQty = (float) $objStock->desiredstock;
}
// Farbe setzen
$stockColor = 'ffffff';
if ($qtyStock < 1) {
$stockColor = 'red'; // ausverkauft
} elseif ($qtyStock < $desiredQty) {
$stockColor = 'orange'; // kleiner als Wunschbestand
}
// Artikel-Link
$full_url = rtrim($shop_url, '/') . '/' . $line->ref_fourn;
$newref = '<a href="'.$full_url.'" target="_blank" class="classfortooltip" title="'.dol_escape_htmltag('Artikel im Shop ansehen').'">';
$newref .= $line->ref_fourn;
$newref .= ' <span class="fa fa-external-link-alt opacitymedium" style="font-size: 0.8em;"></span>';
$newref .= '</a>';
// Lagerbestand daneben mit Farbe
$newref .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="fas fa-box-open em080 pictofixedwidth" title="Lagerbestand" style="color: '.$stockColor.'"></span><b> <span style="color: '.$stockColor.'">'.$qtyStock.'</span></b>';
$line->ref_fourn = $newref;
}
}
}
@ -448,4 +468,5 @@ class ActionsSupplierLink3 extends CommonHookActions
return 0;
}
}