$approbatorstatic->lastname = $infos_CP['validator_lastname']; $approbatorstatic->firstname = $infos_CP['validator_firstname']; $date = $infos_CP['date_create']; print '<tr ' . $bc[$var] . '>'; print '<td>'; $holidaystatic->id = $infos_CP['rowid']; $holidaystatic->ref = $infos_CP['rowid']; print $holidaystatic->getNomUrl(1); print '</td>'; 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 align="center">' . dol_print_date($infos_CP['date_debut'], 'day') . '</td>'; print '<td align="center">' . dol_print_date($infos_CP['date_fin'], 'day') . '</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'); print '<td align="right" colspan="2">' . $holidaystatic->LibStatut($infos_CP['statut'], 5) . '</td>'; print '</tr>' . "\n"; } } // Si il n'y a pas d'enregistrement suite à une recherche if ($holiday_payes == '2') { print '<tr>'; print '<td colspan="9" class="pair" style="text-align: center; padding: 5px;">' . $langs->trans('None') . '</td>'; print '</tr>'; } print '</table>'; print '</form>'; if ($user_id == $user->id) { print '<br>';
print $langs->trans($listhalfday[$endhalfday]); print '</td>'; print '</tr>'; } else { print '<tr>'; print '<td>' . $langs->trans('DateFinCP') . ' (' . $langs->trans("LastDayOfHoliday") . ')</td>'; print '<td>'; $form->select_date($cp->date_fin, 'date_fin_'); print ' '; print $form->selectarray('endhalfday', $listhalfday, GETPOST('endhalfday') ? GETPOST('endhalfday') : $endhalfday); print '</td>'; print '</tr>'; } print '<tr>'; print '<td>' . $langs->trans('NbUseDaysCP') . '</td>'; print '<td>' . num_open_day($cp->date_debut_gmt, $cp->date_fin_gmt, 0, 1, $cp->halfday) . '</td>'; print '</tr>'; // Status print '<tr>'; print '<td>' . $langs->trans('StatutCP') . '</td>'; print '<td>' . $cp->getLibStatut(2) . '</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>';
} 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>'; print '</div>'; // Fin de page llxFooter(); $db->close();
/** * testNumOpenDay * * @return void */ public function testNumOpenDay() { global $conf, $user, $langs, $db; $conf = $this->savconf; $user = $this->savuser; $langs = $this->savlangs; $db = $this->savdb; // With same hours - Tuesday/Wednesday jan 2013 $date1 = dol_mktime(0, 0, 0, 1, 1, 2013); $date2 = dol_mktime(0, 0, 0, 1, 2, 2013); $result = num_open_day($date1, $date2, 0, 1, 0, 'FR'); print __METHOD__ . " result=" . $result . "\n"; $this->assertEquals(1, $result, 'NumOpenDay Tuesday/Wednesday jan 2013 for FR'); // 1 opened days $result = num_open_day($date1, $date2, 0, 1, 0, 'XX'); print __METHOD__ . " result=" . $result . "\n"; $this->assertEquals(2, $result, 'NumOpenDay Tuesday/Wednesday jan 2013 for XX'); // 2 opened days (country unknown) // With same hours - Friday/Sunday jan 2013 $date1 = dol_mktime(0, 0, 0, 1, 4, 2013); $date2 = dol_mktime(0, 0, 0, 1, 6, 2013); $result = num_open_day($date1, $date2, 0, 1, 0, 'FR'); print __METHOD__ . " result=" . $result . "\n"; $this->assertEquals(1, $result, 'NumOpenDay for FR'); // 1 opened day, 2 closed $result = num_open_day($date1, $date2, 'XX', 1); print __METHOD__ . " result=" . $result . "\n"; $this->assertEquals(1, $result, 'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown) }