From c5b95d0dc02aa687fbbd36396676715175f2c618 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 10 Dec 2014 12:29:24 -0600 Subject: [PATCH] forms: Hide 'require for ticket close' for non ticket-related forms --- include/class.dynamic_forms.php | 33 +++++++++++-------- .../templates/dynamic-field-config.tmpl.php | 9 +++-- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index c237e747f..d8ce6d282 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -423,27 +423,32 @@ class DynamicFormField extends VerySimpleModel { var $_field; - const FLAG_ENABLED = 0x0001; - const FLAG_EXT_STORED = 0x0002; // Value stored outside of form_entry_value - const FLAG_CLOSE_REQUIRED = 0x0004; - - const FLAG_MASK_CHANGE = 0x0010; - const FLAG_MASK_DELETE = 0x0020; - const FLAG_MASK_EDIT = 0x0040; - const FLAG_MASK_DISABLE = 0x0080; + const FLAG_ENABLED = 0x00001; + const FLAG_EXT_STORED = 0x00002; // Value stored outside of form_entry_value + const FLAG_CLOSE_REQUIRED = 0x00004; + + const FLAG_MASK_CHANGE = 0x00010; + const FLAG_MASK_DELETE = 0x00020; + const FLAG_MASK_EDIT = 0x00040; + const FLAG_MASK_DISABLE = 0x00080; const FLAG_MASK_REQUIRE = 0x10000; const FLAG_MASK_VIEW = 0x20000; const FLAG_MASK_NAME = 0x40000; + const MASK_MASK_INTERNAL = 0x400B0; # !change, !delete, !disable, !edit-name const MASK_MASK_ALL = 0x700F0; - const FLAG_CLIENT_VIEW = 0x0100; - const FLAG_CLIENT_EDIT = 0x0200; - const FLAG_CLIENT_REQUIRED = 0x0400; + const FLAG_CLIENT_VIEW = 0x00100; + const FLAG_CLIENT_EDIT = 0x00200; + const FLAG_CLIENT_REQUIRED = 0x00400; - const FLAG_AGENT_VIEW = 0x1000; - const FLAG_AGENT_EDIT = 0x2000; - const FLAG_AGENT_REQUIRED = 0x4000; + const MASK_CLIENT_FULL = 0x00700; + + const FLAG_AGENT_VIEW = 0x01000; + const FLAG_AGENT_EDIT = 0x02000; + const FLAG_AGENT_REQUIRED = 0x04000; + + const MASK_AGENT_FULL = 0x7000; // Multiple inheritance -- delegate to FormField function __call($what, $args) { diff --git a/include/staff/templates/dynamic-field-config.tmpl.php b/include/staff/templates/dynamic-field-config.tmpl.php index ab77ecf32..470684604 100644 --- a/include/staff/templates/dynamic-field-config.tmpl.php +++ b/include/staff/templates/dynamic-field-config.tmpl.php @@ -38,7 +38,7 @@ echo DynamicFormField::FLAG_CLIENT_VIEW; ?>" <?php if ($field->hasFlag(DynamicFormField::FLAG_CLIENT_VIEW)) echo 'checked="checked"'; if ($field->isPrivacyForced()) echo ' disabled="disabled"'; - ?>> <?php echo __('For Clients'); ?><br/> + ?>> <?php echo __('For EndUsers'); ?><br/> </div> <div class="span3"> <input type="checkbox" name="flags[]" value="<?php @@ -63,7 +63,7 @@ echo DynamicFormField::FLAG_CLIENT_REQUIRED; ?>" <?php if ($field->hasFlag(DynamicFormField::FLAG_CLIENT_REQUIRED)) echo 'checked="checked"'; if ($field->isRequirementForced()) echo ' disabled="disabled"'; - ?>> <?php echo __('For Clients'); ?><br/> + ?>> <?php echo __('For EndUsers'); ?><br/> </div> <div class="span3"> <input type="checkbox" name="flags[]" value="<?php @@ -86,7 +86,7 @@ <input type="checkbox" name="flags[]" value="<?php echo DynamicFormField::FLAG_CLIENT_EDIT; ?>" <?php if ($field->hasFlag(DynamicFormField::FLAG_CLIENT_EDIT)) echo 'checked="checked"'; - ?>> <?php echo __('For Clients'); ?><br/> + ?>> <?php echo __('For EndUsers'); ?><br/> </div> <div class="span3"> <input type="checkbox" name="flags[]" value="<?php @@ -94,6 +94,8 @@ if ($field->hasFlag(DynamicFormField::FLAG_AGENT_EDIT)) echo 'checked="checked"'; ?>> <?php echo __('For Agents'); ?><br/> </div> + +<?php if (in_array($field->get('form')->get('type'), array('G', 'T'))) { ?> <hr class="faded"/> <div class="span4"> @@ -109,6 +111,7 @@ if ($field->hasFlag(DynamicFormField::FLAG_CLOSE_REQUIRED)) echo 'checked="checked"'; ?>> <?php echo __('Required to close a ticket'); ?><br/> </div> +<?php } ?> <?php } ?> </div> </div> -- GitLab