Commit b69ebd60fa1b51e27e96e97384f58f0685aebffb

Authored by Michael Joseph
1 parent b86f1fc9

fixed #2673- if a new document field has a lookup, then redirect to add lookup page


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2331 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/docfieldmanagement/addDocFieldSuccess.php
... ... @@ -10,28 +10,35 @@
10 10  
11 11 require_once("../../../../../config/dmsDefaults.php");
12 12  
13   -global $default;
14   -
15 13 if(checkSession()) {
  14 + require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc");
  15 +
  16 + $oDocField = DocumentField::get($fDocFieldID);
  17 + if ($oDocField) {
  18 + // if we're setting lookup to be true, then prompt for an initial lookup value??
  19 + if ($oDocField->getHasLookup()) {
  20 + // and there are no metadata values for this lookup
  21 + // there shouldn't be since this has just been added- but lets be paranoid shall we?
  22 + if (DocumentField::getLookupCount($fDocFieldID) == 0) {
  23 + // then redirect to the edit metadata page
  24 + controllerRedirect("addMetaDataForField", "fDocFieldID=$fDocFieldID");
  25 + }
  26 + }
  27 + }
16 28  
17 29 // include the page template (with navbar)
18 30 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
19   -
  31 + global $default;
20 32 $Center .= renderHeading("Add Document Field");
21 33 $Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n";
22 34 $Center .= "<tr>\n";
23   - if ($fDocTypeID == -1) {
  35 + if ($fDocFieldID == -1) {
24 36 $Center .= "<td><b>Document Field addition Unsuccessful!</b></td>\n";
25 37 $Center .= "</tr>\n";
26 38 $Center .= "<tr></tr>\n";
27   - $Center .= "<tr>\n";
28   - $Center .= "<td>Document Type already exists</td>\n";
29   - $Center .= "</tr>\n";
30   -
31 39 } else {
32 40 $Center .= "<td><b>Document Field added Successfully!</b></td>\n";
33 41 $Center .= "</tr>\n";
34   -
35 42 }
36 43 $Center .= "<tr></tr>\n";
37 44 $Center .= "<tr></tr>\n";
... ...