Garradin Plugins

Check-in [877f5de8ce]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Correction bug dans les récupérations de dispo
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 877f5de8ced4e08c8ba586c61a22ec45353bd4d9
User & Date: bohwaz 2020-05-16 00:32:52
Context
2020-05-17
22:30
Soucis de fuseaux horaire locaux check-in: 79d5867829 user: bohwaz tags: trunk
2020-05-16
00:32
Correction bug dans les récupérations de dispo check-in: 877f5de8ce user: bohwaz tags: trunk
2020-05-07
21:44
Fix check-in: 16a086a63a user: bohwaz tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to reservations/garradin_plugin.ini.

1
2
3
4
5
6
7
8
nom="Réservations"
description="Permet de configurer des créneaux et permettre aux adhérents de s'y inscrire"
auteur="BohwaZ"
url="https://garradin.eu/"
version="0.3"
menu=1
config=1
min_version="0.9.6"




|



1
2
3
4
5
6
7
8
nom="Réservations"
description="Permet de configurer des créneaux et permettre aux adhérents de s'y inscrire"
auteur="BohwaZ"
url="https://garradin.eu/"
version="0.4"
menu=1
config=1
min_version="0.9.6"

Changes to reservations/lib/Reservations.php.

59
60
61
62
63
64
65
66



67
68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
	{
		$db = DB::getInstance();
		return $db->exec(sprintf('DELETE FROM plugin_reservations_creneaux WHERE %s;', $db->where('id', 'NOT IN', $ids)));
	}

	public function listUpcomingSlots()
	{
		$slots = DB::getInstance()->get('SELECT id, heure, maximum,



			CASE WHEN repetition = 1 AND jour < date() THEN
				date(\'now\', strftime(\'weekday %w\', jour))
			ELSE
				jour
			END AS date,
			(SELECT COUNT(*) FROM plugin_reservations_personnes prp WHERE creneau = prc.id AND prp.date = date) AS jauge
			FROM plugin_reservations_creneaux prc
			WHERE jour >= date() OR repetition = 1
			ORDER BY date, heure;');


		$date = null;
		$hour_now = date('Hi');
		$day_now = date('Y-m-d');

		foreach ($slots as &$slot) {
			if ($date !== $slot->date) {







|
>
>
>
|
|
|
|
|
<
|
|
|
>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
	{
		$db = DB::getInstance();
		return $db->exec(sprintf('DELETE FROM plugin_reservations_creneaux WHERE %s;', $db->where('id', 'NOT IN', $ids)));
	}

	public function listUpcomingSlots()
	{
		$slots = DB::getInstance()->get('SELECT *,
			(SELECT COUNT(*) FROM plugin_reservations_personnes prp WHERE creneau = a.id AND date(prp.date) = a.date) AS jauge
			FROM (
				SELECT id, heure, maximum,
				CASE WHEN repetition = 1 AND jour < date() THEN
					date(\'now\', strftime(\'weekday %w\', jour))
				ELSE
					jour
				END AS date

				FROM plugin_reservations_creneaux prc
				WHERE jour >= date() OR repetition = 1
				ORDER BY date, heure
			) AS a;');

		$date = null;
		$hour_now = date('Hi');
		$day_now = date('Y-m-d');

		foreach ($slots as &$slot) {
			if ($date !== $slot->date) {