]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6998 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 3 Sep 2024 09:09:13 +0000 (11:09 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 3 Sep 2024 09:09:13 +0000 (11:09 +0200)
app/Fluidbook/Compiler/Articles.php
app/Fluidbook/Compiler/Cart.php
app/Fluidbook/Compiler/Compiler.php
app/Models/FluidbookHealthIssues.php

index 2ff0deb3dd493ef3a68a8513121e9ddb51385a13..dbe813d8ecbe32ee58078345896162ae8ac2547e 100644 (file)
@@ -154,7 +154,7 @@ trait Articles
         $nb = count($list);
 
         usort($list, function ($a, $b) {
-            if ($a['page'] == $b['page']) {
+            if (!isset($a['page']) || !isset($b['page']) || $a['page'] == $b['page']) {
                 $ea = explode('-', $a['id']);
                 $eb = explode('-', $b['id']);
                 if (is_numeric($ea[0]) && is_numeric($eb[0])) {
index b65ad7554fc1cf1db6b24edd7aa0022deddf5337..ec4f0ba099983ff2c38981ce12d8fb912510e6d0 100644 (file)
@@ -132,7 +132,7 @@ trait Cart
 
         $this->config->product_zoom_references = [];
         foreach ($this->config->basketReferences as $ref => $data) {
-            $this->config->product_zoom_references[$ref] = [$ref];
+            $this->config->set('product_zoom_references.' . $ref, [$ref]);
         }
     }
 
@@ -171,7 +171,7 @@ trait Cart
             }
             $vdest = 'data/commerce/opt/' . $d;
             $this->vdir->copy($dest, $vdest);
-            $this->config->basketReferences[$ref]['Image'] = $vdest;
+            $this->config->set('basketReferences.' . $ref . '.Image', $vdest);
         }
 
         foreach ($links as $link) {
index b9f1ae3d53c51190032acd602219d2676146c172..0a678a56a3b13a9c8e4ca54f6c7b461776e43a06 100644 (file)
@@ -1345,21 +1345,34 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
 
         for ($i = 1; $i <= 5; $i++) {
             $ic = $this->fluidbookSettings->{'navExtraIcon' . $i};
-            if ($ic != '') {
-                if (stristr($ic, '.svg')) {
-                    $e = explode('.', $ic);
-                    $sname = 'external-' . $e[0];
-                    $this->addSVGSymbolFromFile($this->wdir . '/' . $ic, $sname);
-                    $this->config->{'navExtraIcon' . $i} = $sname;
-                } else if (stristr($ic, '.')) {
-                    $this->vdir->copy($this->wdir . '/' . $ic, 'data/images/' . $ic);
-                }
+            if (!$ic) {
+                continue;
+            }
+            $f = $this->wdir . '/' . $ic;
+
+            if (!stristr($ic, '.')) {
+                continue;
+            }
+
+            if (!file_exists($f)) {
+                $this->addIssue(FluidbookHealthIssues::TYPE_MISSING_FILE, ['path', $f]);
+                continue;
+            }
+
+            if (stristr($ic, '.svg')) {
+                $e = explode('.', $ic);
+                $sname = 'external-' . $e[0];
+                $this->addSVGSymbolFromFile($f, $sname);
+                $this->config->{'navExtraIcon' . $i} = $sname;
+            } else {
+                $this->vdir->copy($f, 'data/images/' . $ic);
             }
         }
     }
 
     protected function addSVGSymbolFromFile($svg, $symbolName)
     {
+
         $svg = SVGTools::optimizeSVG($svg);
 
         $xml = simplexml_load_string(file_get_contents($svg));
index b14a3df27d8e5b1e1376dc9e1833ae4e4c0af97b..81234e0de7046f356c6a2dc4e5d3e80d852fb1f7 100644 (file)
@@ -86,7 +86,7 @@ class FluidbookHealthIssues extends ToolboxModel
         return [
             static::TYPE_MISSING_FILE =>
                 [
-                    'summary' => __('Erreur 404'),
+                    'summary' => __('Erreur 404') . ', ' . __('Fichier introuvable'),
                     'criticality' => self::CRIT_ERROR,
                     'text' => __('Le chemin ":path" est introuvable'),