Bug war week-end: Fix a duplicate page on holiday, fix missing badge on
some documents tabs.
This commit is contained in:
parent
0d8788e552
commit
a8758fa5b7
@ -39,10 +39,15 @@ function holiday_prepare_head($object)
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Document');
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
// Attachments
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
|
||||
@ -84,9 +84,14 @@ function member_prepare_head(Adherent $object)
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$h++;
|
||||
|
||||
// Attachments
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,1,$object,'member').'/'.dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
$head[$h][2] = 'document';
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/info.php?id='.$object->id;
|
||||
|
||||
@ -310,7 +310,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5002__+MAX_llx_menu__, '/holiday/list.php?select_statut=2&leftmenu=hrm', 'ListToApprove', 2, 'trips', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5005__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5006__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 4, __ENTITY__);
|
||||
-- HRM - Expense reports
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 15__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->deplacement->enabled', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__);
|
||||
|
||||
@ -1252,7 +1252,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/holiday/list.php?select_statut=2&leftmenu=hrm", $langs->trans("ListToApprove"), 2, $user->rights->holiday->read);
|
||||
$newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday);
|
||||
$newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
|
||||
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->define_holiday);
|
||||
}
|
||||
|
||||
// Trips and expenses (old module)
|
||||
|
||||
@ -33,7 +33,9 @@ class Holiday extends CommonObject
|
||||
{
|
||||
public $element='holiday';
|
||||
public $table_element='holiday';
|
||||
|
||||
protected $isnolinkedbythird = 1; // No field fk_soc
|
||||
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see id
|
||||
@ -211,7 +213,8 @@ class Holiday extends CommonObject
|
||||
$sql.= " cp.note_private,";
|
||||
$sql.= " cp.note_public,";
|
||||
$sql.= " cp.fk_user_create,";
|
||||
$sql.= " cp.fk_type";
|
||||
$sql.= " cp.fk_type,";
|
||||
$sql.= " cp.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp";
|
||||
$sql.= " WHERE cp.rowid = ".$id;
|
||||
|
||||
@ -247,6 +250,7 @@ class Holiday extends CommonObject
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->fk_user_create = $obj->fk_user_create;
|
||||
$this->fk_type = $obj->fk_type;
|
||||
$this->entity = $obj->entity;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@ -159,8 +159,18 @@ llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');
|
||||
|
||||
print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n";
|
||||
if ($holiday->getConfCP('lastUpdate')) print '<strong>'.dol_print_date($db->jdate($holiday->getConfCP('lastUpdate')),'dayhour','tzuser').'</strong>';
|
||||
$lastUpdate = $holiday->getConfCP('lastUpdate', 0);
|
||||
if ($lastUpdate)
|
||||
{
|
||||
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||
$yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
|
||||
print '<strong>'.dol_print_date($db->jdate($holiday->getConfCP('lastUpdate')),'dayhour','tzuser').'</strong>';
|
||||
print '<br>'.$langs->trans("MonthOfLastMonthlyUpdate").': <strong>'.$yearLastUpdate.'-'.$monthLastUpdate.'</strong>'."\n";
|
||||
}
|
||||
else print $langs->trans('None');
|
||||
|
||||
|
||||
|
||||
print "</div><br>\n";
|
||||
|
||||
$result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user.
|
||||
|
||||
@ -253,6 +253,7 @@ else
|
||||
dol_fiche_head('');
|
||||
}
|
||||
|
||||
$alltypeleaves=$holiday->getTypes(1,-1); // To have labels
|
||||
|
||||
$out='';
|
||||
$typeleaves=$holiday->getTypes(1,1);
|
||||
@ -291,7 +292,7 @@ print_liste_field_titre($langs->trans("DateCreateCP"),$_SERVER["PHP_SELF"],"cp.d
|
||||
print_liste_field_titre($langs->trans("Employe"),$_SERVER["PHP_SELF"],"cp.fk_user","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder);
|
||||
@ -407,7 +408,10 @@ if (! empty($holiday->holiday))
|
||||
print '<td style="text-align: center;">'.dol_print_date($date,'day').'</td>';
|
||||
print '<td>'.$userstatic->getNomUrl('1').'</td>';
|
||||
print '<td>'.$approbatorstatic->getNomUrl('1').'</td>';
|
||||
print '<td>'.$infos_CP['fk_type'].'</td>';
|
||||
print '<td>';
|
||||
$label=$alltypeleaves[$infos_CP['fk_type']]['label'];
|
||||
print $label?$label:$infos_CP['fk_type'];
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
$nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']);
|
||||
print $nbopenedday.' '.$langs->trans('DurationDays');
|
||||
|
||||
@ -1,156 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 François Legastelois <flegastelois@teclib.com>
|
||||
*
|
||||
* 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/holiday/month_report.php
|
||||
* \ingroup holiday
|
||||
* \brief Monthly report of paid holiday.
|
||||
*/
|
||||
|
||||
require('../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
// Si l'utilisateur n'a pas le droit de lire cette page
|
||||
if(!$user->rights->holiday->read_all) accessforbidden();
|
||||
|
||||
$langs->load('hrm');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$holidaystatic = new Holiday($db);
|
||||
|
||||
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
|
||||
$cp = new Holiday($db);
|
||||
|
||||
$month = GETPOST('month_start');
|
||||
$year = GETPOST('year_start');
|
||||
|
||||
if(empty($month)) {
|
||||
$month = date('n');
|
||||
}
|
||||
if(empty($year)) {
|
||||
$year = date('Y');
|
||||
}
|
||||
|
||||
$sql = "SELECT cp.rowid, cp.fk_user, cp.date_debut, cp.date_fin, cp.halfday";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "holiday cp";
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "user u ON cp.fk_user = u.rowid";
|
||||
$sql.= " WHERE cp.statut = 3"; // Approved
|
||||
// TODO Use BETWEEN instead of date_format
|
||||
$sql.= " AND (date_format(cp.date_debut, '%Y-%c') = '$year-$month' OR date_format(cp.date_fin, '%Y-%c') = '$year-$month')";
|
||||
$sql.= " ORDER BY u.lastname,cp.date_debut";
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print load_fiche_titre($langs->trans('MenuReportMonth'), '', 'title_hrm.png');
|
||||
|
||||
// Get month of last update
|
||||
$lastUpdate = $cp->getConfCP('lastUpdate', 0);
|
||||
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||
$yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
|
||||
print $langs->trans("MonthOfLastMonthlyUpdate").': <strong>'.$yearLastUpdate.'-'.$monthLastUpdate.'</strong><br><br>'."\n";
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print $langs->trans('Month').': ';
|
||||
print $htmlother->select_month($month, 'month_start').' ';
|
||||
print $htmlother->select_year($year,'year_start',1,10,3);
|
||||
|
||||
print '<input type="submit" value="'.$langs->trans("Refresh").'" class="button" />';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
$var=true;
|
||||
print '<table class="noborder" width="40%;">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('Employee').'</td>';
|
||||
print '<td>'.$langs->trans('DateDebCP').'</td>';
|
||||
print '<td>'.$langs->trans('DateFinCP').'</td>';
|
||||
print '<td align="right">'.$langs->trans('nbJours').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if($num == '0') {
|
||||
|
||||
print '<tr class="pair">';
|
||||
print '<td colspan="5">'.$langs->trans('None').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
} else {
|
||||
|
||||
$langs->load('users');
|
||||
|
||||
while ($holiday = $db->fetch_array($result))
|
||||
{
|
||||
$user = new User($db);
|
||||
$user->fetch($holiday['fk_user']);
|
||||
$var=!$var;
|
||||
|
||||
$holidaystatic->id=$holiday['rowid'];
|
||||
$holidaystatic->ref=$holiday['rowid'];
|
||||
|
||||
$start_date=$db->jdate($holiday['date_debut']);
|
||||
$end_date=$db->jdate($holiday['date_fin']);
|
||||
$start_date_gmt=$db->jdate($holiday['date_debut'],1);
|
||||
$end_date_gmt=$db->jdate($holiday['date_fin'],1);
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$holidaystatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$user->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_print_date($start_date,'day');
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($end_date,'day');
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
$nbopenedday=num_open_day($start_date_gmt, $end_date_gmt, 0, 1, $holiday['halfday']);
|
||||
print $nbopenedday;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Fin de page
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -22,7 +22,7 @@ ReviewedByCP=Will be reviewed by
|
||||
DescCP=Description
|
||||
SendRequestCP=Create leave request
|
||||
DelayToRequestCP=Leave requests must be made at least <b>%s day(s)</b> before them.
|
||||
MenuConfCP=Edit balance of leaves
|
||||
MenuConfCP=Balance of leaves
|
||||
UpdateAllCP=Update the leaves
|
||||
SoldeCPUser=Leaves balance is <b>%s</b> days.
|
||||
ErrorEndDateCP=You must select an end date greater than the start date.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user