summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2016-06-12 17:59:50 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2016-06-12 17:59:50 +0200
commit524c912d70cf0e33b1d4441081e36ead774d97dc (patch)
treed42b7aa17588c8ee80843a34432db03408decba4
parent61256d532e8a0155aaa9c28977f542823073e4ec (diff)
downloadchd_gestion-524c912d70cf0e33b1d4441081e36ead774d97dc.zip
chd_gestion-524c912d70cf0e33b1d4441081e36ead774d97dc.tar.gz
chd_gestion-524c912d70cf0e33b1d4441081e36ead774d97dc.tar.bz2
Adherent/view : allow service termination if ServiceStatut is "Prévu"
-rw-r--r--generator/after-bake/src/Controller/ServicesController.php4
-rw-r--r--generator/after-bake/src/Template/Adherents/view.ctp4
2 files changed, 6 insertions, 2 deletions
diff --git a/generator/after-bake/src/Controller/ServicesController.php b/generator/after-bake/src/Controller/ServicesController.php
index 57f9e5d..616385a 100644
--- a/generator/after-bake/src/Controller/ServicesController.php
+++ b/generator/after-bake/src/Controller/ServicesController.php
@@ -285,7 +285,7 @@ class ServicesController extends AppController
$this->Flash->error(__('The service could not be saved. Please, try again.'));
}
} else {
- $this->Flash->error(__('Can\'t terminate the service. Bad service state.'));
+ $this->Flash->error(__('Can\'t suspend the service. Bad service state.'));
}
return $this->redirect(['controller' => 'Adherents', 'action' => 'view', $service->adherent_id]);
}
@@ -296,7 +296,7 @@ class ServicesController extends AppController
$this->request->allowMethod(['post']);
$service = $this->Services->get($id);
if ( $service ) {
- if ( $service->service_statut_id === 4 /* Actif CHD */ ) {
+ if ( $service->service_statut_id === 4 /* Actif CHD */ || $service->service_statut_id === 1 /* Prévu */ ) {
$patch = array(
'service_statut_id' => 6, /* Actif CHD */
'date_fin' => new DateTime('now'),
diff --git a/generator/after-bake/src/Template/Adherents/view.ctp b/generator/after-bake/src/Template/Adherents/view.ctp
index e93b234..9beccb2 100644
--- a/generator/after-bake/src/Template/Adherents/view.ctp
+++ b/generator/after-bake/src/Template/Adherents/view.ctp
@@ -192,6 +192,10 @@
__('Activate'), ['controller' => 'Services', 'action' => 'activate', $services->id],
['confirm' => __('Are you sure you want to activate # {0}?', $services->id)]
) . "\n";
+ echo $this->Form->postLink(
+ __('Terminate'), ['controller' => 'Services', 'action' => 'terminate', $services->id],
+ ['confirm' => __('Are you sure you want to terminate # {0}?', $services->id)]
+ ) . "\n";
break;
case 2: /* Actif TTN */
echo $this->Form->postLink(