Skip to content

Commit 1edd487

Browse files
authored
[6.0] Upmerges - 2025-05-21
Merge pull request #45511 from Bodge-IT/upmerges/2025-05-21
2 parents 5adca98 + 8a7d836 commit 1edd487

File tree

95 files changed

+3192
-522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3192
-522
lines changed

administrator/components/com_banners/src/Table/BannerTable.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ public function __construct(DatabaseInterface $db, ?DispatcherInterface $dispatc
6868
public function clicks()
6969
{
7070
$id = (int) $this->id;
71-
$query = $this->_db->getQuery(true)
72-
->update($this->_db->quoteName('#__banners'))
73-
->set($this->_db->quoteName('clicks') . ' = ' . $this->_db->quoteName('clicks') . ' + 1')
74-
->where($this->_db->quoteName('id') . ' = :id')
71+
$db = $this->getDatabase();
72+
$query = $db->getQuery(true)
73+
->update($db->quoteName('#__banners'))
74+
->set($db->quoteName('clicks') . ' = ' . $db->quoteName('clicks') . ' + 1')
75+
->where($db->quoteName('id') . ' = :id')
7576
->bind(':id', $id, ParameterType::INTEGER);
7677

77-
$this->_db->setQuery($query);
78-
$this->_db->execute();
78+
$db->setQuery($query);
79+
$db->execute();
7980
}
8081

8182
/**
@@ -144,7 +145,10 @@ public function check()
144145
$this->ordering = 0;
145146
} elseif (empty($this->ordering)) {
146147
// Set ordering to last if ordering was 0
147-
$this->ordering = $this->getNextOrder($this->_db->quoteName('catid') . ' = ' . ((int) $this->catid) . ' AND ' . $this->_db->quoteName('state') . ' >= 0');
148+
$db = $this->getDatabase();
149+
$this->ordering = $this->getNextOrder(
150+
$db->quoteName('catid') . ' = ' . ((int)$this->catid) . ' AND ' . $db->quoteName('state') . ' >= 0'
151+
);
148152
}
149153

150154
// Set modified to created if not set
@@ -214,7 +218,7 @@ public function bind($array, $ignore = [])
214218
*/
215219
public function store($updateNulls = true)
216220
{
217-
$db = $this->getDbo();
221+
$db = $this->getDatabase();
218222

219223
if (empty($this->id)) {
220224
$purchaseType = $this->purchase_type;
@@ -276,7 +280,7 @@ public function store($updateNulls = true)
276280
// Need to reorder ?
277281
if ($oldrow->state >= 0 && ($this->state < 0 || $oldrow->catid != $this->catid)) {
278282
// Reorder the oldrow
279-
$this->reorder($this->_db->quoteName('catid') . ' = ' . ((int) $oldrow->catid) . ' AND ' . $this->_db->quoteName('state') . ' >= 0');
283+
$this->reorder($db->quoteName('catid') . ' = ' . ((int) $oldrow->catid) . ' AND ' . $db->quoteName('state') . ' >= 0');
280284
}
281285
}
282286

@@ -318,7 +322,7 @@ public function stick($pks = null, $state = 1, $userId = 0)
318322
}
319323

320324
// Get an instance of the table
321-
$table = new self($this->getDbo(), $this->getDispatcher());
325+
$table = new self($this->getDatabase(), $this->getDispatcher());
322326

323327
// For all keys
324328
foreach ($pks as $pk) {

administrator/components/com_categories/forms/filter_categories.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949
mode="nested"
5050
custom="false"
5151
class="js-select-submit-on-change"
52-
/>
52+
default=""
53+
>
54+
<option value="0">JNONE_FILTER</option>
55+
</field>
5356

5457
<field
5558
name="level"

administrator/components/com_categories/src/Model/CategoriesModel.php

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,13 @@ protected function getListQuery()
333333
}
334334

335335
if ($tag && \is_array($tag)) {
336-
$tag = ArrayHelper::toInteger($tag);
336+
$tag = ArrayHelper::toInteger($tag);
337+
$includeNone = false;
338+
339+
if (\in_array(0, $tag)) {
340+
$tag = array_filter($tag);
341+
$includeNone = true;
342+
}
337343

338344
$subQuery = $db->getQuery(true)
339345
->select('DISTINCT ' . $db->quoteName('content_item_id'))
@@ -346,17 +352,51 @@ protected function getListQuery()
346352
);
347353

348354
$query->join(
349-
'INNER',
355+
$includeNone ? 'LEFT' : 'INNER',
350356
'(' . $subQuery . ') AS ' . $db->quoteName('tagmap'),
351357
$db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
352358
)
359+
->bind(':typeAlias', $typeAlias);
360+
361+
if ($includeNone) {
362+
$subQuery2 = $db->getQuery(true)
363+
->select('DISTINCT ' . $db->quoteName('content_item_id'))
364+
->from($db->quoteName('#__contentitem_tag_map'))
365+
->where($db->quoteName('type_alias') . ' = :typeAlias2');
366+
$query->join(
367+
'LEFT',
368+
'(' . $subQuery2 . ') AS ' . $db->quoteName('tagmap2'),
369+
$db->quoteName('tagmap2.content_item_id') . ' = ' . $db->quoteName('a.id')
370+
)
371+
->where(
372+
'(' . $db->quoteName('tagmap.content_item_id') . ' IS NOT NULL OR '
373+
. $db->quoteName('tagmap2.content_item_id') . ' IS NULL)'
374+
)
375+
->bind(':typeAlias2', $typeAlias);
376+
}
377+
} elseif (is_numeric($tag)) {
378+
$tag = (int) $tag;
379+
380+
if ($tag === 0) {
381+
$subQuery = $db->getQuery(true)
382+
->select('DISTINCT ' . $db->quoteName('content_item_id'))
383+
->from($db->quoteName('#__contentitem_tag_map'))
384+
->where($db->quoteName('type_alias') . ' = :typeAlias');
385+
386+
// Only show categories without tags
387+
$query->join(
388+
'LEFT',
389+
'(' . $subQuery . ') AS ' . $db->quoteName('tagmap'),
390+
$db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
391+
)
392+
->where($db->quoteName('tagmap.content_item_id') . ' IS NULL')
353393
->bind(':typeAlias', $typeAlias);
354-
} elseif ($tag = (int) $tag) {
355-
$query->join(
356-
'INNER',
357-
$db->quoteName('#__contentitem_tag_map', 'tagmap'),
358-
$db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
359-
)
394+
} else {
395+
$query->join(
396+
'INNER',
397+
$db->quoteName('#__contentitem_tag_map', 'tagmap'),
398+
$db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
399+
)
360400
->where(
361401
[
362402
$db->quoteName('tagmap.tag_id') . ' = :tag',
@@ -365,6 +405,7 @@ protected function getListQuery()
365405
)
366406
->bind(':tag', $tag, ParameterType::INTEGER)
367407
->bind(':typeAlias', $typeAlias);
408+
}
368409
}
369410

370411
// Add the list ordering clause

administrator/components/com_contact/forms/filter_contacts.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@
7474
custom="false"
7575
hint="JOPTION_SELECT_TAG"
7676
class="js-select-submit-on-change"
77-
/>
77+
default=""
78+
>
79+
<option value="0">JNONE_FILTER</option>
80+
</field>
7881

7982
<field
8083
name="level"

administrator/components/com_contact/src/Model/ContactsModel.php

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,13 @@ protected function getListQuery()
283283
}
284284

