From 12c2ce0a384d93aa65b05d1b5fd34fb1415cc0ed Mon Sep 17 00:00:00 2001 From: Cerdic <cedric@yterium.com> Date: Sun, 17 Dec 2006 18:56:26 +0000 Subject: [PATCH] "ne pas effacer toute la table qui a un champ 'impt' mais seulement ceux qui ont impt='oui'" --- ecrire/inc/import.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ecrire/inc/import.php b/ecrire/inc/import.php index f93e95ef10..d35e177513 100644 --- a/ecrire/inc/import.php +++ b/ecrire/inc/import.php @@ -139,9 +139,14 @@ function import_init_tables($request) // on vide toutes les tables dont la restauration est demandee $tables = import_table_choix($request); foreach($tables as $table){ - - if (($table!='spip_auteurs')&&(!in_array($table,$IMPORT_tables_noerase))) - spip_query("DELETE FROM $table"); + // regarder si il y a au moins un champ impt='non' + if (($table!='spip_auteurs')&&(!in_array($table,$IMPORT_tables_noerase))){ + $res = spip_query("SELECT impt FROM $table WHERE impt='non' LIMIT 0,1"); + if (spip_num_rows($res)) + spip_query("DELETE FROM $table WHERE impt='oui'"); + else + spip_query("DELETE FROM $table"); + } } // Bidouille pour garder l'acces admin actuel pendant toute la restauration -- GitLab