NEW Share msg "not found" for widgets and add a button to add new record when none exists (#31309)

* New msg displayed on widghet

* update msg

* comment code on box_fediverse

* comment code on box_fediverse and delete code langs

* fix errors

* remove underscore before comparing files

* update boxes for get messages and buttons

* continue adding button for widgets

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
lamrani abdelwadoud
2024-10-14 11:56:59 +02:00
committed by GitHub
parent 28cbda6a0b
commit 39e021feba
31 changed files with 258 additions and 225 deletions

View File

@@ -158,6 +158,14 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo
* @var string[] Example array("accounting")
*/
public $depends;
/**
* @var string urltoaddentry
*/
public $urltoaddentry;
/**
* @var string msg when no records exist
*/
public $msgNoRecords = 'NoRecordFound';
@@ -429,6 +437,17 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo
$out .= "</tr>\n";
}
}
} else {
if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) {
$out .= '<tr><td colspan="2" class="center"><span class="opacitymedium">'.$langs->trans($this->msgNoRecords).' </span>';
// Check if $urltoaddentry is defined for the widget
if (!empty($this->urltoaddentry)) {
$out .= '<a href="'.$this->urltoaddentry.'">'.img_picto($langs->trans("New"), 'add', 'pictofixedwidth').'</a>';
}
$out .= '</td></tr>';
}
}
if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) {