Souhaits #1437 » 0001-Une-couleur-et-un-texte-pour-les-dons-1437.patch
galette/lib/Galette/Entity/Adherent.php | ||
---|---|---|
private $_admin;
|
||
private $_staff;
|
||
private $_due_free;
|
||
private $_donator_period; //est donateur dans la période/année en cours
|
||
private $_login;
|
||
private $_password;
|
||
private $_creation_date;
|
||
... | ... | |
*/
|
||
private function checkDues()
|
||
{
|
||
//how many days since our beloved member has been created
|
||
global $preferences;
|
||
|
||
$date_now = new \DateTime();
|
||
|
||
//a t-il fait des dons dans l'année en cours ?
|
||
if ($preferences->pref_beg_membership != '') { //adhésion classique de date à date + 1 an
|
||
list($j, $m) = explode('/', $preferences->pref_beg_membership);
|
||
$sdate = new \DateTime($date_now->format('Y') . '-' . $m . '-' . $j);
|
||
|
||
} elseif ($preferences->pref_membership_ext != '') { //adhésion classique de date à date + N mois
|
||
$dext = new \DateInterval('P' . $preferences->pref_membership_ext . 'M');
|
||
$sdate = $date_now->sub($dext); // now - X months
|
||
}
|
||
|
||
//date_debut_cotis car l'adhérent peut demander un enregistrement de son don pour l'année suivante (en fin d'année)
|
||
$select = $this->zdb->select(Contribution::TABLE, 'c');
|
||
$select->columns(
|
||
array(
|
||
'idx' => new \Laminas\Db\Sql\Expression('COUNT(*)')
|
||
)
|
||
)
|
||
->join(
|
||
array(
|
||
'ct' => PREFIX_DB . ContributionsTypes::TABLE),
|
||
'c.' . ContributionsTypes::PK . '=ct.' . ContributionsTypes::PK,
|
||
array()
|
||
)
|
||
->where(['id_adh' => $this->_id])
|
||
->where->greaterThanOrEqualTo('date_debut_cotis', $sdate->format('Y-m-d'))
|
||
->where->equalTo('cotis_extension', 0); //uniquement les dons
|
||
|
||
// $statement = $this->zdb->sql->getSqlStringForSqlObject($select);
|
||
// echo "$statement<br>";
|
||
|
||
$results = $this->zdb->execute($select);
|
||
$result = $results->current();
|
||
$this->donator_period = (integer) $result->idx >0;
|
||
|
||
//how many days since our beloved member has been created
|
||
$this->_oldness = $date_now->diff(
|
||
new \DateTime($this->_creation_date)
|
||
)->days;
|
||
)->days;
|
||
|
||
if ($this->isDueFree()) {
|
||
//no fee required, we don't care about dates
|
||
$this->_row_classes .= ' cotis-exempt';
|
||
} else {
|
||
//ok, fee is required. Let's check the dates
|
||
if ($this->_due_date == '') {
|
||
$this->_row_classes .= ' cotis-never';
|
||
|
||
//n'est pas adhérent, mais y a t-il un don entre le début de l'année et maintenant
|
||
//dans ce cas _row_classes contiendra .cotis-give
|
||
if ($this->donator_period)
|
||
$this->_row_classes .= ' cotis-give'; //dans le css, la couleur est la même que pour les adhésions en retard, j'ai changé en bleu
|
||
else
|
||
$this->_row_classes .= ' cotis-never';
|
||
} else {
|
||
$date_end = new \DateTime($this->_due_date);
|
||
$date_diff = $date_now->diff($date_end);
|
||
... | ... | |
_T("%days days remaining (ending on %date)")
|
||
);
|
||
}
|
||
|
||
if ($this->donator_period) $ret .= _T(" - Donator");
|
||
return $ret;
|
||
}
|
||
galette/templates/default/gestion_adherents.tpl | ||
---|---|---|
<th class="cotis-late color-sample"> </th>
|
||
<td class="back">{_T string="Lateness in fee"}</td>
|
||
</tr>
|
||
<tr>
|
||
<th class="cotis-give color-sample"> </th>
|
||
<td class="back">{_T string="Never contributed, but a donation"}</td>
|
||
|
||
</tr>
|
||
</tbody>
|
||
<tbody>
|
||
<tr>
|
galette/webroot/themes/default/galette.css | ||
---|---|---|
}
|
||
.cotis-give {
|
||
background-color: #FFDDDD!important;
|
||
background-color: #bae4dc !important;
|
||
vertical-align: top;
|
||
}
|
||
-
|