diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php
index 03e4a0ec9f3..bc1dc74f6c4 100644
--- a/htdocs/admin/boxes.php
+++ b/htdocs/admin/boxes.php
@@ -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 "
\n";
print "\n\n".''."\n";
@@ -339,11 +339,9 @@ print '
| '.$langs->trans("Parameter").' | '; print ''.$langs->trans("Value").' | '; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 0502bbed3e7..2061d73be00 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -343,6 +343,26 @@ if ($resql) print ''.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").') | '; print ''.dol_print_date($object->date_fin,'day'); print ' '; - print $langs->trans($listhalfday[$endhalfday]); + print ''.$langs->trans($listhalfday[$endhalfday]).''; print ' | '; print ''; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 4381eacb3a7..041505759f8 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -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 diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index ac1b7370993..8627b7367d9 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -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 "\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 '|||
| '; - $holidaystatic->id=$infos_CP['rowid']; - $holidaystatic->ref=$infos_CP['rowid']; print $holidaystatic->getNomUrl(1); print ' | '; print ''.dol_print_date($date,'day').' | '; @@ -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 ''; - print ''.dol_print_date($infos_CP['date_debut'],'day').' | '; - print ''.dol_print_date($infos_CP['date_fin'],'day').' | '; + print ''; + print dol_print_date($infos_CP['date_debut'],'day'); + print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; + print ' | '; + print ''; + print dol_print_date($infos_CP['date_fin'],'day'); + print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; + print ' | '; print ''.$holidaystatic->LibStatut($infos_CP['statut'],5).' | '; // Action column diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 1549e7124e0..6223bf92aad 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -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) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b1856809856..b8673911f7f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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). diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 006b9275b58..c9e14f3d67a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1526,7 +1526,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $title=$appli.'