diff --git a/admin/setup.php b/admin/setup.php index 0f38928a..bd45b5b1 100644 --- a/admin/setup.php +++ b/admin/setup.php @@ -37,11 +37,14 @@ require_once __DIR__ . '/../lib/saturne.lib.php'; // Global variables definitions -global $db, $langs, $user; +global $conf, $db, $langs, $user; // Load translation files required by the page saturne_load_langs(['admin']); +// Initialize view objects +$form = new Form($db); + // Parameters $action = GETPOST('action', 'alpha'); $value = GETPOST('value', 'alpha'); @@ -51,6 +54,30 @@ $permissiontoread = $user->rights->saturne->adminpage->read; saturne_check_access($permissiontoread); +/* + * Actions + */ + +if ($action == 'set_media_infos') { + $mediasMax['SATURNE_MEDIA_MAX_WIDTH_MINI'] = GETPOST('MediaMaxWidthMini', 'alpha'); + $mediasMax['SATURNE_MEDIA_MAX_HEIGHT_MINI'] = GETPOST('MediaMaxHeightMini', 'alpha'); + $mediasMax['SATURNE_MEDIA_MAX_WIDTH_SMALL'] = GETPOST('MediaMaxWidthSmall', 'alpha'); + $mediasMax['SATURNE_MEDIA_MAX_HEIGHT_SMALL'] = GETPOST('MediaMaxHeightSmall', 'alpha'); + $mediasMax['SATURNE_MEDIA_MAX_WIDTH_MEDIUM'] = GETPOST('MediaMaxWidthMedium', 'alpha'); + $mediasMax['SATURNE_MEDIA_MAX_HEIGHT_MEDIUM'] = GETPOST('MediaMaxHeightMedium', 'alpha'); + $mediasMax['SATURNE_MEDIA_MAX_WIDTH_LARGE'] = GETPOST('MediaMaxWidthLarge', 'alpha'); + $mediasMax['SATURNE_MEDIA_MAX_HEIGHT_LARGE'] = GETPOST('MediaMaxHeightLarge', 'alpha'); + $mediasMax['SATURNE_DISPLAY_NUMBER_MEDIA_GALLERY'] = GETPOST('DisplayNumberMediaGallery', 'alpha'); + + foreach($mediasMax as $key => $valueMax) { + dolibarr_set_const($db, $key, $valueMax, 'integer', 0, '', $conf->entity); + } + + setEventMessage('SavedConfig'); + header('Location: ' . $_SERVER['PHP_SELF']); + exit; +} + /* * View */ @@ -136,6 +163,68 @@ // End of the table print ''; +print load_fiche_titre($langs->trans('Configs', $langs->transnoentities('MediasMin')), '', ''); + +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +// End of the table +print '
' . $langs->trans('Name') . '' . $langs->trans('Description') . '' . $langs->trans('Value') . '
' . $langs->trans('MediaMaxWidthMiniDescription') . '
' . $langs->trans('MediaMaxHeightMiniDescription') . '
' . $langs->trans('MediaMaxWidthSmallDescription') . '
' . $langs->trans('MediaMaxHeightSmallDescription') . '
' . $langs->trans('MediaMaxWidthMediumDescription') . '
' . $langs->trans('MediaMaxHeightMediumDescription') . '
' . $langs->trans('MediaMaxWidthLargeDescription') . '
' . $langs->trans('MediaMaxHeightLargeDescription') . '
' . $langs->trans('DisplayNumberMediaGalleryDescription') . '
'; +print $form->buttonsSaveCancel('Save', ''); +print '
'; + // Page end print dol_get_fiche_end(); llxFooter(); diff --git a/class/saturnedashboard.class.php b/class/saturnedashboard.class.php index 09c966ff..ea42a38b 100644 --- a/class/saturnedashboard.class.php +++ b/class/saturnedashboard.class.php @@ -134,57 +134,69 @@ public function show_dashboard(?array $moreParams = []) foreach ($dashboards['widgets'] as $dashboardWidgets) { foreach ($dashboardWidgets as $key => $dashboardWidget) { if (!isset($disableWidgetList->$key) && is_array($dashboardWidget) && !empty($dashboardWidget)) { - $widget .= '
'; - $widget .= '
'; - $widget .= ''; - $widget .= ''; - $widget .= ''; - $widget .= '
'; - $widget .= '
'; - $widget .= ''; - $widget .= '
'; - $widget .= '
'; - $widget .= '
'; - for ($i = 0; $i < count($dashboardWidget['label']); $i++) { - if (!empty($dashboardWidget['label'][$i])) { - $widget .= '' . $dashboardWidget['label'][$i] . ' : ' . ''; - if (isset($dashboardWidget['content'][$i]) && $dashboardWidget['content'][$i] !== '') { - $widget .= '' . $dashboardWidget['content'][$i] . ''; - $widget .= (!empty($dashboardWidget['tooltip'][$i]) ? $form->textwithpicto('', $langs->transnoentities($dashboardWidget['tooltip'][$i])) : '') . ''; - if (isset($dashboardWidget['moreContent'][$i]) && $dashboardWidget['moreContent'][$i] !== '') { - $widget .= $dashboardWidget['moreContent'][$i]; - } - } else { - $widget .= $dashboardWidget['customContent'][$i]; + + $widget .= '
'; + + $widget .= '
'; + $widget .= '
'; + $widget .= ''; + $widget .= ''; + $widget .= '
'; + $widget .= '
' . ($dashboardWidget['title'] ?? $langs->transnoentities('Title')) . '
'; + $widget .= ''; + $widget .= '
'; + + $widget .= '
'; + $widget .= '
    '; + for ($i = 0; $i < count($dashboardWidget['label']); $i++) { + if (!empty($dashboardWidget['label'][$i])) { + $widget .= '
  • '; + $widget .= ''; + $widget .= $dashboardWidget['label'][$i]; + $widget .= (!empty($dashboardWidget['tooltip'][$i]) ? $form->textwithpicto('', $langs->transnoentities($dashboardWidget['tooltip'][$i])) : ''); + $widget .= ''; + $widget .= ''; + $widget .= ''; // @TODO Boucle ici pour avoir plusieurs badges + if (isset($dashboardWidget['content'][$i]) && $dashboardWidget['content'][$i] !== '') { + $widget .= '' . $dashboardWidget['content'][$i] . ''; + + if (isset($dashboardWidget['moreContent'][$i]) && $dashboardWidget['moreContent'][$i] !== '') { + $widget .= $dashboardWidget['moreContent'][$i]; + } + } else { + $widget .= $dashboardWidget['customContent'][$i]; + } + $widget .= ''; + $widget .= ''; + $widget .= '
  • '; } - $widget .= '
    '; } - } - if (is_array($dashboardWidget['moreParams']) && (!empty($dashboardWidget['moreParams']))) { - foreach ($dashboardWidget['moreParams'] as $dashboardWidgetMoreParamsKey => $dashboardWidgetMoreParams) { - switch ($dashboardWidgetMoreParamsKey) { - case 'links' : - if (is_array($dashboardWidget['moreParams']['links']) && (!empty($dashboardWidget['moreParams']['links']))) { - foreach ($dashboardWidget['moreParams']['links'] as $dashboardWidgetMoreParamsLink) { - $widget .= '' . img_picto($langs->trans('Url'), 'globe', 'class="paddingrightonly"') . $langs->transnoentities($dashboardWidgetMoreParamsLink['linkName']) . '
    '; + $widget .= '
