diff --git a/lib/Alchemy/Phrasea/Controller/Datafiles.php b/lib/Alchemy/Phrasea/Controller/Datafiles.php index 946b94e661..a8b2cc2167 100644 --- a/lib/Alchemy/Phrasea/Controller/Datafiles.php +++ b/lib/Alchemy/Phrasea/Controller/Datafiles.php @@ -66,10 +66,16 @@ class Datafiles extends AbstractDelivery $watermark = !$app['acl']->get($app['authentication']->getUser())->has_right_on_base($record->get_base_id(), 'nowatermark'); if ($watermark && !$all_access) { - $subdef_class = $databox - ->get_subdef_structure() - ->get_subdef($record->get_type(), $subdef) - ->get_class(); + $subdef_class = null; + try { + $subdef_class = $databox + ->get_subdef_structure() + ->get_subdef($record->get_type(), $subdef) + ->get_class(); + } catch(\Exception_Databox_SubdefNotFound $e) { + + } + if ($subdef_class == \databox_subdef::CLASS_PREVIEW && $app['acl']->get($app['authentication']->getUser())->has_preview_grant($record)) { $watermark = false; @@ -79,11 +85,8 @@ class Datafiles extends AbstractDelivery } if ($watermark && !$all_access) { - $repository = $app['repo.basket-elements']; - /* @var $repository BasketElementRepository */ - $ValidationByRecord = $repository->findReceivedValidationElementsByRecord($record, $app['authentication']->getUser()); $ReceptionByRecord = $repository->findReceivedElementsByRecord($record, $app['authentication']->getUser()); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Order.php b/lib/Alchemy/Phrasea/Controller/Prod/Order.php index 1a5b8ad683..98cfb0f21c 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Order.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Order.php @@ -146,6 +146,7 @@ class Order implements ControllerProviderInterface 'order_id' => $order->getId(), 'usr_id' => $order->getUser()->getId() ]); + $success = true; $app['EM']->persist($order); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php index 5109a0e4df..28ad989498 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Push.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php @@ -221,7 +221,7 @@ class Push implements ControllerProviderInterface 'basket' => $Basket->getId(), ); - if (!$app['conf']->get(['registry', 'actions', 'force-authentication']) || !$request->get('force_authentication')) { + if (!$app['conf']->get(['registry', 'actions', 'enable-push-authentication']) || !$request->get('force_authentication')) { $arguments['LOG'] = $app['manipulator.token']->createBasketAccessToken($Basket, $user_receiver); } @@ -416,7 +416,7 @@ class Push implements ControllerProviderInterface 'basket' => $Basket->getId(), ); - if (!$app['conf']->get(['registry', 'actions', 'force-authentication']) || !$request->get('force_authentication')) { + if (!$app['conf']->get(['registry', 'actions', 'enable-push-authentication']) || !$request->get('force_authentication')) { $arguments['LOG'] = $app['manipulator.token']->createBasketAccessToken($Basket, $participant_user); } diff --git a/lib/Alchemy/Phrasea/Core/Configuration/RegistryManipulator.php b/lib/Alchemy/Phrasea/Core/Configuration/RegistryManipulator.php index 0fa7d495ba..2771ab2ade 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/RegistryManipulator.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/RegistryManipulator.php @@ -110,7 +110,8 @@ class RegistryManipulator 'export-title-choice' => false, 'default-export-title' => 'title', 'social-tools' => 'none', - 'force-authentication' => false, + 'enable-push-authentication' => false, + 'force-push-authentication' => false, ], 'ftp' => [ 'ftp-enabled' => false, diff --git a/lib/Alchemy/Phrasea/Form/Configuration/ActionsFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/ActionsFormType.php index 34016f3e2d..fd61d66c76 100644 --- a/lib/Alchemy/Phrasea/Form/Configuration/ActionsFormType.php +++ b/lib/Alchemy/Phrasea/Form/Configuration/ActionsFormType.php @@ -47,7 +47,7 @@ class ActionsFormType extends AbstractType 'label' => 'Enable this setting to share on Facebook and Twitter', 'choices' => ['none' => 'Disabled', 'publishers' => 'Publishers', 'all' => 'Enabled'], ]); - $builder->add('force-authentication', 'checkbox', [ + $builder->add('enable-push-authentication', 'checkbox', [ 'label' => 'Enable Forcing authentication to see push content', 'help_message' => 'Adds an option to the push form submission to restrict push recipient(s) to Phraseanet users only.', ]); diff --git a/lib/classes/databox.php b/lib/classes/databox.php index 4d379972b0..b62b1652f5 100644 --- a/lib/classes/databox.php +++ b/lib/classes/databox.php @@ -664,20 +664,24 @@ class databox extends base try { $metaStructData = $this->get_data_from_cache(self::CACHE_META_STRUCT); } catch (\Exception $e) { - $sql = 'SELECT id, name FROM metadatas_structure ORDER BY sorter ASC'; + $sql = 'SELECT id, `name` FROM metadatas_structure ORDER BY sorter ASC'; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $metaStructData = $rs; - $this->set_data_to_cache($metaStructData, self::CACHE_META_STRUCT); + if ($rs) { + $metaStructData = $rs; + $this->set_data_to_cache($metaStructData, self::CACHE_META_STRUCT); + } } $this->meta_struct = new databox_descriptionStructure(); - foreach ($metaStructData as $row) { - $this->meta_struct->add_element(databox_field::get_instance($this->app, $this, $row['id'])); + if ($metaStructData) { + foreach ($metaStructData as $row) { + $this->meta_struct->add_element(databox_field::get_instance($this->app, $this, $row['id'])); + } } return $this->meta_struct; diff --git a/templates/web/prod/WorkZone/Macros.html.twig b/templates/web/prod/WorkZone/Macros.html.twig index 3af456d212..6bee665ea9 100644 --- a/templates/web/prod/WorkZone/Macros.html.twig +++ b/templates/web/prod/WorkZone/Macros.html.twig @@ -48,7 +48,7 @@ {% if app['acl'].get(app['authentication'].getUser()).has_right('modifyrecord') %}
{% endif %} @@ -219,7 +219,7 @@ onclick="downloadThis('lst={{story.getRecord(app).get_serialize_key()}}');">{{ 'action::exporter' | trans }} - {% if app['authentication'].getUser().ACL().has_right('modifyrecord') %} + {% if app['acl'].get(app['authentication'].getUser()).has_right('modifyrecord') %}