mirror of
https://github.com/processwire/processwire.git
synced 2025-08-07 07:16:51 +02:00
Fix issue processwire/processwire-issues#1903
This commit is contained in:
@@ -866,18 +866,24 @@ abstract class FieldtypeMulti extends Fieldtype {
|
||||
*
|
||||
*/
|
||||
public function getLoadQueryAutojoin(Field $field, DatabaseQuerySelect $query) {
|
||||
$database = $this->wire()->database;
|
||||
if($this->get('useOrderByCols')) {
|
||||
// autojoin is not used if sorting or pagination is active
|
||||
$orderByCols = $field->get('orderByCols');
|
||||
if(count($orderByCols) > 0) return null;
|
||||
}
|
||||
$table = $this->database->escapeTable($field->table);
|
||||
$schema = $this->trimDatabaseSchema($this->getDatabaseSchema($field));
|
||||
$fieldName = $this->database->escapeCol($field->name);
|
||||
$table = $database->escapeTable($field->table);
|
||||
$schemaAll = $this->getDatabaseSchema($field);
|
||||
$schema = $this->trimDatabaseSchema($schemaAll);
|
||||
$fieldName = $database->escapeCol($field->name);
|
||||
$separator = self::multiValueSeparator;
|
||||
if($field->distinctAutojoin) $table = "DISTINCT $table";
|
||||
$orderBy = '';
|
||||
if($field->distinctAutojoin) {
|
||||
if(isset($schemaAll['sort'])) $orderBy = "ORDER BY $table.sort";
|
||||
$table = "DISTINCT $table";
|
||||
}
|
||||
foreach($schema as $key => $unused) {
|
||||
$query->select("GROUP_CONCAT($table.$key SEPARATOR '$separator') AS `{$fieldName}__$key`"); // QA
|
||||
$query->select("GROUP_CONCAT($table.$key $orderBy SEPARATOR '$separator') AS `{$fieldName}__$key`"); // QA
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
@@ -1039,5 +1045,3 @@ abstract class FieldtypeMulti extends Fieldtype {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -242,6 +242,7 @@ var InputfieldPageAutocomplete = {
|
||||
axis: 'y',
|
||||
update: function(e, data) {
|
||||
InputfieldPageAutocomplete.rebuildInput($(this));
|
||||
InputfieldPageAutocomplete.triggerChange($ol)
|
||||
$ol.trigger('sorted', [ data.item ]);
|
||||
},
|
||||
start: function(e, data) {
|
||||
|
@@ -323,11 +323,20 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
|
||||
$queryStrings[] = "format_name=$name";
|
||||
}
|
||||
|
||||
// optional extra data set in session in case any hooks need it.
|
||||
// how to retrieve when ProcessPageSearch is $this->process
|
||||
// $name = $input->get->fieldName('format_name');
|
||||
// $data = $process->getForSelector($name, true);
|
||||
$data = array(
|
||||
'page_id' => ($this->hasPage ? $this->hasPage->id : 0),
|
||||
'field' => ($this->hasField ? $this->hasField->name : ''),
|
||||
);
|
||||
|
||||
$queryStrings[] = 'get=' . urlencode($this->labelFieldName);
|
||||
|
||||
// tell ProcessPageSearch to store this selector which we can tell it to use
|
||||
// by setting $_GET['for_selector_name'] = $name
|
||||
$url = $pps->setForSelector($name, trim($selector, ', '));
|
||||
$url = $pps->setForSelector($name, trim($selector, ', '), $data);
|
||||
if(count($queryStrings)) $url .= '&' . implode('&', $queryStrings);
|
||||
|
||||
// replace any pipes with encoded version
|
||||
|
Reference in New Issue
Block a user