mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-01 22:47:19 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
fa96dca929
|
@ -5382,7 +5382,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
|
|
||||||
if (!$this->_workflowState) {
|
if (!$this->_workflowState) {
|
||||||
$queryStr=
|
$queryStr=
|
||||||
"SELECT b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflowStates` b ON a.`state` = b.id WHERE `a`.`id`=". $this->_workflow['id'];
|
"SELECT b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflowStates` b ON a.`state` = b.`id` WHERE `a`.`id`=". $this->_workflow->getID();
|
||||||
$recs = $db->getResultArray($queryStr);
|
$recs = $db->getResultArray($queryStr);
|
||||||
if (is_bool($recs) && !$recs)
|
if (is_bool($recs) && !$recs)
|
||||||
return false;
|
return false;
|
||||||
|
@ -5446,7 +5446,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
|
|
||||||
if (!isset($this->_workflow)) {
|
if (!isset($this->_workflow)) {
|
||||||
$queryStr=
|
$queryStr=
|
||||||
"SELECT a.id as wdcid, a.parent, b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflows` b ON a.`workflow` = b.id WHERE a.`version`='".$this->_version
|
"SELECT a.`id` as `wdcid`, a.`parent`, b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflows` b ON a.`workflow` = b.id WHERE a.`version`='".$this->_version
|
||||||
."' AND a.`document` = '". $this->_document->getID() ."' "
|
."' AND a.`document` = '". $this->_document->getID() ."' "
|
||||||
." AND a.`state` IS NOT NULL"
|
." AND a.`state` IS NOT NULL"
|
||||||
." ORDER BY `date` DESC LIMIT 1";
|
." ORDER BY `date` DESC LIMIT 1";
|
||||||
|
|
|
@ -749,6 +749,36 @@ function uploadDocumentFile($request, $response, $args) { /* {{{ */
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
function addDocumentLink($request, $response, $args) { /* {{{ */
|
||||||
|
global $dms, $userobj;
|
||||||
|
|
||||||
|
if(!$userobj) {
|
||||||
|
return $response->withJson(array('success'=>false, 'message'=>'Not logged in', 'data'=>''), 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ctype_digit($args['id']) || $args['id'] == 0) {
|
||||||
|
return $response->withJson(array('success'=>false, 'message'=>'No source document given', 'data'=>''), 400);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$sourcedoc = $dms->getDocument($args['id']);
|
||||||
|
$targetdoc = $dms->getDocument($args['documentid']);
|
||||||
|
if($sourcedoc && $targetdoc) {
|
||||||
|
if($sourcedoc->getAccessMode($userobj, 'addDocumentLink') >= M_READ) {
|
||||||
|
$params = $request->getParsedBody();
|
||||||
|
$public = !isset($params['public']) ? true : false;
|
||||||
|
if ($sourcedoc->addDocumentLink($targetdoc->getId(), $userobj->getID(), $public)){
|
||||||
|
return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>$rec), 201);
|
||||||
|
} else {
|
||||||
|
return $response->withJson(array('success'=>false, 'message'=>'Could not create document link', 'data'=>''), 500);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $response->withJson(array('success'=>false, 'message'=>'No access on source document', 'data'=>''), 403);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $response->withJson(array('success'=>false, 'message'=>'Could not find source or target document', 'data'=>''), 500);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
function getDocument($request, $response, $args) { /* {{{ */
|
function getDocument($request, $response, $args) { /* {{{ */
|
||||||
global $dms, $userobj;
|
global $dms, $userobj;
|
||||||
$document = $dms->getDocument($args['id']);
|
$document = $dms->getDocument($args['id']);
|
||||||
|
@ -1277,7 +1307,7 @@ function doSearchByAttr($request, $response) { /* {{{ */
|
||||||
$params = $request->getQueryParams();
|
$params = $request->getQueryParams();
|
||||||
$attrname = $params['name'];
|
$attrname = $params['name'];
|
||||||
$query = $params['value'];
|
$query = $params['value'];
|
||||||
if(!$limit = $params['limit'])
|
if(empty($params['limit']) || !$limit = $params['limit'])
|
||||||
$limit = 50;
|
$limit = 50;
|
||||||
$attrdef = $dms->getAttributeDefinitionByName($attrname);
|
$attrdef = $dms->getAttributeDefinitionByName($attrname);
|
||||||
$entries = array();
|
$entries = array();
|
||||||
|
@ -1975,6 +2005,7 @@ $app->get('/document/{id}/version/{version}', 'getDocumentVersion');
|
||||||
$app->get('/document/{id}/files', 'getDocumentFiles');
|
$app->get('/document/{id}/files', 'getDocumentFiles');
|
||||||
$app->get('/document/{id}/file/{fileid}', 'getDocumentFile');
|
$app->get('/document/{id}/file/{fileid}', 'getDocumentFile');
|
||||||
$app->get('/document/{id}/links', 'getDocumentLinks');
|
$app->get('/document/{id}/links', 'getDocumentLinks');
|
||||||
|
$app->post('/document/{id}/link/{documentid}', 'addDocumentLink');
|
||||||
$app->get('/document/{id}/attributes', 'getDocumentAttributes');
|
$app->get('/document/{id}/attributes', 'getDocumentAttributes');
|
||||||
$app->get('/document/{id}/preview/{version}/{width}', 'getDocumentPreview');
|
$app->get('/document/{id}/preview/{version}/{width}', 'getDocumentPreview');
|
||||||
$app->delete('/document/{id}/categories', 'removeDocumentCategories');
|
$app->delete('/document/{id}/categories', 'removeDocumentCategories');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user