Overview
Comment: | Add choice of subscription date and expiry date |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
395808c48e9b4a7789e48f963539f4cc |
User & Date: | bohwaz on 2020-11-13 22:08:58 |
Other Links: | branch diff | manifest | tags |
Context
2020-11-13
| ||
22:15 | Implement user service subscription removal check-in: ffb67f54a0 user: bohwaz tags: dev, 1.0.0-beta3 | |
22:08 | Add choice of subscription date and expiry date check-in: 395808c48e user: bohwaz tags: dev | |
21:57 | Force opening and closing accounts to not be in the reports check-in: 4897d3a5f5 user: bohwaz tags: dev | |
Changes
Modified src/VERSION from [f104a17f69] to [119b9fff28].
|
| | | 1 | 1.0.0-beta3 |
Modified src/include/lib/Garradin/Entity.php from [f3c9fc3145] to [de03b9076a].
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | return $this->import($source); } protected function filterUserValue(string $type, $value, string $key) { if ($type == 'date') { if (preg_match('!^\d{2}/\d{2}/\d{2}$!', $value)) { return \DateTime::createFromFormat('d/m/y', $value); } elseif (preg_match('!^\d{2}/\d{2}/\d{4}$!', $value)) { return \DateTime::createFromFormat('d/m/Y', $value); } elseif (null !== $value) { | > > > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | return $this->import($source); } protected function filterUserValue(string $type, $value, string $key) { if ($type == 'date') { if (!trim($value)) { return null; } if (preg_match('!^\d{2}/\d{2}/\d{2}$!', $value)) { return \DateTime::createFromFormat('d/m/y', $value); } elseif (preg_match('!^\d{2}/\d{2}/\d{4}$!', $value)) { return \DateTime::createFromFormat('d/m/Y', $value); } elseif (null !== $value) { |
︙ | ︙ |
Modified src/include/lib/Garradin/Services/Services.php from [baa6fae35b] to [8034954296].
︙ | ︙ | |||
17 18 19 20 21 22 23 | static public function listAssoc() { return DB::getInstance()->getAssoc('SELECT id, label FROM services ORDER BY label COLLATE NOCASE;'); } static public function listGroupedWithFees(?int $user_id = null) { | | > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | static public function listAssoc() { return DB::getInstance()->getAssoc('SELECT id, label FROM services ORDER BY label COLLATE NOCASE;'); } static public function listGroupedWithFees(?int $user_id = null) { $services = DB::getInstance()->getGrouped('SELECT id, label, duration, start_date, end_date, description, CASE WHEN end_date IS NOT NULL THEN end_date WHEN duration IS NOT NULL THEN date(\'now\', \'+\'||duration||\' days\') ELSE NULL END AS expiry_date FROM services;'); $fees = Fees::listAllByService($user_id); $out = []; foreach ($services as $service) { $out[$service->id] = $service; $out[$service->id]->fees = []; } |
︙ | ︙ |
Modified src/templates/services/save.tpl from [49cc6efec5] to [49160d87b8].
︙ | ︙ | |||
18 19 20 21 22 23 24 | <dt>Membre sélectionné</dt> <dd><h3>{$user_name}</h3><input type="hidden" name="id_user" value="{$user_id}" /></dd> <dt><label for="f_service_ID">Activité</label> <b>(obligatoire)</b></dt> {foreach from=$grouped_services item="service"} <dd> <label class="radio-btn"> | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <dt>Membre sélectionné</dt> <dd><h3>{$user_name}</h3><input type="hidden" name="id_user" value="{$user_id}" /></dd> <dt><label for="f_service_ID">Activité</label> <b>(obligatoire)</b></dt> {foreach from=$grouped_services item="service"} <dd> <label class="radio-btn"> {input type="radio" name="id_service" value=$service.id data-expiry=$service.expiry_date|date_short} <div> <h3>{$service.label}</h3> <p> {if $service.duration} {$service.duration} jours {elseif $service.start_date} du {$service.start_date|date_short} au {$service.end_date|date_short} |
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | {/if} </div> </label> </dd> {/foreach} </dl> {/foreach} <dl> {input type="checkbox" name="paid" value="1" default="1" label="Marquer cette inscription comme payée"} <dd class="help">Décocher cette case pour pouvoir suivre les règlements de personnes qui payent en plusieurs fois. Il sera possible de cocher cette case lorsque le solde aura été réglé.</dd> </dl> </fieldset> <fieldset class="accounting"> <legend>Enregistrement en comptabilité</legend> | > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | {/if} </div> </label> </dd> {/foreach} </dl> {/foreach} </fieldset> <fieldset> <legend>Détails</legend> <dl> {input type="date" name="date" required=1 default=$today label="Date d'inscription"} {input type="date" name="expiry_date" default=$today label="Date d'expiration de l'inscription"} {input type="checkbox" name="paid" value="1" default="1" label="Marquer cette inscription comme payée"} <dd class="help">Décocher cette case pour pouvoir suivre les règlements de personnes qui payent en plusieurs fois. Il sera possible de cocher cette case lorsque le solde aura été réglé.</dd> </dl> </fieldset> <fieldset class="accounting"> <legend>Enregistrement en comptabilité</legend> |
︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 | {literal} <script type="text/javascript"> function selectService(elm) { $('[data-service]').forEach((e) => { e.style.display = ('s' + elm.value == e.getAttribute('data-service')) ? 'block' : 'none'; }); var first = document.querySelector('[data-service="s' + elm.value + '"] input[name=id_fee]'); if (first) { first.checked = true; selectFee(first); } | > > | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | {literal} <script type="text/javascript"> function selectService(elm) { $('[data-service]').forEach((e) => { e.style.display = ('s' + elm.value == e.getAttribute('data-service')) ? 'block' : 'none'; }); $('#f_expiry_date').value = elm.dataset.expiry; var first = document.querySelector('[data-service="s' + elm.value + '"] input[name=id_fee]'); if (first) { first.checked = true; selectFee(first); } |
︙ | ︙ |
Modified src/www/admin/services/save.php from [3028376e0f] to [9b5a2bdf52].
︙ | ︙ | |||
42 43 44 45 46 47 48 | }, $csrf_key); $selected_user = $user_name ? [$user_id => $user_name] : null; $types_details = Transaction::getTypesDetails(); $account_targets = $types_details[Transaction::TYPE_REVENUE]->accounts[1]->targets_string; | > > | | 42 43 44 45 46 47 48 49 50 51 52 53 | }, $csrf_key); $selected_user = $user_name ? [$user_id => $user_name] : null; $types_details = Transaction::getTypesDetails(); $account_targets = $types_details[Transaction::TYPE_REVENUE]->accounts[1]->targets_string; $today = new \DateTime; $tpl->assign(compact('today', 'grouped_services', 'csrf_key', 'selected_user', 'account_targets', 'user_name', 'user_id')); $tpl->display('services/save.tpl'); |