Commit a453bbfc130cdc02935c597a222ab7759b0edba7
1 parent
97c2e57f
Merged in from DEV trunk...
"KTS-1973" "Webservice error when calling get_folder_contents fom VB.NET" Updated. Added typecast to integer for content listing. Removed the 'return true' for procedures. Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@6611 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
8 additions
and
67 deletions
ktapi/ktapi.inc.php
| 1 | 1 | <? |
| 2 | - | |
| 3 | 2 | /** |
| 4 | 3 | * |
| 5 | 4 | * Implements a cleaner wrapper API for KnowledgeTree. |
| ... | ... | @@ -314,7 +313,6 @@ class KTAPI_Session |
| 314 | 313 | $this->user = null; |
| 315 | 314 | $this->session = ''; |
| 316 | 315 | $this->sessionid = -1; |
| 317 | - return true; | |
| 318 | 316 | } |
| 319 | 317 | |
| 320 | 318 | } |
| ... | ... | @@ -655,6 +653,7 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 655 | 653 | $num_items = count($contents); |
| 656 | 654 | for($i=0;$i<$num_items;$i++) |
| 657 | 655 | { |
| 656 | + $contents[$i]['id'] = (int) $contents[$i]['id']; | |
| 658 | 657 | if ($contents[$i]['item_type'] == 'D') |
| 659 | 658 | { |
| 660 | 659 | $contents[$i]['items'] = array(); |
| ... | ... | @@ -766,7 +765,6 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 766 | 765 | * This deletes the current folder. |
| 767 | 766 | * |
| 768 | 767 | * @param string $reason |
| 769 | - * @return true | |
| 770 | 768 | */ |
| 771 | 769 | function delete($reason) |
| 772 | 770 | { |
| ... | ... | @@ -790,15 +788,12 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 790 | 788 | return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR); |
| 791 | 789 | } |
| 792 | 790 | DBUtil::commit(); |
| 793 | - | |
| 794 | - return true; | |
| 795 | 791 | } |
| 796 | 792 | |
| 797 | 793 | /** |
| 798 | 794 | * This renames the folder |
| 799 | 795 | * |
| 800 | 796 | * @param string $newname |
| 801 | - * @return true | |
| 802 | 797 | */ |
| 803 | 798 | function rename($newname) |
| 804 | 799 | { |
| ... | ... | @@ -817,8 +812,6 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 817 | 812 | return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR); |
| 818 | 813 | } |
| 819 | 814 | DBUtil::commit(); |
| 820 | - | |
| 821 | - return true; | |
| 822 | 815 | } |
| 823 | 816 | |
| 824 | 817 | /** |
| ... | ... | @@ -826,7 +819,6 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 826 | 819 | * |
| 827 | 820 | * @param KTAPI_Folder $ktapi_target_folder |
| 828 | 821 | * @param string $reason |
| 829 | - * @return true | |
| 830 | 822 | */ |
| 831 | 823 | function move($ktapi_target_folder, $reason='') |
| 832 | 824 | { |
| ... | ... | @@ -852,8 +844,6 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 852 | 844 | return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR); |
| 853 | 845 | } |
| 854 | 846 | DBUtil::commit(); |
| 855 | - | |
| 856 | - return true; | |
| 857 | 847 | } |
| 858 | 848 | |
| 859 | 849 | /** |
| ... | ... | @@ -861,7 +851,6 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 861 | 851 | * |
| 862 | 852 | * @param KTAPI_Folder $ktapi_target_folder |
| 863 | 853 | * @param string $reason |
| 864 | - * @return true | |
| 865 | 854 | */ |
| 866 | 855 | function copy($ktapi_target_folder, $reason='') |
| 867 | 856 | { |
| ... | ... | @@ -888,8 +877,6 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 888 | 877 | return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR); |
| 889 | 878 | } |
| 890 | 879 | DBUtil::commit(); |
| 891 | - | |
| 892 | - return true; | |
| 893 | 880 | } |
| 894 | 881 | |
| 895 | 882 | /** |
| ... | ... | @@ -1000,7 +987,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1000 | 987 | * @param string $reason |
| 1001 | 988 | * @param string $tempfilename |
| 1002 | 989 | * @param bool $major_update |
| 1003 | - * @return true | |
| 1004 | 990 | */ |
| 1005 | 991 | function checkin($filename, $reason, $tempfilename, $major_update=false) |
| 1006 | 992 | { |
| ... | ... | @@ -1038,14 +1024,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1038 | 1024 | return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR); |
| 1039 | 1025 | } |
| 1040 | 1026 | DBUtil::commit(); |
| 1041 | - return true; | |
| 1042 | 1027 | } |
| 1043 | 1028 | |
| 1044 | 1029 | /** |
| 1045 | 1030 | * This reverses the checkout process. |
| 1046 | 1031 | * |
| 1047 | 1032 | * @param string $reason |
| 1048 | - * @return true | |
| 1049 | 1033 | */ |
| 1050 | 1034 | function undo_checkout($reason) |
| 1051 | 1035 | { |
| ... | ... | @@ -1080,14 +1064,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1080 | 1064 | return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR); |
| 1081 | 1065 | } |
| 1082 | 1066 | DBUtil::commit(); |
| 1083 | - return true; | |
| 1084 | 1067 | } |
| 1085 | 1068 | |
| 1086 | 1069 | /** |
| 1087 | 1070 | * This returns a URL to the file that can be downloaded. |
| 1088 | 1071 | * |
| 1089 | 1072 | * @param string $reason |
| 1090 | - * @return true; | |
| 1091 | 1073 | */ |
| 1092 | 1074 | function checkout($reason) |
| 1093 | 1075 | { |
| ... | ... | @@ -1112,15 +1094,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1112 | 1094 | } |
| 1113 | 1095 | |
| 1114 | 1096 | DBUtil::commit(); |
| 1115 | - | |
| 1116 | - return true; | |
| 1117 | 1097 | } |
| 1118 | 1098 | |
| 1119 | 1099 | /** |
| 1120 | 1100 | * This deletes a document from the folder. |
| 1121 | 1101 | * |
| 1122 | 1102 | * @param string $reason |
| 1123 | - * @return mixed This returns true or a PEAR::Error | |
| 1124 | 1103 | */ |
| 1125 | 1104 | function delete($reason) |
| 1126 | 1105 | { |
| ... | ... | @@ -1145,15 +1124,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1145 | 1124 | } |
| 1146 | 1125 | |
| 1147 | 1126 | DBUtil::commit(); |
| 1148 | - | |
| 1149 | - return true; | |
| 1150 | 1127 | } |
| 1151 | 1128 | |
| 1152 | 1129 | /** |
| 1153 | 1130 | * This changes the owner of the file. |
| 1154 | 1131 | * |
| 1155 | 1132 | * @param string $ktapi_newuser |
| 1156 | - * @return true | |
| 1157 | 1133 | */ |
| 1158 | 1134 | function change_owner($newusername, $reason='Changing of owner.') |
| 1159 | 1135 | { |
| ... | ... | @@ -1200,7 +1176,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1200 | 1176 | } |
| 1201 | 1177 | |
| 1202 | 1178 | DBUtil::commit(); |
| 1203 | - return true; | |
| 1204 | 1179 | } |
| 1205 | 1180 | |
| 1206 | 1181 | /** |
| ... | ... | @@ -1210,7 +1185,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1210 | 1185 | * @param string $reason |
| 1211 | 1186 | * @param string $newname |
| 1212 | 1187 | * @param string $newfilename |
| 1213 | - * @return true | |
| 1214 | 1188 | */ |
| 1215 | 1189 | function copy(&$ktapi_target_folder, $reason, $newname=null, $newfilename=null) |
| 1216 | 1190 | { |
| ... | ... | @@ -1226,7 +1200,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1226 | 1200 | $newfilename=null; |
| 1227 | 1201 | } |
| 1228 | 1202 | |
| 1229 | - | |
| 1230 | 1203 | $user = $this->ktapi->get_user(); |
| 1231 | 1204 | |
| 1232 | 1205 | if ($this->document->getIsCheckedOut()) |
| ... | ... | @@ -1303,9 +1276,7 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1303 | 1276 | ); |
| 1304 | 1277 | $oTrigger->setInfo($aInfo); |
| 1305 | 1278 | $ret = $oTrigger->postValidate(); |
| 1306 | - } | |
| 1307 | - | |
| 1308 | - return true; | |
| 1279 | + } | |
| 1309 | 1280 | } |
| 1310 | 1281 | |
| 1311 | 1282 | /** |
| ... | ... | @@ -1315,7 +1286,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1315 | 1286 | * @param string $reason |
| 1316 | 1287 | * @param string $newname |
| 1317 | 1288 | * @param string $newfilename |
| 1318 | - * @return true | |
| 1319 | 1289 | */ |
| 1320 | 1290 | function move(&$ktapi_target_folder, $reason, $newname=null, $newfilename=null) |
| 1321 | 1291 | { |
| ... | ... | @@ -1403,15 +1373,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1403 | 1373 | } |
| 1404 | 1374 | |
| 1405 | 1375 | DBUtil::commit(); |
| 1406 | - | |
| 1407 | - return true; | |
| 1408 | 1376 | } |
| 1409 | 1377 | |
| 1410 | 1378 | /** |
| 1411 | 1379 | * This changes the filename of the document. |
| 1412 | 1380 | * |
| 1413 | 1381 | * @param string $newname |
| 1414 | - * @return true | |
| 1415 | 1382 | */ |
| 1416 | 1383 | function renameFile($newname) |
| 1417 | 1384 | { |
| ... | ... | @@ -1430,15 +1397,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1430 | 1397 | return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR); |
| 1431 | 1398 | } |
| 1432 | 1399 | DBUtil::commit(); |
| 1433 | - | |
| 1434 | - return true; | |
| 1435 | 1400 | } |
| 1436 | 1401 | |
| 1437 | 1402 | /** |
| 1438 | 1403 | * This changes the document type of the document. |
| 1439 | 1404 | * |
| 1440 | 1405 | * @param string $newname |
| 1441 | - * @return true | |
| 1442 | 1406 | */ |
| 1443 | 1407 | function change_document_type($documenttype) |
| 1444 | 1408 | { |
| ... | ... | @@ -1464,14 +1428,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1464 | 1428 | } |
| 1465 | 1429 | DBUtil::commit(); |
| 1466 | 1430 | } |
| 1467 | - return true; | |
| 1468 | 1431 | } |
| 1469 | 1432 | |
| 1470 | 1433 | /** |
| 1471 | 1434 | * This changes the title of the document. |
| 1472 | 1435 | * |
| 1473 | 1436 | * @param string $newname |
| 1474 | - * @return true | |
| 1475 | 1437 | */ |
| 1476 | 1438 | function rename($newname) |
| 1477 | 1439 | { |
| ... | ... | @@ -1496,15 +1458,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1496 | 1458 | } |
| 1497 | 1459 | DBUtil::commit(); |
| 1498 | 1460 | } |
| 1499 | - | |
| 1500 | - return true; | |
| 1501 | 1461 | } |
| 1502 | 1462 | |
| 1503 | 1463 | /** |
| 1504 | 1464 | * This flags the document as 'archived'. |
| 1505 | 1465 | * |
| 1506 | 1466 | * @param string $reason |
| 1507 | - * @return true | |
| 1508 | 1467 | */ |
| 1509 | 1468 | function archive($reason) |
| 1510 | 1469 | { |
| ... | ... | @@ -1541,16 +1500,13 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1541 | 1500 | ); |
| 1542 | 1501 | $oTrigger->setInfo($aInfo); |
| 1543 | 1502 | $ret = $oTrigger->postValidate(); |
| 1544 | - } | |
| 1545 | - | |
| 1546 | - return true; | |
| 1503 | + } | |
| 1547 | 1504 | } |
| 1548 | 1505 | |
| 1549 | 1506 | /** |
| 1550 | 1507 | * This starts a workflow on a document. |
| 1551 | 1508 | * |
| 1552 | 1509 | * @param string $workflow |
| 1553 | - * @return true | |
| 1554 | 1510 | */ |
| 1555 | 1511 | function start_workflow($workflow) |
| 1556 | 1512 | { |
| ... | ... | @@ -1582,14 +1538,11 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1582 | 1538 | return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID); |
| 1583 | 1539 | } |
| 1584 | 1540 | DBUtil::commit(); |
| 1585 | - | |
| 1586 | - return true; | |
| 1587 | 1541 | } |
| 1588 | 1542 | |
| 1589 | 1543 | /** |
| 1590 | 1544 | * This deletes the workflow on the document. |
| 1591 | 1545 | * |
| 1592 | - * @return true | |
| 1593 | 1546 | */ |
| 1594 | 1547 | function delete_workflow() |
| 1595 | 1548 | { |
| ... | ... | @@ -1614,8 +1567,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1614 | 1567 | return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID); |
| 1615 | 1568 | } |
| 1616 | 1569 | DBUtil::commit(); |
| 1617 | - | |
| 1618 | - return true; | |
| 1619 | 1570 | } |
| 1620 | 1571 | |
| 1621 | 1572 | /** |
| ... | ... | @@ -1623,7 +1574,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1623 | 1574 | * |
| 1624 | 1575 | * @param string $transition |
| 1625 | 1576 | * @param string $reason |
| 1626 | - * @return true | |
| 1627 | 1577 | */ |
| 1628 | 1578 | function perform_workflow_transition($transition, $reason) |
| 1629 | 1579 | { |
| ... | ... | @@ -1653,9 +1603,7 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1653 | 1603 | DBUtil::rollback(); |
| 1654 | 1604 | return new PEAR_Error(KTAPI_ERROR_WORKFLOW_INVALID); |
| 1655 | 1605 | } |
| 1656 | - DBUtil::commit(); | |
| 1657 | - | |
| 1658 | - return true; | |
| 1606 | + DBUtil::commit(); | |
| 1659 | 1607 | } |
| 1660 | 1608 | |
| 1661 | 1609 | |
| ... | ... | @@ -1737,7 +1685,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1737 | 1685 | * This updates the metadata on the file. This includes the 'title'. |
| 1738 | 1686 | * |
| 1739 | 1687 | * @param array This is an array containing the metadata to be associated with the file. |
| 1740 | - * @return mixed This returns true or a PEAR::Error | |
| 1741 | 1688 | */ |
| 1742 | 1689 | function update_metadata($metadata) |
| 1743 | 1690 | { |
| ... | ... | @@ -1782,8 +1729,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1782 | 1729 | return new PEAR_Error(sprintf(_kt("Unexpected validation failure: %s."), $result->getMessage())); |
| 1783 | 1730 | } |
| 1784 | 1731 | DBUtil::commit(); |
| 1785 | - | |
| 1786 | - return true; | |
| 1787 | 1732 | } |
| 1788 | 1733 | |
| 1789 | 1734 | |
| ... | ... | @@ -1964,7 +1909,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1964 | 1909 | * This does a download of a version of the document. |
| 1965 | 1910 | * |
| 1966 | 1911 | * @param string $version |
| 1967 | - * @return true | |
| 1968 | 1912 | */ |
| 1969 | 1913 | function download($version=null) |
| 1970 | 1914 | { |
| ... | ... | @@ -1974,8 +1918,6 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1974 | 1918 | |
| 1975 | 1919 | $oDocumentTransaction = & new DocumentTransaction($this->document, 'Document downloaded', 'ktcore.transactions.download', $aOptions); |
| 1976 | 1920 | $oDocumentTransaction->create(); |
| 1977 | - | |
| 1978 | - return true; | |
| 1979 | 1921 | } |
| 1980 | 1922 | |
| 1981 | 1923 | /** |
| ... | ... | @@ -2032,11 +1974,13 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 2032 | 1974 | * This expunges a document from the system. |
| 2033 | 1975 | * |
| 2034 | 1976 | * @access public |
| 2035 | - * @return mixed This returns true or a PEAR::Error | |
| 2036 | 1977 | */ |
| 2037 | 1978 | function expunge() |
| 2038 | 1979 | { |
| 2039 | - if ($this->document->getStatusID()) | |
| 1980 | + if ($this->document->getStatusID() != 3) | |
| 1981 | + { | |
| 1982 | + return new PEAR_Error('You should not purge this'); | |
| 1983 | + } | |
| 2040 | 1984 | DBUtil::startTransaction(); |
| 2041 | 1985 | |
| 2042 | 1986 | $transaction = & new DocumentTransaction($this->document, "Document expunged", 'ktcore.transactions.expunge'); |
| ... | ... | @@ -2052,15 +1996,12 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 2052 | 1996 | $result= $storage->expunge($this->document); |
| 2053 | 1997 | |
| 2054 | 1998 | $this->commitTransaction(); |
| 2055 | - | |
| 2056 | - return true; | |
| 2057 | 1999 | } |
| 2058 | 2000 | |
| 2059 | 2001 | /** |
| 2060 | 2002 | * This expunges a document from the system. |
| 2061 | 2003 | * |
| 2062 | 2004 | * @access public |
| 2063 | - * @return mixed This returns true or a PEAR::Error | |
| 2064 | 2005 | */ |
| 2065 | 2006 | function restore() |
| 2066 | 2007 | { | ... | ... |