Jump to content

Move Support Ticket Custom Fields - Client and Admin Area


faisal

Recommended Posts

on the admin side, you'll need to do the following...

 

1. delete the custom fields tab - just remove line 43 in admin/templates/blend/viewticket.tpl

 

<li><a href="#tab2" role="tab" data-toggle="tab" onclick="loadTab(2, 'customfields', 1)">{$_ADMINLANG.setup.customfields}</a></li>

 

2. paste the code below into admin/templates/blend/viewticket.tpl - probably just after {if !$relatedservices}<br />{/if}

 

        <div class="panel panel-default">
       <div class="panel-heading">
           <h3 class="panel-title">
               <i class="fa fa-database"></i>  {$_ADMINLANG.setup.customfields}</h3>
       </div>
           {foreach from=$customfields item=customfield}
               <div class="list-group">
               <div class="list-group-item">
                   <strong>{$customfield.name}</strong><br>{$customfield.value}
               </div>
               </div>      
           {/foreach}
       </div>

 

on the client side...

 

1. again, use a modified version of the above code - all you should need to change is the Admin Lang for a client side lang...

paste it into six/viewticket.tpl after {if !$invalidTicketId}

 

 <div class="panel panel-default">
       <div class="panel-heading">
           <h3 class="panel-title">
               <i class="fa fa-database"></i>  {$LANG.customfield}</h3>
       </div>
           {foreach from=$customfields item=customfield}
               <div class="list-group">
               <div class="list-group-item">
                   <strong>{$customfield.name}</strong><br>{$customfield.value}
               </div>
               </div>
           {/foreach}
       </div>  

 

2. to remove the sidebar, just create a file in includes/hooks, call it ticketcfsidebar.php and add the following code..

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaSecondarySidebar', 1, function(MenuItem $secondarySidebar)
{
   if (!is_null($secondarySidebar->getChild('Custom Fields'))) {
            $secondarySidebar->removeChild('Custom Fields');                            
   }
});

Edited by brian!
Link to comment
Share on other sites

That is awesome :)

 

Thank you very much, that was very helpful.

 

 

*Note the client area code above missing:

[color=#000000][color=#007700]            {/foreach}
       </[/color][color=#0000BB]div[/color][color=#007700]>  [/color][/color]

So if anybody just copying and pasting this please be careful.

Link to comment
Share on other sites

Hmm, What about Text Area! (nl2br)

 

Do you think is it OK to use "nl2br" for all custom fields?

{if $customfields}
   <ul>
   {foreach from=$customfields item=customfield}
       <li><strong>{$customfield.name}</strong> {$customfield.value|nl2br}</li>
   {/foreach}
   </ul>
{/if}

 

 

Or I can do something like:

This is not working it is just an idea

{if $customfields}
   <ul>
   {foreach from=$customfields item=customfield}
       <li>
           <strong>{$customfield.name}</strong>
           {if $customfieldtype == 'textarea'}
               {$customfield.value|nl2br}
           {else}
               {$customfield.value}
           {/if}
       </li>
   {/foreach}
   </ul>
{/if}

Link to comment
Share on other sites

OK this code is working fine:

{if $customfields}
   <ul>
   {foreach from=$customfields item=customfield}
       <li>
           <strong>{$customfield.name}</strong>
           {if $customfield.type eq "textarea"}
               {$customfield.value|nl2br}
           {else}
               {$customfield.value}
           {/if}
       </li>
   {/foreach}
   </ul>
{/if}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated