diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index b0d2c997d05..88c6ee49f09 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -759,25 +759,30 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0) } /** - * Fonction retournant le nombre de jour entre deux dates sans les jours feries (jours ouvres) + * Function to return number of working days (and text of units) between two dates (jours ouvres) * - * @param timestamp $timestampStart Timestamp de debut - * @param timestamp $timestampEnd Timestamp de fin - * @param int $inhour 0: sort le nombre de jour , 1: sort le nombre d'heure (72 max) - * @param int $lastday We include last day, 0: non, 1:oui - * @return int Nombre de jours ou d'heures + * @param timestamp $timestampStart Timestamp for start date + * @param timestamp $timestampEnd Timestamp for end date + * @param int $inhour 0: return number of days, 1: return number of hours (72 max) + * @param int $lastday We include last day, 0: no, 1:yes + * @return int Number of days or hours */ function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0) { global $langs; dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday); + + // Check parameters + if (! is_int($timestampStart) && ! is_float($timestampStart)) return 'ErrorBadParameter_num_open_day'; + if (! is_int($timestampEnd) && ! is_float($timestampEnd)) return 'ErrorBadParameter_num_open_day'; + //print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday; if ($timestampStart < $timestampEnd) { //print num_between_day($timestampStart, $timestampEnd, $lastday).' - '.num_public_holiday($timestampStart, $timestampEnd); $nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $lastday); - $nbOpenDay.= " ".$langs->trans("Days"); + $nbOpenDay.= " " . $langs->trans("Days"); if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort"); return $nbOpenDay; } @@ -785,7 +790,7 @@ function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0) { $nbOpenDay=$lastday; if ($inhour == 1) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort"); - return $nbOpenDay=1; + return $nbOpenDay; } else { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 865705f7493..1fe9810414f 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -380,13 +380,13 @@ class Holiday extends CommonObject $tab_result[$i]['rowid'] = $obj->rowid; $tab_result[$i]['fk_user'] = $obj->fk_user; - $tab_result[$i]['date_create'] = $obj->date_create; + $tab_result[$i]['date_create'] = $this->db->jdate($obj->date_create); $tab_result[$i]['description'] = $obj->description; - $tab_result[$i]['date_debut'] = $obj->date_debut; - $tab_result[$i]['date_fin'] = $obj->date_fin; + $tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut); + $tab_result[$i]['date_fin'] = $this->db->jdate($obj->date_fin); $tab_result[$i]['statut'] = $obj->statut; $tab_result[$i]['fk_validator'] = $obj->fk_validator; - $tab_result[$i]['date_valid'] = $obj->date_valid; + $tab_result[$i]['date_valid'] = $this->db->jdate($obj->date_valid); $tab_result[$i]['fk_user_valid'] = $obj->fk_user_valid; $tab_result[$i]['date_refuse'] = $obj->date_refuse; $tab_result[$i]['fk_user_refuse'] = $obj->fk_user_refuse; diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 8f25af52a3b..859069957a6 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -563,13 +563,12 @@ if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes') -/*************************************************** +/* * View -****************************************************/ + */ $form = new Form($db); - llxHeader(array(),$langs->trans('CPTitreMenu')); if (empty($id) || $action == 'add' || $action == 'request') @@ -753,35 +752,36 @@ else //print_fiche_titre($langs->trans('TitreRequestCP')); // Si il y a une erreur - if (GETPOST('error')) { - - switch(GETPOST('error')) { + if (GETPOST('error')) + { + switch(GETPOST('error')) + { case 'datefin' : - $errors[] = $langs->trans('ErrorEndDateCP'); + $errors[] = $langs->transnoentitiesnoconv('ErrorEndDateCP'); break; case 'SQL_Create' : - $errors[] = $langs->trans('ErrorSQLCreateCP').' '.htmlentities($_GET['msg']).''; + $errors[] = $langs->transnoentitiesnoconv('ErrorSQLCreateCP').' '.$_GET['msg']; break; case 'CantCreate' : - $errors[] = $langs->trans('CantCreateCP'); + $errors[] = $langs->transnoentitiesnoconv('CantCreateCP'); break; case 'Valideur' : - $errors[] = $langs->trans('InvalidValidatorCP'); + $errors[] = $langs->transnoentitiesnoconv('InvalidValidatorCP'); break; case 'nodatedebut' : - $errors[] = $langs->trans('NoDateDebut'); + $errors[] = $langs->transnoentitiesnoconv('NoDateDebut'); break; case 'nodatedebut' : - $errors[] = $langs->trans('NoDateFin'); + $errors[] = $langs->transnoentitiesnoconv('NoDateFin'); break; case 'DureeHoliday' : - $errors[] = $langs->trans('ErrorDureeCP'); + $errors[] = $langs->transnoentitiesnoconv('ErrorDureeCP'); break; case 'NoMotifRefuse' : - $errors[] = $langs->trans('NoMotifRefuseCP'); + $errors[] = $langs->transnoentitiesnoconv('NoMotifRefuseCP'); break; case 'mail' : - $errors[] = $langs->trans('ErrorMailNotSend').'
'.$_GET['error_content'].''; + $errors[] = $langs->transnoentitiesnoconv('ErrorMailNotSend')."\n".$_GET['error_content']; break; } @@ -795,7 +795,7 @@ else if ($action == 'delete' && $cp->statut == 1) { if($user->rights->holiday->delete) { - $ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); + $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); if ($ret == 'html') print '
'; } } @@ -803,14 +803,14 @@ else // Si envoi en validation if ($action == 'sendToValidate' && $cp->statut == 1 && $userID == $cp->fk_user) { - $ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 0, 1); + $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); if ($ret == 'html') print '
'; } // Si validation de la demande if ($action == 'valid' && $cp->statut == 2 && $userID == $cp->fk_validator) { - $ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 0, 1); + $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); if ($ret == 'html') print '
'; } @@ -818,19 +818,28 @@ else if ($action == 'refuse' && $cp->statut == 2 && $userID == $cp->fk_validator) { $array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>"")); - $ret=$form->form_confirm("fiche.php?id=".$_GET['id']."&action=confirm_refuse",$langs->trans("TitleRefuseCP"),"","confirm_refuse",$array_input,"",0); + $ret=$form->form_confirm("fiche.php?id=".$id."&action=confirm_refuse",$langs->trans("TitleRefuseCP"),"","confirm_refuse", $array_input, 1 ,0); if ($ret == 'html') print '
'; } // Si annulation de la demande if ($action == 'cancel' && $cp->statut == 2 && $userID == $cp->fk_validator) { - $ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 0, 1); + $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); if ($ret == 'html') print '
'; } - dol_fiche_head(array(),'card',$langs->trans("CPTitreMenu"),0,'holiday'); + $h=0; + $head = array(); + $head[$h][0] = DOL_URL_ROOT . '/holiday/fiche.php?id='.$id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + complete_head_from_modules($conf,$langs,$cp,$head,$h,'holiday'); + + dol_fiche_head($head,'card',$langs->trans("CPTitreMenu"),0,'holiday'); if ($action == 'edit' && $user->id == $cp->fk_user && $cp->statut == 1) diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index 26188e1e35d..dd706ed9be2 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -57,6 +57,7 @@ $search_employe = GETPOST('search_employe'); $search_valideur = GETPOST('search_valideur'); $search_statut = GETPOST('select_statut'); +$holiday = new Holiday($db); /* * Actions @@ -147,12 +148,10 @@ $user_id = $user->id; // Récupération des congés payés de l'utilisateur ou de tous les users if(!$user->rights->holiday->lire_tous) { - $holiday = new Holiday($db); $holiday_payes = $holiday->fetchByUser($user_id,$order,$filter); } else { - $holiday = new Holiday($db); $holiday_payes = $holiday->fetchAll($order,$filter); } @@ -282,21 +281,20 @@ if (! empty($holiday->holiday)) $validator = new User($db); $validator->fetch($infos_CP['fk_validator']); - $date = date_create($infos_CP['date_create']); - $date = date_format($date,'Y-m-d'); + $date = $infos_CP['date_create']; $statut = $holiday->getStatutCP($infos_CP['statut']); print ''; print 'CP '.$infos_CP['rowid'].''; - print ''.$date.''; + print ''.dol_print_date($date,'day').''; print ''.$user->getNomUrl('1').''; print ''.$validator->getNomUrl('1').''; print ''.$infos_CP['date_debut'].''; print ''.$infos_CP['date_fin'].''; print ''; $nbopenedday=num_open_day($infos_CP['date_debut'],$infos_CP['date_fin'],0,1); - print $nbopenedday.' '.$langs->trans('Jours'); + print $nbopenedday; print ''.$statut.''; print ''."\n"; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 4731b29d956..5c212a87ea6 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -87,7 +87,7 @@ foreach($cp->logs as $logs_CP) if($log_holiday == '2') { print ''; - print ''.$langs->trans('NoResult').''; + print ''.$langs->trans('NoResults').''; print ''; } diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 78a9efcc083..2f252d39923 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -20,7 +20,6 @@ AddThisArticle=Add this article RestartSelling=Go back on sell SellFinished=Sell finished PrintTicket=Print ticket -NoResults=No results NoProductFound=No article found ProductFound=product found ProductsFound=products found diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 36866d73a8a..088e5076733 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -627,6 +627,7 @@ BySalesRepresentative=By sales representative LinkedToSpecificUsers=Linked to a particular user contact DeleteAFile=Delete a file ConfirmDeleteAFile=Are you sure you want to delete file +NoResults=No results # Week day Monday=Monday diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index cb7e7f25251..5c59db99c57 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -20,7 +20,6 @@ AddThisArticle=Ajouter cet article RestartSelling=Reprendre la vente SellFinished=Vente terminée PrintTicket=Imprimer ticket -NoResults=Aucun résultat NoProductFound=Aucun article trouvé ProductFound=produit trouvé ProductsFound=produits trouvés diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index b2147ce7e20..ff50038f5c2 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -629,6 +629,7 @@ BySalesRepresentative=Par commerciaux LinkedToSpecificUsers=Liés à un contact utilisateur particulier DeleteAFile=Suppression de fichier ConfirmDeleteAFile=Confirmez-vous la suppression du fichier +NoResults=Aucun résultat # Week day Monday=Lundi