Add method setEventMessages (can deal this->error and this->errors)
This commit is contained in:
parent
32fd2e03ce
commit
782aaf52ae
@ -4064,10 +4064,10 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
|
|||||||
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
|
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
|
||||||
* @return void
|
* @return void
|
||||||
* @see dol_htmloutput_events
|
* @see dol_htmloutput_events
|
||||||
|
* @deprecated Use setEventMessages instead
|
||||||
*/
|
*/
|
||||||
function setEventMessage($mesgs, $style='mesgs')
|
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 (! is_array($mesgs)) // If mesgs is a string
|
||||||
{
|
{
|
||||||
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;
|
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).
|
* 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
|
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is
|
||||||
|
|||||||
@ -328,7 +328,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1214,10 +1214,13 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// Third party
|
// Third party
|
||||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
|
print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
|
||||||
|
|
||||||
// Duration
|
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
|
{
|
||||||
print '<td>'.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
// Duration
|
||||||
print '</tr>';
|
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
|
||||||
|
print '<td>'.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Description (must be a textarea and not html must be allowed (used in list view)
|
// Description (must be a textarea and not html must be allowed (used in list view)
|
||||||
print '<tr><td valign="top">';
|
print '<tr><td valign="top">';
|
||||||
@ -1345,7 +1348,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $extrafields->showOutputField($key,$value);
|
print $extrafields->showOutputField($key,$value);
|
||||||
if ($object->statut == 0 && $user->rights->ficheinter->creer) print ' <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras&attribute='.$key.'">'.img_picto('','edit').' '.$langs->trans('Modify').'</a>';
|
if (($object->statut == 0 || $object->statut == 1) && $user->rights->ficheinter->creer) print ' <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras&attribute='.$key.'">'.img_picto('','edit').' '.$langs->trans('Modify').'</a>';
|
||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
@ -1615,7 +1618,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Modify
|
// Modify
|
||||||
if ($object->statut == 1 && $user->rights->ficheinter->creer && empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
if ($object->statut == 1 && $user->rights->ficheinter->creer)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?id='.$object->id.'&action=modify"';
|
print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?id='.$object->id.'&action=modify"';
|
||||||
print '>'.$langs->trans("Modify").'</a></div>';
|
print '>'.$langs->trans("Modify").'</a></div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user