Merge branch 'develop' into main

pull/92/head
iglocska 2021-11-25 00:36:43 +01:00
commit 35464623e1
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
3 changed files with 46 additions and 8 deletions

View File

@ -18,6 +18,20 @@ final class UserOrg extends AbstractMigration
*/
public function change(): void
{
<<<<<<< HEAD
$exists = $this->table('users')->hasColumn('organisation_id');
if (!$exists) {
$this->table('users')
->addColumn('organisation_id', 'integer', [
'default' => null,
'null' => true,
'signed' => false,
'length' => 10
])
->addIndex('organisation_id')
->update();
}
=======
$alignments = $this->table('users')
->addColumn('organisation_id', 'integer', [
'default' => null,
@ -27,6 +41,7 @@ final class UserOrg extends AbstractMigration
])
->addIndex('organisation_id')
->update();
>>>>>>> main
$q1 = $this->getQueryBuilder();
$org_id = $q1->select(['min(id)'])->from('organisations')->execute()->fetchAll()[0][0];
if (!empty($org_id)) {

View File

@ -71,6 +71,18 @@ class InstanceTable extends AppTable
public function searchAll($value, $limit=5, $model=null)
{
$results = [];
// search in metafields. FIXME: To be replaced by the meta-template system
$metaFieldTable = TableRegistry::get('MetaFields');
$query = $metaFieldTable->find()->where([
'value LIKE' => '%' . $value . '%'
]);
$results['MetaFields']['amount'] = $query->count();
$result = $query->limit($limit)->all()->toList();
if (!empty($result)) {
$results['MetaFields']['entries'] = $result;
}
$models = $this->seachAllTables;
if (!is_null($model)) {
if (in_array($model, $this->seachAllTables)) {

View File

@ -19,6 +19,16 @@
</span>', h($tableName), $tableResult['amount']);
foreach ($tableResult['entries'] as $entry) {
if ($entry->getSource() == 'MetaFields') {
$section .= sprintf('<a class="dropdown-item" href="%s">%s</a>',
Cake\Routing\Router::URL([
'controller' => Cake\Utility\Inflector::pluralize($entry->scope),
'action' => 'view',
h($entry->parent_id)
]),
sprintf('%s (%s::%s)', h($entry->value), h($entry->scope), h($entry->field))
);
} else {
$section .= sprintf('<a class="dropdown-item" href="%s">%s</a>',
Cake\Routing\Router::URL([
'controller' => Cake\Utility\Inflector::pluralize($entry->getSource()),
@ -28,6 +38,7 @@
h($entry[$fieldPath])
);
}
}
$remaining = $tableResult['amount'] - count($tableResult['entries']);
if ($remaining > 0) {
$section .= sprintf('<a href="%s" class="dropdown-item total-found d-block pe-2">%s <strong class="total-found-number text-primary">%s</strong><span class="total-found-text d-inline ms-1" href="#">%s</span></a>',