From b507c11d83b99bc5fb3e9c75fb834ca37e6c1df9 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Fri, 25 May 2012 20:41:23 +0200 Subject: [PATCH] fix #655 No metas for grouping record fix #654 Toolbox error when file has no subdef --- lib/Alchemy/Phrasea/Controller/Prod/Tools.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php index 82daec296e..a65e2efd88 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php @@ -38,18 +38,26 @@ class Tools implements ControllerProviderInterface $selection = $helper->get_elements(); $metadatas = false; + $record = null; if (count($selection) == 1) { - try { - $record = reset($selection); + $record = reset($selection); - $reader = new \PHPExiftool\Reader(); - $metadatas = $reader->files($record->get_subdef('document')->get_pathfile()) - ->first()->getMetadatas(); - } catch (\PHPExiftool\Exception\Exception $e) { + if ( ! $record->is_grouping()) { + try { + $reader = new \PHPExiftool\Reader(); + + $metadatas = $reader + ->files($record->get_subdef('document')->get_pathfile()) + ->first()->getMetadatas(); + } catch (\PHPExiftool\Exception\Exception $e) { + + } catch (\Exception_Media_SubdefNotFound $e) { + + } } }