Commit 1c399af7 authored by Denis S. Valdenaire's avatar Denis S. Valdenaire

fixes #65

parent 1a417720
......@@ -14,9 +14,10 @@ class Family_Member {
public static function fetch_all(&$family_members, $member_id) {
$family_members = array();
// SQL SELECT family_members
$sql = " SELECT id, firstname, lastname, birth_date, link_id
$sql = " SELECT id, firstname, lastname, DATE_FORMAT(birth_date, '%d/%m/%Y') AS birth_date, link_id
FROM family_members
WHERE member_id = ".$member_id;
WHERE member_id = ".$member_id."
ORDER BY DATE_FORMAT(birth_date, '%Y/%m/%d') ASC";
$GLOBALS["data"]->select($sql, $family_members, "Family_Member", true);
return sizeof($family_members);
}
......
......@@ -4,9 +4,119 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "a31e651ea26a527432562441b3545e0a",
"content-hash": "c43ceea98646f3ef85cd2f04d3f32b27",
"hash": "4075de6455546b6bbcb193216c2bda35",
"content-hash": "3d0b0ef0c5d39b5caf344aa0d41257c0",
"packages": [
{
"name": "nette/mail",
"version": "v2.3.4",
"source": {
"type": "git",
"url": "https://github.com/nette/mail.git",
"reference": "3b8ba96407029d94d83177086bcb5e1fe0046929"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/mail/zipball/3b8ba96407029d94d83177086bcb5e1fe0046929",
"reference": "3b8ba96407029d94d83177086bcb5e1fe0046929",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"nette/utils": "~2.2",
"php": ">=5.3.1"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/di": "~2.3",
"nette/tester": "~1.3"
},
"suggest": {
"ext-fileinfo": "to detect type of attached files"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "Nette Mail: Sending E-mails",
"homepage": "https://nette.org",
"time": "2015-11-29 22:09:25"
},
{
"name": "nette/utils",
"version": "v2.3.7",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "6f1ed73088c28a24acc9657ca14b3418a270e24b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/6f1ed73088c28a24acc9657ca14b3418a270e24b",
"reference": "6f1ed73088c28a24acc9657ca14b3418a270e24b",
"shasum": ""
},
"require": {
"php": ">=5.3.1"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "~1.0"
},
"suggest": {
"ext-gd": "to use Image",
"ext-iconv": "to use Strings::webalize() and toAscii()",
"ext-intl": "for script transliteration in Strings::webalize() and toAscii()",
"ext-mbstring": "to use Strings::lower() etc..."
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "Nette Utility Classes",
"homepage": "https://nette.org",
"time": "2015-11-30 00:11:35"
},
{
"name": "twig/twig",
"version": "v1.23.1",
......
......@@ -120,13 +120,23 @@ class GamesController extends AppController {
function _create_reservation() {
try {
$game = Game::fetch($GLOBALS["data"]->db_escape_string($_REQUEST["i"]));
if($game->id != 0) {
$game->create_reservation();
$member = Member::fetch($GLOBALS["data"]->db_escape_string($_REQUEST["member_id"]));
if($game->id != 0 && $member->id != 0) {
$member->fetch_subscriptions();
if($member->has_valid_subscription()) {
if($member->email != "") {
$game->create_reservation();
$this->set_message("La réservation a été faite");
} else {
$this->set_message("Impossible de réserver : pas d'adresse email pour cet utilisateur", "danger");
}
} else {
$this->set_message("Impossible de réserver : pas d'inscription valide pour cet utilisateur", "danger");
}
$this->set("game", $game);
$this->set_message("La réservation a été faite");
return "games/edit";
}
return "games/not_found";
return "games/not_found"; // well... something went wrong somewhere...
} catch (data_exception $e) {
return "data_exception";
}
......
......@@ -147,6 +147,7 @@ class MembersController extends AppController {
try {
$member = Member::fetch($GLOBALS["data"]->db_escape_string($_REQUEST["i"]));
if($member->id != 0) {
$_REQUEST["member_id"] = $member->id;
$member->create_subscription();
$member->fetch_subscriptions();
$this->set("member", $member);
......@@ -165,6 +166,7 @@ class MembersController extends AppController {
try {
$member = Member::fetch($GLOBALS["data"]->db_escape_string($_REQUEST["i"]));
if($member->id != 0) {
$_REQUEST["member_id"] = $member->id;
$member->update_subscription();
$member->fetch_subscriptions();
$this->set("member", $member);
......
......@@ -25,7 +25,10 @@ if(!array_key_exists("user_id", $_SESSION)) {
$_SESSION["user_id"] = $logged_user->id;
$_REQUEST["o"] = "home";
$_REQUEST["a"] = "index";
}
} else {
$_REQUEST["o"] = "users";
$_REQUEST["a"] = "login";
}
} // stay not authenticated
} else {
if(array_key_exists("a", $_REQUEST) && $_REQUEST["a"] == "logout") {
......
......@@ -91,12 +91,12 @@
<footer>
{% if global['debug'] %}
<pre>
REQUEST :
{% for key, val in request %}
{% if key != "passwd" %}
{{ key }} : {{ val }}
{% endif %}
{% endfor %}
REQUEST :
{% for key, val in request %}
{% if key != "passwd" %}
{{ key }} : {{ val }}
{% endif %}
{% endfor %}
</pre>
{% endif %}
</footer>
......
{% for key, val in global['ihm_message'] %}
<div class="alert alert-{{ val.level }} alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
{% if val.level == 'danger' %}
<span class="glyphicon glyphicon-remove"></span>
{% endif %}
{% if val.level == 'info' %}
<span class="glyphicon glyphicon-ok"></span>
{% endif %}
{{ val.msg }}
</div>
{% endfor %}
{% extends "base.html" %}
{% block title %}Catalogue des jeux{% endblock %}
{% block title %}
{% if member.id %} {{ member.lastname }} {{ member.firstname }} {% else %} Nouvel adhérent {% endif %}
{% endblock %}
{% block content %}
<div class="panel panel-default">
<div class="panel-heading">
<h4><span class="glyphicon glyphicon-user" style="margin-right: 10px" ></span>
{% if game.id %} {{ member.lastname }} {{ member.firstname }} {% else %} Nouvel adhérent {% endif %}
{% if member.id %} {{ member.lastname }} {{ member.firstname }} {% else %} Nouvel adhérent {% endif %}
</h4>
</div>
<div class="panel-body">
......@@ -124,7 +126,7 @@
<label class="control-label col-sm-2" for="deposit">Caution</label>
<div class="col-sm-1">
<input type="hidden" id="deposit" name="deposit"
value="<?=($member->deposit ? 1 : 0)?>" />
value="{{ member.deposit ? 1 : 0 }}" />
<input type="checkbox" id="deposit_cbx" name="deposit_cbx" class="form-control"
{% if member.deposit %} checked {% endif %} />
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment