implement logic for hiddens phone adapters

This commit is contained in:
osaajani 2021-01-26 19:33:08 +01:00
parent c0c79781bf
commit 05cb62a503
2 changed files with 17 additions and 8 deletions

View File

@ -209,6 +209,13 @@ class Phone extends \descartes\Controller
return $this->redirect(\descartes\Router::url('Phone', 'add'));
}
if ($find_adapter['meta_hidden'])
{
\FlashMessage\FlashMessage::push('danger', 'Ce type de téléphone ne peux pas être créé via l\'interface graphique.');
return $this->redirect(\descartes\Router::url('Phone', 'add'));
}
//If missing required data fields, error
foreach ($find_adapter['meta_data_fields'] as $field)
{

View File

@ -54,14 +54,16 @@
</p>
<select name="adapter" class="form-control" id="adapter-select">
<?php foreach ($adapters as $adapter) { ?>
<option
value="<?= $adapter['meta_classname'] ?>"
data-description="<?php $this->s($adapter['meta_description']); ?>"
data-data-fields="<?php $this->s(json_encode($adapter['meta_data_fields'])); ?>"
<?= ($_SESSION['previous_http_post']['adapter'] ?? '') == $adapter['meta_classname'] ? 'selected' : '' ?>
>
<?php $this->s($adapter['meta_name']); ?>
</option>
<?php if ($adapter['meta_hidden'] === false) { ?>
<option
value="<?= $adapter['meta_classname'] ?>"
data-description="<?php $this->s($adapter['meta_description']); ?>"
data-data-fields="<?php $this->s(json_encode($adapter['meta_data_fields'])); ?>"
<?= ($_SESSION['previous_http_post']['adapter'] ?? '') == $adapter['meta_classname'] ? 'selected' : '' ?>
>
<?php $this->s($adapter['meta_name']); ?>
</option>
<?php } ?>
<?php } ?>
</select>
</div>