Debug of holiday module
This commit is contained in:
parent
246f3b5bb8
commit
e441b246a8
@ -14,8 +14,7 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -12,9 +12,8 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -14,9 +14,8 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -12,9 +12,8 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -35,10 +34,12 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
// Si l'utilisateur n'a pas le droit de lire cette page
|
||||
if(!$user->rights->holiday->define_holiday) accessforbidden();
|
||||
|
||||
$action=GETPOST('action');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
*/
|
||||
|
||||
llxHeader($langs->trans('CPTitreMenu'));
|
||||
|
||||
@ -49,8 +50,8 @@ $listUsers = $holiday->fetchUsers(false,false);
|
||||
$userstatic=new User($db);
|
||||
|
||||
// Si il y a une action de mise à jour
|
||||
if(isset($_POST['action']) && $_POST['action'] == 'update' && isset($_POST['update_cp'])) {
|
||||
|
||||
if ($action == 'update' && isset($_POST['update_cp']))
|
||||
{
|
||||
$userID = array_keys($_POST['update_cp']);
|
||||
$userID = $userID[0];
|
||||
|
||||
@ -70,13 +71,13 @@ if(isset($_POST['action']) && $_POST['action'] == 'update' && isset($_POST['upda
|
||||
$holiday->updateSoldeCP($userID,$userValue);
|
||||
|
||||
|
||||
print '<div class="tabBar">';
|
||||
print $langs->trans('UpdateConfCPOK');
|
||||
print '</div>';
|
||||
$mesg='<div class="ok">'.$langs->trans('UpdateConfCPOK').'</div>';
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
} elseif(isset($_POST['action']) && $_POST['action'] == 'add_event') {
|
||||
|
||||
}
|
||||
elseif($action == 'add_event')
|
||||
{
|
||||
$error = false;
|
||||
|
||||
if(!empty($_POST['list_event']) && $_POST['list_event'] > 0) {
|
||||
@ -138,7 +139,7 @@ foreach($listUsers as $users)
|
||||
print '<td>';
|
||||
print '<input type="text" value="'.$holiday->getCPforUser($users['rowid']).'" name="nb_holiday['.$users['rowid'].']" size="5" style="text-align: center;"/>';
|
||||
print ' jours</td>'."\n";
|
||||
print '<td><input type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/edit.png" name="update_cp['.$users['rowid'].']" style="border:0;"/></td>'."\n";
|
||||
print '<td><input type="submit" name="update_cp['.$users['rowid'].']" value="'.dol_escape_htmltag($langs->trans("Update")).'" class="button"/></td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@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
|
||||
@ -12,9 +12,8 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -53,7 +52,7 @@ if ($action == 'add')
|
||||
{
|
||||
|
||||
// Si pas le droit de créer une demande
|
||||
if(!$user->rights->holiday->create_edit_read)
|
||||
if(!$user->rights->holiday->write)
|
||||
{
|
||||
header('Location: fiche.php?action=request&error=CantCreate');
|
||||
exit;
|
||||
@ -142,7 +141,7 @@ if($action == 'update')
|
||||
{
|
||||
|
||||
// Si pas le droit de modifier une demande
|
||||
if(!$user->rights->holiday->create_edit_read)
|
||||
if(!$user->rights->holiday->write)
|
||||
{
|
||||
header('Location: fiche.php?action=request&error=CantUpdate');
|
||||
exit;
|
||||
@ -244,7 +243,7 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
|
||||
}
|
||||
|
||||
// Si envoi de la demande
|
||||
if ($_GET['action'] == 'confirm_send')
|
||||
if ($action == 'confirm_send')
|
||||
{
|
||||
$cp = new Holiday($db);
|
||||
$cp->fetch($_GET['id']);
|
||||
@ -333,7 +332,7 @@ if ($_GET['action'] == 'confirm_send')
|
||||
}
|
||||
|
||||
// Si Validation de la demande
|
||||
if($_GET['action'] == 'confirm_valid')
|
||||
if($action == 'confirm_valid')
|
||||
{
|
||||
|
||||
$cp = new Holiday($db);
|
||||
@ -415,9 +414,9 @@ if($_GET['action'] == 'confirm_valid')
|
||||
|
||||
}
|
||||
|
||||
if ($_GET['action'] == 'confirm_refuse')
|
||||
if ($action == 'confirm_refuse')
|
||||
{
|
||||
if($_POST['action'] == 'confirm_refuse' && !empty($_POST['detail_refuse']))
|
||||
if(!empty($_POST['detail_refuse']))
|
||||
{
|
||||
$cp = new Holiday($db);
|
||||
$cp->fetch($_GET['id']);
|
||||
@ -492,7 +491,7 @@ if ($_GET['action'] == 'confirm_refuse')
|
||||
}
|
||||
|
||||
// Si Validation de la demande
|
||||
if ($_GET['action'] == 'confirm_cancel' && $_GET['confirm'] == 'yes')
|
||||
if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes')
|
||||
{
|
||||
$cp = new Holiday($db);
|
||||
$cp->fetch($_GET['id']);
|
||||
@ -571,11 +570,11 @@ if ($_GET['action'] == 'confirm_cancel' && $_GET['confirm'] == 'yes')
|
||||
|
||||
llxHeader($langs->trans('CPTitreMenu'));
|
||||
|
||||
if ($_GET['action'] == 'request')
|
||||
if ($action == 'request')
|
||||
{
|
||||
|
||||
// Si l'utilisateur n'a pas le droit de faire une demande
|
||||
if(!$user->rights->holiday->create_edit_read)
|
||||
if(!$user->rights->holiday->write)
|
||||
{
|
||||
print '<div class="tabBar">';
|
||||
print $langs->trans('CantCreateCP');
|
||||
@ -756,7 +755,7 @@ elseif(isset($_GET['id']))
|
||||
// Utilisateur connecté
|
||||
$userID = $user->id;
|
||||
|
||||
print_fiche_titre($langs->trans('TitreRequestCP'));
|
||||
//print_fiche_titre($langs->trans('TitreRequestCP'));
|
||||
|
||||
// Si il y a une erreur
|
||||
if(isset($_GET['error'])) {
|
||||
@ -798,9 +797,10 @@ elseif(isset($_GET['id']))
|
||||
}
|
||||
|
||||
// On vérifie si l'utilisateur à le droit de lire cette demande
|
||||
if($user->id == $cp->fk_user || $user->rights->holiday->lire_tous) {
|
||||
if($user->id == $cp->fk_user || $user->rights->holiday->lire_tous)
|
||||
{
|
||||
|
||||
if($_GET['action'] == 'delete' && $cp->statut == 1) {
|
||||
if ($action == 'delete' && $cp->statut == 1) {
|
||||
if($user->rights->holiday->delete) {
|
||||
$html = new Form($db);
|
||||
|
||||
@ -843,10 +843,10 @@ elseif(isset($_GET['id']))
|
||||
}
|
||||
|
||||
|
||||
print '<div class="tabBar">';
|
||||
dol_fiche_head(array(),'card',$langs->trans("CPTitreMenu"),0,'holiday');
|
||||
|
||||
|
||||
if($_GET['action'] == 'edit' && $user->id == $cp->fk_user && $cp->statut == 1)
|
||||
if ($action == 'edit' && $user->id == $cp->fk_user && $cp->statut == 1)
|
||||
{
|
||||
$edit = true;
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$_GET['id'].'">'."\n";
|
||||
@ -856,14 +856,14 @@ elseif(isset($_GET['id']))
|
||||
$html = new Form($db);
|
||||
}
|
||||
|
||||
print '<table class="border" style="float: left; width:40%;">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tbody>';
|
||||
print '<tr class="liste_titre">';
|
||||
/*print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("InfosCP").'</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';*/
|
||||
|
||||
print '<tr>';
|
||||
print '<td width="50%">ID</td>';
|
||||
print '<td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$cp->rowid.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -898,6 +898,20 @@ elseif(isset($_GET['id']))
|
||||
print '<td>'.$langs->trans('NbUseDaysCP').'</td>';
|
||||
print '<td>'.$cp->getOpenDays(strtotime($cp->date_debut),strtotime($cp->date_fin)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('StatutCP').'</td>';
|
||||
print '<td><b>'.$cp->getStatutCP($cp->statut).'</b></td>';
|
||||
print '</tr>';
|
||||
if($cp->statut == 5) {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DetailRefusCP').'</td>';
|
||||
print '<td>'.$cp->detail_refuse.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Description
|
||||
if(!$edit) {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DescCP').'</td>';
|
||||
@ -912,16 +926,20 @@ elseif(isset($_GET['id']))
|
||||
print '</tbody>';
|
||||
print '</table>'."\n";
|
||||
|
||||
print '<div style="width: 4%; float: left;"> </div>';
|
||||
print '<br><br>';
|
||||
|
||||
print '<div style="float: left;width: 40%;">'."\n";
|
||||
|
||||
print '<table class="border" style="width: 100%;">'."\n";
|
||||
print '<table class="border" width="50%">'."\n";
|
||||
print '<tbody>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("InfosWorkflowCP").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('RequestByCP').'</td>';
|
||||
print '<td>'.$userRequest->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if(!$edit) {
|
||||
print '<tr>';
|
||||
print '<td width="50%">'.$langs->trans('ValidateByCP').'</td>';
|
||||
@ -942,10 +960,6 @@ elseif(isset($_GET['id']))
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('RequestByCP').'</td>';
|
||||
print '<td>'.$userRequest->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateCreateCP').'</td>';
|
||||
print '<td>'.$cp->date_create.'</td>';
|
||||
@ -968,29 +982,17 @@ elseif(isset($_GET['id']))
|
||||
print '<td>'.$cp->date_refuse.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('StatutCP').'</td>';
|
||||
print '<td><b>'.$cp->getStatutCP($cp->statut).'</b></td>';
|
||||
print '</tr>';
|
||||
if($cp->statut == 5) {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DetailRefusCP').'</td>';
|
||||
print '<td>'.$cp->detail_refuse.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</tbody>';
|
||||
print '</table>';
|
||||
|
||||
print '<div style="clear: both;"></div>'."\n";
|
||||
dol_fiche_end();
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear: both;"></div>'."\n";
|
||||
print '</div>';
|
||||
|
||||
if ($edit)
|
||||
{
|
||||
print '<center>';
|
||||
if($user->rights->holiday->create_edit_read && $_GET['action'] == 'edit' && $cp->statut == 1)
|
||||
if($user->rights->holiday->write && $_GET['action'] == 'edit' && $cp->statut == 1)
|
||||
{
|
||||
print '<input type="submit" value="'.$langs->trans("UpdateButtonCP").'" class="button">';
|
||||
}
|
||||
@ -1006,7 +1008,7 @@ elseif(isset($_GET['id']))
|
||||
|
||||
// Boutons d'actions
|
||||
|
||||
if($user->rights->holiday->create_edit_read && $_GET['action'] != 'edit' && $cp->statut == 1) {
|
||||
if($user->rights->holiday->write && $_GET['action'] != 'edit' && $cp->statut == 1) {
|
||||
print '<a href="fiche.php?id='.$_GET['id'].'&action=edit" class="butAction" style="float: left;">'.$langs->trans("EditCP").'</a>';
|
||||
}
|
||||
if($user->rights->holiday->delete && $cp->statut == 1) {
|
||||
|
||||
@ -14,8 +14,7 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -72,7 +71,7 @@ $order = " ORDER BY $sortfield $sortorder " . $db->plimit( $conf->liste_limit +
|
||||
*************************************/
|
||||
|
||||
$max_year = 5;
|
||||
$min_year = 5;
|
||||
$min_year = 10;
|
||||
|
||||
$search_ref = $_GET['search_ref'];
|
||||
$month_create = $_GET['month_create'];
|
||||
@ -207,14 +206,14 @@ print '</div>';
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
print '<table class="noborder" width="100%;">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("ID"),"index.php","cp.rowid","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreateCP"),"index.php","cp.date_create","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Employe"),"index.php","cp.fk_user","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ValidatorCP"),"index.php","cp.fk_validator","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDebCP"),"index.php","cp.date_debut","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateFinCP"),"index.php","cp.date_fin","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cp.rowid","",'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreateCP"),$_SERVER["PHP_SELF"],"cp.date_create","",'','align="center"',$sortfield,$sortorder);
|
||||
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("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("Duration"));
|
||||
print_liste_field_titre($langs->trans("Statut"),"index.php","cp.statut","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Statut"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// FILTRES
|
||||
|
||||
@ -13,8 +13,7 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -14,8 +14,7 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -77,7 +76,7 @@ function llxHeader($title)
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add("/holiday/index.php?mainmenu=holiday",$langs->trans("CPTitreMenu"));
|
||||
if($user->rights->holiday->create_edit_read) {
|
||||
if($user->rights->holiday->write) {
|
||||
$menu->add("/holiday/fiche.php?mainmenu=holiday&action=request",$langs->trans("MenuAddCP"),2);
|
||||
}
|
||||
if($user->rights->holiday->define_holiday) {
|
||||
|
||||
@ -1,21 +1,20 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@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 2 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Displays the log of actions performed in the module.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user