Skip to content

Commit

Permalink
Merge pull request #3863 from laurentj/notification-sender
Browse files Browse the repository at this point in the history
[internal] support of new config parameter notificationReceiverEmail
  • Loading branch information
laurentj authored Aug 31, 2023
2 parents 62bb8d0 + d85390e commit 3edd47e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lizmap/modules/lizmap/classes/lizmapServices.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,12 @@ public function saveIntoIni($ini, $liveIni)
$liveIni->setValue($key, $this->{$prop}, $section);
} elseif ($this->{$prop} != '') {
$ini->setValue($prop, $this->{$prop}, 'services');
if ($prop == 'adminContactEmail' && $this->globalConfig->lizmap['setAdminContactEmailAsReplyTo']) {
$liveIni->setValue('replyTo', $this->{$prop}, 'mailer');
if ($prop == 'adminContactEmail') {
if ($this->globalConfig->lizmap['setAdminContactEmailAsReplyTo']) {
$liveIni->setValue('replyTo', $this->{$prop}, 'mailer');
}
// for jCommunity 1.4+
$liveIni->setValue('notificationReceiverEmail', $this->{$prop}, 'jcommunity');
}
} else {
$ini->removeValue($prop, 'services');
Expand Down
26 changes: 26 additions & 0 deletions lizmap/modules/lizmap/install/upgrade_commconfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

class lizmapModuleUpgrader_commconfig extends jInstallerModule
{
public $targetVersions = array(
'3.7.0-alpha.3',
'3.6.6',
);

public $date = '2023-08-31';

public function install()
{
// copy the value of adminContactEmail into the config parameter notificationReceiverEmail
// for jCommunity 1.4+
$liveIni = new \Jelix\IniFile\IniModifier(jApp::varConfigPath('liveconfig.ini.php'));
$currentValue = $liveIni->getValue('notificationReceiverEmail', 'jcommunity');
if (!$currentValue) {
$lizmapConfFile = jApp::varConfigPath('lizmapConfig.ini.php');
$ini = new \Jelix\IniFile\IniModifier($lizmapConfFile);
$contact = $ini->getValue('adminContactEmail', 'services');
$liveIni->setValue('notificationReceiverEmail', $contact, 'jcommunity');
$liveIni->save();
}
}
}

0 comments on commit 3edd47e

Please sign in to comment.