diff --git a/core/boxes/box_mahnung_offen.php b/core/boxes/box_mahnung_offen.php
index 602e9fa..d2cfb1e 100644
--- a/core/boxes/box_mahnung_offen.php
+++ b/core/boxes/box_mahnung_offen.php
@@ -80,7 +80,10 @@ class box_mahnung_offen extends ModeleBoxes
$sql .= " ORDER BY m2.stufe DESC LIMIT 1) as mahnstufe,";
$sql .= " (SELECT m3.date_mahnung FROM ".MAIN_DB_PREFIX."mahnung_mahnung as m3";
$sql .= " WHERE m3.fk_facture = f.rowid AND m3.status != ".((int) Mahnung::STATUS_STORNIERT);
- $sql .= " ORDER BY m3.stufe DESC LIMIT 1) as mahndatum";
+ $sql .= " ORDER BY m3.stufe DESC LIMIT 1) as mahndatum,";
+ $sql .= " (SELECT m4.rowid FROM ".MAIN_DB_PREFIX."mahnung_mahnung as m4";
+ $sql .= " WHERE m4.fk_facture = f.rowid AND m4.status != ".((int) Mahnung::STATUS_STORNIERT);
+ $sql .= " ORDER BY m4.stufe DESC LIMIT 1) as mahnid";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
@@ -145,8 +148,8 @@ class box_mahnung_offen extends ModeleBoxes
$late = img_warning(sprintf($l_due_date, dol_print_date($datelimit, 'day', 'tzuserrel')));
}
- // Mahnstufe-Badge
- $mahnBadge = '';
+ // Mahnstufe-Badge (mit Link zur Mahnung) oder Strich fuer keine Mahnung
+ $mahnCell = '—';
if (!empty($objp->mahnstufe)) {
$stufe = (int) $objp->mahnstufe;
$colors = array(1 => '#4a90d9', 2 => '#e68a00', 3 => '#cc3333');
@@ -155,7 +158,12 @@ class box_mahnung_offen extends ModeleBoxes
$label = $labels[$stufe] ?? 'Stufe '.$stufe;
$mahnDatum = $objp->mahndatum ? dol_print_date($this->db->jdate($objp->mahndatum), 'day') : '';
$tooltip = $label.($mahnDatum ? ' vom '.$mahnDatum : '');
- $mahnBadge = ''.$label.'';
+ $badge = ''.$label.'';
+ if (!empty($objp->mahnid)) {
+ $mahnCell = ''.$badge.'';
+ } else {
+ $mahnCell = $badge;
+ }
}
// Spalte 1: Rechnung + Warnung
@@ -188,7 +196,7 @@ class box_mahnung_offen extends ModeleBoxes
// Spalte 5: Mahnstufe
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
- 'text' => !empty($mahnBadge) ? $mahnBadge : '',
+ 'text' => $mahnCell,
'asis' => 1,
);