case 'nodatedebut':
                    $errors[] = $langs->trans('NoDateDebut');
                    break;
                case 'nodatefin':
                    $errors[] = $langs->trans('NoDateFin');
                    break;
                case 'DureeHoliday':
                    $errors[] = $langs->trans('ErrorDureeCP');
                    break;
                case 'alreadyCP':
                    $errors[] = $langs->trans('alreadyCPexist');
                    break;
            }
            dol_htmloutput_mesg('', $errors, 'error');
        }
        $delayForRequest = $cp->getConfCP('delayForRequest');
        //$delayForRequest = $delayForRequest * (60*60*24);
        $nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
        print '<script type="text/javascript">
	    function valider()
	    {
    	    if(document.demandeCP.date_debut_.value != "")
    	    {
	           	if(document.demandeCP.date_fin_.value != "")
	           	{
	               if(document.demandeCP.valideur.value != "-1") {
	                 return true;
	               }
	               else {
	                 alert("' . dol_escape_js($langs->transnoentities('InvalidValidatorCP')) . '");
	                 return false;
    print '</tr>';
    // LastName
    print '<tr><td width="25%" valign="top">' . $langs->trans("LastName") . '</td>';
    print '<td colspan="2">' . $fuser->lastname . '</td>';
    print "</tr>\n";
    // FirstName
    print '<tr><td width="25%" valign="top">' . $langs->trans("FirstName") . '</td>';
    print '<td colspan="2">' . $fuser->firstname . '</td>';
    print "</tr>\n";
    print '</table><br>';
} else {
    print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num);
    dol_fiche_head('');
}
$nbaquis = $holiday->getCPforUser($user_id);
$nbdeduced = $holiday->getConfCP('nbHolidayDeducted');
$nb_holiday = $nbaquis / $nbdeduced;
print $langs->trans('SoldeCPUser', round($nb_holiday, 2)) . ($nbdeduced != 1 ? ' (' . $nbaquis . ' / ' . $nbdeduced . ')' : '');
if ($id > 0) {
    dol_fiche_end();
    print '</br>';
} else {
    dol_fiche_end();
}
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("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);
Beispiel #3
0
if (empty($year)) {
    $tmpdate = dol_getdate(dol_now());
    $year = $tmpdate['year'];
}
$langs->load('users');
/*
 * View
 */
$cp = new Holiday($db);
llxHeader(array(), $langs->trans('CPTitreMenu') . ' (' . $langs->trans("Year") . ' ' . $year . ')');
// Recent changes are more important than old changes
$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC', " AND date_action BETWEEN '" . $db->idate(dol_get_first_day($year, 1, 1)) . "' AND '" . $db->idate(dol_get_last_day($year, 12, 1)) . "'");
// Load $cp->logs
print load_fiche_titre($langs->trans('LogCP'), '<div class="pagination"><ul><li class="pagination"><a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year - 1) . '">&lt;</a><li class="pagination"><a href="">' . $langs->trans("Year") . ' ' . $year . '</a></li><li class="pagination"><a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year + 1) . '">&gt;</a></li></lu></div>', 'title_hrm.png');
print '<div class="info">' . $langs->trans('LastUpdateCP') . ': ' . "\n";
if ($cp->getConfCP('lastUpdate')) {
    print '<strong>' . dol_print_date($db->jdate($cp->getConfCP('lastUpdate')), 'dayhour', 'tzuser') . '</strong>';
} else {
    print $langs->trans('None');
}
print "</div><br>\n";
print '<table class="noborder" width="100%">';
print '<tbody>';
print '<tr class="liste_titre">';
print '<td class="liste_titre">' . $langs->trans('ID') . '</td>';
print '<td class="liste_titre" align="center">' . $langs->trans('Date') . '</td>';
print '<td class="liste_titre">' . $langs->trans('ActionByCP') . '</td>';
print '<td class="liste_titre">' . $langs->trans('UserUpdateCP') . '</td>';
print '<td class="liste_titre">' . $langs->trans('Description') . '</td>';
print '<td class="liste_titre">' . $langs->trans('Type') . '</td>';
print '<td class="liste_titre" align="right">' . $langs->trans('PrevSoldeCP') . '</td>';
Beispiel #4
0
                case 'nodatedebut':
                    $errors[] = $langs->trans('NoDateDebut');
                    break;
                case 'nodatefin':
                    $errors[] = $langs->trans('NoDateFin');
                    break;
                case 'DureeHoliday':
                    $errors[] = $langs->trans('ErrorDureeCP');
                    break;
                case 'alreadyCP':
                    $errors[] = $langs->trans('alreadyCPexist');
                    break;
            }
            setEventMessages($errors, null, 'errors');
        }
        $delayForRequest = $cp->getConfCP('delayForRequest');
        //$delayForRequest = $delayForRequest * (60*60*24);
        $nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
        print '<script type="text/javascript">
	    function valider()
	    {
    	    if(document.demandeCP.date_debut_.value != "")
    	    {
	           	if(document.demandeCP.date_fin_.value != "")
	           	{
	               if(document.demandeCP.valideur.value != "-1") {
	                 return true;
	               }
	               else {
	                 alert("' . dol_escape_js($langs->transnoentities('InvalidValidatorCP')) . '");
	                 return false;
            // On ajoute la modification dans le LOG
            $holiday->addLogCP($user->id, $userCP, $holiday->getNameEventCp($event), $new_holiday, $vacationTypeID);
            $holiday->updateSoldeCP($userCP, $new_holiday, $vacationTypeID);
        }
        setEventMessages('AddEventToUserOkCP', '', 'mesgs');
    }
}
/*
 * View
 */
$form = new Form($db);
$userstatic = new User($db);
llxHeader(array(), $langs->trans('CPTitreMenu'));
print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');
print '<div class="info">' . $langs->trans('LastUpdateCP') . ': ' . "\n";
$lastUpdate = $holiday->getConfCP('lastUpdate');
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.
if ($result < 0) {
    setEventMessages($holiday->error, $holiday->errors, 'errors');
}
$listUsers = $holiday->fetchUsers(false, true);
print '<tbody>';
print '<tr class="liste_titre">';
print '<th class="liste_titre">' . $langs->trans('DescOptionCP') . '</td>';
print '<th class="liste_titre">' . $langs->trans('ValueOptionCP') . '</td>';
print '</tr>';
$var = true;
/*$var=!$var;
print '<tr '.$bc[$var].'>'."\n";
print '<td style="padding:5px;">'.$langs->trans('GroupToValidateCP').'</td>'."\n";
print '<td style="padding:5px;">'.$cp->selectUserGroup('userGroup').'</td>'."\n";
print '</tr>'."\n";
*/
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<td style="padding:5px;">' . $langs->trans('DelayForSubmitCP') . '</td>' . "\n";
print '<td style="padding:5px;"><input class="flat" type="text" name="delayForRequest" value="' . $cp->getConfCP('delayForRequest') . '" size="2" /> ' . $langs->trans('DurationDays') . '</td>' . "\n";
print '</tr>' . "\n";
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<td style="padding:5px;">' . $langs->trans('AlertValidatorDelayCP') . '</td>' . "\n";
print '<td style="padding:5px;"><input class="flat" type="checkbox" name="AlertValidatorDelay" ' . $cp->getCheckOption('AlertValidatorDelay') . '/></td>' . "\n";
print '</tr>' . "\n";
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<td style="padding:5px;">' . $langs->trans('AlertValidorSoldeCP') . '</td>' . "\n";
print '<td style="padding:5px;"><input class="flat" type="checkbox" name="AlertValidatorSolde" ' . $cp->getCheckOption('AlertValidatorSolde') . '/></td>' . "\n";
print '</tr>' . "\n";
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<td style="padding:5px;">' . $langs->trans('nbHolidayEveryMonthCP') . '</td>' . "\n";
print '<td style="padding:5px;"><input class="flat" type="text" name="nbHolidayEveryMonth" value="' . $cp->getConfCP('nbHolidayEveryMonth') . '" size="5"/> ' . $langs->trans('DurationDays') . '</td>' . "\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_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>';