Overview
Comment:ne pas nettoyer la table si le champ identifiant n'est pas encore déterminé
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5784129344de509ecf9a028de115171b223e1af1
User & Date: bohwaz on 2014-04-01 15:53:51
Other Links: manifest | tags
Context
2014-04-01
15:55
Plus correct comme ça check-in: 66241a8a6f user: bohwaz tags: trunk
15:53
ne pas nettoyer la table si le champ identifiant n'est pas encore déterminé check-in: 5784129344 user: bohwaz tags: trunk
15:51
possibilité d'avoir les erreurs par email, et toujours loguer les erreurs check-in: 780a9c9c43 user: bohwaz tags: trunk
Changes

Modified src/include/class.champs_membres.php from [582e8b71a5] to [0d13dc8648].

425
426
427
428
429
430
431




432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442




443
444
445
446
447
448
449
450
451
452
453
454
455







+
+
+
+







-
-
-
-













    	$copy = 'INSERT INTO membres_tmp (' . implode(', ', $copy) . ') SELECT ' . implode(', ', $copy) . ' FROM membres;';

    	$db->exec('PRAGMA foreign_keys = OFF;');
    	$db->exec('BEGIN;');
    	$db->exec($create);
    	
    	if ($enable_copy) {
            // Mettre les champs identifiant vides à NULL pour pouvoir créer un index unique
            $db->exec('UPDATE membres SET '.$config->get('champ_identifiant').' = NULL 
                WHERE '.$config->get('champ_identifiant').' = "";');

    		$db->exec($copy);
    	}
    	
        $db->exec('DROP TABLE IF EXISTS membres;');
    	$db->exec('ALTER TABLE membres_tmp RENAME TO membres;');
        $db->exec('CREATE INDEX membres_id_categorie ON membres (id_categorie);'); // Index

        // Mettre les champs identifiant vides à NULL pour pouvoir créer un index unique
        $db->exec('UPDATE membres SET '.$config->get('champ_identifiant').' = NULL 
            WHERE '.$config->get('champ_identifiant').' = "";');

        // Création de l'index unique
        $db->exec('CREATE UNIQUE INDEX membres_identifiant ON membres ('.$config->get('champ_identifiant').');');
    	$db->exec('END;');
    	$db->exec('PRAGMA foreign_keys = ON;');

    	$config->set('champs_membres', $this);
    	$config->save();

    	return true;
    }
}

?>

Modified src/www/admin/install.php from [b7ef29e145] to [90e52f272b].

137
138
139
140
141
142
143
144
145
146
147
148
149



150
151
152
153
154
155
156
137
138
139
140
141
142
143


144
145
146
147
148
149
150
151
152
153
154
155
156
157







-
-




+
+
+







                $config->set('adresse_asso', utils::post('adresse_asso'));
                $config->set('email_asso', utils::post('email_asso'));
                $config->set('site_asso', WWW_URL);
                $config->set('monnaie', '€');
                $config->set('pays', 'FR');
                $config->set('email_envoi_automatique', utils::post('email_asso'));
                $config->setVersion(garradin_version());
                $config->set('champ_identifiant', 'email');
                $config->set('champ_identite', 'nom');

                $champs = Champs_Membres::importInstall();
                $champs->save(false); // Pas de copie car pas de table membres existante

                $config->set('champ_identifiant', 'email');
                $config->set('champ_identite', 'nom');
                
                // Création catégories
                $cats = new Membres_Categories;
                $id = $cats->add([
                    'nom' => 'Membres actifs',
                ]);
                $config->set('categorie_membres', $id);