Overview
Comment:Utiliser la première ligne du tableau comme entête du tableau, évite les soucis quand un champ personnalisé s'appelle aussi "categorie" !
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 55272812dedd86b34bbf2f6ccca3f4523f491425
User & Date: bohwaz on 2018-10-21 19:49:08
Other Links: branch diff | manifest | tags
Context
2018-10-25
09:18
Correction [1637e5ee7e] lien supprimer ne doit être visible que pour les membres ayant accès en écriture check-in: 07ef54faa1 user: bohwaz tags: dev
2018-10-21
19:49
Utiliser la première ligne du tableau comme entête du tableau, évite les soucis quand un champ personnalisé s'appelle aussi "categorie" ! check-in: 55272812de user: bohwaz tags: dev
19:47
En cas d'appel d'un signal pour un plugin qui n'est pas ici, ne pas déclencher d'erreur, sauf si le plugin est système.

Ce cas est pour quand on installe sur une autre installation une sauvegarde d'une autre instance check-in: 72d2e5e89b user: bohwaz tags: dev

Changes

Modified src/include/lib/Garradin/Membres/Import.php from [3f31ffe733] to [f63328115c].

265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
	{
		$db = DB::getInstance();

		$champs = Config::getInstance()->get('champs_membres')->getKeys();
		$champs_sql = 'm.' . implode(', m.', $champs);
		$where = $list ? 'WHERE ' . $db->where('m.id', $list) : '';

		$res = $db->iterate('SELECT ' . $champs_sql . ', c.nom AS categorie FROM membres AS m 
			LEFT JOIN membres_categories AS c ON m.id_categorie = c.id
			' . $where . '
			ORDER BY c.id;');

		return [
			array_merge($champs, ['categorie']),
			$res,
			sprintf('Export membres - %s - %s', Config::getInstance()->get('nom_asso'), date('Y-m-d')),
		];
	}

	public function toCSV(array $list = null)
	{







|
|




|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
	{
		$db = DB::getInstance();

		$champs = Config::getInstance()->get('champs_membres')->getKeys();
		$champs_sql = 'm.' . implode(', m.', $champs);
		$where = $list ? 'WHERE ' . $db->where('m.id', $list) : '';

		$res = $db->iterate('SELECT ' . $champs_sql . ', c.nom AS "Catégorie membre" FROM membres AS m 
			INNER JOIN membres_categories AS c ON m.id_categorie = c.id
			' . $where . '
			ORDER BY c.id;');

		return [
			array_keys((array) $res->current()),
			$res,
			sprintf('Export membres - %s - %s', Config::getInstance()->get('nom_asso'), date('Y-m-d')),
		];
	}

	public function toCSV(array $list = null)
	{