Garradin Plugins

Check-in [87caf8232f]
Login

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

Overview
Comment:Ne pas permettre de réserver des créneaux qui sont déjà passés
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 87caf8232f00d02c2d907920020a17158488cdd1
User & Date: bohwaz 2020-05-07 20:58:18
Context
2020-05-07
21:31
Ajout choix date sur lignes ajoutées dynamiquement check-in: 99d4908075 user: bohwaz tags: trunk
20:58
Ne pas permettre de réserver des créneaux qui sont déjà passés check-in: 87caf8232f user: bohwaz tags: trunk
2020-05-06
22:10
Mise à jour : permettre d'ajouter des réservations à la place des adhérents check-in: 304e118766 user: bohwaz tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to reservations/lib/Reservations.php.

71
72
73
74
75
76
77



78
79
80
81
82
83

84
85







86
87
88
89
90
91
92
			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;



		foreach ($slots as &$slot) {
			if ($date !== $slot->date) {
				$slot->date_change = true;
				$date = $slot->date;
			}


			$slot->timestamp = DateTime::createFromFormat('Y-m-d', $slot->date)->getTimestamp();
			$slot->available = $slot->maximum - $slot->jauge;







		}

		return $slots;
	}

	public function deleteSlot(int $id)
	{







>
>
>






>


>
>
>
>
>
>
>







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
			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) {
				$slot->date_change = true;
				$date = $slot->date;
			}

			$slot_hour = (int) str_replace(':', '', $slot->heure);
			$slot->timestamp = DateTime::createFromFormat('Y-m-d', $slot->date)->getTimestamp();
			$slot->available = $slot->maximum - $slot->jauge;

			if ($day_now == $slot->date && $hour_now > $slot_hour) {
				$slot->bookable = false;
			}
			else {
				$slot->bookable = true;
			}
		}

		return $slots;
	}

	public function deleteSlot(int $id)
	{

Changes to reservations/templates/_form.tpl.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
	{else}
		<dl class="slots">
			{foreach from=$slots item="slot"}
				{if $slot.date_change}
					<dt>{$slot.timestamp|strftime_fr:"%A %e %B %Y"}</dt>
				{/if}
				<dd class="hour available_{$slot.available}">
					{if $slot.available && !$booking}
						<label><input type="radio" class="n-radio" name="slot" value="{$slot.id}={$slot.date}" /> {$slot.heure}</label>
					{else}
						{$slot.heure}
					{/if}
				</dd>
				<dd class="spots available_{$slot.available}">
					<em>{$slot.available} places disponibles</em>







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
	{else}
		<dl class="slots">
			{foreach from=$slots item="slot"}
				{if $slot.date_change}
					<dt>{$slot.timestamp|strftime_fr:"%A %e %B %Y"}</dt>
				{/if}
				<dd class="hour available_{$slot.available}">
					{if $slot.available && !$booking && $slot.bookable}
						<label><input type="radio" class="n-radio" name="slot" value="{$slot.id}={$slot.date}" /> {$slot.heure}</label>
					{else}
						{$slot.heure}
					{/if}
				</dd>
				<dd class="spots available_{$slot.available}">
					<em>{$slot.available} places disponibles</em>