Overview
Comment:Correction statut cotisation à jour, ou non, pour les cotisations à date fixe
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: 2fe08af1af859c19ee1e816a6c84c83bb1d1f602
User & Date: bohwaz on 2019-01-22 14:35:09
Other Links: manifest | tags
Context
2019-01-22
14:35
Correction formulaire ajout de cotisation à un membre par ID check-in: 82c8a4304d user: bohwaz tags: trunk, stable
14:35
Correction statut cotisation à jour, ou non, pour les cotisations à date fixe check-in: 2fe08af1af user: bohwaz tags: trunk, stable
12:02
Fix missing foreign_keys check-in: d1d91decbf 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);