diff --git a/htdocs/holiday/admin/tomergewithholiday.php b/htdocs/holiday/admin/tomergewithholiday.php index 7ff795a455b..c301e1ba348 100755 --- a/htdocs/holiday/admin/tomergewithholiday.php +++ b/htdocs/holiday/admin/tomergewithholiday.php @@ -223,4 +223,3 @@ echo ''; llxFooter(); $db->close(); -?> \ No newline at end of file diff --git a/htdocs/holiday/define_congespayes.php b/htdocs/holiday/define_congespayes.php new file mode 100755 index 00000000000..cd3b818b208 --- /dev/null +++ b/htdocs/holiday/define_congespayes.php @@ -0,0 +1,126 @@ + + * Copyright (C) 2011 Dimitri Mouillard + * + * 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. + */ + +/** + * \file define_congespayes.php + * \ingroup congespayes + * \brief File that defines the balance of paid leave of users. + * \version $Id: define_congespayes.php,v 1.00 2011/09/15 11:00:00 dmouillard Exp $ + * \author dmouillard@teclib.com + * \remarks File that defines the balance of paid leave of users. + */ + +require('../main.inc.php'); +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; + +// Protection if external user +if ($user->societe_id > 0) accessforbidden(); + +// If the user does not have perm to read the page +if(!$user->rights->holiday->define_holiday) accessforbidden(); + + +/* + * View + */ + +llxHeader(array(),$langs->trans('CPTitreMenu')); + + +print_fiche_titre($langs->trans('MenuConfCP')); + +$congespayes = new Holidays($db); +$listUsers = $congespayes->fetchUsers(false, true); + +// Si il y a une action de mise à jour +if (isset($_POST['action']) && $_POST['action'] == 'update') { + + $fk_type = $_POST['fk_type']; + + foreach ($_POST['nb_conges'] as $user_id => $compteur) { + if (!empty($compteur)) { + $userValue = str_replace(',', '.', $compteur); + $userValue = number_format($userValue, 2, '.', ''); + } else { + $userValue = '0.00'; + } + $congespayes->updateSoldeCP($user_id,$userValue,$fk_type); + } + + print '
'; + print $langs->trans('UpdateConfCPOK'); + print '
'; + +} + +$var = true; +$i = 0; + +foreach($congespayes->getTypes() as $type) +{ + if($type['affect']==1) + { + print '
'; + + print '

'.$type['label'].'

'; + + print '
' . "\n"; + print ''; + print ''; + + print ''; + print ""; + print ''; + print ''; + print ''; + + foreach ($listUsers as $users) { + $var = !$var; + print ''; + print ''; + print '' . "\n"; + print ''; + + $i++; + } + + echo ""; + print ''; + echo ""; + + print '
' . $langs->trans('Employee') . '' . $langs->trans('Counter') . '
' . $users['name'] . ' ' . $users['firstname'] . ''; + print ''; + print ' jours
'; + print '
'; + + print '
'; + } +} + +// Fin de page +$db->close(); +llxFooter(); +?> diff --git a/htdocs/install/mysql/tables/llx_holiday_types.sql b/htdocs/install/mysql/tables/llx_holiday_types.sql index 4fa2c5e387f..242483b5974 100755 --- a/htdocs/install/mysql/tables/llx_holiday_types.sql +++ b/htdocs/install/mysql/tables/llx_holiday_types.sql @@ -20,8 +20,8 @@ CREATE TABLE llx_holiday_types ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, label varchar(45) NOT NULL, description varchar(255) NOT NULL, - affect int(1) NOT NULL, - delay int(1) NOT NULL, + affect integer NOT NULL, + delay integer NOT NULL, insertAt DATETIME NOT NULL, updateAt DATETIME, deleteAt DATETIME,