From 23e2c95af685641ec5fc06c186edffabba9c4112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 16 Oct 2017 21:22:13 +0200 Subject: [PATCH] enhance admin translation --- htdocs/admin/translation.php | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index e2d2db9e659..1b2a52466e5 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -1,6 +1,7 @@ * Copyright (C) 2009-2017 Regis Houssin + * Copyright (C) 2017 Frédéric France * * 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 @@ -170,7 +171,7 @@ if ($action == 'add') else { setEventMessages($db->lasterror(), null, 'errors'); - } + } $action=''; } } @@ -291,9 +292,9 @@ if ($mode == 'overwrite') print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1); print ''."\n"; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; // Limit to superadmin /*if (! empty($conf->multicompany->enabled) && !$user->entity) @@ -483,7 +484,7 @@ if ($mode == 'searchkey') //} print ''; // Action column - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print ''; @@ -508,9 +509,28 @@ if ($mode == 'searchkey') { if ($val != $newlangfileonly->tab_translate[$key]) { + // retrieve rowid + $sql = "SELECT rowid"; + $sql.= " FROM " . MAIN_DB_PREFIX . "overwrite_trans"; + $sql.= " WHERE transkey = '".$key."'"; + $sql.= " AND entity IN (" . $user->entity . ", " . $conf->entity . ")"; + dol_syslog("translation::select from table", LOG_DEBUG); + $result = $db->query($sql); + if ($result) + { + $obj = $db->fetch_object($result); + } + print '' . img_edit() . ''; + print '  '; + print '' . img_delete() . ''; + print '  '; $htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]); print $form->textwithpicto('', $htmltext, 1, 'info'); } + else if (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) + { + print '' . img_edit() . ''; + } } else {