mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
7a8fffadfc
|
@ -138,6 +138,7 @@
|
|||
- initialize categories to empty array. Closes #458
|
||||
- add new parameter $skipcont to hook folderListitem()
|
||||
- use standard output format for documents and folders on ManageNotify page
|
||||
- allow multiple dependencies on seeddms of extension
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.15
|
||||
|
|
|
@ -190,10 +190,22 @@ class SeedDMS_Core_DMS {
|
|||
*/
|
||||
public $callbacks;
|
||||
|
||||
/**
|
||||
* @var string last error message. This can be set by hooks to pass an
|
||||
* error message from the hook to the application which has called the
|
||||
* method containing the hook. For example SeedDMS_Core_Document::remove()
|
||||
* calls the hook 'onPreRemoveDocument'. The hook function can set $dms->lasterror
|
||||
* which can than be read when SeedDMS_Core_Document::remove() fails.
|
||||
* This variable could be set in any SeedDMS_Core class, but is currently
|
||||
* only set by hooks.
|
||||
* @access public
|
||||
*/
|
||||
public $lasterror;
|
||||
|
||||
/**
|
||||
* @var SeedDMS_Core_DMS
|
||||
*/
|
||||
public $_dms;
|
||||
// public $_dms;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -457,6 +469,7 @@ class SeedDMS_Core_DMS {
|
|||
$this->classnames['transmittal'] = 'SeedDMS_Core_Transmittal';
|
||||
$this->classnames['transmittalitem'] = 'SeedDMS_Core_TransmittalItem';
|
||||
$this->callbacks = array();
|
||||
$this->lasterror = '';
|
||||
$this->version = '@package_version@';
|
||||
if($this->version[0] == '@')
|
||||
$this->version = '6.0.9';
|
||||
|
@ -2589,8 +2602,8 @@ class SeedDMS_Core_DMS {
|
|||
$user = $this->getUser($this->db->getInsertID('tblUsers'));
|
||||
|
||||
/* Check if 'onPostAddUser' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddUser'])) {
|
||||
foreach($this->_dms->callbacks['onPostUser'] as $callback) {
|
||||
if(isset($this->callbacks['onPostAddUser'])) {
|
||||
foreach($this->callbacks['onPostUser'] as $callback) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $user)) {
|
||||
}
|
||||
|
@ -2652,8 +2665,8 @@ class SeedDMS_Core_DMS {
|
|||
$group = $this->getGroup($this->db->getInsertID('tblGroups'));
|
||||
|
||||
/* Check if 'onPostAddGroup' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddGroup'])) {
|
||||
foreach($this->_dms->callbacks['onPostAddGroup'] as $callback) {
|
||||
if(isset($this->callbacks['onPostAddGroup'])) {
|
||||
foreach($this->callbacks['onPostAddGroup'] as $callback) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $group)) {
|
||||
}
|
||||
|
@ -2848,8 +2861,8 @@ class SeedDMS_Core_DMS {
|
|||
$category = $this->getKeywordCategory($this->db->getInsertID('tblKeywordCategories'));
|
||||
|
||||
/* Check if 'onPostAddKeywordCategory' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddKeywordCategory'])) {
|
||||
foreach($this->_dms->callbacks['onPostAddKeywordCategory'] as $callback) {
|
||||
if(isset($this->callbacks['onPostAddKeywordCategory'])) {
|
||||
foreach($this->callbacks['onPostAddKeywordCategory'] as $callback) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $category)) {
|
||||
}
|
||||
|
@ -2925,8 +2938,8 @@ class SeedDMS_Core_DMS {
|
|||
$category = $this->getDocumentCategory($this->db->getInsertID('tblCategory'));
|
||||
|
||||
/* Check if 'onPostAddDocumentCategory' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPostAddDocumentCategory'])) {
|
||||
foreach($this->_dms->callbacks['onPostAddDocumentCategory'] as $callback) {
|
||||
if(isset($this->callbacks['onPostAddDocumentCategory'])) {
|
||||
foreach($this->callbacks['onPostAddDocumentCategory'] as $callback) {
|
||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||
if(!call_user_func($callback[0], $callback[1], $category)) {
|
||||
}
|
||||
|
|
|
@ -2383,6 +2383,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
* @return bool|mixed
|
||||
*/
|
||||
function removeContent($version) { /* {{{ */
|
||||
$this->_dms->lasterror = '';
|
||||
|
||||
/* Check if 'onPreRemoveDocument' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPreRemoveContent'])) {
|
||||
foreach($this->_dms->callbacks['onPreRemoveContent'] as $callback) {
|
||||
|
@ -2668,6 +2670,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
*/
|
||||
function remove() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
$this->_dms->lasterror = '';
|
||||
|
||||
/* Check if 'onPreRemoveDocument' callback is set */
|
||||
if(isset($this->_dms->callbacks['onPreRemoveDocument'])) {
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
</stability>
|
||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
- no changes, just keep same version as seeddms application
|
||||
- fix call of hooks in SeedDMS_Core
|
||||
- add variable lasterror in SeedDMS_Core_DMS which can be set by hooks to pass an
|
||||
error msg to the calling application
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
|
|
@ -45,7 +45,10 @@ class SeedDMS_Controller_RemoveDocument extends SeedDMS_Controller_Common {
|
|||
$result = $this->callHook('removeDocument', $document);
|
||||
if($result === null) {
|
||||
if (!$document->remove()) {
|
||||
$this->errormsg = "error_occured";
|
||||
if($dms->lasterror)
|
||||
$this->errormsg = $dms->lasterror;
|
||||
else
|
||||
$this->errormsg = "error_occured";
|
||||
return false;
|
||||
}
|
||||
} elseif($result === false) {
|
||||
|
|
|
@ -372,14 +372,27 @@ class SeedDMS_Extension_Mgr {
|
|||
switch($dkey) {
|
||||
case 'seeddms':
|
||||
$version = new SeedDMS_Version;
|
||||
$tmp = explode('-', $dval, 2);
|
||||
if(self::cmpVersion($tmp[0], $version->version()) > 0 || ($tmp[1] && self::cmpVersion($tmp[1], $version->version()) < 0))
|
||||
$this->errmsgs[] = sprintf("Incorrect SeedDMS version (needs version %s)", $extconf['constraints']['depends']['seeddms']);
|
||||
if(is_array($dval)) {
|
||||
$fullfill = false;
|
||||
foreach($dval as $ddval) {
|
||||
$tmp = explode('-', $ddval, 2);
|
||||
if(self::cmpVersion($tmp[0], $version->version()) > 0 || ($tmp[1] && self::cmpVersion($tmp[1], $version->version()) < 0))
|
||||
; // No within version range
|
||||
else
|
||||
$fullfill = true;
|
||||
}
|
||||
if(!$fullfill)
|
||||
$this->errmsgs[] = sprintf("Incorrect SeedDMS version (needs version \"%s\")", implode('" or "', $dval));
|
||||
} elseif(is_string($dval)) {
|
||||
$tmp = explode('-', $dval, 2);
|
||||
if(self::cmpVersion($tmp[0], $version->version()) > 0 || ($tmp[1] && self::cmpVersion($tmp[1], $version->version()) < 0))
|
||||
$this->errmsgs[] = sprintf("Incorrect SeedDMS version (needs version %s)", $extconf['constraints']['depends']['seeddms']);
|
||||
}
|
||||
break;
|
||||
case 'php':
|
||||
$tmp = explode('-', $dval, 2);
|
||||
if(self::cmpVersion($tmp[0], phpversion()) > 0 || ($tmp[1] && self::cmpVersion($tmp[1], phpversion()) < 0))
|
||||
$this->errmsgs[] = sprintf("Incorrect PHP version (needs version %s)", $extconf['constraints']['depends']['php']);
|
||||
$this->errmsgs[] = sprintf("Incorrect PHP version (needs version %s)", $dval);
|
||||
break;
|
||||
case 'phpext':
|
||||
if(is_array($dval) && $dval) {
|
||||
|
|
|
@ -552,7 +552,7 @@ switch($command) {
|
|||
add_log_line();
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText('error_remove_document'), 'data'=>''));
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText('error_remove_document')."<br />".getMLText($controller->getErrorMsg()), 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
|
|
Loading…
Reference in New Issue
Block a user