285285
if ($tag && \is_array($tag)) {
286-
$tag = ArrayHelper::toInteger($tag);
286+
$tag = ArrayHelper::toInteger($tag);
287+
$includeNone = false;
288+
289+
if (\in_array(0, $tag)) {
290+
$tag = array_filter($tag);
291+
$includeNone = true;
292+
}
287293

288294
$subQuery = $db->getQuery(true)
289295
->select('DISTINCT ' . $db->quoteName('content_item_id'))
@@ -296,23 +302,56 @@ protected function getListQuery()
296302
);
297303

298304
$query->join(
299-
'INNER',
305+
$includeNone ? 'LEFT' : 'INNER',
300306
'(' . $subQuery . ') AS ' . $db->quoteName('tagmap'),
301307
$db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
302308
);
303-
} elseif ($tag = (int) $tag) {
304-
$query->join(
305-
'INNER',
306-
$db->quoteName('#__contentitem_tag_map', 'tagmap'),
307-
$db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
308-
)
309+
310+
if ($includeNone) {
311+
$subQuery2 = $db->getQuery(true)
312+
->select('DISTINCT ' . $db->quoteName('content_item_id'))
313+
->from($db->quoteName('#__contentitem_tag_map'))
314+
->where($db->quoteName('type_alias') . ' = ' . $db->quote('com_contact.contact'));
315+
$query->join(
316+
'LEFT',
317+
'(' . $subQuery2 . ') AS ' . $db->quoteName('tagmap2'),
318+
$db->quoteName('tagmap2.content_item_id') . ' = ' . $db->quoteName('a.id')
319+
)
320+
->where(
321+
'(' . $db->quoteName('tagmap.content_item_id') . ' IS NOT NULL OR '
322+
. $db->quoteName('tagmap2.content_item_id') . ' IS NULL)'
323+
);
324+
}
325+
} elseif (is_numeric($tag)) {
326+
$tag = (int) $tag;
327+
328+
if ($tag === 0) {
329+
$subQuery = $db->getQuery(true)
330+
->select('DISTINCT ' . $db->quoteName('content_item_id'))
331+
->from($db->quoteName('#__contentitem_tag_map'))
332+
->where($db->quoteName('type_alias') . ' = ' . $db->quote('com_contact.contact'));
333+
334+
// Only show contacts without tags
335+
$query->join(
336+
'LEFT',
337+
'(' . $subQuery . ') AS ' . $db->quoteName('tagmap'),
338+
$db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
339+
)
340+
->where($db->quoteName('tagmap.content_item_id') . ' IS NULL');
341+
} else {
342+
$query->join(
343+
'INNER',
344+
$db->quoteName('#__contentitem_tag_map', 'tagmap'),
345+
$db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
346+
)
309347
->where(
310348
[
311349
$db->quoteName('tagmap.tag_id') . ' = :tag',
312350
$db->quoteName('tagmap.type_alias') . ' = ' . $db->quote('com_contact.contact'),
313351
]
314352
)
315353
->bind(':tag', $tag, ParameterType::INTEGER);
354+
}
316355
}
317356

