Merge #15452 - Display an error when trying to import in designer a table that's already imported

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-08-22 14:02:22 +02:00
commit 9518e0d053
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 15 additions and 0 deletions

View File

@ -554,6 +554,18 @@ function Add_Other_db_tables () {
button_options[PMA_messages.strGo] = function () {
var db = $('#add_table_from').val();
var table = $('#add_table').val();
//Check if table already imported or not.
var $table = $('[id="' + encodeURIComponent(db) + '.' + encodeURIComponent(table) + '"]');
if ($table.length !== 0) {
PMA_ajaxShowMessage(
PMA_sprintf(PMA_messages.strTableAlreadyExists, db + '.' + table),
undefined,
'error'
);
return;
}
$.post('db_designer.php', {
'ajax_request' : true,
'dialog' : 'add_table',

View File

@ -751,6 +751,9 @@ $js_messages['strStrong'] = __('Strong');
$js_messages['strU2FTimeout'] = __('Timed out waiting for security key activation.');
$js_messages['strU2FError'] = __('Failed security key activation (%s).');
/* Designer */
$js_messages['strTableAlreadyExists'] = _pgettext('The table already exists in the designer and can not be added once more.', 'Table %s already exists!');
echo "var PMA_messages = new Array();\n";
foreach ($js_messages as $name => $js_message) {
Sanitize::printJsValue("PMA_messages['" . $name . "']", $js_message);