Projet

Général

Profil

Evolution #1438 » 0001-Adhesion-en-mois-mensualisation-1438.patch

Manuel Her, 17/08/2020 18:46

Voir les différences:

galette/lib/Galette/Entity/Contribution.php
private function retrieveEndDate()
{
global $preferences;
$bdate = new \DateTime($this->_begin_date);
if ($preferences->pref_beg_membership != '') {
//case beginning of membership
list($j, $m) = explode('/', $preferences->pref_beg_membership);
$edate = new \DateTime($bdate->format('Y') . '-' . $m . '-' . $j);
while ($edate <= $bdate) {
$edate->modify('+1 year');
}
if ($preferences->pref_membership_offermonths > 0) {
//count days until end of membership date
$diff1 = (int)$bdate->diff($edate)->format('%a');
//count days beetween end of membership date and offered months
$tdate = clone $edate;
$tdate->modify('-' . $preferences->pref_membership_offermonths . ' month');
$diff2 = (int)$edate->diff($tdate)->format('%a');
//when number of days until end of membership is less than for offered months, it's free :)
if ($diff1 <= $diff2) {
if ($preferences->pref_beg_membership != '') { //adhésion classique de date à date + 1 an
if ($this->_type->extension==-1) //C'est une adhésion classique en année
{
//case beginning of membership
list($j, $m) = explode('/', $preferences->pref_beg_membership);
$edate = new \DateTime($bdate->format('Y') . '-' . $m . '-' . $j);
while ($edate <= $bdate) {
$edate->modify('+1 year');
}
if ($preferences->pref_membership_offermonths > 0) {
//count days until end of membership date
$diff1 = (int)$bdate->diff($edate)->format('%a');
//count days beetween end of membership date and offered months
$tdate = clone $edate;
$tdate->modify('-' . $preferences->pref_membership_offermonths . ' month');
$diff2 = (int)$edate->diff($tdate)->format('%a');
//when number of days until end of membership is less than for offered months, it's free :)
if ($diff1 <= $diff2) {
$edate->modify('+1 year');
}
}
$this->_end_date = $edate->format('Y-m-d');
}
$this->_end_date = $edate->format('Y-m-d');
} elseif ($preferences->pref_membership_ext != '') {
else
{
$dext = new \DateInterval('P' . $this->_type->extension . 'M');
$edate = $bdate->add($dext);
$this->_end_date = $edate->format('Y-m-d');
}
} elseif ($preferences->pref_membership_ext != '') { //adhésion classique de date à date + N mois
//case membership extension
if ($this->_extension == null) {
$this->_extension = $preferences->pref_membership_ext;
if ($this->_type->extension==-1)
$this->_extension = $preferences->pref_membership_ext;
else
$this->_extension = $this->_type->extension;
}
$dext = new \DateInterval('P' . $this->_extension . 'M');
$edate = $bdate->add($dext);
......
} else {
throw new \RuntimeException(
'Unable to define end date; none of pref_beg_membership nor pref_membership_ext are defined!'
);
);
}
}
......
'c.' . ContributionsTypes::PK . '=ct.' . ContributionsTypes::PK,
array()
)->where(Adherent::PK . ' = ' . $this->_member)
->where(array('cotis_extension' => new Expression('true')))
//->where(array('cotis_extension' => new Expression('true')))
->where->notEqualTo('cotis_extension', 0)
->where->nest->nest
->greaterThanOrEqualTo('date_debut_cotis', $this->_begin_date)
->lessThan('date_debut_cotis', $this->_end_date)
......
array()
)->where(
Adherent::PK . ' = ' . $member_id
)->where(
array('cotis_extension' => new Expression('true'))
);
)->where->notEqualTo('cotis_extension', 0);
/*->where(
array('cotis_extension' => new Expression('true'))
);*/
$results = $zdb->execute($select);
$result = $results->current();
......
//set type
$this->$rname = new ContributionsTypes($this->zdb, $value);
//set is_cotis according to type
if ($this->$rname->extension == 1) {
if ($this->$rname->extension != 0) {//== 1) {
$this->_is_cotis = true;
} else {
$this->_is_cotis = false;
galette/lib/Galette/Entity/Entitled.php
}
if ($extent !== null) {
if ($extent === true) {
$select->where(array($this->fthird => new Expression('true')));
//$select->where(array($this->fthird => new Expression('true')));
$select->where->notEqualTo($this->fthird, 0);
} elseif ($extent === false) {
$select->where(array($this->fthird => new Expression('false')));
//$select->where(array($this->fthird => new Expression('false')));
$select->where->equalTo($this->fthird, 0);
}
}
galette/templates/default/editer_intitule.tpl
<input type="text" size="4" name="{$field}" id="{$field}" value="{$entry->$field}" />
<span class="exemple">{_T string="Note: members with a status priority lower than %priority are staff members." pattern="/%priority/" replace=$non_staff_priority}</span>
{elseif $class == 'ContributionsTypes'}
<input type="checkbox" name="{$field}" id="{$field}" value="1"{if $entry->$field == 1} checked="checked"{/if} />
<select name="{$field}">
<option value="0" {if $entry->$field == 0}selected="selected"{/if}>{_T string="No"}</option>
<option value="-1" {if $entry->$field == -1}selected="selected"{/if}>{_T string="By default"}</option>
{for $m=12 to 2 step -1}
<option value="{$m}" {if $entry->$field == $m}selected="selected"{/if} >{$m} {_T string="months"}</option>
{/for}
<option value="1" {if $entry->$field == 1}selected="selected"{/if} >1 {_T string="month"}</option>
</select>
{/if}
</p>
</div>
galette/templates/default/gestion_intitule_content.tpl
{if $class == 'ContributionsTypes'}
<select name="{$fields.third}">
<option value="0" selected="selected">{_T string="No"}</option>
<option value="1">{_T string="Yes"}</option>
<option value="-1">{_T string="By default"}</option>
{for $m=12 to 2 step -1}
<option value="{$m}">{$m} {_T string="months"}</option>
{/for}
<option value="1">1 {_T string="month"}</option>
</select>
{elseif $class == 'Status'}
<input size="4" type="text" name="{$fields.third}" value="99" />
......
</td>
<td data-title="{if $class == 'ContributionsTypes'}{_T string="Extends membership?"}{else}{_T string="Priority"}{/if}">
{if $class == 'ContributionsTypes'}
{if $entry.extra eq 1}
{_T string="Yes"}
{else}
{if $entry.extra eq 0}
{_T string="No"}
{elseif $entry.extra eq -1}
{_T string="By default"}
{elseif $entry.extra eq 1}
{$entry.extra} {_T string="month"}
{else}
{$entry.extra} {_T string="months"}
{/if}
{elseif $class == 'Status'}
{$entry.extra}
(2-2/3)