Commit 2bbfabf2634d63d37ffc54627a04d488dac197a1

Authored by michael
1 parent 0f994a94

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,28 +10,35 @@
10 10
11 require_once("../../../../../config/dmsDefaults.php"); 11 require_once("../../../../../config/dmsDefaults.php");
12 12
13 -global $default;  
14 -  
15 if(checkSession()) { 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 // include the page template (with navbar) 29 // include the page template (with navbar)
18 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); 30 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
19 - 31 + global $default;
20 $Center .= renderHeading("Add Document Field"); 32 $Center .= renderHeading("Add Document Field");
21 $Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n"; 33 $Center .= "<TABLE BORDER=\"0\" CELLSPACING=\"2\" CELLPADDING=\"2\">\n";
22 $Center .= "<tr>\n"; 34 $Center .= "<tr>\n";
23 - if ($fDocTypeID == -1) { 35 + if ($fDocFieldID == -1) {
24 $Center .= "<td><b>Document Field addition Unsuccessful!</b></td>\n"; 36 $Center .= "<td><b>Document Field addition Unsuccessful!</b></td>\n";
25 $Center .= "</tr>\n"; 37 $Center .= "</tr>\n";
26 $Center .= "<tr></tr>\n"; 38 $Center .= "<tr></tr>\n";
27 - $Center .= "<tr>\n";  
28 - $Center .= "<td>Document Type already exists</td>\n";  
29 - $Center .= "</tr>\n";  
30 -  
31 } else { 39 } else {
32 $Center .= "<td><b>Document Field added Successfully!</b></td>\n"; 40 $Center .= "<td><b>Document Field added Successfully!</b></td>\n";
33 $Center .= "</tr>\n"; 41 $Center .= "</tr>\n";
34 -  
35 } 42 }
36 $Center .= "<tr></tr>\n"; 43 $Center .= "<tr></tr>\n";
37 $Center .= "<tr></tr>\n"; 44 $Center .= "<tr></tr>\n";