NEW Add tab "Expense report" on user card
This commit is contained in:
parent
abd5251330
commit
d82af57b57
@ -68,7 +68,7 @@ function user_prepare_head($object)
|
||||
if ($canreadperms)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("UserRights"). ' <span class="badge">'.($object->nb_rights).'</span>';
|
||||
$head[$h][1] = $langs->trans("Rights"). ' <span class="badge">'.($object->nb_rights).'</span>';
|
||||
$head[$h][2] = 'rights';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ class modExpenseReport extends DolibarrModules
|
||||
$r++;
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs = array();
|
||||
$this->tabs = array('user:+expensereport:ExpenseReport:expensereport:$user->rights->expensereport->lire:/expensereport/list.php?mainmenu=hrm&id=__ID__');
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(); // List of boxes
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("users");
|
||||
@ -62,6 +63,7 @@ $pagenext = $page + 1;
|
||||
if (!$sortorder) $sortorder="DESC";
|
||||
if (!$sortfield) $sortfield="d.date_debut";
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
$sall = GETPOST('sall', 'alphanohtml');
|
||||
$search_ref = GETPOST('search_ref');
|
||||
@ -181,12 +183,26 @@ $form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$fuser = new User($db);
|
||||
|
||||
$title = $langs->trans("ListOfTrips");
|
||||
llxHeader('', $title);
|
||||
|
||||
$max_year = 5;
|
||||
$min_year = 5;
|
||||
|
||||
// Récupération de l'ID de l'utilisateur
|
||||
$user_id = $user->id;
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
// Charge utilisateur edite
|
||||
$fuser->fetch($id, '', '', 1);
|
||||
$fuser->getrights();
|
||||
$user_id = $fuser->id;
|
||||
|
||||
$search_user = $user_id;
|
||||
}
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
|
||||
$sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,";
|
||||
@ -327,9 +343,50 @@ if ($resql)
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
$title = $langs->trans("ListTripsAndExpenses");
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
if ($id > 0) // For user tab
|
||||
{
|
||||
$title = $langs->trans("User");
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$head = user_prepare_head($fuser);
|
||||
|
||||
dol_fiche_head($head, 'expensereport', $title, -1, 'user');
|
||||
|
||||
dol_banner_tab($fuser,'id',$linkback,$user->rights->user->user->lire || $user->admin);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
/*if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
|
||||
{
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
showMyBalance($holiday, $user_id);
|
||||
}*/
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$canedit=(($user->id == $user_id && $user->rights->expensereport->creer) || ($user->id != $user_id));
|
||||
|
||||
// Boutons d'actions
|
||||
if ($canedit)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?action=request&id='.$user_id.'" class="butAction">'.$langs->trans("AddTrip").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$title = $langs->trans("ListTripsAndExpenses");
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
}
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
@ -743,22 +800,24 @@ if ($resql)
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
if (empty($id))
|
||||
{
|
||||
// Show list of available documents
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
// Show list of available documents
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->expensereport->lire;
|
||||
$delallowed=$user->rights->expensereport->creer;
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->expensereport->lire;
|
||||
$delallowed=$user->rights->expensereport->creer;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||
print $formfile->showdocuments('massfilesarea_expensereport','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -259,6 +259,8 @@ if ($id > 0)
|
||||
$fuser->fetch($id, '', '', 1);
|
||||
$fuser->getrights();
|
||||
$user_id = $fuser->id;
|
||||
|
||||
$search_employee = $user_id;
|
||||
}
|
||||
|
||||
// Récupération des congés payés de l'utilisateur ou de tous les users
|
||||
|
||||
@ -1038,11 +1038,11 @@ td.showDragHandle {
|
||||
height: calc(100% - 50px);*/
|
||||
}
|
||||
|
||||
<?php if (!empty($conf->global->THEME_TOPMENU_STICKY_POSITION)) { ?>
|
||||
<?php if (empty($conf->global->THEME_DISABLE_STICKY_TOPMENU)) { ?>
|
||||
.side-nav-vert {
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
z-index: 90;
|
||||
z-index: 210;
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
@ -4875,10 +4875,12 @@ div.tabsElem a.tab {
|
||||
}
|
||||
div.login_block {
|
||||
<?php if ($conf->browser->layout == 'phone' && ((GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?>
|
||||
/* Style when phone layout or when using the menuhider */
|
||||
display: none;
|
||||
padding-top: 20px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
padding-bottom: 16px;
|
||||
<?php } else { ?>
|
||||
padding-top: 10px;
|
||||
padding-left: 5px;
|
||||
|
||||
@ -288,16 +288,16 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
{
|
||||
print '<div class="warning">'.$langs->trans("RIBControlError").'</div>';
|
||||
}
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
// Nbre max d'elements des petites listes
|
||||
$MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
|
||||
/*
|
||||
* Last salaries
|
||||
*/
|
||||
if (! empty($conf->salaries->enabled) &&
|
||||
if (! empty($conf->salaries->enabled) &&
|
||||
($user->rights->salaries->read || ($user->rights->salaries->read && $object->id == $user->id))
|
||||
)
|
||||
{
|
||||
@ -334,7 +334,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
print '<td class="nowrap">';
|
||||
$salary->id = $objp->rowid;
|
||||
$salary->ref = $objp->rowid;
|
||||
|
||||
|
||||
print $salary->getNomUrl(1);
|
||||
print '</td><td align="right" width="80px">'.dol_print_date($db->jdate($objp->datesp),'day')."</td>\n";
|
||||
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dateep),'day')."</td>\n";
|
||||
@ -350,11 +350,11 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Last holidays
|
||||
*/
|
||||
if (! empty($conf->holiday->enabled) &&
|
||||
if (! empty($conf->holiday->enabled) &&
|
||||
($user->rights->holiday->read_all || ($user->rights->holiday->read && $object->id == $user->id))
|
||||
)
|
||||
{
|
||||
@ -393,7 +393,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
$holiday->ref = $objp->rowid;
|
||||
$holiday->fk_type = $objp->fk_type;
|
||||
$nbopenedday=num_open_day($db->jdate($objp->date_debut), $db->jdate($objp->date_fin), 0, 1, $objp->halfday);
|
||||
|
||||
|
||||
print $holiday->getNomUrl(1);
|
||||
print '</td><td align="right" width="80px">'.dol_print_date($db->jdate($objp->date_debut),'day')."</td>\n";
|
||||
print '<td align="right" style="min-width: 60px">'.$nbopenedday.' '.$langs->trans('DurationDays').'</td>';
|
||||
@ -413,7 +413,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
/*
|
||||
* Last expense report
|
||||
*/
|
||||
if (! empty($conf->expensereport->enabled) &&
|
||||
if (! empty($conf->expensereport->enabled) &&
|
||||
($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id))
|
||||
)
|
||||
{
|
||||
@ -436,7 +436,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastExpenseReports",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expensereport/list.php?search_user='.$object->id.'">'.$langs->trans("AllExpenseReports").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastExpenseReports",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expensereport/list.php?id='.$object->id.'">'.$langs->trans("AllExpenseReports").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -451,7 +451,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
$exp->id = $objp->rowid;
|
||||
$exp->ref = $objp->ref;
|
||||
$exp->fk_type = $objp->fk_type;
|
||||
|
||||
|
||||
print $exp->getNomUrl(1);
|
||||
print '</td><td align="right" width="80px">'.dol_print_date($db->jdate($objp->date_debut),'day')."</td>\n";
|
||||
print '<td align="right" style="min-width: 60px">'.price($objp->total_ttc).'</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user