diff --git a/Controller/Backup.php b/Controller/Backup.php index 0a9ff9d..e8bd304 100644 --- a/Controller/Backup.php +++ b/Controller/Backup.php @@ -41,6 +41,9 @@ class Backup extends Controller /** @var string */ public $active_tab = 'download'; + /** @var string */ + public $download_tab = 'general'; + /** @var array */ public $backup_list = []; @@ -50,6 +53,9 @@ class Backup extends Controller /** @var string */ public $zip_file_name = ''; + /** @var string */ + public $db_charset = 'utf8'; + /** * Return the max file size that can be uploaded. * @@ -80,7 +86,11 @@ public function privateCore(&$response, $user, $permissions) { parent::privateCore($response, $user, $permissions); + // track charset for the download tab selector + $this->db_charset = Tools::config('mysql_charset', 'utf8'); + $this->active_tab = $this->request->get('active_tab', 'download'); + $this->download_tab = $this->request->get('download_tab', 'general'); $action = $this->request->get('action', ''); switch ($action) { @@ -685,6 +695,9 @@ private function switchDbCharsetAction(): void return; } + $this->db_charset = $selectedCharset; + $this->active_tab = 'advanced'; + Tools::log()->notice('record-updated-correctly'); } diff --git a/Translation/en_EN.json b/Translation/en_EN.json index 7d9bbc7..08cc607 100644 --- a/Translation/en_EN.json +++ b/Translation/en_EN.json @@ -1,6 +1,6 @@ { "backup": "Backup", - "backup-charset-error": "The backup encoding is %db-charset%, while in config.php it is %config-charset%. Press the change encoding button before restoring.", + "backup-charset-error": "The backup encoding is %db-charset%, while config.php uses %config-charset%. Adjust the encoding before restoring.", "backup-file-too-big": "The backup file is too large to upload to the server. The maximum size is %size% MB", "backup-memory-warning": "Warning: the backup takes %size% MB, but you only have %memory% MB of memory available. Insufficient to perform the backup.", "backup-port-warning": "The MySQL port should be 3306, but you are using %port%", @@ -15,5 +15,8 @@ "restore-backup-warning": "Warning: restoring FacturaScripts data is like going back in time. Everything that was not in the backup will be deleted, that is, the invoices that you have made later and are not in the copy, will be lost.", "restore-files": "Restore files", "restore-files-p": "If you have the backup of the files, select that zip file and press the restore button.", - "switch-db-charset": "Change encoding" + "switch-db-charset": "Database encoding", + "switch-db-charset-info": "The encoding must match the backup. If you receive a warning that it is different, change it from here.", + "general": "General", + "advanced": "Advanced" } \ No newline at end of file diff --git a/Translation/es_ES.json b/Translation/es_ES.json index 0fa202f..7154f25 100644 --- a/Translation/es_ES.json +++ b/Translation/es_ES.json @@ -1,6 +1,6 @@ { "backup": "Copia de seguridad", - "backup-charset-error": "La codificación de la copia de seguridad es %db-charset%, mientras que en el config.php es %config-charset%. Pulsa el botón cambiar codificación antes de restaurar.", + "backup-charset-error": "La codificación de la copia de seguridad es %db-charset%, mientras que en el config.php es %config-charset%. Ajusta la codificación antes de restaurar.", "backup-file-too-big": "El archivo de copia de seguridad es demasiado grande para subirlo al servidor. El tamaño máximo es %size% MB", "backup-memory-warning": "Advertencia: la copia de seguridad ocupa %size% MB, pero solamente tienes %memory% MB de memoria RAM disponible. Insuficiente para realizar la copia de seguridad. Como alternativa puedes comprimir la carpeta de FacturaScripts, que es equivalente a una copia de los archivos.", "backup-port-warning": "El puerto de MySQL debe ser el 3306, pero estás usando el %port%", @@ -15,5 +15,8 @@ "restore-backup-warning": "Advertencia: restaurar los datos de FacturaScripts es como volver al pasado. Se eliminará todo lo que no estuviese en la copia de seguridad, es decir, las facturas que hayas realizado después y no estén en la copia, se perderán.", "restore-files": "Restaurar archivos", "restore-files-p": "Si tienes la copia de seguridad de los archivos, selecciona ese archivo zip y pulsa el botón restaurar.", - "switch-db-charset": "Cambiar codificación" + "switch-db-charset": "Codificación de la base de datos", + "switch-db-charset-info": "La codificación debe ser la misma que la de la copia de seguridad. Si recibe aviso de que no es la misma, cámbiela desde aquí.", + "general": "General", + "advanced": "Avanzado" } \ No newline at end of file diff --git a/View/Backup.html.twig b/View/Backup.html.twig index dec8665..931e30f 100644 --- a/View/Backup.html.twig +++ b/View/Backup.html.twig @@ -20,6 +20,14 @@ {{ trans('restore') }} +
@@ -47,29 +55,33 @@

{{ trans('download-backup-p') }}

-
@@ -169,24 +181,6 @@ -
- -
@@ -220,6 +214,45 @@ + {% set tabClass = fsc.active_tab == 'advanced' ? 'tab-pane fade show active' : 'tab-pane fade' %} +
+
+
+

+ {{ trans('switch-db-charset') }} +

+

+ {{ trans('switch-db-charset-info') }} +

+
+ +
+
@@ -284,4 +317,4 @@ }); }); -{% endblock %} \ No newline at end of file +{% endblock %}