Overview
SHA1:2fe08af1af859c19ee1e816a6c84c83bb1d1f602
Date: 2019-01-22 14:35:09
User: bohwaz
Comment:Correction statut cotisation à jour, ou non, pour les cotisations à date fixe
Timelines: family | ancestors | descendants | both | trunk | stable
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2019-01-22
14:35
[82c8a4304d] Correction formulaire ajout de cotisation à un membre par ID (user: bohwaz, tags: trunk, stable)
14:35
[2fe08af1af] Correction statut cotisation à jour, ou non, pour les cotisations à date fixe (user: bohwaz, tags: trunk, stable)
12:02
[d1d91decbf] Fix missing foreign_keys (user: bohwaz, tags: trunk, stable, 0.9.1)
Changes

Modified src/include/lib/Garradin/Membres/Cotisations.php from [07c3d844f4] to [ac1577bdbf].

343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
	 * (si NULL = cotisation jamais enregistrée, si 1 = cotisation ponctuelle enregistrée, sinon date d'expiration)
	 */
	public function isMemberUpToDate($id, $id_cotisation)
	{
		$db = DB::getInstance();
		return $db->first('SELECT c.*,
			CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date()
			WHEN c.fin IS NOT NULL THEN (cm.id IS NOT NULL AND date() <= c.fin AND date() >= c.debut)
			WHEN cm.id IS NOT NULL THEN 1 ELSE 0 END AS a_jour,
			CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\')
			WHEN c.fin IS NOT NULL THEN c.fin ELSE 1 END AS expiration
			FROM cotisations AS c 
				LEFT JOIN cotisations_membres AS cm ON cm.id_cotisation = c.id AND cm.id_membre = ?
			WHERE c.id = ? ORDER BY cm.date DESC;',
			(int)$id, (int)$id_cotisation);







|







343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
	 * (si NULL = cotisation jamais enregistrée, si 1 = cotisation ponctuelle enregistrée, sinon date d'expiration)
	 */
	public function isMemberUpToDate($id, $id_cotisation)
	{
		$db = DB::getInstance();
		return $db->first('SELECT c.*,
			CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\') >= date()
			WHEN c.fin IS NOT NULL THEN (cm.id IS NOT NULL)
			WHEN cm.id IS NOT NULL THEN 1 ELSE 0 END AS a_jour,
			CASE WHEN c.duree IS NOT NULL THEN date(cm.date, \'+\'||c.duree||\' days\')
			WHEN c.fin IS NOT NULL THEN c.fin ELSE 1 END AS expiration
			FROM cotisations AS c 
				LEFT JOIN cotisations_membres AS cm ON cm.id_cotisation = c.id AND cm.id_membre = ?
			WHERE c.id = ? ORDER BY cm.date DESC;',
			(int)$id, (int)$id_cotisation);