How: Add more Custom field

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Edarat.Net
Posts: 6
Joined: Sun Oct 12, 2008 8:57 am

How: Add more Custom field

Post by Edarat.Net »

Script URL: http://www.estesharat.edarat.net
Version of script: 0.94.1
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Custom field
Write your message below:

Hello,

There is 5 Custom field on the script and need to have more. Is it doable?

Thanks,
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Doable yes (if you know PHP and MySQL :wink: ), but requires quite some editing and is unfortunately out of the scope of my support.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Edarat.Net
Posts: 6
Joined: Sun Oct 12, 2008 8:57 am

I got it :-)

Post by Edarat.Net »

time to think and finish :-)


Please find below the answer:

For Example we need to make it 7
1- Edit file -> admin_settings.php

Change:

for ($i=1;$i<=5;$i++)
To be ===>
for ($i=1;$i<=7;$i++)
2- Do the same at admin_settings_save.php

3- Edit file -> admin_settings.php

Change:
if (d.s_use_custom[1].checked) {
if (d.s_custom1_use.checked && d.s_custom1_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom2_use.checked && d.s_custom2_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom3_use.checked && d.s_custom3_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom4_use.checked && d.s_custom4_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom5_use.checked && d.s_custom5_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
To be ==>
if (d.s_use_custom[1].checked) {
if (d.s_custom1_use.checked && d.s_custom1_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom2_use.checked && d.s_custom2_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom3_use.checked && d.s_custom3_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom4_use.checked && d.s_custom4_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom5_use.checked && d.s_custom5_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom6_use.checked && d.s_custom6_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
if (d.s_custom7_use.checked && d.s_custom7_name.value == '') {alert('<?php echo $hesklang['err_custname']; ?>'); return false;}
I just change this and I am till working on it ....

Thanks,
Edarat.Net
Posts: 6
Joined: Sun Oct 12, 2008 8:57 am

More Editing ....

Post by Edarat.Net »

4- Edit admin_ticket.php

Change:
myMsg = myMsg.replace(/%%HESK_NAME%%/g, '<?php echo str_replace('\'','\\\'',$ticket['name']); ?>');
myMsg = myMsg.replace(/%%HESK_EMAIL%%/g, '<?php echo str_replace('\'','\\\'',$ticket['email']); ?>');
myMsg = myMsg.replace(/%%HESK_custom1%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom1']); ?>');
myMsg = myMsg.replace(/%%HESK_custom2%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom2']); ?>');
myMsg = myMsg.replace(/%%HESK_custom3%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom3']); ?>');
myMsg = myMsg.replace(/%%HESK_custom4%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom4']); ?>');
myMsg = myMsg.replace(/%%HESK_custom5%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom5']); ?>');
To be ==>
myMsg = myMsg.replace(/%%HESK_NAME%%/g, '<?php echo str_replace('\'','\\\'',$ticket['name']); ?>');
myMsg = myMsg.replace(/%%HESK_EMAIL%%/g, '<?php echo str_replace('\'','\\\'',$ticket['email']); ?>');
myMsg = myMsg.replace(/%%HESK_custom1%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom1']); ?>');
myMsg = myMsg.replace(/%%HESK_custom2%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom2']); ?>');
myMsg = myMsg.replace(/%%HESK_custom3%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom3']); ?>');
myMsg = myMsg.replace(/%%HESK_custom4%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom4']); ?>');
myMsg = myMsg.replace(/%%HESK_custom5%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom5']); ?>');
myMsg = myMsg.replace(/%%HESK_custom6%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom6']); ?>');
myMsg = myMsg.replace(/%%HESK_custom7%%/g, '<?php echo str_replace('\'','\\\'',$ticket['custom7']); ?>');
5- I think you have to check hesk_settings.inc.php to be writable during editing maybe...

I will try and come back to you ...
Edarat.Net
Posts: 6
Joined: Sun Oct 12, 2008 8:57 am

Post by Edarat.Net »

Hello,

All working well but :oops:

once you write in the new field you can't see it on the admin page :( :( :(

Anyhow, let us try again all

Regards,
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

You are missing the main thing: once submitted the data must be inserted in the database. So you need to:

a) add more fields in the MySQL database

and

b) edit code in submit_ticket.php to process form fields and add insert the submitted info into the database.

Maybe this will also help:
viewtopic.php?t=1435&highlight=custom+fields
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Edarat.Net
Posts: 6
Joined: Sun Oct 12, 2008 8:57 am

Done

Post by Edarat.Net »

:o Yes Yes Yes,

I add on databasa => Ticket table custom6 and custom7

plus add on submit_ticket.php the following:
INSERT INTO `hesk_tickets` (
`trackid`,`name`,`email`,`category`,`priority`,`subject`,`message`,`dt`,`lastchange`,`ip`,`status`,`attachments`,`custom1`,`custom2`,`custom3`,`custom4`,`custom5`
To be ==>
INSERT INTO `hesk_tickets` (
`trackid`,`name`,`email`,`category`,`priority`,`subject`,`message`,`dt`,`lastchange`,`ip`,`status`,`attachments`,`custom1`,`custom2`,`custom3`,`custom4`,`custom5`,`custom6`,`custom7`
and
VALUES (
'$trackingID','$name','$email','$category','$priority','$subject','$message',NOW(),NOW(),'$_SERVER[REMOTE_ADDR]','0','$myattachments','$custom1','$custom2','$custom3','$custom4','$custom5'
to be ==>
VALUES (
'$trackingID','$name','$email','$category','$priority','$subject','$message',NOW(),NOW(),'$_SERVER[REMOTE_ADDR]','0','$myattachments','$custom1','$custom2','$custom3','$custom4','$custom5','$custom6','$custom7'
Thanks for support and hope that any one need to add fileds just to change the above needed.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Thanks to you to for sharing the final result so other can use it too :wink:
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
quicu
Posts: 1
Joined: Tue Nov 04, 2008 10:54 am

Post by quicu »

Is it very different for v2.0?
Post Reply