From 524c912d70cf0e33b1d4441081e36ead774d97dc Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 12 Jun 2016 17:59:50 +0200 Subject: =?UTF-8?q?Adherent/view=20:=20allow=20service=20termination=20if?= =?UTF-8?q?=20ServiceStatut=20is=20"Pr=C3=A9vu"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generator/after-bake/src/Controller/ServicesController.php | 4 ++-- generator/after-bake/src/Template/Adherents/view.ctp | 4 ++++ 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( -- cgit v1.1