Overview
Comment:On ne peut pas s'importer soi-même en CSV, car on risque d'importer n'importe quoi et de se retrouver à la porte (dans ce cas-ci : un espace au début de l'adresse email !)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: d4e0b0f126836344be076294654ff2b836cb0e3e
User & Date: bohwaz on 2018-02-21 04:23:08
Other Links: manifest | tags
References
2020-12-08
23:25 Wiki page "Changelog/0.9" artifact: b9c916b4d1 user: bohwaz
Context
2018-02-21
04:38
Corrige encodage du From dans les mails envoyés, signalé par @Emelyne check-in: 2cc684a884 user: bohwaz tags: trunk, stable
04:23
On ne peut pas s'importer soi-même en CSV, car on risque d'importer n'importe quoi et de se retrouver à la porte (dans ce cas-ci : un espace au début de l'adresse email !) check-in: d4e0b0f126 user: bohwaz tags: trunk, stable
2018-02-09
01:33
Affichage numéro membre et non ID (signalé par @Fabrice) check-in: da6a237093 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Membres/Import.php from [4ee4e4e20f] to [abd6fb1bd8].

143
144
145
146
147
148
149

150
151
152

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

153
154
155
156
157
158
159
160







+


-
+







		fclose($fp);
		return true;
	}

	/**
	 * Importer un CSV de la liste des membres depuis un export Garradin
	 * @param  string $path 	Chemin vers le CSV
	 * @param  int    $current_user_id
	 * @return boolean          TRUE en cas de succès
	 */
	public function fromCSV($path)
	public function fromCSV($path, $current_user_id)
	{
		if (!file_exists($path) || !is_readable($path))
		{
			throw new \RuntimeException('Fichier inconnu : '.$path);
		}

		$fp = fopen($path, 'r');
231
232
233
234
235
236
237






238
239
240
241
242
243
244
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251







+
+
+
+
+
+







				unset($data['numero']);
				$numero = false;
			}

			try {
				if ($numero && ($id = $membres->getIDWithNumero($numero)))
				{
					if ($id === $current_user_id)
					{
						// Ne pas modifier le membre courant, on risque de se tirer une balle dans le pied
						continue;
					}

					$membres->edit($id, $data);
				}
				else
				{
					$membres->add($data, false);
				}
			}

Modified src/www/admin/membres/import.php from [1b75882f9f] to [729a351975].

32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46







-
+







        {
            if (f('type') == 'galette')
            {
                $import->fromGalette($_FILES['upload']['tmp_name'], f('galette_translate'));
            }
            elseif (f('type') == 'garradin')
            {
                $import->fromCSV($_FILES['upload']['tmp_name']);
                $import->fromCSV($_FILES['upload']['tmp_name'], $user->id);
            }
            else
            {
                throw new UserException('Import inconnu.');
            }

            Utils::redirect(ADMIN_URL . 'membres/import.php?ok');