From 7f55a0b27c64ee275dd7c5428646c5e58b4c2986 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 13 Aug 2015 13:53:03 -0500
Subject: [PATCH] registration: Render !visible, !editable fields

So, fields with only the 'required' flag set for users are shown for the
registration page.
---
 include/client/register.inc.php                | 2 +-
 include/client/templates/dynamic-form.tmpl.php | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/client/register.inc.php b/include/client/register.inc.php
index bf6830952..4f683c718 100644
--- a/include/client/register.inc.php
+++ b/include/client/register.inc.php
@@ -27,7 +27,7 @@ $info = Format::htmlchars(($errors && $_POST)?$_POST:$info);
 <tbody>
 <?php
     $cf = $user_form ?: UserForm::getInstance();
-    $cf->render(false);
+    $cf->render(false, false, array('mode' => 'create'));
 ?>
 <tr>
     <td colspan="2">
diff --git a/include/client/templates/dynamic-form.tmpl.php b/include/client/templates/dynamic-form.tmpl.php
index 7a23a4546..cfde56a64 100644
--- a/include/client/templates/dynamic-form.tmpl.php
+++ b/include/client/templates/dynamic-form.tmpl.php
@@ -14,8 +14,13 @@
     // 'private' are not included in the output for clients
     global $thisclient;
     foreach ($form->getFields() as $field) {
-        if (!$field->isVisibleToUsers() && !$field->isEditableToUsers())
+        if (isset($options['mode']) && $options['mode'] == 'create') {
+            if (!$field->isVisibleToUsers() && !$field->isRequiredForUsers())
+                continue;
+        }
+        elseif (!$field->isVisibleToUsers() && !$field->isEditableToUsers()) {
             continue;
+        }
         ?>
         <tr>
             <td colspan="2" style="padding-top:10px;">
-- 
GitLab