'; + if (is_array($dashboardWidget['moreParams']) && (!empty($dashboardWidget['moreParams']))) { + $widget .= '
'; + foreach ($dashboardWidget['moreParams'] as $dashboardWidgetMoreParamsKey => $dashboardWidgetMoreParams) { + switch ($dashboardWidgetMoreParamsKey) { + case 'links' : + if (is_array($dashboardWidget['moreParams']['links']) && (!empty($dashboardWidget['moreParams']['links']))) { + foreach ($dashboardWidget['moreParams']['links'] as $dashboardWidgetMoreParamsLink) { + $widget .= '' . img_picto($langs->trans('Url'), 'globe', 'class="paddingrightonly"') . $langs->transnoentities($dashboardWidgetMoreParamsLink['linkName']) . '
'; + } } - } - break; - default : - $widget .= $dashboardWidgetMoreParams; - break; + break; + default : + $widget .= $dashboardWidgetMoreParams; + break; + } } + $widget .= '
'; } - } $widget .= '
'; - $widget .= '
'; - $widget .= '
'; - $widget .= '
'; + $widget .= '
'; } } } - print '
' . $widget . '
'; + print '
' . $widget . '
'; } print '
'; @@ -258,13 +270,10 @@ public function show_dashboard(?array $moreParams = []) $graph->draw($fileName[$uniqueKey], $fileUrl[$uniqueKey]); print '
'; - $downloadCSV = '
'; - $downloadCSV .= ''; - $downloadCSV .= ''; - $downloadCSV .= ''; - $downloadCSV .= '
'; + $downloadCSV = ''; + $downloadCSV .= ''; $dashboardGraph['morehtmlright'] .= $downloadCSV; print load_fiche_titre($dashboardGraph['title'], $dashboardGraph['morehtmlright'], $dashboardGraph['picto']); @@ -288,13 +297,13 @@ public function show_dashboard(?array $moreParams = []) print ''; print ''; foreach ($dashboardList['labels'] as $key => $dashboardListLabel) { - print ''; + print ''; } print ''; foreach ($dashboardList['data'] as $dashboardListDatasets) { print ''; foreach ($dashboardListDatasets as $key => $dashboardGraphDataset) { - print ''; + print ''; } print ''; } diff --git a/class/saturnedocuments.class.php b/class/saturnedocuments.class.php index 96098e2a..3f35f74a 100644 --- a/class/saturnedocuments.class.php +++ b/class/saturnedocuments.class.php @@ -265,16 +265,14 @@ public function generateDocument(string $modele, Translate $outputlangs, int $hi * @param string $moduleNameLowerCase Module name in lowercase * @param string $fileDir File directory * @param string $fileType Type of file + * @param int $entity Entity * @return array|int $result Array of document or -1 if not found */ - public function getLastDocument(string $moduleNameLowerCase = '', string $fileDir = '', string $fileType = '') + public function getLastDocument(string $moduleNameLowerCase = '', string $fileDir = '', string $fileType = '', int $entity = 1) { - global $conf; - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $uploadDir = $conf->$moduleNameLowerCase->multidir_output[$conf->entity ?? 1]; - $fileDir = $uploadDir . '/' . $fileDir; + $fileDir = DOL_DATA_ROOT . '/' . ($entity > 1 ? $entity . '/' : '') . $moduleNameLowerCase . '/' . $fileDir; $fileList = dol_dir_list($fileDir, 'files', 0, '(\.' . $fileType . ')', '', 'date', 'SORT_DESC', 1); if (count($fileList)) { $result = $fileList[0]; @@ -292,14 +290,15 @@ public function getLastDocument(string $moduleNameLowerCase = '', string $fileDi * @param string $fileDir File directory * @param string $fileType Type of file * @param string $icon Icon for download button + * @param int $entity Entity * @return string String of html button */ - public function showUrlOfLastGeneratedDocument(string $moduleNameLowerCase = '', string $fileDir = '', string $fileType = '', string $icon = 'fa-file-word'): string + public function showUrlOfLastGeneratedDocument(string $moduleNameLowerCase = '', string $fileDir = '', string $fileType = '', string $icon = 'fa-file-word', int $entity = 1): string { global $langs; $out = ''; - $document = $this->getLastDocument($moduleNameLowerCase, $fileDir, $fileType); + $document = $this->getLastDocument($moduleNameLowerCase, $fileDir, $fileType, $entity); if (is_array($document)) { $documentUrl = DOL_URL_ROOT . '/document.php'; $fileUrl = $documentUrl . '?modulepart=' . $moduleNameLowerCase . '&file=' . urlencode($fileDir . '/' . $document['name']); diff --git a/class/saturneobject.class.php b/class/saturneobject.class.php index dcff032b..efdfe228 100644 --- a/class/saturneobject.class.php +++ b/class/saturneobject.class.php @@ -433,6 +433,9 @@ public function getNomUrl(int $withpicto = 0, string $option = '', int $notoolti } $label .= '
'; $label .= '' . $langs->trans('Ref') . ' : ' . $this->ref; + if (property_exists($this, 'label')) { + $label .= '
' . $langs->transnoentities('Label') . ' : ' . $this->label; + } $url = dol_buildpath('/' . $this->module . '/view/' . $this->element . '/' . $this->element . '_card.php', 1) . '?id=' . $this->id; diff --git a/core/modules/modSaturne.class.php b/core/modules/modSaturne.class.php index 70e4fea7..7c9db01c 100644 --- a/core/modules/modSaturne.class.php +++ b/core/modules/modSaturne.class.php @@ -181,6 +181,15 @@ public function __construct($db) $i++ => ['SATURNE_USE_CAPTCHA', 'integer', 0, '', 0, 'current'], $i++ => ['SATURNE_USE_ALL_EMAIL_MODE', 'integer', 1, '', 0, 'current'], $i++ => ['SATURNE_USE_CREATE_DOCUMENT_ON_ARCHIVE', 'integer', 1, '', 0, 'current'], + $i++ => ['SATURNE_MEDIA_MAX_WIDTH_MINI', 'integer', 128, '', 0, 'current'], + $i++ => ['SATURNE_MEDIA_MAX_HEIGHT_MINI', 'integer', 72, '', 0, 'current'], + $i++ => ['SATURNE_MEDIA_MAX_WIDTH_SMALL', 'integer', 480, '', 0, 'current'], + $i++ => ['SATURNE_MEDIA_MAX_HEIGHT_SMALL', 'integer', 270, '', 0, 'current'], + $i++ => ['SATURNE_MEDIA_MAX_WIDTH_MEDIUM', 'integer', 854, '', 0, 'current'], + $i++ => ['SATURNE_MEDIA_MAX_HEIGHT_MEDIUM', 'integer', 480, '', 0, 'current'], + $i++ => ['SATURNE_MEDIA_MAX_WIDTH_LARGE', 'integer', 1280, '', 0, 'current'], + $i++ => ['SATURNE_MEDIA_MAX_HEIGHT_LARGE', 'integer', 720, '', 0, 'current'], + $i++ => ['SATURNE_DISPLAY_NUMBER_MEDIA_GALLERY', 'integer', 8, '', 0, 'current'], // CONST DOLIBARR $i => ['MAIN_ALLOW_SVG_FILES_AS_IMAGES', 'integer', 1, '', 0, 'current'] @@ -273,6 +282,8 @@ public function __construct($db) 'user' => 0, ]; } + + $conf->global->MAIN_UMASK = '0664'; } /** @@ -317,6 +328,8 @@ public function init($options = ''): int return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') } + dolibarr_set_const($this->db, 'MAIN_UMASK', '0664', 'chaine', 0, 0, 'global', 1); + return $this->_init($sql, $options); } diff --git a/core/modules/saturne/modules_saturne.php b/core/modules/saturne/modules_saturne.php index 7fa9bc06..aa450714 100644 --- a/core/modules/saturne/modules_saturne.php +++ b/core/modules/saturne/modules_saturne.php @@ -501,9 +501,17 @@ public function info(Translate $langs): string $info .= ''; $info .= '- ' . $file['name']; if (!$this->custom_info) { - $info .= ' ' . img_picto('', 'download') . ''; + if (getDolGlobalString('MAIN_UMASK') == '0664') { + $info .= ' ' . img_picto('', 'download') . ''; + } else { + $info .= ' ' . img_picto('', 'download') . ''; + } } else { - $info .= ' ' . img_picto('', 'fontawesome_fa-download_fas_#ffffff') . ''; + if (getDolGlobalString('MAIN_UMASK') == '0664') { + $info .= ' ' . img_picto('', 'fontawesome_fa-download_fas_#ffffff') . ''; + } else { + $info .= ' ' . img_picto('', 'fontawesome_fa-download_fas_#ffffff') . ''; + } $info .= ' ' . img_picto('', 'fontawesome_fa-trash_fas_#ffffff') . ''; } $info .= '
'; diff --git a/core/tpl/actions/dashboard_actions.tpl.php b/core/tpl/actions/dashboard_actions.tpl.php index d499ea22..f1a50c69 100644 --- a/core/tpl/actions/dashboard_actions.tpl.php +++ b/core/tpl/actions/dashboard_actions.tpl.php @@ -47,7 +47,7 @@ } if ($action == 'generate_csv') { - parse_str(GETPOST('graph'), $data); + $data = json_decode(file_get_contents('php://input'), true); if (!empty($data)) { $now = dol_now(); diff --git a/core/tpl/admin/object/object_numbering_module_view.tpl.php b/core/tpl/admin/object/object_numbering_module_view.tpl.php index 6b3352e9..54dc1e51 100644 --- a/core/tpl/admin/object/object_numbering_module_view.tpl.php +++ b/core/tpl/admin/object/object_numbering_module_view.tpl.php @@ -25,9 +25,23 @@ * The following vars must be defined : * Global : $conf, $db, $langs * Objects : $object - * Variable : $documentParentType, $documentPath, $moduleName, $moduleNameLowerCase, $objectModSubdir + * Variable : $documentParentType (optional), $documentPath (optional), $moduleName, $moduleNameLowerCase, $objectModSubdir (optional) */ +$varsToChecks = [ + 'conf' => ['isset' => true, 'not_empty' => true, 'type' => 'object'], + 'db' => ['isset' => true, 'not_empty' => true, 'type' => 'object'], + 'langs' => ['isset' => true, 'not_empty' => true, 'type' => 'object'], + 'object' => ['isset' => true, 'not_empty' => true, 'type' => 'object'], + 'documentParentType' => ['isset' => false, 'not_empty' => true, 'type' => 'string'], + 'documentPath' => ['isset' => false, 'not_empty' => true, 'type' => 'bool'], + 'moduleName' => ['isset' => true, 'not_empty' => true, 'type' => 'string'], + 'moduleNameLowerCase' => ['isset' => true, 'not_empty' => true, 'type' => 'string'], + 'objectModSubdir' => ['isset' => false, 'not_empty' => true, 'type' => 'string'] +]; + +require_once __DIR__ . '/../../utils/saturne_check_variable.php'; + //$numberingModuleLabel = str_contains($object->element, 'det') ? 'NumberingModuleDet' : 'NumberingModule'; print load_fiche_titre($langs->trans('NumberingModule'), '', ''); @@ -43,7 +57,7 @@ if (empty($documentPath)) { $objectType = $object->element; - $path = '/custom/' . $moduleNameLowerCase . '/core/modules/' . $moduleNameLowerCase . '/' . ($objectModSubdir ? $objectModSubdir . '/' : '') . $objectType . '/'; + $path = '/custom/' . $moduleNameLowerCase . '/core/modules/' . $moduleNameLowerCase . '/' . (!empty($objectModSubdir) ? $objectModSubdir . '/' : '') . $objectType . '/'; } else { $objectType = $documentParentType; $path = '/custom/' . $moduleNameLowerCase . '/core/modules/' . $moduleNameLowerCase . '/' . $moduleNameLowerCase . 'documents/' . $objectType . '/'; diff --git a/core/tpl/documents/documents_action.tpl.php b/core/tpl/documents/documents_action.tpl.php index f5936943..fb5e7a27 100644 --- a/core/tpl/documents/documents_action.tpl.php +++ b/core/tpl/documents/documents_action.tpl.php @@ -103,7 +103,7 @@ $urlToRedirect = preg_replace('/#builddoc$/', '', $urlToRedirect); $urlToRedirect = preg_replace('/action=builddoc&?/', '', $urlToRedirect); // To avoid infinite loop. $urlToRedirect = preg_replace('/forcebuilddoc=1&?/', '', $urlToRedirect); // To avoid infinite loop. - if (isset($shouldRedirect) && $shouldRedirect) { + if (!isset($shouldRedirect) || $shouldRedirect) { header('Location: ' . $urlToRedirect); exit; } diff --git a/core/tpl/medias/medias_gallery_modal.tpl.php b/core/tpl/medias/medias_gallery_modal.tpl.php index 4d484e64..996792c3 100644 --- a/core/tpl/medias/medias_gallery_modal.tpl.php +++ b/core/tpl/medias/medias_gallery_modal.tpl.php @@ -41,7 +41,7 @@ // Array for the sizes of thumbs $mediaSizes = ['mini', 'small', 'medium', 'large']; -if ( ! $error && $subaction == 'uploadPhoto' && ! empty($conf->global->MAIN_UPLOAD_DOC)) { +if (!(isset($error) && $error) && $subaction == 'uploadPhoto' && ! empty($conf->global->MAIN_UPLOAD_DOC)) { // Define relativepath and upload_dir $relativepath = $moduleNameLowerCase . '/medias'; @@ -108,10 +108,13 @@ } } else { $modObjectName = dol_strtoupper($moduleNameLowerCase) . '_' . dol_strtoupper($object->element) . '_ADDON'; - $numberingModuleName = [$object->element => $conf->global->$modObjectName]; - list($modObject) = saturne_require_objects_mod($numberingModuleName, $moduleNameLowerCase); - - $pathToObjectImg = $conf->$moduleNameLowerCase->multidir_output[$conf->entity] . '/' . $object->element . '/tmp/' . $modObject->prefix . '0/' . $data['objectSubdir']; + $numberingModuleName = [$object->element => getDolGlobalString($modObjectName)]; + if ($numberingModuleName[$data['objectType']] != '') { + list($modObject) = saturne_require_objects_mod($numberingModuleName, $moduleNameLowerCase); + $pathToObjectImg = $conf->$moduleNameLowerCase->multidir_output[$conf->entity] . '/' . $object->element . '/tmp/' . $modObject->prefix . '0/' . $data['objectSubdir']; + } else { + $pathToObjectImg = $conf->$moduleNameLowerCase->multidir_output[$conf->entity] . '/' . $data['objectType'] . '/tmp/' . $data['objectSubdir'] . '/'; + } } if (!dol_is_dir($pathToObjectImg)) { @@ -122,8 +125,8 @@ // Create thumbs foreach($mediaSizes as $size) { - $confWidth = $moduleNameUpperCase . '_MEDIA_MAX_WIDTH_' . dol_strtoupper($size); - $confHeight = $moduleNameUpperCase . '_MEDIA_MAX_HEIGHT_' . dol_strtoupper($size); + $confWidth = 'SATURNE_MEDIA_MAX_WIDTH_' . dol_strtoupper($size); + $confHeight = 'SATURNE_MEDIA_MAX_HEIGHT_' . dol_strtoupper($size); vignette($pathToECMImg . '/' . $fileName, $conf->global->$confWidth, $conf->global->$confHeight, '_' . $size); vignette($pathToObjectImg . '/' . $fileName, $conf->global->$confWidth, $conf->global->$confHeight, '_' . $size); } @@ -148,10 +151,13 @@ $pathToObjectImg = $conf->$moduleNameLowerCase->multidir_output[$conf->entity] . '/' . $objectType . '/' . $object->ref . '/' . $data['objectSubdir']; } else { $modObjectName = dol_strtoupper($moduleNameLowerCase) . '_' . dol_strtoupper($objectType) . '_ADDON'; - $numberingModuleName = [$objectType => $conf->global->$modObjectName]; - list($modObject) = saturne_require_objects_mod($numberingModuleName, $moduleNameLowerCase); - - $pathToObjectImg = $conf->$moduleNameLowerCase->multidir_output[$conf->entity] . '/' . $objectType . '/tmp/' . $modObject->prefix . '0/' . $data['objectSubdir']; + $numberingModuleName = [$objectType => getDolGlobalString($modObjectName)]; + if ($numberingModuleName[$objectType] != '') { + list($modObject) = saturne_require_objects_mod($numberingModuleName, $moduleNameLowerCase); + $pathToObjectImg = $conf->$moduleNameLowerCase->multidir_output[$conf->entity] . '/' . $objectType . '/tmp/' . $modObject->prefix . '0/' . $data['objectSubdir']; + } else { + $pathToObjectImg = $conf->$moduleNameLowerCase->multidir_output[$conf->entity] . '/' . $objectType . '/tmp/' . $data['objectSubdir'] . '/'; + } } if (!dol_is_dir($pathToObjectImg)) { @@ -176,8 +182,8 @@ // Create thumbs foreach($mediaSizes as $size) { - $confWidth = $moduleNameUpperCase . '_MEDIA_MAX_WIDTH_' . dol_strtoupper($size); - $confHeight = $moduleNameUpperCase . '_MEDIA_MAX_HEIGHT_' . dol_strtoupper($size); + $confWidth = 'SATURNE_MEDIA_MAX_WIDTH_' . dol_strtoupper($size); + $confHeight = 'SATURNE_MEDIA_MAX_HEIGHT_' . dol_strtoupper($size); vignette($pathToObjectImg . '/' . $fileName, $conf->global->$confWidth, $conf->global->$confHeight, '_' . $size); } } @@ -264,7 +270,7 @@ } } -if ( ! $error && $subaction == 'pagination') { +if (!(isset($error) && $error) && $subaction == 'pagination') { $data = json_decode(file_get_contents('php://input'), true); $offset = $data['offset']; @@ -273,7 +279,7 @@ $loadedPageArray = saturne_load_pagination($pagesCounter, [], $offset); } -if ( ! $error && $subaction == 'toggleTodayMedias') { +if (!(isset($error) && $error) && $subaction == 'toggleTodayMedias') { $toggleValue = GETPOST('toggle_today_medias'); $tabparam['SATURNE_MEDIA_GALLERY_SHOW_TODAY_MEDIAS'] = $toggleValue; @@ -281,7 +287,7 @@ dol_set_user_param($db, $conf,$user, $tabparam); } -if ( ! $error && $subaction == 'toggleUnlinkedMedias') { +if (!(isset($error) && $error) && $subaction == 'toggleUnlinkedMedias') { $toggleValue = GETPOST('toggle_unlinked_medias'); $tabparam['SATURNE_MEDIA_GALLERY_SHOW_UNLINKED_MEDIAS'] = $toggleValue; @@ -289,24 +295,24 @@ dol_set_user_param($db, $conf,$user, $tabparam); } -if (!$error && $subaction == 'regenerate_thumbs') { +if (!(isset($error) && $error) && $subaction == 'regenerate_thumbs') { $data = json_decode(file_get_contents('php://input'), true); foreach($mediaSizes as $size) { - $confWidth = $moduleNameUpperCase . '_MEDIA_MAX_WIDTH_' . dol_strtoupper($size); - $confHeight = $moduleNameUpperCase . '_MEDIA_MAX_HEIGHT_' . dol_strtoupper($size); + $confWidth = 'SATURNE_MEDIA_MAX_WIDTH_' . dol_strtoupper($size); + $confHeight = 'SATURNE_MEDIA_MAX_HEIGHT_' . dol_strtoupper($size); vignette($data['fullname'], $conf->global->$confWidth, $conf->global->$confHeight, '_' . $size); } } -if (is_array($submitFileErrorText)) { +if (!empty($submitFileErrorText) && is_array($submitFileErrorText)) { print ''; } require_once __DIR__ . '/media_editor_modal.tpl.php'; ?> -
' . $langs->transnoentities($dashboardListLabel) . '' . $langs->transnoentities($dashboardListLabel) . '
' . $dashboardGraphDataset['value'] . '' . $dashboardGraphDataset['value'] . '