Commit 232014a3 authored by okhin's avatar okhin 🚴

Merge branch 'Guinness/don-fix-admin-user-view' into 'preprod'

Guinness/don fix admin user view

Closes #26, #24, and #23

See merge request !55
parents 9b4639ad 727bd396
Pipeline #2237 failed with stages
in 4 minutes and 28 seconds
This diff is collapsed.
<?php
namespace Controller;
use LQDN\Command\UserUpdateCumulCommand;
use LQDN\Command\UserUpdateTotalCommand;
class Bank extends Controller
{
/* We want to ignore the sanitizing on this page */
......@@ -150,13 +153,13 @@ class Bank extends Controller
$status = $res->fetch(\PDO::FETCH_ASSOC);
$status = $status['status'];
$res = $db->query("SELECT * FROM users WHERE id='".$don['user_id']."';");
$user = $res->fetch(\PDO::FETCH_ASSOC);
$user = $f3->get('container')['user_finder']->findById($don['user_id']);
$cb_log->write("Utilisation d'un utilisateur existant");
// Ajout du nouveau don au cumul actuel
if ($status!=101) {
$cb_log->write("Ajout de ".$don['somme']);
$db->query("UPDATE users set cumul = cumul + " . $don['somme'] . ", total = total + " . $don['somme'] . " WHERE id='".$don['user_id']."'");
$f3->get('container')['command_handler']->handle(new UpdateUserTotalCommand($user['id'], (int) $user['total'] + $don['somme']));
$f3->get('container')['command_handler']->handle(new UpdateUserCumulCommand($user['id'], (int) $user['cumul'] + $don['cumul']));
}
$result = $db->query("SELECT cumul FROM users WHERE id='".$don['user_id']."'");
$cumul = $result->fetch(\PDO::FETCH_ASSOC);
......@@ -199,7 +202,7 @@ Toute l'équipe de La Quadrature du Net
")."\n\n";
// Création de l'url d'administration
$admin_url = "https://support.laquadrature.net/perso";
$admin_url = "https://don.laquadrature.net/perso";
foreach ($f3->get('languages') as $key => $language) {
if ($lang==$language[1]) {
$admin_url = "https://".$language[0].$f3->get('dev').".laquadrature.net/perso";
......
<?php
namespace Controller;
use LQDN\Command\UserUpdateTotalCommand;
use LQDN\Command\UserCreateCommand;
use LQDN\Command\DonationCreateCommand;
class Campaign extends Controller
{
/*
......@@ -93,8 +97,7 @@ class Campaign extends Controller
$db = $f3->get('DB');
// Si l'utilisateur est déjà connecté, on le récupère
if ($f3->get('SESSION.user', true)) {
$user = $db->query("SELECT * FROM users WHERE id = ".$f3->get('SESSION.id'));
$user = $user->fetch(\PDO::FETCH_ASSOC);
$user = $f3->get('container')['user_finder']->findById($f3->get('SESSION.id'));
$email = $user['email'];
$user_id = $user['id'];
$cumul_id = $user['cumul'];
......@@ -103,10 +106,9 @@ class Campaign extends Controller
$email = \Utils::asl($f3->get('email'));
$hash = hash('sha256', $f3->get('password'));
$sql = "SELECT id FROM users WHERE email = '".\Utils::asl($email)."';";
$result = $db->query($sql);
$user = $f3->get('container')['user_finder']->findByEmail(\Utils::asl($email));
if ($result->fetchColumn() > 0) {
if (len($user) > 0) {
// We have an existing user, we should try to login with the provided password
// or 403.
$mapper = new \DB\SQL\Mapper($f3->get('DB'), 'users');
......@@ -114,11 +116,6 @@ class Campaign extends Controller
$login = $auth->login($email, $hash);
if (!$login) {
$f3->error(403);
} else {
$result = $db->query("SELECT id, cumul FROM users WHERE email = '".\Utils::asl($email)."'");
$user = $result->fetch(\PDO::FETCH_ASSOC);
$user_id = $user['id'];
$cumul_id = $user['cumul'];
}
} else {
// The user does not exist, so let's create it
......
......@@ -4,6 +4,11 @@ namespace Controller;
use LQDN\Command\AddressCreateCommand;
use LQDN\Command\AddressDeleteCommand;
use LQDN\Command\AddressUpdateCommand;
use LQDN\Command\CounterpartCreateCommand;
use LQDN\Command\CounterpartDeleteCommand;
use LQDN\Command\UserUpdateCumulCommand;
use LQDN\Command\UserUpdateTotalCommand;
use LQDN\Command\UserCreateCommand;
class Perso extends Controller
{
......@@ -38,41 +43,14 @@ class Perso extends Controller
{
// Chargement des informations de l'utilisateur
$db = $f3->get('DB');
// Let's update the total first
$total = 0;
$total_res = $db->query("SELECT SUM(somme) as total FROM dons WHERE status in (1, 4, 101, 102) AND user_id='".$f3->get('SESSION.id')."'");
$total_res = $total_res->fetch(\PDO::FETCH_ASSOC);
$total = $total_res['total'];
// While we're at it, let's remove the price of each asked contreparties
// printed piplome is 30, pibag is 50, pishirt is 100 and hoodie is 250
// We first need to have the number of each counterpart claimed by the
// user
$cumul_counterpart = $db->query("SELECT sum(if(quoi='piplome', 1, 0)) as piplomes,
sum(if(quoi='pibag', 1, 0)) as pibags,
sum(if(quoi='pishirt', 1, 0)) as pishirts,
sum(if(quoi='hoodie', 1, 0)) as hoodies
FROM contreparties
WHERE user_id = '".$f3->get('SESSION.id')."';");
$cumul_counterpart = $cumul_counterpart->fetch(\PDO::FETCH_ASSOC);
foreach (['hoodies', 'pishirts', 'pibags', 'piplomes'] as $key) {
if (!array_key_exists($key, $cumul_counterpart)) {
$cumul_counterpart[$key] = 0;
}
}
$cumul = $cumul_counterpart['hoodies'] * 250 + max(($cumul_counterpart['pishirts'] - $cumul_counterpart['hoodies']), 0) * 100 + max(($cumul_counterpart['pibags'] - $cumul_counterpart['pishirts'] - $cumul_counterpart['hoodies']), 0) * 50 + max(($cumul_counterpart['piplomes'] - $cumul_counterpart['pibags'] - $cumul_counterpart['pishirts'] - $cumul_counterpart['hoodies']), 0) * 30;
$cumul = $total - $cumul;
$db->query("UPDATE users SET total = '".$total."', cumul = '".$cumul."' WHERE id = '".$f3->get('SESSION.id')."'");
$result = $db->query("SELECT id, pseudo, email, total, cumul FROM users WHERE id='".$f3->get('SESSION.id')."' ");
$data = $result->fetch(\PDO::FETCH_ASSOC);
$f3->set('infos', $data);
$result = $db->query("SELECT id, pdf, decimale FROM dons WHERE user_id='".$data['id']."' and pdf!='' ");
$user = $f3->get('container')['user_finder']->findById($f3->get('SESSION.id'));
$f3->set('infos', $user);
$result = $db->query("SELECT id, pdf, decimale FROM dons WHERE user_id='".$user['id']."' and pdf!='' ");
$pdfs = array();
foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$pdfs[$row['pdf']] = $row;
}
$addresse = $f3->get('container')['address_finder']->findByUserId((int) $data['id']);
$addresse = $f3->get('container')['address_finder']->findByUserId((int) $user['id']);
$f3->set('adresse', $addresse);
$f3->set('pdfs', $pdfs);
}
......@@ -80,25 +58,19 @@ class Perso extends Controller
public function get_contreparties($f3)
{
// Chargement des contreparties de l'utilisateur
$db = $f3->get('DB');
$result =$db->query("SELECT datec, status, quoi, taille, adresse_id FROM contreparties WHERE user_id='".$f3->get('SESSION.id')."' ORDER BY datec DESC");
$data = array();
foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$data[] = $row;
}
$f3->set('contreparties', $data);
$contreparties = $f3->get('container')['counterpart_finder']->findByUserId((int) $f3->get('SESSION.id'));
$f3->set('contreparties', $contreparties);
}
public function get_dons($f3)
{
// 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 DESC");
$data = array();
foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$data[] = $row;
}
$f3->set('dons', $data);
$dons = $f3->get('container')['donation_finder']->findByUserId((int) $f3->get('SESSION.id'));
$dons = array_filter($dons, function ($id) {
return in_array((int) $id, [1, 4, 102]);
});
$f3->set('dons', $dons);
}
public function get_recurrents($f3)
......@@ -115,8 +87,6 @@ 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') {
......@@ -240,8 +210,7 @@ class Perso extends Controller
if ($f3->get('email')!='') {
// On vérifie que l'adresse mail n'existe pas
$db = $f3->get('DB');
$query = $db->query("SELECT email FROM users WHERE email='".$f3->get('email')."';");
$result = $query->fetch(\PDO::FETCH_ASSOC);
$user = $f3->get('container')['user_finder']->findByEmail($f3->get('email'));
$cumul = 0;
if ($result['email']!=$f3->get('email')) {
$hash = hash('sha256', $f3->get('password'));
......@@ -337,11 +306,8 @@ class Perso extends Controller
if (!$f3->exists('SESSION.user')) {
$f3->error('401');
}
// Récupération du cumul actuel de l'utilisateur
$db = $f3->get('DB');
$result = $db->query("SELECT cumul FROM users WHERE id='".$f3->get('SESSION.id')."' ");
$me = $result->fetch(\PDO::FETCH_ASSOC);
$cumul = $me['cumul'];
$user = $f3->get('container')['user_finder']->findById($f3->get('SESSION.id'));
// Récupération des valeurs du formulaire
$adresse_id = $f3->get('adresse_id');
......@@ -351,7 +317,6 @@ class Perso extends Controller
$piplome_id = intval(substr($f3->get('piplome_id'), 0, strpos($f3->get('piplome_id'), '_')));
$taille = intval($f3->get('taille'));
$taille_h = intval($f3->get('taille_h'));
$f3->clear('SESSION.error');
switch ($quoi) {
case 'piplome':
$valeur = 30;
......@@ -368,24 +333,28 @@ class Perso extends Controller
}
// Ajout d'une demande de contrepartie pour chaque contrepartie
if ($cumul >= $valeur) {
if ((int) $user['cumul'] >= $valeur) {
switch ($quoi) {
case 'piplome':
$db->query("INSERT INTO contreparties (user_id,datec,quoi,taille,adresse_id,status,commentaire) VALUES ('".$f3->get('SESSION.id')."',NOW(),'piplome','".\Utils::asl($piplome_id)."','".\Utils::asl($adresse_id)."',1, '".\Utils::asl($commentaire)."')");
$f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'piplome', \Utils::asl($piplome_id), 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire)));
break;
case 'pibag':
$db->query("INSERT INTO contreparties (user_id,datec,quoi,taille,adresse_id,status,commentaire) VALUES ('".$f3->get('SESSION.id')."',NOW(),'pibag','','".\Utils::asl($adresse_id)."',1, '".\Utils::asl($commentaire)."')");
$f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'pibag', '', 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire)));
break;
case 'pishirt':
$db->query("INSERT INTO contreparties (user_id,datec,quoi,taille,adresse_id,status,commentaire) VALUES ('".$f3->get('SESSION.id')."',NOW(),'pishirt','".\Utils::asl($taille)."','".\Utils::asl($adresse_id)."',1, '".\Utils::asl($commentaire)."')");
$f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'pishirt', \Utils::asl($taille), 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire)));
break;
case 'hoopie':
$db->query("INSERT INTO contreparties (user_id,datec,quoi,taille,adresse_id,status,commentaire) VALUES ('".$f3->get('SESSION.id')."',NOW(),'hoodie','".\Utils::asl($taille_h)."','".\Utils::asl($adresse_id)."',1, '".\Utils::asl($commentaire)."')");
$f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'hoopie', \Utils::asl($taille_h), 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire)));
break;
}
// Puis diminution du cumul de la valeur des contreparties
$f3->get('container')['command_handler']->handle(new UserUpdateCumulCommand($user['id'], $user['cumul'] - $valeur));
$f3->set('SESSION.message', _("Merci, vos contreparties seront envoyées dès que possible !".$valeur));
} else {
$f3->set('SESSION.error', _("Désolé, mais vous n'avez pas cumulé suffisament de dons pour avoir un ").$quoi);
$f3->clear('SESSION.message');
}
// 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('SESSION.message', _("Merci, vos contreparties seront envoyées dès que possible !"));
$f3->reroute('/perso');
}
......
......@@ -27,6 +27,8 @@ GET|POST @admin:/admin=Controller\Admin->show
GET @add_support:/admin/support/add=Controller\Admin->support
GET @edit_support:/admin/support/edit/@id=Controller\Admin->support
POST @modify_support:/admin/support/edit=Controller\Admin->support
GET @invalidate_support:/admin/support/invalidate/@id=Controller\Admin->invalidate
GET @validate_support:/admin/support/validate/@id=Controller\Admin->validate
GET|POST @admin_accounts:/admin/accounts=Controller\Admin->accounts
......
<include href="backend/header.html" />
<include href="backend/toolbar.html" />
<include href="{{ @block_content }}" />
<include href="backend/footer.html" />
<!-- <include href="backend/footer.html" /> <!-- No need for scripts right now -->
......@@ -7,13 +7,13 @@
<h2>Ajout d'une contrepartie</h2>
</false>
</check>
<form name="f" method="POST" action="{{ 'edit_counterpart', 'id='+@id | alias }}">
<form name="f" method="POST" action="{{ 'edit_counterpart', 'id='.@id | alias }}">
<input type="hidden" name="taille" id="taille" value="{{ @contrepartie.taille }}" />
<input type="hidden" name="user_id" id="user_id" value="{{ @contrepartie.user_id }}" />
<input type="hidden" id="csrf" name="csrf" value="{{ @CSRF }}" />
<label for="quoi">Quoi</label>
<select id="quoi" name="quoi" onchange="select_span()">
<select id="quoi" name="quoi">
<option value="piplome" <check if="{{ @contrepartie.quoi=='piplome' }}">selected</check> >piplome</option>
<option value="pishirt" <check if="{{ @contrepartie.quoi=='pishirt' }}">selected</check> >pishirt</option>
<option value="hoodie" <check if="{{ @contrepartie.quoi=='hoodie' }}">selected</check> >hoodie</option>
......@@ -22,15 +22,15 @@
<span id="quoi_taille">
<label for="size">Taille</label>
<select id="size" name="size" onchange="select_taille()">
<repeat group="{{ @TAILLES }}" key="{{ @key }}" value="{{ @value }}">
<select id="size" name="size">
<repeat group="{{ @atailles }}" key="{{ @key }}" value="{{ @value }}">
<option value="{{ @key }}" <check if="{{ @contrepartie.taille==@key }}">selected</check> >{{ @value }}</option>
</repeat>
</select>
</span>
<span id="quoi_pdf">
<label for="url">Pdf</label>
<select id="url" name="url" onchange="select_taille()">
<select id="url" name="url">
<repeat group="{{ @pdfs }}" value="{{ @pdf }}">
<option value="{{ @pdf.id }}" <check if="{{ @contrepartie.taille==@pdf.id }}">selected</check> >{{ @pdf.pdf }} / {{ @pdf.nom }}</option>
</repeat>
......@@ -43,7 +43,11 @@
<br />
<label for="adresse">Adresse</label>
<textarea id="adresse" name="adresse" cols="30" rows="2">{{ @contrepartie.adresse }}</textarea>
<input type="text" id="adresse" name="adresse" size="60" value="{{ @contrepartie.adresse }}">
<br />
<label for="adresse">Complément d'adresse</label>
<input type="text" id="adresse2" name="adresse2" size="60" value="{{ @contrepartie.adresse2 }}">
<br />
<label for="codepostal">Code postal</label>
......@@ -65,7 +69,7 @@
</select>
<br />
<label for=commentaire">Commentaire</label>
<label for="commentaire">Commentaire</label>
<textarea type="textarea" id="commentaire" name="commentaire" cols="30" rows="2">{{ @contrepartie.commentaire }}</textarea>
<br />
......
......@@ -71,14 +71,14 @@
&nbsp;
</true>
<false>
{{ @TAILLES[@row.taille] }}
{{ @atailles[@row.taille] }}
</false>
</check>
</false>
</check>
</td>
<td>
{{ @row.nom }}<br />
{{ @row.pseudo }}<br />
{{ @row.adresse }}<br />
{{ @row.adresse2 }}<br />
{{ @row.codepostal }} {{ @row.ville }}<br />
......
......@@ -55,8 +55,8 @@
<tr>
<td>{{ @row.id }}</td>
<td class="inline">{{ @row.datec }}</td>
<td>{{ @row.nom }}</td>
<td><a href="{{ 'user_info','id='.@row.user_id | alias }}">{{ @row.email }}</a></td>
<td>{{ @row.pseudo }}</td>
<td><a href="{{ 'user_info','id='.@row.user_id | alias }}">{{ @row.email }}</a></td>
<td>{{ @row.somme }}</td>
<td>
{{ @row.adresse }}<br />
......@@ -71,12 +71,12 @@
-
<check if="{{ @row.status==0 || @row.status==100 }}" >
<true>
<span class="lien" onclick="valid({{ @row.id }})">Valider</span>
<a href="{{ 'validate_support', 'id='.@row.id | alias }}">Valider</a>
</true>
<false>
<span class="lien" onclick="invalid({{ @row.id }})">Invalider</span>
<a href="{{ 'invalidate_support', 'id='.@row.id | alias }}">Invalider</a>
-
<span class="lien" onclick="pdf({{ @row.id }})">PDF</span>
<a href="{{ 'validate_support', 'id='.@row.id | alias }}">PDF</a>
</false>
</check>
</td>
......
......@@ -35,52 +35,50 @@
<br />
</section>
<section id="adresses">
<h2>Adresses associées à cet utilisateur</h2>
<repeat group="{{ @user.adresses }}" value="{{ @adresse }}" counter="{{ @i }}">
<h3>{{ @i }}&nbsp:{{ @adresse.alias }}</h3>
<form name="addr_{{@id }}" method="POST" action="{{ 'adresse' |alias }}">
<input type="hidden" id="csrf" name="csrf" value="{{ @CSRF }}" />
<input type="hidden" name="id" id="id" value="{{ @adresse.id }}" />
<input type="hidden" name="action" id="action" value="modify" />
<label for="nom">Nom</label>
<input type="text" id="nom" name="nom" size="30" value="{{ @adresse.nom }}" />
<br />
<label for="adresse">Adresse</label>
<input type="text" id="adresse" name="adresse" size="100" value="{{ @adresse.adresse }}" />
<br />
<label for="adresse2">Adresse (compl.)</label>
<input type="text" id="adresse2" name="adresse2" size="100" value="{{ @adresse.adresse2 }}" />
<br />
<label for="codepostal">Code Postal</label>
<input type="text" id="codepostal" name="codepostal" size="10" value="{{ @adresse.codepostal }}" />
<br />
<label for="ville">Ville</label>
<input type="text" id="ville" name="ville" size="50" value="{{ @adresse.ville }}" />
<br />
<label for="etat">Etat / Province / Comté</label>
<input type="text" id="etat" name="etat" size="50" value="{{ @adresse.etat }}" />
<br />
<label for="pays">Pays</label>
<input type="text" id="pays" name="pays" size="30" value="{{ @adresse.pays }}" />
<br />
<input type="submit" value="Modifier l'adresse" />
</form>
<form name="del_addr_{{@id}}" method="POST" action="{{ 'adresse' | alias }}">
<input type="hidden" id="csrf" name="csrf" value="{{ @CSRF }}" />
<input type="hidden" name="id" id="id" value="{{ @adresse.id }}" />
<input type="hidden" name="action" id="action" value="delete" />
<input type="submit" value="Effacer l'adresse" />
</form>
</repeat>
<h2>Adresse postale de cet utilisateur</h2>
<check if="@@user.adresse">
<form name="addr_{{@id }}" method="POST" action="{{ 'adresse' |alias }}">
<input type="hidden" id="csrf" name="csrf" value="{{ @CSRF }}" />
<input type="hidden" name="id" id="id" value="{{ @@user.adresse.id }}" />
<input type="hidden" name="action" id="action" value="modify" />
<label for="nom">Nom</label>
<input type="text" id="nom" name="nom" size="30" value="{{ @@user.adresse.nom }}" />
<br />
<label for="adresse">Adresse</label>
<input type="text" id="adresse" name="adresse" size="100" value="{{ @@user.adresse.adresse }}" />
<br />
<label for="adresse2">Adresse (compl.)</label>
<input type="text" id="adresse2" name="adresse2" size="100" value="{{ @@user.adresse.adresse2 }}" />
<br />
<label for="codepostal">Code Postal</label>
<input type="text" id="codepostal" name="codepostal" size="10" value="{{ @@user.adresse.codepostal }}" />
<br />
<label for="ville">Ville</label>
<input type="text" id="ville" name="ville" size="50" value="{{ @@user.adresse.ville }}" />
<br />
<label for="etat">Etat / Province / Comté</label>
<input type="text" id="etat" name="etat" size="50" value="{{ @@user.adresse.etat }}" />
<br />
<label for="pays">Pays</label>
<input type="text" id="pays" name="pays" size="30" value="{{ @@user.adresse.pays }}" />
<br />
<input type="submit" value="Modifier l'adresse" />
</form>
<form name="del_addr_{{@id}}" method="POST" action="{{ 'adresse' | alias }}">
<input type="hidden" id="csrf" name="csrf" value="{{ @CSRF }}" />
<input type="hidden" name="id" id="id" value="{{ @@user.adresse.id }}" />
<input type="hidden" name="action" id="action" value="delete" />
<input type="submit" value="Effacer l'adresse" />
</form>
</check>
</section>
<section id="contreparties">
<check if="{{ count(@user.contreparties) > 0}}">
......@@ -123,7 +121,7 @@
<td>
<check if="{{ @row.adresse_id != null }}">
<true>
{{ @user.adresses[@row.adresse_id].alias }}
{{ @@user.adresses[@row.adresse_id].nom }}
</true>
<false>
-
......@@ -174,7 +172,6 @@
<th>ID</th>
<th>Date</th>
<th>Don</th>
<th>Adresse</th>
<th>PDF</th>
<th>Statut</th>
<th>Actions</th>
......@@ -186,35 +183,26 @@
<td class="inline">{{ @row.datec }}</td>
<td>{{ @row.somme }}</td>
<td>
<check if="{{ array_key_exists(@row.adresse_id, @user.adresses)}}">
<true>
{{ @user.adresses[@row.adresse_id].alias }}
</true>
<false>
&nbsp;
</false>
</check>
</td>
<td>
<check if="{{ @row.pdf != '' }}">
<true><a href="{{ @PIPLOME_URL }}{{ @row.pdf }}.pdf">{{ @row.pdf }}</a>( {{@user.adresses[@row.adresse_id].nom }})</td>
</true>
<false>
&nbsp;
</false>
</check>
<check if="{{ @row.pdf == '' }}">
<true>
<a href="/cron/piplome/{{ @row.id }}">PDF</a>
</true>
<false>
<a href="{{ PIPLOME_URL }}/{{ @row.pdf }}.pdf" target="_blank">PDF</a>
</false>
</check>
</td>
<td class="inline">{{ @DONS_STATUTS[@row.status] }}</td>
<td>
<a href="{{ 'edit_support', 'id='.@row.id | alias }}">Editer</a>
-
<check if="{{ @row.status==0 || @row.status==100 }}" >
<true>
<span class="lien" onclick="valid({{ @row.id }})">Valider</span>
<a href="{{ 'validate_support', 'id='.@row.id | alias }}">Valider</a>
</true>
<false>
<span class="lien" onclick="invalid({{ @row.id }})">Invalider</span>
<a href="{{ 'invalidate_support', 'id='.@row.id | alias }}">Invalider</a>
-
<span class="lien" onclick="pdf({{ @row.id }})">PDF</span>
</false>
</check>
</td>
......
<?php
namespace LQDN\Command;
class CounterpartChangeStateCommand
{
private $counterpartId;
private $state;
public function __construct($counterpartId, $state)
{
$this->counterpartId = $counterpartId;
$this->state = $state;
}
public function getCounterpartId()
{
return $this->counterpartId;
}
public function getState()
{
return $this->state;
}
}
<?php
namespace LQDN\Command;
class CounterpartCreateCommand
{
private $counterpartId;
private $adresseId;
private $userId;
private $quoi;
private $taille;
private $status;
private $date;
public function __construct($addressId, $userId, $quoi, $taille, $status, $date, $commentaire)
{
$this->userId = $userId;
$this->addressId = $addressId;
$this->quoi = $quoi;
$this->taille = $taille;
$this->status = $status;
$this->date = $date;
$this->commentaire = $commentaire;
}
public function getUserId()
{
return $this->userId;
}
public function getAddressId()
{
return $this->addressId;
}
public function getQuoi()
{
return $this->quoi;
}
public function getTaille()
{
return $this->taille;
}
public function getStatus()
{
return $this->status;
}
public function getDateCreation()
{
return $this->date;
}
public function getCommentaire()
{
return $this->commentaire;
}
}
<?php
namespace LQDN\Command;
class CounterpartDeleteCommand
{
private $counterpartId;
public function __construct($counterpartId)
{
$this->counterpartId = $counterpartId;
}
public function getCounterpartId()
{
return $this->counterpartId;
}
}
<?php
namespace LQDN\Command;
class DonationCreateCommand
{
private $status;
private $datec;
private $somme;
private $userId;
private $public;
private $cumul;
public function __construct($userId, $status, $datec, $somme, $public, $cumul)
{
$this->status = $status;
$this->userId = $userId;
$this->datec = $datec;
$this->somme = $somme;
$this->public = $public;
$this->cumul = $cumul;
}
public function getUserId()
{
return $this->userId;
}
public function getStatus()
{
return $this->status;
}
public function getDateC()
{
return $this->datec;
}
public function getSomme()
{
return $this->somme;
}
public function getPublic()
{
return $this->public;
}
public function getCumul()
{
return $this->cumul;
}
}
<?php
namespace LQDN\Command;
class UserCreateCommand
{
private $email;
private $hash;
private $pseudo;
public function __construct($email, $hash