318357
// Filter by categories and by level

administrator/components/com_contact/src/Table/ContactTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function store($updateNulls = true)
121121
}
122122

123123
// Verify that the alias is unique
124-
$table = new self($this->getDbo(), $this->getDispatcher());
124+
$table = new self($this->getDatabase(), $this->getDispatcher());
125125

126126
if ($table->load(['alias' => $this->alias, 'catid' => $this->catid]) && ($table->id != $this->id || $this->id == 0)) {
127127
// Is the existing contact trashed?

administrator/components/com_fields/src/Table/FieldTable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function check()
152152
$this->name = str_replace(',', '-', $this->name);
153153

154154
// Verify that the name is unique
155-
$table = new self($this->_db, $this->getDispatcher());
155+
$table = new self($this->getDatabase(), $this->getDispatcher());
156156

157157
if ($table->load(['name' => $this->name]) && ($table->id != $this->id || $this->id == 0)) {
158158
$this->setError(Text::_('COM_FIELDS_ERROR_UNIQUE_NAME'));
@@ -298,7 +298,7 @@ protected function _getAssetParentId(?Table $table = null, $id = null)
298298
*/
299299
private function getAssetId($name)
300300
{
301-
$db = $this->getDbo();
301+
$db = $this->getDatabase();
302302
$query = $db->getQuery(true)
303303
->select($db->quoteName('id'))
304304
->from($db->quoteName('#__assets'))

administrator/components/com_fields/src/Table/GroupTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ protected function _getAssetTitle()
203203
protected function _getAssetParentId(?Table $table = null, $id = null)
204204
{
205205
$component = explode('.', $this->context);
206-
$db = $this->getDbo();
206+
$db = $this->getDatabase();
207207
$query = $db->getQuery(true)
208208
->select($db->quoteName('id'))
209209
->from($db->quoteName('#__assets'))

administrator/components/com_finder/src/Table/FilterTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function store($updateNulls = true)
160160
}
161161

162162
// Verify that the alias is unique
163-
$table = new self($this->getDbo(), $this->getDispatcher());
163+
$table = new self($this->getDatabase(), $this->getDispatcher());
164164

165165
if ($table->load(['alias' => $this->alias]) && ($table->filter_id != $this->filter_id || $this->filter_id == 0)) {
166166
$this->setError(Text::_('COM_FINDER_FILTER_ERROR_UNIQUE_ALIAS'));

administrator/components/com_finder/src/Table/MapTable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Joomla\CMS\Factory;
1515
use Joomla\CMS\Language\Text;
1616
use Joomla\CMS\Table\Nested;
17-
use Joomla\Database\DatabaseDriver;
17+
use Joomla\Database\DatabaseInterface;
1818
use Joomla\Event\DispatcherInterface;
1919

2020
// phpcs:disable PSR1.Files.SideEffects
@@ -31,12 +31,12 @@ class MapTable extends Nested
3131
/**
3232
* Constructor
3333
*
34-
* @param DatabaseDriver $db Database connector object
34+
* @param DatabaseInterface $db Database connector object
3535
* @param ?DispatcherInterface $dispatcher Event dispatcher for this table
3636
*
3737
* @since 2.5
3838
*/
39-
public function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher = null)
39+
public function __construct(DatabaseInterface $db, ?DispatcherInterface $dispatcher = null)
4040
{
4141
parent::__construct('#__finder_taxonomy', 'id', $db, $dispatcher);
4242

0 commit comments

Comments
 (0)