Skip to content
Extraits de code Groupes Projets
Valider d715546e rédigé par Matthieu Napoli's avatar Matthieu Napoli
Parcourir les fichiers

#6933 Improve the "Device model" report by prefixing the model with the brand name

E.g. 'iPad' would become 'Apple - iPad'
parent d23efdee
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -25,7 +25,7 @@ class Archiver extends \Piwik\Plugin\Archiver
const DEVICE_TYPE_FIELD = "config_device_type";
const DEVICE_BRAND_FIELD = "config_device_brand";
const DEVICE_MODEL_FIELD = "config_device_model";
const DEVICE_MODEL_FIELD = "CONCAT(log_visit.config_device_brand, ';', log_visit.config_device_model)";
const OS_FIELD = "config_os";
const OS_VERSION_FIELD = "CONCAT(log_visit.config_os, ';', COALESCE(log_visit.config_os_version, ''))";
const BROWSER_FIELD = "config_browser_name";
......
......@@ -34,9 +34,6 @@ class DeviceModel extends Base
$userAgent = $request->getUserAgent();
$parser = $this->getUAParser($userAgent);
$brand = $parser->getBrandName();
$brand = $brand ? $brand . ' - ' : '';
return $brand . $parser->getModel();
return $parser->getModel();
}
}
......@@ -179,10 +179,19 @@ function getDeviceTypeLogo($label)
function getModelName($label)
{
if (!$label) {
return Piwik::translate('General_Unknown');
if (strpos($label, ';') !== false) {
list($brand, $model) = explode(';', $label, 2);
} else {
$brand = null;
$model = $label;
}
if (!$model) {
$model = Piwik::translate('General_Unknown');
}
if (!$brand) {
return $model;
}
return $label;
return getDeviceBrandLabel($brand) . ' - ' . $model;
}
function getOSFamilyFullName($label)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter