Commit bdeb51df authored by Denis S. Valdenaire's avatar Denis S. Valdenaire

fixes #67

parent 69039275
......@@ -45,10 +45,10 @@ class Member extends Record {
// SQL SELECT members
$sql = "SELECT id, firstname, lastname, birth_date, address, po_town,
home_phone, work_phone, mobile_phone, fax_phone, comments, member_ref,
email, newsletter, other_members, deposit, deposit_expiration_date,
DATEDIFF(deposit_expiration_date, curdate()) as remaining_deposit_days,
CONCAT(lastname, ' ', firstname) AS full_name
home_phone, work_phone, mobile_phone, fax_phone, comments, member_ref,
email, newsletter, other_members, deposit, deposit_expiration_date,
DATEDIFF(deposit_expiration_date, curdate()) as remaining_deposit_days,
CONCAT(lastname, ' ', firstname) AS full_name
FROM members
WHERE id = ".$id;
$GLOBALS["data"]->select($sql, $member, "Member");
......@@ -189,10 +189,22 @@ class Member extends Record {
public static function fetch_all(&$members) {
$members = array();
// SQL SELECT members
$sql = "SELECT id, lastname, firstname, po_town, CONCAT(firstname, ' ', lastname) AS full_name
FROM members
ORDER BY lastname";
// SQL SELECT members subscriptions
$sql = "SELECT m.id, m.lastname, m.firstname, m.po_town,
CONCAT(m.firstname, ' ', m.lastname) AS full_name,
s.id AS subscription_id, MAX(s.end_date) AS subscription_end_date,
CASE WHEN s.id IS NULL
THEN 'Non trouvée'
ELSE
CASE WHEN MAX(s.end_date) < curdate()
THEN 'Expirée'
ELSE 'Valide'
END
END AS subscription_status
FROM members m
LEFT OUTER JOIN subscriptions s ON (s.member_id = m.id)
GROUP BY m.id
ORDER BY m.lastname";
$GLOBALS["data"]->select($sql, $members, "Member");
return sizeof($members);
}
......
......@@ -16,7 +16,7 @@ class AppController {
$loader = new Twig_Loader_Filesystem('views'); // Dossier contenant les templates
$this->twig = new Twig_Environment($loader, array(
'cache' => false
'cache' => false,
));
$this->context["global"] = $GLOBALS;
$this->context["request"] = $_REQUEST;
......
ALTER TABLE `bank_operations` ADD KEY `move_id_idx` (`move_id`);
ALTER TABLE `bank_operations` CHANGE `move_id` `move_id` INT(11) NULL DEFAULT NULL;
update bank_operations set move_id = NULL where move_id = 0;
ALTER TABLE `bank_operations` ADD FOREIGN KEY (`move_id`) REFERENCES `ludotheque`.`moves`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
INSERT INTO schema_migrations values ('201601301833');
CREATE TABLE IF NOT EXISTS `checkbooks` (
`id` int(11) NOT NULL,
`name` varchar(128) NOT NULL,
`num_start` int(11) NOT NULL,
`num_end` int(11) NOT NULL,
`num_length` int(11) NOT NULL,
`account_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `checkbooks` ADD PRIMARY KEY (`id`);
ALTER TABLE `checkbooks` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT:;
CREATE TABLE IF NOT EXISTS `checks` (
`id` varchar(16) NOT NULL,
`checkbook_id` int(11) NOT NULL,
`move_id` int(11) DEFAULT NULL,
`is_canceled` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `checks`
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `move_id` (`move_id`), ADD KEY `checkbook_id` (`checkbook_id`);
ALTER TABLE `checks`
ADD CONSTRAINT `checks_ibfk_1` FOREIGN KEY (`checkbook_id`) REFERENCES `checkbooks` (`id`),
ADD CONSTRAINT `checks_ibfk_2` FOREIGN KEY (`move_id`) REFERENCES `moves` (`id`);
INSERT INTO schema_migrations VALUES ('201601310006');
......@@ -45,12 +45,6 @@
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="2">
Aucune catégorie n'a été trouvée.
</td>
</tr>
{% endfor %}
</tbody>
</table>
......@@ -72,6 +66,9 @@
$(document).ready(function() {
$('#object_list').DataTable({
"autoWidth": false,
"language": {
"emptyTable": "Aucune catégorie n'a été trouvée."
},
"columnDefs": [{ "orderable": false, "targets": -1 }],
"fnDrawCallback": function() {
$(this).show();
......
......@@ -49,10 +49,6 @@
{% if val.loan_status == '' %} Libre {% else %} Emprunté {% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="3" align="center">Aucun jeu trouvé</td>
</tr>
{% endfor %}
</tbody>
</table>
......@@ -90,6 +86,7 @@ $(document).ready(function() {
"language": {
"url": "js/dataTables.french.json"
},
"dom": '<"slider_div">frtip'
});
$('#new_button').click(function(){
......
......@@ -57,7 +57,10 @@ $(document).ready(function() {
"autoWidth": false,
"fnDrawCallback": function() {
$(this).show();
}
},
"language": {
"emptyTable": "Aucun emprunt en cours"
},
});
$('#new_button').click(function(){
$('#a').val('new');
......
......@@ -23,7 +23,7 @@
<tr>
<th>Nom</th>
<th>Ville</th>
<th>Etat</th>
<th>Adhésion</th>
</tr>
</thead>
<tbody>
......@@ -36,15 +36,10 @@
{{ val.po_town }}
</td>
<td>
FIXME
{{ val.subscription_status }}
{{ val.subscription_end_date }}
</td>
</tr>
{% else %}
<tr>
<td colspan="3">
Aucun membre trouvé.
</td>
</tr>
{% endfor %}
</tbody>
</table>
......@@ -56,6 +51,9 @@
$(document).ready(function() {
$('#list_member').DataTable({
"autoWidth": false,
"language": {
"emptyTable": "Aucun membre trouvé"
},
"fnDrawCallback": function() {
$(this).show();
}
......
......@@ -47,12 +47,6 @@
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">
Aucun type d'adhésion trouvée
</td>
</tr>
{% endfor %}
</tbody>
</table>
......@@ -74,6 +68,9 @@
$(document).ready(function() {
$('#object_list').DataTable({
"autoWidth": false,
"language": {
"emptyTable": "Aucun type d'adhésion trouvée"
},
"columnDefs": [{ "orderable": false, "targets": -1 }],
"fnDrawCallback": function() {
$(this).show();
......
......@@ -45,12 +45,6 @@
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="2">
Aucun moyen de paiement n'a été trouvé.
</td>
</tr>
{% endfor %}
</tbody>
</table>
......@@ -72,6 +66,9 @@
$(document).ready(function() {
$('#object_list').DataTable({
"autoWidth": false,
"language": {
"emptyTable": "Aucun moyen de paiement n'a été trouvé."
},
"columnDefs": [{ "orderable": false, "targets": -1 }],
"fnDrawCallback": function() {
$(this).show();
......
......@@ -45,10 +45,6 @@
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="4" align="center">Aucune réservation en cours</td>
</tr>
{% endfor %}
</tbody>
</table>
......@@ -62,6 +58,9 @@
$(document).ready(function() {
$('#object_list').DataTable({
"autoWidth": false,
"language": {
"emptyTable": "Aucune réservation en cours."
},
"columnDefs": [{ "orderable": false, "targets": -1 }],
"fnDrawCallback": function() {
$(this).show();
......
......@@ -56,12 +56,6 @@
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="4">
Aucun utilisateur trouvé. À se demander comment l'utilisateur courant peut être connecté !
</td>
</tr>
{% endfor %}
</tbody>
</table>
......@@ -83,6 +77,9 @@
$(document).ready(function() {
$('#object_list').DataTable({
"autoWidth": false,
"language": {
"emptyTable": "Aucun utilisateur trouvé. À se demander comment l'utilisateur courant peut être connecté !"
},
"columnDefs": [{ "orderable": false, "targets": -1 }],
"fnDrawCallback": function() {
$(this).show();
......
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