Commit 9bc49746 authored by Théo GUILLON's avatar Théo GUILLON
Browse files

Merge branch '53-bloquer-la-creation-d-un-traitement-en-tant-que-superadmin-2' into 'master'

Resolve "Bloquer la création d'un traitement en tant que superadmin"

See merge request web-DPO/web-DPO!52
parents c00bb7cd df67fbc2
......@@ -184,6 +184,15 @@ class AppController extends Controller
]
]);
$this->set('serviceEntitee', $serviceEntitee);
$organisations = $this->Organisation->find('all', [
'fields' => [
'id',
'raisonsociale'
]
]);
$listeOrganisations = Hash::combine($organisations, '{n}.Organisation.id', '{n}.Organisation.raisonsociale');
$this->set(compact('listeOrganisations'));
}
}
......@@ -516,7 +516,7 @@ class OrganisationsController extends AppController {
*/
public function change($id = null, $redirect = 0, $controller = null, $action = null) {
if ($id === 'null' ) {
$id = trim((string)Hash::get($this->request->data, 'Pannel.organisationcible'));
$id = trim((string)Hash::get($this->request->data, 'Organisation.organisationcible'));
$id = $id === '' ? null : $id;
}
......
......@@ -55,15 +55,6 @@ class PannelController extends AppController {
}
$this->set('title', __d('default', 'default.titreAdministrationApplication'));
$organisations = $this->Organisation->find('all', [
'fields' => [
'id',
'raisonsociale'
]
]);
$listeOrganisations = Hash::combine($organisations, '{n}.Organisation.id', '{n}.Organisation.raisonsociale');
$this->set(compact('listeOrganisations'));
}
/**
......
......@@ -48,6 +48,9 @@ msgstr "Registre"
msgid "default.titreAdministration"
msgstr "Administration de l'entité"
msgid "default.titreAdministrationEntite"
msgstr "Administration d'une entité"
msgid "default.sousTitreInfoGenerale"
msgstr "Informations générales"
......
......@@ -338,7 +338,7 @@
'class' => 'fa-certificate',
'url' => [
'controller' => 'normes',
'action' => 'index',
'action' => 'index'
]
]
],
......@@ -348,21 +348,29 @@
'class' => 'fa-building-o',
'url' => [
'controller' => 'organisations',
'action' => 'index',
'action' => 'index'
]
],
__d('default', 'default.titreAdministrationEntite') => [
'class' => 'fa-wrench',
'url' => [
'#' => '#'
],
'data-toggle' => 'modal',
'data-target' => '#modalAdministrerEntite'
],
__d('default', 'default.sousTitreSuperAdministrateur') => [
'class' => 'fa-user',
'url' => [
'controller' => 'admins',
'action' => 'index',
'action' => 'index'
]
],
__d('default', 'default.sousTitreGestionTousUtilisateurs') => [
'class' => 'fa-users',
'url' => [
'controller' => 'users',
'action' => 'admin_index',
'action' => 'admin_index'
]
],
__d('default', 'default.sousTitreGestionTousSousTraitants') => [
......@@ -642,6 +650,71 @@
</div>
</div>
<!--Pop-up pour administrer une entité-->
<div class="modal fade" id="modalAdministrerEntite" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<?php echo __d('pannel', 'pannel.popupAdministrerEntite'); ?>
</h4>
</div>
<div class="modal-body">
<div class="row form-group">
<?php
echo $this->Form->create('Organisation', [
'url' => [
'controller' => 'organisations',
'action' => 'change',
'null',
1,
'organisations',
'administrer'
]
]);
echo $this->WebcilForm->input('Organisation.organisationcible', [
'id' => 'organisationcible',
'options' => $listeOrganisations,
'class' => 'usersDeroulant transformSelect form-control',
'required' => true,
'empty' => true,
'data-placeholder' => ' '
]);
?>
</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default-default" data-dismiss="modal">
<i class="fa fa-times-circle fa-lg"></i>
<?php echo __d('default', 'default.btnAnnuler'); ?>
</button>
<?php
echo $this->Form->button("<i class='fa fa-wrench fa-lg'>&nbsp;</i>" . __d('organisation', 'organisation.btnAdministrerEntite'), [
'type' => 'submit',
'class' => 'btn btn-default-success',
'escape' => false
]);
?>
</div>
<?php
echo $this->Form->end();
?>
</div>
</div>
</div>
</div>
<div id="footer" class="container-fluid-custom">
<div class="text-center versioning">
<?php
......
......@@ -58,18 +58,6 @@
'escapeTitle' => false
]);
if ($this->Autorisation->authorized(12, $droits)) {
echo $this->Html->link('<span class="fa fa-pencil fa-lg"></span>', [
'controller' => 'organisations',
'action' => 'edit',
$donnees['Organisation']['id']
], [
'class' => 'btn btn-default-default boutonEdit btn-sm my-tooltip',
'title' => 'Modifier cette organisation',
'escapeTitle' => false
]);
}
if ($donnees[ 'Count' ] == 0) {
if ($this->Autorisation->isSu()) {
echo $this->Html->link('<span class="fa fa-trash fa-lg"></span>', [
......@@ -83,21 +71,6 @@
], 'Voulez vous vraiment supprimer l\'entité ' . $donnees['Organisation']['raisonsociale']);
}
}
if ($this->Autorisation->isSu()) {
echo $this->Html->link('<span class="fa fa-wrench fa-lg fa-success"></span>', [
'controller' => 'organisations',
'action' => 'change',
$donnees['Organisation']['id'],
1,
'organisations',
'administrer'
], [
'class' => 'btn btn-default-success boutonEdit btn-sm my-tooltip',
'title' => __d('organisation', 'organisation.btnAdministrerEntite'),
'escapeTitle' => false
]);
}
?>
</div>
</td>
......
<div class="row">
<div class="col-md-12">
<div type="button" class="btn btn-default-menu" data-toggle="modal" data-target="#modalAdministrerEntite">
<a type="button" class="btn btn-default-menu" href="/organisations/index/">
<div class="fa fa-building-o fa-primary fa-2x"></div>
<div>
......@@ -8,6 +8,16 @@
echo __d('default', 'default.sousTitreEntites');
?>
</div>
</a>
<div type="button" class="btn btn-default-menu" data-toggle="modal" data-target="#modalAdministrerEntite">
<div class="fa fa-wrench fa-primary fa-2x"></div>
<div>
<?php
echo __d('default', 'default.titreAdministrationEntite');
?>
</div>
</div>
</div>
......@@ -57,69 +67,4 @@
</div>
</a>
</div>
</div>
<!--Pop-up de duplication d'un formulaire dans une autre organisation-->
<div class="modal fade" id="modalAdministrerEntite" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<?php echo __d('pannel', 'pannel.popupAdministrerEntite'); ?>
</h4>
</div>
<div class="modal-body">
<div class="row form-group">
<?php
echo $this->Form->create('Organisation', [
'url' => [
'controller' => 'organisations',
'action' => 'change',
'null',
1,
'organisations',
'administrer'
]
]);
echo $this->WebcilForm->input('organisationcible', [
'id' => 'organisationcible',
'options' => $listeOrganisations,
'class' => 'usersDeroulant transformSelect form-control',
'required' => true,
'empty' => true,
'data-placeholder' => ' '
]);
?>
</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default-default" data-dismiss="modal">
<i class="fa fa-times-circle fa-lg"></i>
<?php echo __d('default', 'default.btnAnnuler'); ?>
</button>
<?php
echo $this->Form->button("<i class='fa fa-wrench fa-lg'>&nbsp;</i>" . __d('organisation', 'organisation.btnAdministrerEntite'), [
'type' => 'submit',
'class' => 'btn btn-default-success',
'escape' => false
]);
?>
</div>
<?php
echo $this->Form->end();
?>
</div>
</div>
</div>
</div>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment