Overview
Comment:Fix: error message when trying to have two subscriptions for the same service the same day
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 718020831bef600a36d8a439afb72f6787aa257b0ba1f9118cc824d2ba31f5eb
User & Date: bohwaz on 2021-11-01 15:11:40
Other Links: manifest | tags
Context
2021-11-01
15:24
Fix error on SQLite file storage when overwriting an existing file check-in: 6ade070e76 user: bohwaz tags: trunk, stable
15:11
Fix: error message when trying to have two subscriptions for the same service the same day check-in: 718020831b user: bohwaz tags: trunk, stable
15:05
Handle null hours in date_hour modifier check-in: 57a611310f user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Entities/Services/Service_User.php from [10de17a459] to [7a9bb0372a].

37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
	protected $_service, $_fee;

	public function selfCheck(): void
	{
		$this->paid = (bool) $this->paid;
		$this->assert($this->id_service, 'Aucune activité spécifiée');
		$this->assert($this->id_user, 'Aucun membre spécifié');
		$this->assert($this->id || !DB::getInstance()->test(self::TABLE, 'id_user = ? AND id_service = ? AND date = ?', $this->id_user, $this->id_service, $this->date->format('Y-m-d')), 'Cette activité a déjà été enregistrée pour ce membre et cette date');

	}

	public function importForm(?array $source = null)
	{
		if (null === $source) {
			$source = $_POST;
		}







|
>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	protected $_service, $_fee;

	public function selfCheck(): void
	{
		$this->paid = (bool) $this->paid;
		$this->assert($this->id_service, 'Aucune activité spécifiée');
		$this->assert($this->id_user, 'Aucun membre spécifié');
		$this->assert($this->exists() || !DB::getInstance()->test(self::TABLE, 'id_user = ? AND id_service = ? AND date = ?', $this->id_user, $this->id_service, $this->date->format('Y-m-d')), 'Cette activité a déjà été enregistrée pour ce membre et cette date');
		$this->assert(!$this->exists() || !DB::getInstance()->test(self::TABLE, 'id_user = ? AND id_service = ? AND date = ? AND id != ?', $this->id_user, $this->id_service, $this->date->format('Y-m-d'), $this->id()), 'Cette activité a déjà été enregistrée pour ce membre et cette date');
	}

	public function importForm(?array $source = null)
	{
		if (null === $source) {
			$source = $_POST;
		}

Modified src/templates/services/user/_service_user_form.tpl from [c3ab4accdb] to [10a2edc910].

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
assert(isset($grouped_services) && is_array($grouped_services));
?>

<form method="post" action="{$self_url}" data-focus="1" data-create="{$create|escape:json}">

	{if $has_past_services}
	<nav class="tabs">
		<ul class="sub">
			<li{if $current_only} class="current"{/if}><a href="{$form_url}">Inscrire à une activité courante</a></li>
			<li{if !$current_only} class="current"{/if}><a href="{$form_url}past_services=1">Inscrire à une activité passée</a></li>
		</ul>
	</nav>
	{/if}

	<fieldset>







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
assert(isset($grouped_services) && is_array($grouped_services));
?>

<form method="post" action="{$self_url}" data-focus="1" data-create="{$create|escape:json}">

	{if $has_past_services}
	<nav class="tabs">
		<ul{if $create} class="sub"{/if}>
			<li{if $current_only} class="current"{/if}><a href="{$form_url}">Inscrire à une activité courante</a></li>
			<li{if !$current_only} class="current"{/if}><a href="{$form_url}past_services=1">Inscrire à une activité passée</a></li>
		</ul>
	</nav>
	{/if}

	<fieldset>