Update traduction.php

This commit is contained in:
UT from dolibit 2022-08-23 20:52:56 +02:00 committed by GitHub
parent 83ace0cb12
commit 9e013bf44f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,9 +20,9 @@
*/
/**
* \file htdocs/product/traduction.php
* \ingroup product
* \brief Page of translation of products
* \file htdocs/categories/traduction.php
* \ingroup categories
* \brief Page of translation of categories
*/
require '../main.inc.php';
@ -35,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page
$langs->loadLangs(array('categories', 'languages'));
$id = GETPOST('id', 'int');
$label = GETPOST('label', 'alpha');
$id = GETPOST('id', 'int');
$label = GETPOST('label', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
@ -56,21 +56,23 @@ if ($result <= 0) {
$type = $object->type;
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
*/
$error = 0;
// retour a l'affichage des traduction si annulation
// return to translation view if cancelled
if ($cancel == $langs->trans("Cancel")) {
$action = '';
}
// Validation de l'ajout
// validation of addition
if ($action == 'vadd' &&
$cancel != $langs->trans("Cancel") &&
($user->rights->categorie->creer)) {
@ -94,7 +96,7 @@ $cancel != $langs->trans("Cancel") &&
}
if (!$error) {
// update de l'objet
// update the object
if ($forcelangprod == $current_lang) {
$object->label = $libelle;
$object->description = dol_htmlcleanlastbr($desc);
@ -103,7 +105,7 @@ $cancel != $langs->trans("Cancel") &&
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
}
// sauvegarde en base
// save in base / sauvegarde en base
$res = $object->setMultiLangs($user);
if ($res < 0) {
$error++;
@ -119,14 +121,14 @@ $cancel != $langs->trans("Cancel") &&
}
}
// Validation de l'edition
// validation of the edition
if ($action == 'vedit' &&
$cancel != $langs->trans("Cancel") &&
($user->rights->categorie->creer)) {
$object->fetch($id);
$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');
$desc = GETPOST('desc-'.$key);
@ -164,7 +166,7 @@ $cancel != $langs->trans("Cancel") &&
* View
*/
$form = new Form($db);
$form = new Form($db);
$formadmin = new FormAdmin($db);
$formother = new FormOther($db);
@ -223,10 +225,10 @@ print dol_get_fiche_end();
/*
* Action bar
*/
print "\n<div class=\"tabsAction\">\n";
if ($action == '') {
@ -243,7 +245,7 @@ print "\n</div>\n";
if ($action == 'edit') {
//WYSIWYG Editor
// WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -260,6 +262,7 @@ if ($action == 'edit') {
// 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>';
// Desc
$desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']);
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';