Fix error management in adding translation key
This commit is contained in:
parent
e97fae0c43
commit
1a98c4a3ff
@ -75,7 +75,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$transkey='';
|
$transkey='';
|
||||||
$transvalue='';
|
$transvalue='';
|
||||||
@ -116,7 +116,11 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,9 +426,17 @@ if ($mode == 'searchkey')
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||||
print dol_escape_htmltag($val);
|
print dol_escape_htmltag($val);
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
if ($val != $newlangfileonly->tab_translate[$key])
|
if (! empty($newlangfileonly->tab_translate[$key]))
|
||||||
{
|
{
|
||||||
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
if ($val != $newlangfileonly->tab_translate[$key])
|
||||||
|
{
|
||||||
|
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
||||||
|
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||||
}
|
}
|
||||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||||
|
|||||||
@ -1075,6 +1075,7 @@ CurrentTranslationString=Current translation string
|
|||||||
WarningAtLeastKeyOrTranslationRequired=A search criteria is required at least for key or translation string
|
WarningAtLeastKeyOrTranslationRequired=A search criteria is required at least for key or translation string
|
||||||
NewTranslationStringToShow=New translation string to show
|
NewTranslationStringToShow=New translation string to show
|
||||||
OriginalValueWas=The original translation is overwritten. Original value was:<br><br>%s
|
OriginalValueWas=The original translation is overwritten. Original value was:<br><br>%s
|
||||||
|
TransKeyWithoutOriginalValue=You forced a new translation for the translation key '<strong>%s</strong>' that does not exists in any language files
|
||||||
TotalNumberOfActivatedModules=Total number of activated feature modules: <b>%s</b> / <b>%s</b>
|
TotalNumberOfActivatedModules=Total number of activated feature modules: <b>%s</b> / <b>%s</b>
|
||||||
YouMustEnableOneModule=You must at least enable 1 module
|
YouMustEnableOneModule=You must at least enable 1 module
|
||||||
ClassNotFoundIntoPathWarning=Class %s not found into PHP path
|
ClassNotFoundIntoPathWarning=Class %s not found into PHP path
|
||||||
|
|||||||
@ -205,3 +205,4 @@ WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice
|
|||||||
WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Please use more filters or set the constant %s to a higher limit.
|
WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Please use more filters or set the constant %s to a higher limit.
|
||||||
WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent.
|
WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent.
|
||||||
WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action.
|
WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action.
|
||||||
|
WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language
|
||||||
Loading…
Reference in New Issue
Block a user