diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8973b54734b..0f6aec27eda 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12,7 +12,7 @@ * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Cédric GROSS - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -173,7 +173,7 @@ function dol_shutdown() * @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's text and sign, 'aZ'=check it's a-z only, 'array'=check it's array, 'san_alpha'= Use filter_var with FILTER_SANITIZE_STRING, 'custom'= custom filter specify $filter and $options) * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie) * @param int $filter Filter to apply when $check is set to custom. (See http://php.net/manual/en/filter.filters.php for détails) - * @param mixed $options Options to pass to filter_var when $check is set to custom + * @param mixed $options Options to pass to filter_var when $check is set to custom * @return string||string[] Value found, or '' if check fails */ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) @@ -4064,10 +4064,10 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors') * @return void * @see dol_htmloutput_events + * @deprecated Use setEventMessages instead */ function setEventMessage($mesgs, $style='mesgs') { - if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage'); if (! is_array($mesgs)) // If mesgs is a string { if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs; @@ -4081,6 +4081,23 @@ function setEventMessage($mesgs, $style='mesgs') } } +/** + * Set event messages in dol_events session object. Will be output by calling dol_htmloutput_events. + * Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function. + * + * @param string $mesg Message string + * @param array $mesgs Message array + * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors') + * @return void + * @see dol_htmloutput_events + */ +function setEventMessages($mesg, $mesgs, $style='mesgs') +{ + if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage'); + if (empty($mesgs)) setEventMessage($mesg, $style); + else setEventMessage($mesgs, $style); +} + /** * Print formated messages to output (Used to show messages on html output). * Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index a31f04a0c91..cec56d14c3c 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -328,7 +328,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) else { $langs->load("errors"); - $mesg='
'.$langs->trans($object->error).'
'; + setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } } @@ -1214,10 +1214,13 @@ else if ($id > 0 || ! empty($ref)) // Third party print "".$langs->trans("Company")."".$object->client->getNomUrl(1).""; - // Duration - print ''.$langs->trans("TotalDuration").''; - print ''.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).''; - print ''; + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + // Duration + print ''.$langs->trans("TotalDuration").''; + print ''.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).''; + print ''; + } // Description (must be a textarea and not html must be allowed (used in list view) print ''; @@ -1345,7 +1348,7 @@ else if ($id > 0 || ! empty($ref)) else { print $extrafields->showOutputField($key,$value); - if ($object->statut == 0 && $user->rights->ficheinter->creer) print '   '.img_picto('','edit').' '.$langs->trans('Modify').''; + if (($object->statut == 0 || $object->statut == 1) && $user->rights->ficheinter->creer) print '   '.img_picto('','edit').' '.$langs->trans('Modify').''; } print ''."\n"; } @@ -1615,7 +1618,7 @@ else if ($id > 0 || ! empty($ref)) } // Modify - if ($object->statut == 1 && $user->rights->ficheinter->creer && empty($conf->global->FICHINTER_DISABLE_DETAILS)) + if ($object->statut == 1 && $user->rights->ficheinter->creer) { print '';