diff --git a/src/app/history/controllers/HistoryController.php b/src/app/history/controllers/HistoryController.php index 2a1303fcb7b2c503fd8cd6d7ce3181a965e21b9a..8172da6e5d46725767c94aa420f87761b1f3f728 100644 --- a/src/app/history/controllers/HistoryController.php +++ b/src/app/history/controllers/HistoryController.php @@ -433,7 +433,7 @@ class HistoryController } $queryParams = $request->getQueryParams(); - if (!empty($queryParams['onlyProof']) && (!$queryParams['onlyProof'] || empty($proofDocument))) { + if (!empty($queryParams['onlyProof']) && (empty($queryParams['onlyProof']) || empty($proofDocument))) { $formattedHistory = HistoryController::getFormattedHistory(['id' => $args['id']]); $historyXml = HistoryController::arrayToXml(['data' => $formattedHistory['formattedHistory'], 'xml' => false]); $historyXmlPath = $tmpPath . 'maarchProof' . $GLOBALS['id'] . "_" . rand() . '.xml'; diff --git a/src/app/notifications/controllers/NotificationsScheduleController.php b/src/app/notifications/controllers/NotificationsScheduleController.php index 52405e587ec6dcc97ccd86bb550b153831c0ab90..3ee84b48dac9a5ecb0459695d3baac962a6e86de 100644 --- a/src/app/notifications/controllers/NotificationsScheduleController.php +++ b/src/app/notifications/controllers/NotificationsScheduleController.php @@ -240,8 +240,8 @@ class NotificationsScheduleController } $configuration = ConfigurationModel::getByIdentifier(['identifier' => 'customization']); - $configuration = $configuration[0]; - $configuration['value'] = json_decode($configuration['value'], true); + $configuration = $configuration[0] ?? null; + $configuration['value'] = json_decode($configuration['value'] ?? '{}', true); if (empty($configuration['value']['schedulerPath']) || !is_file($configuration['value']['schedulerPath'])) { $schedulerScript = NotificationsScheduleController::createSchedulerScript(); @@ -262,7 +262,7 @@ class NotificationsScheduleController HistoryController::add([ 'code' => 'OK', 'objectType' => 'configurations', - 'objectId' => $configuration['id'], + 'objectId' => $configuration['id'] ?? null, 'type' => 'MODIFICATION', 'message' => "{schedulerScriptCreated} : {$configuration['value']['schedulerPath']}" ]); @@ -365,8 +365,11 @@ class NotificationsScheduleController shell_exec('chmod +x '.escapeshellarg($fullPath)); $configuration = ConfigurationModel::getByIdentifier(['identifier' => 'customization']); - $configuration = $configuration[0]; - $configuration['value'] = json_decode($configuration['value'], true); + if (empty($configuration)) { + return ['errors' => 'Configuration not found']; + } + $configuration = $configuration[0] ?? null; + $configuration['value'] = json_decode($configuration['value'] ?? '{}', true); $configuration['value']['schedulerPath'] = $fullPath; $configuration['value'] = json_encode($configuration['value']);