Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-09-06 18:56:09 +02:00
commit 2bb27b5b8e
7 changed files with 115 additions and 55 deletions

View File

@ -276,6 +276,8 @@
- groups from ldap can be synced with seeddms groups
- fix error when sending notification to group of reviewers
- seperate some notification messages for folders and documents
- fix drag&drop of attachments
- do not sent notifidation mail to uploader if owner has received on already
--------------------------------------------------------------------------------
Changes in version 5.1.31

View File

@ -85,6 +85,9 @@ class SeedDMS_ConversionServicePdfToImage extends SeedDMS_ConversionServiceBase
}
}
} catch (ImagickException $e) {
if($this->logger) {
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with pdf service failed: '.$e->getMessage(), PEAR_LOG_ERR);
}
$this->success = false;
return false;
}

View File

@ -90,6 +90,8 @@ class SeedDMS_NotificationService {
$to = '';
}
$params['__recvtype__'] = $recvtype;
/* Call filter of notification service if set */
if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipient, $subject, $message, $params, $recvtype)) {
if(!$service->toIndividual($sender, $recipient, $subject, $message, $params)) {
@ -433,8 +435,11 @@ class SeedDMS_NotificationService {
false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $version->getUser()->getID() && false === SeedDMS_Core_DMS::inList($version->getUser(), $nl['users']))
/* Send mail to uploader of version only if the uploader is not the owner and
* the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $version->getUser()->getID() && $version->getUser()->getID() != $document->getOwner() && false === SeedDMS_Core_DMS::inList($version->getUser(), $nl['users']))
$this->toIndividual($user, $version->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */
@ -564,8 +569,11 @@ class SeedDMS_NotificationService {
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $content->getUser()->getID() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
/* Send mail to uploader of version only if the uploader is not the owner and
* the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $content->getUser()->getID() && $content->getUser()->getID() != $document->getOwner() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */
@ -579,6 +587,7 @@ class SeedDMS_NotificationService {
$subject = "removed_file_email_subject";
$message = "removed_file_email_body";
$params = array();
$params['name'] = $file->getName();
$params['document'] = $document->getName();
$params['document_id'] = $document->getId();
$params['username'] = $user->getFullName();
@ -1000,11 +1009,19 @@ class SeedDMS_NotificationService {
if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $content->getUser()->getID() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
/* Send mail to uploader of version only if the uploader is not the owner and
* the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $content->getUser()->getID() && $content->getUser()->getID() != $document->getOwner() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */
/**
* This notification is sent when a user or group was added as a notifier
*
* @param object $obj user or group being added
*/
public function sendNewDocumentNotifyMail($document, $user, $obj) { /* {{{ */
$folder = $document->getFolder();
$subject = "document_notify_added_email_subject";
@ -1024,6 +1041,11 @@ class SeedDMS_NotificationService {
$this->toGroup($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
} /* }}} */
/**
* This notification is sent when a user or group was added as a notifier
*
* @param object $obj user or group being added
*/
public function sendNewFolderNotifyMail($folder, $user, $obj) { /* {{{ */
$subject = "folder_notify_added_email_subject";
$message = "folder_notify_added_email_body";
@ -1106,8 +1128,11 @@ class SeedDMS_NotificationService {
if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $content->getUser()->getID() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
/* Send mail to uploader of version only if the uploader is not the owner and
* the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $content->getUser()->getID() && $content->getUser()->getID() != $document->getOwner() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */
@ -1139,8 +1164,11 @@ class SeedDMS_NotificationService {
if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
/* Send mail to uploader of version */
if($user->getID() != $content->getUser()->getID() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
/* Send mail to uploader of version only if the uploader is not the owner and
* the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $content->getUser()->getID() && $content->getUser()->getID() != $document->getOwner() && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
} /* }}} */

View File

@ -182,13 +182,20 @@ else if ($action == "setdefault") {
// Modify permission ------------------------------------------------------
else if ($action == "editaccess") {
$oldmode = $mode;
if (isset($userid)) {
$folder->changeAccess($mode, $userid, true);
$oldmode = $folder->changeAccess($mode, $userid, true);
}
else if (isset($groupid)) {
$folder->changeAccess($mode, $groupid, false);
$oldmode = $folder->changeAccess($mode, $groupid, false);
}
if($oldmode != $mode) {
if($notifier) {
// Send notification to subscribers.
$notifier->sendChangedFolderAccessMail($folder, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_access')));
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_access')));
}
// Delete Permission ------------------------------------------------------
@ -200,6 +207,10 @@ else if ($action == "delaccess") {
else if (isset($groupid)) {
$folder->removeAccess($groupid, false);
}
if($notifier) {
// Send notification to subscribers.
$notifier->sendChangedFolderAccessMail($folder, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_delete_access')));
}
@ -212,6 +223,10 @@ else if ($action == "addaccess") {
if (isset($groupid) && $groupid != -1) {
$folder->addAccess($mode, $groupid, false);
}
if($notifier) {
// Send notification to subscribers.
$notifier->sendChangedFolderAccessMail($folder, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_access')));
}

View File

@ -123,6 +123,7 @@ else if ($action == "addnotify") {
break;
case 0:
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_notify')));
/* Send notification only to the user being added as a notifier */
if($notifier) {
$obj = $dms->getUser($userid);
$notifier->sendNewFolderNotifyMail($folder, $user, $obj);
@ -148,6 +149,7 @@ else if ($action == "addnotify") {
break;
case 0:
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_notify')));
/* Send notification only to the group being added as a notifier */
if($notifier) {
$obj = $dms->getGroup($groupid);
$notifier->sendNewFolderNotifyMail($folder, $user, $obj);

View File

@ -913,28 +913,33 @@ function onAddClipboard(ev) { /* {{{ */
}
*/
} else if(target_type == 'attachment' && target_id) {
for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('documentid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', files[i]);
fd.append('command', 'addfile');
for (var i = 0; i < items.length; i++) {
var item = items[i]; //.webkitGetAsEntry();
if (item.isFile) {
item.file(function(file) {
if(file.size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('documentid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', file);
fd.append('command', 'addfile');
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status, function(){
$("div.ajax[data-action='documentFiles']").trigger('update', {documentid: target_id});
});
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(file.name,file.size);
SeedDMSUpload.sendFileToServer(fd,status, function(){
$("div.ajax[data-action='documentFiles']").trigger('update', {documentid: target_id});
});
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + file.name + ' (' + file.size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
}
});
}
}

View File

@ -950,28 +950,33 @@ function onAddClipboard(ev) { /* {{{ */
}
*/
} else if(target_type == 'attachment' && target_id) {
for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('documentid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', files[i]);
fd.append('command', 'addfile');
for (var i = 0; i < items.length; i++) {
var item = items[i]; //.webkitGetAsEntry();
if (item.isFile) {
item.file(function(file) {
if(file.size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('documentid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', file);
fd.append('command', 'addfile');
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status, function(){
$("div.ajax[data-action='documentFiles']").trigger('update', {documentid: target_id});
});
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(file.name,file.size);
SeedDMSUpload.sendFileToServer(fd,status, function(){
$("div.ajax[data-action='documentFiles']").trigger('update', {documentid: target_id});
});
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + file.name + ' (' + file.size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
}
});
}
}