Actualiser api.php
This commit is contained in:
@@ -171,7 +171,8 @@ function fetchPhysicalFromUpcitemdb($ean) {
|
||||
'length' => ''
|
||||
];
|
||||
}
|
||||
unction fetchPhysicalFromUpcmdb($ean, $pdo) {
|
||||
|
||||
function fetchPhysicalFromUpcmdb($ean, $pdo) {
|
||||
$empty = ['title'=>'','publisher'=>'','format'=>'','length'=>'','number_of_discs'=>1,'aspect_ratio'=>'','year'=>''];
|
||||
$apiKey = getUpcmdbApiKey($pdo);
|
||||
if (!$apiKey) return $empty;
|
||||
@@ -199,7 +200,6 @@ unction fetchPhysicalFromUpcmdb($ean, $pdo) {
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function fetchPhysicalByEan($ean, $pdo = null) {
|
||||
$res = fetchPhysicalFromUpcitemdb($ean);
|
||||
if (!empty($res['title'])) return $res;
|
||||
@@ -403,7 +403,8 @@ case 'save_config':
|
||||
ORDER BY id DESC
|
||||
";
|
||||
$result = $pdo->query($sql)->fetchAll();
|
||||
foreach ($result as $row) {
|
||||
// IMPORTANT : Utilisation du pointeur `&` pour que la modification soit effective dans $result
|
||||
foreach ($result as &$row) {
|
||||
if ($row['rating'] !== null) {
|
||||
$ratingVal = (float)$row['rating'];
|
||||
$row['rating'] = ($ratingVal == floor($ratingVal)) ? (int)$ratingVal : $ratingVal;
|
||||
@@ -554,4 +555,3 @@ case 'import_batch':
|
||||
}
|
||||
break;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user