mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Fix missing document tab on receptions
This commit is contained in:
@@ -36,8 +36,7 @@ function reception_prepare_head(Reception $object)
|
||||
{
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$langs->load("sendings");
|
||||
$langs->load("deliveries");
|
||||
$langs->loadLangs(array("sendings", "deliveries"));
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@@ -49,8 +48,8 @@ function reception_prepare_head(Reception $object)
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||
$objectsrc = $object;
|
||||
if ($object->origin == 'commande' && $object->origin_id > 0) {
|
||||
$objectsrc = new Commande($db);
|
||||
if ($object->origin == 'supplier_order' && $object->origin_id > 0) {
|
||||
$objectsrc = new CommandeFournisseur($db);
|
||||
$objectsrc->fetch($object->origin_id);
|
||||
}
|
||||
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
|
||||
@@ -69,6 +68,19 @@ function reception_prepare_head(Reception $object)
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'reception');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->reception->dir_output."/".dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/reception/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles + $nbLinks) > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
}
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$nbNote = 0;
|
||||
if (!empty($object->note_private)) {
|
||||
$nbNote++;
|
||||
|
||||
Reference in New Issue
Block a user