Security: on target=_blank, we must have rel="noopener"
This commit is contained in:
parent
46b281f703
commit
0a73daba01
@ -248,10 +248,8 @@ if ($resql)
|
||||
// Check record to know if we must recalculate sort order
|
||||
$i = 0;
|
||||
$decalage=0;
|
||||
$var=false;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = ! $var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
$boxes[$obj->position][$obj->box_id]=1;
|
||||
$i++;
|
||||
@ -321,6 +319,8 @@ if ($resql)
|
||||
|
||||
// Available boxes to activate
|
||||
$boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives);
|
||||
// Activated boxes
|
||||
$boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
|
||||
|
||||
print "<br>\n";
|
||||
print "\n\n".'<!-- Boxes Available -->'."\n";
|
||||
@ -339,11 +339,9 @@ print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
|
||||
print '<td>'.$langs->trans("SourceFile").'</td>';
|
||||
print '<td width="160" align="center">'.$langs->trans("ActivateOn").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
foreach($boxtoadd as $box)
|
||||
{
|
||||
|
||||
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||
{
|
||||
$logo = $box->boximg;
|
||||
@ -376,7 +374,10 @@ foreach($boxtoadd as $box)
|
||||
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
if (! count($boxtoadd) && count($boxactivated))
|
||||
{
|
||||
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("AllWidgetsWereEnabled").'</td></tr>';
|
||||
}
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
@ -387,8 +388,6 @@ print '</form>';
|
||||
print "\n".'<!-- End Boxes Available -->'."\n";
|
||||
|
||||
|
||||
// Activated boxes
|
||||
$boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
|
||||
//var_dump($boxactivated);
|
||||
print "<br>\n\n";
|
||||
print load_fiche_titre($langs->trans("BoxesActivated"));
|
||||
@ -404,13 +403,10 @@ print '<td align="center" width="60" colspan="2">'.$langs->trans("PositionByDefa
|
||||
print '<td align="center" width="80">'.$langs->trans("Disable").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$var=true;
|
||||
$box_order=1;
|
||||
$foundrupture=1;
|
||||
foreach($boxactivated as $key => $box)
|
||||
{
|
||||
$var = ! $var;
|
||||
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||
{
|
||||
$logo = $box->boximg;
|
||||
@ -462,7 +458,6 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addconst">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$var=false;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("Parameter").'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans("Value").'</td>';
|
||||
|
||||
@ -343,6 +343,26 @@ if ($resql)
|
||||
|
||||
print '<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
$nav='';
|
||||
if ($optioncss != '') $nav.= '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
//if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">';
|
||||
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">';
|
||||
if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
|
||||
if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
print $nav;
|
||||
|
||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup,'',$resourceid);
|
||||
dol_fiche_end();
|
||||
@ -378,27 +398,6 @@ if ($resql)
|
||||
$s = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
$nav='';
|
||||
if ($optioncss != '') $nav.= '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
//if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">';
|
||||
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">';
|
||||
if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
|
||||
if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
print $nav;
|
||||
|
||||
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
|
||||
{
|
||||
$tmpforcreatebutton=dol_getdate(dol_now(), true);
|
||||
@ -412,7 +411,7 @@ if ($resql)
|
||||
$link.= '</a>';
|
||||
}
|
||||
|
||||
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit);
|
||||
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, $nav.$link, '', $limit);
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@ -260,7 +260,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$sublink='';
|
||||
if (! empty($head['sublink'])) $sublink.= '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>';
|
||||
if (! empty($head['sublink'])) $sublink.= '<a href="'.$head['sublink'].'"'.(empty($head['target'])?'':' target="'.$head['target'].'"').'>';
|
||||
if (! empty($head['subpicto'])) $sublink.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"');
|
||||
if (! empty($head['sublink'])) $sublink.= '</a>';
|
||||
|
||||
|
||||
@ -149,11 +149,11 @@ if ($action == 'create')
|
||||
{
|
||||
$object->fk_user = $fuserid;
|
||||
$object->description = $description;
|
||||
$object->date_debut = $date_debut;
|
||||
$object->date_fin = $date_fin;
|
||||
$object->fk_validator = $valideur;
|
||||
$object->halfday = $halfday;
|
||||
$object->fk_type = $type;
|
||||
$object->date_debut = $date_debut;
|
||||
$object->date_fin = $date_fin;
|
||||
$object->halfday = $halfday;
|
||||
|
||||
$result = $object->create($user);
|
||||
if ($result <= 0)
|
||||
@ -1089,7 +1089,7 @@ else
|
||||
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
|
||||
print '<td>'.dol_print_date($object->date_debut,'day');
|
||||
print ' ';
|
||||
print $langs->trans($listhalfday[$starthalfday]);
|
||||
print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1111,7 +1111,7 @@ else
|
||||
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
|
||||
print '<td>'.dol_print_date($object->date_fin,'day');
|
||||
print ' ';
|
||||
print $langs->trans($listhalfday[$endhalfday]);
|
||||
print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -698,14 +698,14 @@ class Holiday extends CommonObject
|
||||
* Warning: It consumes a lot of memory because it load in ->holiday all holiday of a dedicated user at each call.
|
||||
*
|
||||
* @param int $fk_user Id user
|
||||
* @param date $dateDebut Start date of period to check
|
||||
* @param date $dateFin End date of period to check
|
||||
* @param date $dateStart Start date of period to check
|
||||
* @param date $dateEnd End date of period to check
|
||||
* @param int $halfday Tag to define how start and end the period to check:
|
||||
* 0:Full days, 2:Sart afternoon end monring, -1:Start afternoon, 1:End morning
|
||||
* @return boolean False is on holiday at least partially into the period, True is never on holiday during chcked period.
|
||||
* 0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
|
||||
* @return boolean False = New range overlap an existing holiday, True = no overlapping (is never on holiday during checked period).
|
||||
* @see verifDateHolidayForTimestamp
|
||||
*/
|
||||
function verifDateHolidayCP($fk_user, $dateDebut, $dateFin, $halfday=0)
|
||||
function verifDateHolidayCP($fk_user, $dateStart, $dateEnd, $halfday=0)
|
||||
{
|
||||
$this->fetchByUser($fk_user,'','');
|
||||
|
||||
@ -713,34 +713,59 @@ class Holiday extends CommonObject
|
||||
{
|
||||
if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays
|
||||
if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays
|
||||
/*
|
||||
var_dump("--");
|
||||
var_dump("old: ".dol_print_date($infos_CP['date_debut'],'dayhour').' '.dol_print_date($infos_CP['date_fin'],'dayhour').' '.$infos_CP['halfday']);
|
||||
var_dump("new: ".dol_print_date($dateStart,'dayhour').' '.dol_print_date($dateEnd,'dayhour').' '.$halfday);
|
||||
*/
|
||||
|
||||
// TODO Also use halfday for the check
|
||||
if ($halfday == 0)
|
||||
{
|
||||
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
||||
if ($dateStart >= $infos_CP['date_debut'] && $dateStart <= $infos_CP['date_fin'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ($dateEnd <= $infos_CP['date_fin'] && $dateEnd >= $infos_CP['date_debut'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($halfday == -1)
|
||||
{
|
||||
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
||||
// new start afternoon, new end afternoon
|
||||
if ($dateStart >= $infos_CP['date_debut'] && $dateStart <= $infos_CP['date_fin'])
|
||||
{
|
||||
return false;
|
||||
if ($dateStart < $infos_CP['date_fin'] || in_array($infos_CP['halfday'], array(0, -1))) return false;
|
||||
}
|
||||
if ($dateEnd <= $infos_CP['date_fin'] && $dateEnd >= $infos_CP['date_debut'])
|
||||
{
|
||||
if ($dateStart < $dateEnd) return false;
|
||||
if ($dateEnd < $infos_CP['date_fin'] || in_array($infos_CP['halfday'], array(0, -1))) return false;
|
||||
}
|
||||
}
|
||||
elseif ($halfday == 1)
|
||||
{
|
||||
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
||||
// new start morning, new end morning
|
||||
if ($dateStart >= $infos_CP['date_debut'] && $dateStart <= $infos_CP['date_fin'])
|
||||
{
|
||||
return false;
|
||||
if ($dateStart < $dateEnd) return false;
|
||||
if ($dateStart > $infos_CP['date_debut'] || in_array($infos_CP['halfday'], array(0, 1))) return false;
|
||||
}
|
||||
if ($dateEnd <= $infos_CP['date_fin'] && $dateEnd >= $infos_CP['date_debut'])
|
||||
{
|
||||
if ($dateEnd > $infos_CP['date_debut'] || in_array($infos_CP['halfday'], array(0, 1))) return false;
|
||||
}
|
||||
}
|
||||
elseif ($halfday == 2)
|
||||
{
|
||||
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
||||
// new start afternoon, new end morning
|
||||
if ($dateStart >= $infos_CP['date_debut'] && $dateStart <= $infos_CP['date_fin'])
|
||||
{
|
||||
return false;
|
||||
if ($dateStart < $infos_CP['date_fin'] || in_array($infos_CP['halfday'], array(0, -1))) return false;
|
||||
}
|
||||
if ($dateEnd <= $infos_CP['date_fin'] && $dateEnd >= $infos_CP['date_debut'])
|
||||
{
|
||||
if ($dateEnd > $infos_CP['date_debut'] || in_array($infos_CP['halfday'], array(0, 1))) return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -471,6 +471,8 @@ print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"cp.statut","",$param,'ali
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
|
||||
|
||||
// Lines
|
||||
if (! empty($holiday->holiday))
|
||||
{
|
||||
@ -481,6 +483,10 @@ if (! empty($holiday->holiday))
|
||||
|
||||
foreach($holiday->holiday as $infos_CP)
|
||||
{
|
||||
// Leave request
|
||||
$holidaystatic->id=$infos_CP['rowid'];
|
||||
$holidaystatic->ref=$infos_CP['rowid'];
|
||||
|
||||
// User
|
||||
$userstatic->id=$infos_CP['fk_user'];
|
||||
$userstatic->lastname=$infos_CP['user_lastname'];
|
||||
@ -499,10 +505,11 @@ if (! empty($holiday->holiday))
|
||||
|
||||
$date = $infos_CP['date_create'];
|
||||
|
||||
$starthalfday=($infos_CP['halfday'] == -1 || $infos_CP['halfday'] == 2)?'afternoon':'morning';
|
||||
$endhalfday=($infos_CP['halfday'] == 1 || $infos_CP['halfday'] == 2)?'morning':'afternoon';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
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>';
|
||||
@ -515,8 +522,14 @@ if (! empty($holiday->holiday))
|
||||
$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>';
|
||||
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="center">';
|
||||
print dol_print_date($infos_CP['date_debut'],'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print dol_print_date($infos_CP['date_fin'],'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
|
||||
print '</td>';
|
||||
print '<td align="right">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
|
||||
|
||||
// Action column
|
||||
|
||||
@ -1478,7 +1478,7 @@ if ($step == 5 && $datatoimport)
|
||||
while ($sourcelinenb < $nboflines && ! $endoffile)
|
||||
{
|
||||
$sourcelinenb++;
|
||||
// Read line and stor it into $arrayrecord
|
||||
// Read line and store it into $arrayrecord
|
||||
$arrayrecord=$obj->import_read_record();
|
||||
if ($arrayrecord === false)
|
||||
{
|
||||
|
||||
@ -131,6 +131,7 @@ HoursOnThisPageAreOnServerTZ=Warning, in contrary of other screens, hours on thi
|
||||
Box=Widget
|
||||
Boxes=Widgets
|
||||
MaxNbOfLinesForBoxes=Max number of lines for widgets
|
||||
AllWidgetsWereEnabled=All available widgets are enabled
|
||||
PositionByDefault=Default order
|
||||
Position=Position
|
||||
MenusDesc=Menu managers set content of the two menu bars (horizontal and vertical).
|
||||
|
||||
@ -1526,7 +1526,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
||||
$title=$appli.'<br>';
|
||||
$title.=$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage');
|
||||
if ($mode == 'wiki') $title.=' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage,'_',' ')).'"';
|
||||
$text.='<a class="help" target="_blank" href="';
|
||||
$text.='<a class="help" target="_blank" rel="noopener" href="';
|
||||
if ($mode == 'wiki') $text.=sprintf($helpbaseurl,urlencode(html_entity_decode($helppage)));
|
||||
else $text.=sprintf($helpbaseurl,$helppage);
|
||||
$text.='">';
|
||||
@ -1609,8 +1609,8 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
|
||||
|
||||
foreach($arrayresult as $key => $val)
|
||||
{
|
||||
//$searchform.=printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth100', 'sall', $val['shortcut'], 'searchleftt', img_picto('',$val['img']));
|
||||
$searchform.=printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth125', 'sall', $val['shortcut'], 'searchleftt', img_picto('', $val['img'], '', false, 1, 1));
|
||||
//$searchform.=printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth100', 'sall', $val['shortcut'], 'searchleft', img_picto('',$val['img']));
|
||||
$searchform.=printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth125', 'sall', $val['shortcut'], 'searchleft', img_picto('', $val['img'], '', false, 1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1689,7 +1689,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
|
||||
if ($doliurl) print '<a class="help" target="_blank" href="'.$doliurl.'">';
|
||||
if ($doliurl) print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">';
|
||||
else print '<span class="help">';
|
||||
print $appli;
|
||||
if ($doliurl) print '</a>';
|
||||
@ -1719,7 +1719,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
|
||||
$bugbaseurl.= urlencode("\n");
|
||||
$bugbaseurl.= urlencode("## Report\n");
|
||||
print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
|
||||
print '<a class="help" target="_blank" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>';
|
||||
print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -3628,8 +3628,8 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
|
||||
/* ============================================================================== */
|
||||
|
||||
/* CSS for treeview */
|
||||
.treeview ul { background-color: transparent !important; margin-top: 0; }
|
||||
.treeview li { background-color: transparent !important; padding: 0 0 0 16px !important; min-height: 20px; }
|
||||
.treeview ul { background-color: transparent !important; margin-top: 4px; padding-top: 4px !important; }
|
||||
.treeview li { background-color: transparent !important; padding: 0 0 0 16px !important; min-height: 26px; }
|
||||
.treeview .hover { color: rgb(<?php print $colortextlink; ?>) !important; text-decoration: underline !important; }
|
||||
|
||||
|
||||
|
||||
@ -201,11 +201,11 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
$localobject->email='newemail@newemail.com';
|
||||
$localobject->jabberid='New im id';
|
||||
$localobject->default_lang='es_ES';
|
||||
|
||||
|
||||
$result=$localobject->update($localobject->id,$user);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update error');
|
||||
|
||||
|
||||
$result=$localobject->update_note($localobject->note_private,'_private');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
|
||||
@ -213,7 +213,7 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
$result=$localobject->update_note($localobject->note_public, '_public');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
|
||||
|
||||
|
||||
|
||||
$newobject=new Holiday($this->savdb);
|
||||
$result=$newobject->fetch($localobject->id);
|
||||
@ -291,4 +291,63 @@ class HolidayTest extends PHPUnit_Framework_TestCase
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* testVerifDateHolidayCP
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testVerifDateHolidayCP()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
// Create a leave request the 1st morning only
|
||||
$localobjecta=new Holiday($this->savdb);
|
||||
$localobjecta->initAsSpecimen();
|
||||
$localobjecta->date_debut = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$localobjecta->date_fin = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$localobjecta->halfday = 1;
|
||||
$result=$localobjecta->create($user);
|
||||
|
||||
// Create a leave request the 2 afternoon only
|
||||
$localobjectb=new Holiday($this->savdb);
|
||||
$localobjectb->initAsSpecimen();
|
||||
$localobjectb->date_debut = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
$localobjectb->date_fin = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
$localobjectb->halfday = -1;
|
||||
$result=$localobjectb->create($user);
|
||||
|
||||
$date_debut = dol_mktime(0, 0, 0, 1, 1, 2020);
|
||||
$date_fin = dol_mktime(0, 0, 0, 1, 2, 2020);
|
||||
|
||||
$localobjectc=new Holiday($this->savdb);
|
||||
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 0);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, full day is not available.');
|
||||
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, 1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, morning of first day is not available.');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, 1);
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_debut, -1);
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, -1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available');
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_fin, $date_fin, -1);
|
||||
$this->assertFalse($result, 'result should be false, there is overlapping, afternoon of second day is not available');
|
||||
|
||||
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning
|
||||
$this->assertTrue($result, 'result should be true, there is no overlapping');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user