Overview
Comment:Correction association des id_rappel à NULL (signalé par @jool)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e4a0ad91d49b0af609f02b2b37a5779ef960a270
User & Date: bohwaz on 2015-12-09 14:48:08
Other Links: manifest | tags
References
2020-12-08
23:25 Wiki page "Changelog/0.9" artifact: b9c916b4d1 user: bohwaz
Context
2016-02-20
12:39
Merge old trunk diversion, as noticed by latest fossil update check-in: 6659412978 user: bohwaz tags: trunk
2015-12-09
14:48
Correction association des id_rappel à NULL (signalé par @jool) check-in: e4a0ad91d4 user: bohwaz tags: trunk
12:48
Forcément la typo check-in: 5b0a7866e3 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Rappels_Envoyes.php from [fa5f4d17da] to [2586be6ed0].

22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
	 * @param  array $data Tableau contenant les champs à ajouter/modifier
	 * @return void
	 */
	protected function _checkFields(&$data)
	{
		$db = DB::getInstance();


		if (empty($data['id_rappel']) || !$db->simpleQuerySingle('SELECT 1 FROM rappels WHERE id = ?;', false, (int) $data['id_rappel']))
		{
			throw new \LogicException('ID rappel non fourni ou inexistant dans la table rappels');
		}

        if (isset($data['id_cotisation']))
        {
        	if (!$db->simpleQuerySingle('SELECT 1 FROM cotisations WHERE id = ?;', false, (int) $data['id_cotisation']))







>
|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
	 * @param  array $data Tableau contenant les champs à ajouter/modifier
	 * @return void
	 */
	protected function _checkFields(&$data)
	{
		$db = DB::getInstance();

		if (!array_key_exists('id_rappel', $data) 
			|| (!is_null($data['id_rappel']) && (empty($data['id_rappel']) || !$db->simpleQuerySingle('SELECT 1 FROM rappels WHERE id = ?;', false, (int) $data['id_rappel']))))
		{
			throw new \LogicException('ID rappel non fourni ou inexistant dans la table rappels');
		}

        if (isset($data['id_cotisation']))
        {
        	if (!$db->simpleQuerySingle('SELECT 1 FROM cotisations WHERE id = ?;', false, (int) $data['id_cotisation']))

Modified src/www/admin/membres/cotisations/rappels.php from [92460e76ea] to [1b6ad513bd].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

if ($user['droits']['membres'] < Membres::DROIT_ECRITURE)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

if (empty($_GET['id']) || !is_numeric($_GET['id']))
{
    throw new UserException("Argument du numéro de membre manquant.");
}

$id = (int) $_GET['id'];

$membre = $membres->get($id);

if (!$membre)
{
    throw new UserException("Ce membre n'existe pas.");
}

$re = new Rappels_Envoyes;
$cm = new Membres\Cotisations;

$error = false;

if (Utils::post('save'))
{
    if (!Utils::CSRF_check('add_rappel_'.$membre['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
			$re->add([

				'id_cotisation'	=>	Utils::post('id_cotisation'),
				'id_membre'		=>	$membre['id'],
				'media'			=>	Utils::post('media'),
				'date'			=>	Utils::post('date'),
			]);

            Utils::redirect('/admin/membres/cotisations/rappels.php?id=' . $membre['id'] . '&ok');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('error', $error);
$tpl->assign('ok', isset($_GET['ok']));
$tpl->assign('membre', $membre);
$tpl->assign('cotisations', $cm->listSubscriptionsForMember($membre['id']));
$tpl->assign('default_date', date('Y-m-d'));
$tpl->assign('rappels', $re->listForMember($membre['id']));

$tpl->display('admin/membres/cotisations/rappels.tpl');







|




|








|









|
|
|
|
|
|
|

>






|
|
|
|
|
|
|










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

if ($user['droits']['membres'] < Membres::DROIT_ECRITURE)
{
	throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

if (empty($_GET['id']) || !is_numeric($_GET['id']))
{
	throw new UserException("Argument du numéro de membre manquant.");
}

$id = (int) $_GET['id'];

$membre = $membres->get($id);

if (!$membre)
{
	throw new UserException("Ce membre n'existe pas.");
}

$re = new Rappels_Envoyes;
$cm = new Membres\Cotisations;

$error = false;

if (Utils::post('save'))
{
	if (!Utils::CSRF_check('add_rappel_'.$membre['id']))
	{
		$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
	}
	else
	{
		try {
			$re->add([
				'id_rappel'     =>  NULL,
				'id_cotisation'	=>	Utils::post('id_cotisation'),
				'id_membre'		=>	$membre['id'],
				'media'			=>	Utils::post('media'),
				'date'			=>	Utils::post('date'),
			]);

			Utils::redirect('/admin/membres/cotisations/rappels.php?id=' . $membre['id'] . '&ok');
		}
		catch (UserException $e)
		{
			$error = $e->getMessage();
		}
	}
}

$tpl->assign('error', $error);
$tpl->assign('ok', isset($_GET['ok']));
$tpl->assign('membre', $membre);
$tpl->assign('cotisations', $cm->listSubscriptionsForMember($membre['id']));
$tpl->assign('default_date', date('Y-m-d'));
$tpl->assign('rappels', $re->listForMember($membre['id']));

$tpl->display('admin/membres/cotisations/rappels.tpl');