Freitext Zeilen Unterstützung hinzugefügt

This commit is contained in:
Eduard Wisch 2026-01-30 19:22:04 +01:00
parent 209ce1e3f8
commit 0cf74ff550
21 changed files with 766 additions and 656 deletions

0
.gitignore vendored Normal file → Executable file
View file

0
.idea/SupplierLink3.iml Normal file → Executable file
View file

View file

@ -0,0 +1,10 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>

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

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

6
.idea/sqldialects.xml Executable file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/class/actions_supplierlink3.class.php" dialect="GenericSQL" />
</component>
</project>

0
.idea/supplierlink3.iml Executable file → Normal file
View file

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

0
COPYING Executable file → Normal file
View file

0
ChangeLog.md Executable file → Normal file
View file

239
README.md Executable file → Normal file
View file

@ -1,96 +1,217 @@
# 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**
Dolibarr module for linking supplier webshops with products and displaying stock levels.
## Features ## Features
Description of the module... ### Shop Links
- Direct access to supplier webshops from within Dolibarr
- Automatic URL generation with supplier article number
- Multi-supplier support with popup selection (sorted by price)
- Configurable shop icon (FontAwesome)
- Same supplier opens in same browser tab
<!-- ### Stock Display
![Screenshot supplierlink3](img/screenshot_supplierlink3.png?raw=true "SupplierLink3"){imgmd} Colored badges for quick overview:
--> - **Red**: Out of stock (< 1)
- **Orange**: Below minimum stock (alert threshold)
- **Gray**: Below desired stock
- **Green**: Sufficient stock
Other external modules are available on [Dolistore.com](https://www.dolistore.com). ### Supported Areas
- Customer Orders
## Translations - Proposals/Quotes
- Supplier Orders
Translations can be completed manually by editing files in the module directories under `langs`. - Stock Replenishment
- Product Card
<!--
This module contains also a sample configuration for Transifex, under the hidden directory [.tx](.tx), so it is possible to manage translation using this service.
For more information, see the [translator's documentation](https://wiki.dolibarr.org/index.php/Translator_documentation).
There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module-template) for this module.
-->
### Quick Supplier Order Creation
- "Create Supplier Order" button in customer orders
- Automatic product and quantity transfer
- Supplier reference with customer name and order number
## Installation ## Installation
Prerequisites: You must have Dolibarr ERP & CRM software installed. You can download it from [Dolistore.org](https://www.dolibarr.org). ### From ZIP file
You can also get a ready-to-use instance in the cloud from https://saas.dolibarr.org 1. Go to menu **Home > Setup > Modules > Deploy external module**
2. Upload the zip file
### Manual Installation
1. Copy module folder to `/custom/supplierlink3/`
2. In Dolibarr: **Setup > Modules > SupplierLink3** - activate
3. On activation, extrafield `shop_url` is created for suppliers
### From the ZIP file and GUI interface ## Configuration
If the module is a ready-to-deploy zip file, so with a name `module_xxx-version.zip` (e.g., when downloading it from a marketplace like [Dolistore](https://www.dolistore.com)), ### Admin Center
go to menu `Home> Setup> Modules> Deploy external module` and upload the zip file. Settings under **Setup > Modules > SupplierLink3 > Settings**
<!-- #### Display Settings
Enable/disable the function for each area:
- Customer Orders
- Proposals
- Supplier Orders
- Stock Replenishment
- Product Card
Note: If this screen tells you that there is no "custom" directory, check that your setup is correct: #### Icon Settings
Customizable FontAwesome icons:
- **Shop Icon**: Default `fas fa-store`
- **Stock Icon**: Optional
- In your Dolibarr installation directory, edit the `htdocs/conf/conf.php` file and check that following lines are not commented: #### Debug Mode
- Disabled by default
- When enabled, writes to `/tmp/supplierlink3_debug.log`
```php ### Setting up Shop URL for Suppliers
//$dolibarr_main_url_root_alt ... 1. Open supplier > Edit
//$dolibarr_main_document_root_alt ... 2. Fill extrafield "Shop URL" (e.g. `https://shop.supplier.com/article/`)
``` 3. The supplier article number is automatically appended
- Uncomment them if necessary (delete the leading `//`) and assign the proper value according to your Dolibarr installation ## Usage
For example : ### In Orders/Proposals
- Click shop icon next to stock level
- Multiple suppliers: Dropdown with price comparison
- Same supplier opens in same browser tab
- UNIX: ### Creating Supplier Order
```php 1. Open customer order
$dolibarr_main_url_root_alt = '/custom'; 2. Click "Create Supplier Order" button
$dolibarr_main_document_root_alt = '/var/www/Dolibarr/htdocs/custom'; 3. Select supplier
``` 4. Select products
5. Create order
- Windows: ## Technical Details
```php
$dolibarr_main_url_root_alt = '/custom';
$dolibarr_main_document_root_alt = 'C:/My Web Sites/Dolibarr/htdocs/custom';
```
-->
<!-- ### Hooks
- `ordersuppliercard` - Supplier Orders
- `ordercard` - Customer Orders
- `propalcard` - Proposals
- `productcard` - Product Card
- `productpricecard` - Product Prices
- `stockreplenishlist` - Replenishment List
### From a GIT repository ### Database
Uses extrafield `shop_url` in `llx_societe_extrafields`.
Clone the repository in `$dolibarr_main_document_root_alt/supplierlink3` ### File Structure
```
```shell supplierlink3/
cd ....../custom ├── admin/
git clone git@github.com:gitlogin/supplierlink3.git supplierlink3 │ ├── setup.php # Settings
│ └── about.php # About page
├── class/
│ └── actions_supplierlink3.class.php # Hook implementation
├── core/modules/
│ └── modSupplierLink3.class.php # Module definition
├── js/
│ └── replenish.js # JavaScript for replenishment
├── langs/
│ ├── de_DE/supplierlink3.lang
│ └── en_US/supplierlink3.lang
├── lib/
│ └── supplierlink3.lib.php
└── create_supplier_order.php # Create supplier order
``` ```
--> ## Changelog
### Final steps ### Version 2.0
- Admin center completely redesigned
- Settings per area (enable/disable)
- Configurable icons (FontAwesome)
- Debug mode disabled by default
- Bilingual (German/English)
- Stock replenishment list integrated
- Improved icon alignment
Using your browser: ### Version 1.0
- Initial release
- Shop links in orders
- Stock badges
- Supplier order from customer order
- Log into Dolibarr as a super-administrator ## Translations
- Go to "Setup"> "Modules"
- You should now be able to find and enable the module
Translations are available in:
- German (de_DE)
- English (en_US)
Additional translations can be added by creating files in `langs/xx_XX/supplierlink3.lang`
## Support
For questions or issues: data@data-it-solution.de
## Licenses ## Licenses
### Main code ### Main Code
GPLv3 or (at your option) any later version. See file COPYING for more information. GPLv3 or (at your option) any later version. See file COPYING for more information.
### Documentation ### Documentation
All texts and readmes are licensed under [GFDL](https://www.gnu.org/licenses/fdl-1.3.en.html).
All texts and readme's are licensed under [GFDL](https://www.gnu.org/licenses/fdl-1.3.en.html). ---
# SupplierLink3 für [Dolibarr ERP & CRM](https://www.dolibarr.org) (Deutsch)
**Version 2.0** | **Lizenz: GPL v3** | **Autor: Eduard Wisch**
Dolibarr-Modul zur Verknüpfung von Lieferanten-Webshops mit Produkten und Anzeige von Lagerbeständen.
## Funktionen
### Shop-Links
- Direkter Zugang zu Lieferanten-Webshops aus Dolibarr heraus
- Automatische URL-Generierung mit Lieferanten-Artikelnummer
- Multi-Lieferanten-Unterstützung mit Popup-Auswahl (sortiert nach Preis)
- Konfigurierbares Shop-Symbol (FontAwesome)
- Gleicher Lieferant öffnet sich im gleichen Browser-Tab
### Lagerbestand-Anzeige
Farbige Badges für schnelle Übersicht:
- **Rot**: Nicht auf Lager (< 1)
- **Orange**: Unter Mindestbestand (Alarm-Schwelle)
- **Grau**: Unter Wunschbestand
- **Grün**: Ausreichend auf Lager
### Unterstützte Bereiche
- Kundenaufträge
- Angebote
- Lieferantenbestellungen
- Nachbestellung (Lager)
- Produktkarte
### Schnelle Lieferantenbestellung
- Button "Lieferantenbestellung erstellen" im Kundenauftrag
- Automatische Übernahme von Produkten und Mengen
- Lieferanten-Referenz mit Kundenname und Auftragsnummer
## Konfiguration
### Shop-URL für Lieferanten einrichten
1. Lieferant öffnen > Bearbeiten
2. Extrafeld "Shop URL" ausfüllen (z.B. `https://shop.lieferant.de/artikel/`)
3. Die Lieferanten-Artikelnummer wird automatisch angehängt
### Admin-Center
Einstellungen unter **Einstellungen > Module > SupplierLink3 > Einstellungen**
#### Anzeige-Einstellungen
Aktivieren/Deaktivieren pro Bereich:
- Kundenaufträge
- Angebote
- Lieferantenbestellungen
- Nachbestellung (Lager)
- Produktkarte
#### Symbol-Einstellungen
- **Shop-Symbol**: Standard `fas fa-store`
- **Lagerbestand-Symbol**: Optional
#### Debug-Modus
- Standardmäßig deaktiviert
- Schreibt bei Aktivierung nach `/tmp/supplierlink3_debug.log`

134
admin/about.php Executable file → Normal file
View file

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2025 Eduard Wisch <data@data-it-solution.de>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr> * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Eduard Wisch <data@data-it-solution.de>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -25,34 +25,31 @@
// Load Dolibarr environment // Load Dolibarr environment
$res = 0; $res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
} }
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
$tmp2 = realpath(__FILE__); $tmp2 = realpath(__FILE__);
$i = strlen($tmp) - 1; $i = strlen($tmp) - 1;
$j = strlen($tmp2) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--; $i--;
$j--; $j--;
} }
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include 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")) { 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"; $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
} }
// Try main.inc.php using relative path
if (!$res && file_exists("../../main.inc.php")) { if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php"; $res = @include "../../main.inc.php";
} }
if (!$res && file_exists("../../../main.inc.php")) { if (!$res && file_exists("../../../main.inc.php")) {
$res = @include "../../../main.inc.php"; $res = @include "../../../main.inc.php";
} }
if (!$res) { if (!$res) {
die("Include of main fails"); die("Include of main fails");
} }
// Libraries // Libraries
@ -60,59 +57,116 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once '../lib/supplierlink3.lib.php'; require_once '../lib/supplierlink3.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Translations // Translations
$langs->loadLangs(array("errors", "admin", "supplierlink3@supplierlink3")); $langs->loadLangs(array("errors", "admin", "supplierlink3@supplierlink3"));
// Access control // Access control
if (!$user->admin) { if (!$user->admin) {
accessforbidden(); accessforbidden();
} }
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
/*
* Actions
*/
// None
/* /*
* View * View
*/ */
$form = new Form($db); $form = new Form($db);
$help_url = ''; $title = $langs->trans("SupplierLink3Setup");
$title = "SupplierLink3Setup";
llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', '', '', 'mod-supplierlink3 page-admin_about'); llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-supplierlink3 page-admin_about');
// Subheader // Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); print load_fiche_titre($title, $linkback, 'title_setup');
// Configuration header // Configuration header
$head = supplierlink3AdminPrepareHead(); $head = supplierlink3AdminPrepareHead();
print dol_get_fiche_head($head, 'about', $langs->trans($title), 0, 'supplierlink3@supplierlink3'); print dol_get_fiche_head($head, 'about', $title, -1, 'supplierlink3@supplierlink3');
// Module info
dol_include_once('/supplierlink3/core/modules/modSupplierLink3.class.php'); dol_include_once('/supplierlink3/core/modules/modSupplierLink3.class.php');
$tmpmodule = new modSupplierLink3($db); $tmpmodule = new modSupplierLink3($db);
print $tmpmodule->getDescLong();
print '<table class="noborder centpercent">';
// Version
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans('SL3_Version').' & '.$langs->trans('SL3_Author').'</th>';
print '</tr>';
print '<tr class="oddeven">';
print '<td width="30%">'.$langs->trans('SL3_Version').'</td>';
print '<td><strong>'.$tmpmodule->version.'</strong></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('SL3_Author').'</td>';
print '<td>Eduard Wisch &lt;data@data-it-solution.de&gt;</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('SL3_License').'</td>';
print '<td>GPL v3</td>';
print '</tr>';
print '</table>';
print '<br>';
// Features
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans('SL3_Features').'</th>';
print '</tr>';
$features = array(
'SL3_Feature1' => 'fa-store',
'SL3_Feature2' => 'fa-boxes',
'SL3_Feature3' => 'fa-truck-loading',
'SL3_Feature4' => 'fa-users',
);
foreach ($features as $key => $icon) {
print '<tr class="oddeven">';
print '<td><i class="fas '.$icon.'" style="color: #0077b6; margin-right: 10px; width: 20px;"></i>'.$langs->trans($key).'</td>';
print '</tr>';
}
print '</table>';
print '<br>';
// Stock badge legend
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans('SL3_StockBadges', 'Lagerbestand-Badges').'</th>';
print '</tr>';
print '<tr class="oddeven">';
print '<td width="150"><span class="badge" style="background-color: #dc3545; color: #fff;">0</span></td>';
print '<td>'.$langs->trans('SL3_StockCritical').'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td><span class="badge" style="background-color: #fd7e14; color: #fff;">5</span></td>';
print '<td>'.$langs->trans('SL3_StockWarning').'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td><span class="badge" style="background-color: #6c757d; color: #fff;">15</span></td>';
print '<td>'.$langs->trans('SL3_StockLow').'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td><span class="badge" style="background-color: #28a745; color: #fff;">42</span></td>';
print '<td>'.$langs->trans('SL3_StockOk').'</td>';
print '</tr>';
print '</table>';
// Page end // Page end
print dol_get_fiche_end(); print dol_get_fiche_end();
llxFooter(); llxFooter();
$db->close(); $db->close();

