Commit 6f5fff2e authored by okhin's avatar okhin 🚴

Merge branch 'preprod' into 'master'

Preprod

See merge request !53
parents 6d8068aa 5e5afbee
Pipeline #2225 passed with stages
in 1 minute and 10 seconds
......@@ -93,7 +93,7 @@ class Perso extends Controller
{
// Chargement des dons de l'utilisateur
$db = $f3->get('DB');
$result = $db->query("SELECT datec, somme, id, pdf, status FROM dons WHERE user_id='".$f3->get('infos.id')."' AND status IN (1,4,102) ORDER BY datec ASC");
$result = $db->query("SELECT datec, somme, id, pdf, status FROM dons WHERE user_id='".$f3->get('infos.id')."' AND status IN (1,4,102) ORDER BY datec DESC");
$data = array();
foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$data[] = $row;
......@@ -116,6 +116,7 @@ class Perso extends Controller
public function login($f3, $args)
{
$f3->clear('SESSION.error');
$f3->clear('SESSION.message');
$f3->set('form_visible', 'login');
if ($f3->get('action')=='renew_password') {
......@@ -268,7 +269,7 @@ class Perso extends Controller
if ($f3->exists('SESSION.id')) {
// Let's firts check that both the password match
if ($f3->get('password') != $f3->get('password_confirmation')) {
$f3->set('SESSION.error', 'Passwords mismatch');
$f3->set('SESSION.error', _("Les mots de passe ne correspondent pas"));
} else {
$sql = "UPDATE users SET email='".\Utils::asl($f3->get('email'))."',
pseudo='".\Utils::asl($f3->get('pseudo'))."'";
......@@ -311,6 +312,7 @@ class Perso extends Controller
$f3->set("error", _("Cette adresse existe déjà."));
$f3->error('403');
}
$f3->set('SESSION.message', _("Adresse ajoutée à votre profil"));
break;
case 'DELETE':
try {
......@@ -324,6 +326,7 @@ class Perso extends Controller
$f3->set("error", _("Cette adresse est utilisée pour une de vos contreparties"));
$f3->error('403');
};
$f3->set('SESSION.message', _("Adresse supprimée de votre profil"));
break;
}
$f3->reroute('/perso');
......@@ -382,7 +385,7 @@ class Perso extends Controller
}
// Puis diminution du cumul de la valeur des contreparties
$db->query("UPDATE users SET cumul = cumul - ".$valeur." WHERE id='".$f3->get('SESSION.id')."'");
$f3->set('msg', _("Merci, vos contreparties seront envoyées dès que possible !"));
$f3->set('SESSION.message', _("Merci, vos contreparties seront envoyées dès que possible !"));
$f3->reroute('/perso');
}
......@@ -532,6 +535,7 @@ class Perso extends Controller
user_id = '".$user_id."',
identifier = '".$identifier."',
cumul = 0;");
$f3->set('SESSION.message', _("Don récurrent supprimé."));
$f3->reroute('/perso');
}
......
......@@ -19,9 +19,6 @@
</form>
<p>Erreur: </p>
<repeat group="{{ @SESSION.errors }}" value="{{ @error }}">
<p>{{@error}}</p>
</repeat>
<section id="gift_holder">
<!-- Différents affichages possibles -->
<div id="no_cado" class="cadeaux" style="display:none">
......
<div class="modal-form <check if="{{ @@form_visible == 'login' }}">visible</check>" id="login">
<div class="modal-form-title modal-form-only">
<a class="close modal-form-only" href="/#"><span>{{ _("Fermer") }}</span></a>
<h1>{{_("Se connecter")}}</h1>
<h1>{{_("Connexion")}}</h1>
</div>
<form method="POST" class="form-inline" action="{{ 'login' | alias }}">
<div class="modal-form-body">
<input type="hidden" name="csrf" id="csrf" value="{{ @CSRF }}" />
<fieldset class="form-group modal-form-only">
<h3>{{ _("Le site de dons a changé. À présent, utilisez votre adresse e-mail comme identifiant.") }} </h3>
<check if="{{ @@SESSION.message }}">
<p class="modal-row alert alert-info">{{ @SESSION.message }}</p>
</check>
<check if="{{ @@SESSION.error }}">
<p class="modal-row alert alert-danger">{{ @SESSION.error }}</p>
</check>
<div class="modal-row form-group">
<label for="email">{{ _("Adresse mail") }}</label>
<input class="form-control" type="email" name="email" id="email" required>
......@@ -91,10 +97,10 @@
</ul>
<ul class="nav navbar-nav navbar-right">
<check if="{{ array_key_exists('user', @SESSION) }}">
<true><li><a href="{{ 'logout' | alias }}">{{ _("Se déconnecter") }}</a></li>
<li><a href="{{ 'perso' | alias }}">{{ _("Réclamer les contreparties") }}</a></li></true>
<true><li><a href="{{ 'logout' | alias }}">{{ _("Déconnexion") }}</a></li>
<li><a href="{{ 'perso' | alias }}">{{ _("Contreparties") }}</a></li></true>
<false><li><a href="#add-account">{{ _("Créer un compte")}}</a></li>
<li><a href="#login">{{ _("Se connecter")}}</a></li></false>
<li><a href="#login">{{ _("Connexion")}}</a></li></false>
</check>
</ul>
<ul class="nav navbar-nav navbar-right">
......@@ -125,7 +131,7 @@
<ul class="nav navbar-nav">
<check if="{{ array_key_exists('user', @SESSION) }}">
<true><li class="pull-right collapsible-menu"><a href="#perso-menu">{{ _("Perso") }}</a></li></true>
<false><li class="pull-right"><a href="#login">{{ _("Se connecter")}}</a></li></false>
<false><li class="pull-right"><a href="#login">{{ _("Connexion")}}</a></li></false>
</check>
<li class="pull-right collapsible-menu"><a href="#action-menu">{{ _("Menu") }}</a>
</li>
......@@ -149,3 +155,12 @@
</div>
</nav>
</div>
<section id="messages">
<check if="{{ @@SESSION.message }}">
<p class="alert alert-info">{{ @SESSION.message }}</p>
</check>
<check if="{{ @@SESSION.error }}">
<p class="alert alert-danger">{{ @SESSION.error }}</p>
</check>
</section>
......@@ -149,9 +149,6 @@
</select></p>
<input type="submit" class="big_button" value="Valider" <check if="{{ @adresse }}"><false>disabled</false>/</check>/>
</div>
<check if="{{ @error!='' }}">
<p class="error">{{ @error }}</p>
</check>
</form>
</check>
</section>
......@@ -32,12 +32,6 @@
<p><input type="button" onclick="document.forms['f1']['create_user'].value=1;document.forms['f1'].submit()" class="btn_password" value="{{ _('Créer un compte') }}" /></p>
</form>
<check if="{{ @error!='' }}">
<p class="error">{{ @error }}</p>
</check>
<check if="{{ @information!='' }}">
<p class="information">{{ @information }}</p>
</check>
</false>
</check>
</section>
......@@ -139,14 +139,21 @@
<th>{{ _("Date") }}</th>
<th>{{ _("Dons") }}</th>
<th>{{ _("Récurent") }}</th>
<th>{{ _("Contreparties") }}</th>
<th>{{ _("Piplome") }}</th>
</tr>
<repeat group="{{ @dons_recurrents }}" value="{{ @don }}">
<tr>
<td>{{ @don.datec }}</td>
<td>{{ @don.somme }}</td>
<td>{{ _("Oui")}}</td>
<td></td>
<td>
<check if="{{ @don.pdf == '' }}">
<a href="/cron/piplome/{{ @don.id }}">{{ _("Générer") }}</a>
<false>
<a href="{{ PIPLOME_URL }}/{{ @don.pdf }}.pdf" target="_blank">{{ @pdfs[@don.pdf].decimale }}.pdf</a>
</false>
</check>
</td>
</tr>
</repeat>
<repeat group="{{ @dons }}" value="{{ @don }}">
......@@ -154,14 +161,26 @@
<td>{{ @don.datec }}</td>
<td>{{ @don.somme }}</td>
<td>{{ _("Non")}}</td>
<td></td>
<td>
<check if="{{ @don.pdf == '' }}">
<a href="/cron/piplome/{{ @don.id }}">{{ _("Générer") }}</a>
<false>
<a href="{{ PIPLOME_URL }}/{{ @don.pdf }}.pdf" target="_blank">{{ @pdfs[@don.pdf].decimale }}.pdf</a>
</false>
</check>
</td>
</tr>
</repeat>
</table>
<table class="table text-left">
<tr>
<th>{{ _("Date") }}</th>
<th>{{ _("Contreparties") }}</th>
</tr>
<repeat group="{{ @contreparties }}" value="{{ @contrepartie }}">
<tr>
<td>{{ @contrepartie.datec }}</td>
<td></td>
<td></td>
<td>{{ @contrepartie.quoi }}</td>
</tr>
</repeat>
......
......@@ -30,7 +30,7 @@ class CounterpartSeeder extends AbstractSeed
'user_id' => 2,
'quoi' => 'piplome', // [piplome|pibag|pishirt|hoodie]
'taille' => 2,
'status' => 1,
'status' => 2,
'adresse_id' => null,
),
);
......
......@@ -92,7 +92,7 @@ EOF;
private function addressUsed($addressId)
{
$count = (int) $this->connection->fetchColumn(
"SELECT count(1) FROM contreparties, dons WHERE contreparties.adresse_id = :id OR dons.adresse_id = :id",
"SELECT count(1) FROM contreparties, dons WHERE contreparties.adresse_id = :id AND contreparties.status = 1;",
[
'id' => $addressId,
],
......
......@@ -20,7 +20,7 @@ class CounterpartFinderTest extends FunctionalTest
'datec' => '2016-06-22 12:34:00',
'quoi' => 'piplome',
'taille' => '2',
'status' => '1',
'status' => '2',
'adresse_id' => null,
'pdf_id' => '1',
'pdf_nom' => 'Main',
......
......@@ -16,6 +16,10 @@ class AddressHandlerTest extends FunctionalTest
$this->setExpectedException('LQDN\Exception\AddressUsedException');
$this->container['command_handler']->handle(new AddressDeleteCommand(1, 1));
$this->container['command_handler']->handle(new AddressDeleteCommand(2, 1));
$this->assertFalse($this->addressExists(2));
}
public function testAdressDelete()
......
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