Merge pull request #21856 from dolibit-ut/patch-420

Update traduction.php
This commit is contained in:
Laurent Destailleur 2022-08-24 18:07:38 +02:00 committed by GitHub
commit f76dcae974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,9 +20,9 @@
*/ */
/** /**
* \file htdocs/product/traduction.php * \file htdocs/categories/traduction.php
* \ingroup product * \ingroup categories
* \brief Page of translation of products * \brief Page of translation of categories
*/ */
require '../main.inc.php'; require '../main.inc.php';
@ -59,18 +59,20 @@ if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
} }
/* /*
* Actions * Actions
*/ */
$error = 0; $error = 0;
// retour a l'affichage des traduction si annulation // return to translation view if cancelled
if ($cancel == $langs->trans("Cancel")) { if ($cancel == $langs->trans("Cancel")) {
$action = ''; $action = '';
} }
// Validation de l'ajout // validation of addition
if ($action == 'vadd' && if ($action == 'vadd' &&
$cancel != $langs->trans("Cancel") && $cancel != $langs->trans("Cancel") &&
($user->rights->categorie->creer)) { ($user->rights->categorie->creer)) {
@ -94,7 +96,7 @@ $cancel != $langs->trans("Cancel") &&
} }
if (!$error) { if (!$error) {
// update de l'objet // update the object
if ($forcelangprod == $current_lang) { if ($forcelangprod == $current_lang) {
$object->label = $libelle; $object->label = $libelle;
$object->description = dol_htmlcleanlastbr($desc); $object->description = dol_htmlcleanlastbr($desc);
@ -103,7 +105,7 @@ $cancel != $langs->trans("Cancel") &&
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc); $object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
} }
// sauvegarde en base // save in base / sauvegarde en base
$res = $object->setMultiLangs($user); $res = $object->setMultiLangs($user);
if ($res < 0) { if ($res < 0) {
$error++; $error++;
@ -119,14 +121,14 @@ $cancel != $langs->trans("Cancel") &&
} }
} }
// Validation de l'edition // validation of the edition
if ($action == 'vedit' && if ($action == 'vedit' &&
$cancel != $langs->trans("Cancel") && $cancel != $langs->trans("Cancel") &&
($user->rights->categorie->creer)) { ($user->rights->categorie->creer)) {
$object->fetch($id); $object->fetch($id);
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
foreach ($object->multilangs as $key => $value) { // enregistrement des nouvelles valeurs dans l'objet foreach ($object->multilangs as $key => $value) { // recording of new values in the object
$libelle = GETPOST('libelle-'.$key, 'alpha'); $libelle = GETPOST('libelle-'.$key, 'alpha');
$desc = GETPOST('desc-'.$key); $desc = GETPOST('desc-'.$key);
@ -223,10 +225,10 @@ print dol_get_fiche_end();
/* /*
* Action bar * Action bar
*/ */
print "\n<div class=\"tabsAction\">\n"; print "\n<div class=\"tabsAction\">\n";
if ($action == '') { if ($action == '') {
@ -260,6 +262,7 @@ if ($action == 'edit') {
// Label // Label
$libelle = (GETPOST('libelle-'.$key, 'alpha') ? GETPOST('libelle-'.$key, 'alpha') : $object->multilangs[$key]['label']); $libelle = (GETPOST('libelle-'.$key, 'alpha') ? GETPOST('libelle-'.$key, 'alpha') : $object->multilangs[$key]['label']);
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$libelle.'"></td></tr>'; print '<tr><td class="titlefield fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$libelle.'"></td></tr>';
// Desc // Desc
$desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']); $desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']);
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';