942
admin/setup.php Executable file → Normal file

File diff suppressed because it is too large Load diff

0
build/buildzip.php Executable file → Normal file
View file

0
build/makepack-supplierlink3.conf Executable file → Normal file
View file

0
img/README.md Executable file → Normal file
View file

91
langs/en_US/supplierlink3.lang Executable file → Normal file
View file

@ -1,42 +1,97 @@
# Translation file # SupplierLink3 - English translation
# Copyright (C) 2025 Eduard Wisch <data@data-it-solution.de>
# #
# Generic # Generic
# #
# Module label 'ModuleSupplierLink3Name'
ModuleSupplierLink3Name = SupplierLink3 ModuleSupplierLink3Name = SupplierLink3
# Module description 'ModuleSupplierLink3Desc' ModuleSupplierLink3Desc = Supplier linking with shop links and stock display
ModuleSupplierLink3Desc = SupplierLink3 description
# #
# Admin page # Admin page
# #
SupplierLink3Setup = SupplierLink3 setup SupplierLink3Setup = SupplierLink3 Setup
Settings = Settings Settings = Settings
SupplierLink3SetupPage = SupplierLink3 setup page SupplierLink3SetupPage = SupplierLink3 setup page
NewSection=New section SupplierLink3Description = Displays shop links and stock levels in orders, proposals and supplier orders
SUPPLIERLINK3_MYPARAM1 = My param 1
SUPPLIERLINK3_MYPARAM1Tooltip = My param 1 tooltip
SUPPLIERLINK3_MYPARAM2=My param 2
SUPPLIERLINK3_MYPARAM2Tooltip=My param 2 tooltip
# Settings sections
SL3_DisplaySettings = Display Settings
SL3_DisplaySettingsDesc = Choose where shop links and stock levels should be displayed
SL3_IconSettings = Icon Settings
SL3_IconSettingsDesc = Customize the icons used
SL3_DebugSettings = Debug Settings
SL3_RegisteredHooks = Registered Hooks
# Display areas
SL3_EnableOrderCard = Customer Orders
SL3_EnableOrderCardDesc = Show shop links and stock in customer orders
SL3_EnablePropalCard = Proposals
SL3_EnablePropalCardDesc = Show shop links and stock in proposals
SL3_EnableSupplierOrder = Supplier Orders
SL3_EnableSupplierOrderDesc = Show shop links and stock in supplier orders
SL3_EnableReplenish = Stock Replenishment
SL3_EnableReplenishDesc = Show shop links and stock in the replenishment list
SL3_EnableProductCard = Product Card
SL3_EnableProductCardDesc = Show shop links on the product card
# Icons
SL3_ShopIcon = Shop Icon
SL3_ShopIconDesc = FontAwesome class for the shop icon (e.g. fa-store, fa-shopping-cart, fa-external-link-alt)
SL3_StockIcon = Stock Icon
SL3_StockIconDesc = FontAwesome class for the stock icon (e.g. fa-box, fa-warehouse, fa-cubes)
SL3_IconPreview = Preview
# Debug
SL3_DebugMode = Debug Mode
SL3_DebugModeDesc = Writes debug messages to the log file
SL3_DebugLog = Debug Log
SL3_DebugLogFile = Log file
SL3_DebugLogSize = Size
SL3_DebugLogClear = Clear log
SL3_DebugLogCleared = Debug log cleared
SL3_DebugLogEmpty = No log file exists. Enable debug mode and perform an action.
SL3_DebugLogLastEntries = Last entries
# Hooks
SL3_HookOrderSupplier = Supplier Orders - Shop links and stock
SL3_HookOrderCard = Customer Orders - Shop links, stock and "Create supplier order" button
SL3_HookPropalCard = Proposals - Shop links and stock
SL3_HookProductCard = Product Card - Shop links
SL3_HookProductPrice = Product Prices - Shop links
SL3_HookReplenish = Replenishment - Shop links and stock
# Messages
SetupSaved = Settings saved
# #
# About page # About page
# #
About = About About = About
SupplierLink3About = About SupplierLink3 SupplierLink3About = About SupplierLink3
SupplierLink3AboutPage = SupplierLink3 about page SupplierLink3AboutPage = SupplierLink3 information
SL3_Version = Version
SL3_Author = Author
SL3_License = License
SL3_Features = Features
SL3_Feature1 = Shop links to supplier webshops
SL3_Feature2 = Stock display with colored badges
SL3_Feature3 = Quick supplier order creation from customer orders
SL3_Feature4 = Multi-supplier support with popup selection
SL3_Documentation = Documentation
# #
# Sample page # Stock badges
# #
SupplierLink3Area = Home SupplierLink3 SL3_StockCritical = Critical (< 1)
MyPageName = My page name SL3_StockWarning = Warning (below minimum stock)
SL3_StockLow = Low (below desired stock)
SL3_StockOk = Sufficient
# #
# Sample widget # Supplier order creation
# #
MyWidget = My widget SL3_CreateSupplierOrder = Create Supplier Order
MyWidgetDescription = My widget description SL3_SelectSupplier = Select supplier
SL3_SelectProducts = Select products
SL3_NoSuppliers = No suppliers available

0
lib/supplierlink3.lib.php Executable file → Normal file
View file

0
modulebuilder.txt Executable file → Normal file
View file

0
sql/dolibarr_allversions.sql Executable file → Normal file
View file

0
supplierlink3index.php Executable file → Normal file
View file