PHRAS-1173 SQL fix and template update

This commit is contained in:
Xavier Rousset
2016-10-11 15:27:13 +02:00
parent c689a59409
commit 7945994140
2 changed files with 48 additions and 26 deletions

View File

@@ -84,7 +84,7 @@ class RegistrationRepository extends EntityRepository
$data = [];
$rsm = $this->createResultSetMappingBuilder('d');
$rsm->addScalarResult('sbas_id','sbas_id');
$rsm->addScalarResult('bas_id','bas_id');
$rsm->addScalarResult('base_id','base_id');
$rsm->addScalarResult('dbname','dbname');
$rsm->addScalarResult('time_limited', 'time_limited');
$rsm->addScalarResult('limited_from', 'limited_from');
@@ -96,22 +96,20 @@ class RegistrationRepository extends EntityRepository
UNIX_TIMESTAMP( limited_from ) AS limited_from,
UNIX_TIMESTAMP( limited_to ) AS limited_to,
bas.server_coll_id, Users.id, basusr.actif,
bas.base_id AS bas_id , " . $rsm->generateSelectClause(['d' => 'd',]) . "
bas.base_id, " . $rsm->generateSelectClause(['d' => 'd',]) . "
FROM (Users, bas, sbas)
LEFT JOIN basusr ON ( Users.id = basusr.usr_id AND bas.base_id = basusr.base_id )
LEFT JOIN Registrations d ON ( d.user_id = Users.id AND bas.base_id = d.base_id )
WHERE bas.active = 1 AND bas.sbas_id = sbas.sbas_id
AND Users.id = ?
AND model_of = 0";
WHERE basusr.actif = 1 AND bas.sbas_id = sbas.sbas_id
AND Users.id = ?";
$query = $this->_em->createNativeQuery($sql, $rsm);
$query->setParameter(1, $user->getId());
foreach ($query->getResult() as $row) {
$registrationEntity = $row[0];
$data[$row['sbas_id']][$row['bas_id']] = [
'base-id' => $row['bas_id'],
$data[$row['sbas_id']][$row['base_id']] = [
'base-id' => $row['base_id'],
'db-name' => $row['dbname'],
'active' => (Boolean) $row['actif'],
'time-limited' => (Boolean) $row['time_limited'],
@@ -122,4 +120,4 @@ class RegistrationRepository extends EntityRepository
return $data;
}
}
}

View File

@@ -15,14 +15,16 @@
<td style="width: 180px;">&nbsp;</td>
</tr>
{% for sbasId, baseInfo in inscriptions %}
{% set sbasName = sbasId | sbas_labels(app) %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
{% set private = 0 %}
{% if baseInfo["registrations"]["by-type"]["accepted"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Allowed access to the following collections" | trans }}
@@ -44,8 +46,12 @@
<td>
</td>
</tr>
{% endif %}
{% if baseInfo["registrations"]["by-type"]["rejected"]|length > 0 %}
{% elseif baseInfo["registrations"]["by-type"]["rejected"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Rejected access to the following collections" | trans }}
@@ -67,8 +73,12 @@
<td>
</td>
</tr>
{% endif %}
{% if baseInfo["registrations"]["by-type"]["pending"]|length > 0 %}
{% elseif baseInfo["registrations"]["by-type"]["pending"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Pending access to the following collections" | trans }}
@@ -88,8 +98,12 @@
<td>
</td>
</tr>
{% endif %}
{% if baseInfo["registrations"]["by-type"]["in-time"]|length > 0 %}
{% elseif baseInfo["registrations"]["by-type"]["in-time"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Temporary access to the following collections" | trans }}
@@ -109,8 +123,12 @@
<td>
</td>
</tr>
{% endif %}
{% if baseInfo["registrations"]["by-type"]["out-dated"]|length > 0 %}
{% elseif baseInfo["registrations"]["by-type"]["out-dated"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Outdated access to the following collections" | trans }}
@@ -130,8 +148,12 @@
<td>
</td>
</tr>
{% endif %}
{% if baseInfo["registrations"]["by-type"]["inactive"]|length > 0 %}
{% elseif baseInfo["registrations"]["by-type"]["inactive"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Suspended access to the following collections" | trans }}
@@ -151,9 +173,11 @@
<td>
</td>
</tr>
{% else %}
{% set private = 1 %}
{% endif %}
{% if attribute(baseInfo["config"]["cgu"], app['locale']) is defined %}
{% if attribute(baseInfo["config"]["cgu"], app['locale']) is defined and private == 0 %}
{% set TOU = attribute(baseInfo["config"]["cgu"], app['locale']) %}
<tr>
<td colspan="3" style="text-align: center;">
@@ -166,7 +190,7 @@
</tr>
{% endif %}
{% for collInfo in baseInfo["config"]["collections"] if (collInfo['registration'] is none and collInfo['can-register']) %}
{% if collInfo["cgu"] is not none %}
{% if collInfo["cgu"] is not none and private == 0 %}
<tr>
<td colspan="3" style="text-align: center;">{{ "login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes" | trans }}</td>
</tr>