diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index e92d59dcac7..b56f361110a 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -1,6 +1,7 @@ + * Copyright (C) 2016 Gilles Poirier * * 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 @@ -28,7 +29,7 @@ * @param Object $object Object * @return array Array of head entries */ -function resourcePrepareHead($object) +function resource_prepare_head($object) { global $langs, $conf, $user; $h = 0; @@ -36,15 +37,50 @@ function resourcePrepareHead($object) $head[$h][0] = dol_buildpath('/resource/card.php',1).'?id='.$object->id; $head[$h][1] = $langs->trans("ResourceCard"); - $head[$h][2] = 'resource'; + $head[$h][2] = 'resource'; $h++; + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + { + $head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id; + $head[$h][1] = $langs->trans('Contact'); + $head[$h][2] = 'contact'; + $h++; + } + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'resource'); + if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $nbNote = 0; + if(!empty($object->note_private)) $nbNote++; + if(!empty($object->note_public)) $nbNote++; + $head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id; + $head[$h][1] = $langs->trans('Notes'); + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + $head[$h][2] = 'note'; + $h++; + } + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $upload_dir = $conf->ficheinter->dir_output . "/" . dol_sanitizeFileName($object->ref); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id; + $head[$h][1] = $langs->trans("Documents"); + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; + $head[$h][2] = 'documents'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$object->id; + $head[$h][1] = $langs->trans('Info'); + $head[$h][2] = 'info'; + $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention','remove'); return $head; }