mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
add actions '[update|remove]transmittalitem'
This commit is contained in:
parent
b6907c6bc2
commit
3e45e8cb10
|
@ -28,7 +28,6 @@ include("../inc/inc.Extension.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
include("../inc/inc.ClassPasswordStrength.php");
|
||||
|
||||
if ($user->isGuest()) {
|
||||
UI::exitError(getMLText("my_transmittals"),getMLText("access_denied"));
|
||||
|
@ -38,7 +37,7 @@ if (isset($_POST["action"])) $action=$_POST["action"];
|
|||
else $action=NULL;
|
||||
|
||||
// add new transmittal ---------------------------------------------------
|
||||
if ($action == "addtransmittal") {
|
||||
if ($action == "addtransmittal") { /* {{{ */
|
||||
|
||||
/* Check if the form data comes for a trusted request */
|
||||
if(!checkFormKey('addtransmittal')) {
|
||||
|
@ -58,10 +57,10 @@ if ($action == "addtransmittal") {
|
|||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_add_transmittal')));
|
||||
|
||||
add_log_line(".php&action=addtransmittal&name=".$name);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
// delete transmittal ------------------------------------------------------------
|
||||
else if ($action == "removetransmittal") {
|
||||
else if ($action == "removetransmittal") { /* {{{ */
|
||||
|
||||
/* Check if the form data comes for a trusted request */
|
||||
if(!checkFormKey('removetransmittal')) {
|
||||
|
@ -88,10 +87,10 @@ else if ($action == "removetransmittal") {
|
|||
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_transmittal')));
|
||||
$transmittalid=-1;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
// modify transmittal ----------------------------------------------------
|
||||
else if ($action == "edittransmittal") {
|
||||
else if ($action == "edittransmittal") { /* {{{ */
|
||||
|
||||
/* Check if the form data comes for a trusted request */
|
||||
if(!checkFormKey('edittransmittal')) {
|
||||
|
@ -119,10 +118,80 @@ else if ($action == "edittransmittal") {
|
|||
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_transmittal')));
|
||||
add_log_line(".php&action=edittransmittal&transmittalid=".$transmittalid);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
// remove transmittal item ------------------------------------------------
|
||||
else if ($action == "removetransmittalitem") { /* {{{ */
|
||||
|
||||
if(!checkFormKey('removetransmittalitem', 'POST')) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||
} else {
|
||||
$item = SeedDMS_Core_TransmittalItem::getInstance((int) $_REQUEST['id'], $dms);
|
||||
if($item) {
|
||||
$transmittal = $item->getTransmittal();
|
||||
if($transmittal) {
|
||||
if ($transmittal->getUser()->getID() == $user->getID()) {
|
||||
if($item->remove()) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'Error removing transmittal item', 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'No access', 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'No transmittal', 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'No transmittal item', 'data'=>''));
|
||||
}
|
||||
}
|
||||
add_log_line(".php&action=removetransmittalitem&id=".$_REQUEST['id']);
|
||||
exit;
|
||||
} /* }}} */
|
||||
|
||||
// update transmittal item ------------------------------------------------
|
||||
else if ($action == "updatetransmittalitem") { /* {{{ */
|
||||
if(!checkFormKey('updatetransmittalitem', 'POST')) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||
} else {
|
||||
$item = SeedDMS_Core_TransmittalItem::getInstance((int) $_REQUEST['id'], $dms);
|
||||
if($item) {
|
||||
$transmittal = $item->getTransmittal();
|
||||
if($transmittal) {
|
||||
if ($transmittal->getUser()->getID() == $user->getID()) {
|
||||
if($item->updateContent()) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'Error updating transmittal item', 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'No access', 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'No transmittal', 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'No transmittal item', 'data'=>''));
|
||||
}
|
||||
}
|
||||
add_log_line(".php&action=updatetransmittalitem&id=".$_REQUEST['id']);
|
||||
exit;
|
||||
} /* }}} */
|
||||
else UI::exitError(getMLText("my_transmittals"),getMLText("unknown_command"));
|
||||
|
||||
header("Location:../out/out.TransmittalMgr.php?transmittalid=".$transmittalid);
|
||||
|
||||
?>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user