Skip to content

Commit

Permalink
#1714 [Hook] fix: saturnepublicinterface for logo in public interface
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Feb 19, 2024
1 parent eef5cee commit 6981561
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 40 deletions.
38 changes: 1 addition & 37 deletions class/actions_digiquali.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public function printCommonFooter($parameters)
* @param object $object Object
* @return void
*/
public function formObjectOptions(array $parameters, object $object) {
public function formObjectOptions(array $parameters, $object) {
if (strpos($parameters['context'], 'productlotcard') !== false) {
$objectData = ['type' => $object->element, 'id' => $object->id];

Expand Down Expand Up @@ -311,42 +311,6 @@ public function saturneBannerTab(array $parameters, CommonObject $object): int
return 0; // or return 1 to replace standard code.
}

/**
* Overloading the printMainArea function : replacing the parent's function with the one below.
*
* @param array $parameters Hook metadatas (context, etc...).
* @return int 0 < on error, 0 on success, 1 to replace standard code.
*/
public function printMainArea(array $parameters): int
{
global $conf, $mysoc;

// Do something only for the current context.
if (preg_match('/publiccontrol|publicsurvey|publicanswer|publiccontrolhistory/', $parameters['context'])) {
if (!empty($conf->global->SATURNE_SHOW_COMPANY_LOGO)) {
// Define logo and logoSmall.
$logoSmall = $mysoc->logo_small;
$logo = $mysoc->logo;
// Define urlLogo.
$urlLogo = '';
if (!empty($logoSmall) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $logoSmall)) {
$urlLogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&entity=' . $conf->entity . '&file=' . urlencode('logos/thumbs/' . $logoSmall);
} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $logo)) {
$urlLogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&entity=' . $conf->entity . '&file=' . urlencode('logos/' . $logo);
}
// Output html code for logo.
if ($urlLogo) {
print '<div class="center signature-logo">';
print '<img src="' . $urlLogo . '">';
print '</div>';
}
print '<div class="underbanner clearboth"></div>';
}
}

return 0; // or return 1 to replace standard code.
}

/**
* Overloading the saturneAdminDocumentData function : replacing the parent's function with the one below.
*
Expand Down
2 changes: 1 addition & 1 deletion public/control/public_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
$object = new Control($db);
$sheet = new Sheet($db);

$hookmanager->initHooks(['publiccontrol']); // Note that conf->hooks_modules contains array.
$hookmanager->initHooks(['publiccontrol', 'saturnepublicinterface']); // Note that conf->hooks_modules contains array.

if (!isModEnabled('multicompany')) {
$entity = $conf->entity;
Expand Down
2 changes: 1 addition & 1 deletion public/control/public_control_history.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
$project = new Project($db);
$user = new User($db);

$hookmanager->initHooks(['publiccontrolhistory']); // Note that conf->hooks_modules contains array.
$hookmanager->initHooks(['publiccontrolhistory', 'saturnepublicinterface']); // Note that conf->hooks_modules contains array.

if (!isModEnabled('multicompany')) {
$entity = $conf->entity;
Expand Down
2 changes: 1 addition & 1 deletion public/survey/public_survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
// Initialize technical objects
$object = new Survey($db);

$hookmanager->initHooks(['publicsurvey']); // Note that conf->hooks_modules contains array
$hookmanager->initHooks(['publicsurvey', 'saturnepublicinterface']); // Note that conf->hooks_modules contains array

if (!isModEnabled('multicompany')) {
$entity = $conf->entity;
Expand Down

0 comments on commit 6981561

Please sign in to comment.