Complete work on use of the new ol_banner_tab.

This commit is contained in:
Laurent Destailleur 2016-11-30 20:24:36 +01:00
parent 37d0e7a2e8
commit 317df1cf91
5 changed files with 167 additions and 16 deletions

View File

@ -56,6 +56,18 @@ function expensereport_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
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.'/expensereport/note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
$head[$h][2] = 'note';
$h++;
}
$head[$h][0] = DOL_URL_ROOT . '/expensereport/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';

View File

@ -2585,7 +2585,7 @@ function img_warning($titlealt = 'default', $morealt = '')
if ($titlealt == 'default') $titlealt = $langs->trans('Warning');
return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($morealt ? ($morealt == '1' ? ' style="float: right"' : ' '.$morealt): ''));
return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($morealt ? ($morealt == '1' ? ' style="float: right"' : ' '.$morealt): ''));
}
/**

View File

@ -93,7 +93,15 @@ if ($object->id)
dol_fiche_head($head, 'documents', $langs->trans("ExpenseReport"), 0, 'trip');
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
@ -102,25 +110,22 @@ if ($object->id)
$totalsize+=$file['size'];
}
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
// Societe
//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();
$modulepart = 'expensereport';
$permission = $user->rights->expensereport->creer;
$permtoedit = $user->rights->expensereport->creer;

View File

@ -43,21 +43,36 @@ $title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Info");
$helpurl="EN:Module_Expense_Reports";
llxHeader("",$title,$helpurl);
if ($id)
if ($id > 0 || ! empty($ref))
{
$object = new ExpenseReport($db);
$object->fetch($id);
$object->info($id);
$object->fetch($id,$ref);
$object->info($object->id);
$head = expensereport_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("ExpenseReport"), 0, 'trip');
print '<table width="100%"><tr><td>';
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
dol_fiche_end();
}
llxFooter();

View File

@ -0,0 +1,119 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/commande/note.php
* \ingroup commande
* \brief Fiche de notes sur une commande
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$langs->load("trips");
$langs->load("companies");
$langs->load("bills");
$langs->load("orders");
$id = GETPOST('id','int');
$ref=GETPOST('ref','alpha');
$socid=GETPOST('socid','int');
$action=GETPOST('action','alpha');
// Security check
$socid=0;
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'expensereport',$id,'');
$object = new ExpenseReport($db);
if (! $object->fetch($id, $ref) > 0)
{
dol_print_error($db);
}
$permissionnote=$user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
/*
* View
*/
$title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Note");
$helpurl="EN:Module_Expense_Reports";
llxHeader("",$title,$helpurl);
$form = new Form($db);
if ($id > 0 || ! empty($ref))
{
$object = new ExpenseReport($db);
$object->fetch($id, $ref);
$object->info($object->id);
$head = expensereport_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("ExpenseReport"), 0, 'trip');
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
/*
print '<table class="border" width="100%">';
// Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print "</td></tr>";
print "</table>";
print '<br>';
*/
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print '</div>';
dol_fiche_end();
}
llxFooter();
$db->close();