Ok... so we're here to test me? I like it!

Anyway, I failed :

Here's my code for now:

<? if($row == "1")

{ ?>

<td style="background-color:#9C0"><?=$status_arr[$row;?></td>

<? } else { ?>

<? if ($row == "2")

{ ?>

<td style="background-color: #F00"><?=$status_arr[$row;?></td>

<? } else { ?>

<? if ($row == "3")

{ ?>

<td style="background-color: #FF0"><?=$status_arr[$row;?></td>

<? } ?>

<? } ?>

<? } ?>

Any suggestions?

EDIT:

Ooops! I didnt' see the tricky curve ball you threw in there!!

I just had to change staff_id to sold so it actually looks at the right colum in the DB... hehe...

Thanks!! This is great!

-Emil

Congrats! Now go (conditionally) conquer the world!!

Congrats! Now go (conditionally) conquer the world!!

Heh, well I did what you suggested and this I guess is my final code:

<? if($row == "0") {?>

<td style="background-color:#9C0"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "1") {?>

<td style="background-color:#F00"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "2") {?>

<td style="background-color:#F90"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "3") {?>

<td style="background-color:#FF0"><?=$status_arr[$row;?></td>

<? } ?>

It works great... Now, of course one thing leads to another so I guess my next challenge will be to post an internal reply every time somebody updates the ticket and who/when it was done.. :

Expect some questions :

-Emil

teryakisan, sorry for taking over your thread like this, but I'm at a dead end.. go figure :

So now that we are able to update the status of a ticket, I want to show WHO did it by an internal note..

I found a different hack that I did last week that shows who closed/re-opened a ticket so I tried to us some of that to my advantage but it's confusing.

from (http://sudobash.net/?p=133) he just added inside class.ticket.php:

$this->postNote('Ticket Closed');

return (db_query($sql) && db_affected_rows())?true;

inside the function of either close or re-open.

I'm thinking I need to create 4 new functions for each status update and based on that update, that function needs to be called. Is that right?

So at this point I'm at class.ticket.php:

function onUpdateSold() {

$this->postNote('Ticket Updated to Sold');

return (db_query($sql) && db_affected_rows())?true;

}

function onUpdateUnsold() {

$this->postNote('Ticket Updated to Unsold');

return (db_query($sql) && db_affected_rows())?true;

}

function onUpdatePending() {

$this->postNote('Ticket Updated to Pending');

return (db_query($sql) && db_affected_rows())?true;

}

function onUpdateWorking() {

$this->postNote('Ticket Updated to Working');

return (db_query($sql) && db_affected_rows())?true;

}

My problem is, how do I invoke these functions based on pressing the "update" button we created?

Wouldn't it be easier to just modify the the setSimpleStatus function instead? The idea is, make the function post up a note every time someone changes the work status, right? The setSimpleStatus function is the part that does all the heavy lifting, so lets make it do some more.

So here's what we have to start out with...

in class.ticket.php

function setSimpleStatus($status_val){

$status_val = (int) $status_val; // only allowed to use int

// you can add an error check and message here if you want

$sql = 'UPDATE ' . TICKET_TABLE . ' SET work=' .

db_input($status_val) . ' WHERE ' .

'ticket_id='.db_input($this->getId());

db_query($sql);

}

Lets use our handy dandy IF statement to write the note everytime we update the status...

function setSimpleStatus($status_val){

$status_val = (int) $status_val;// only allowed to use int

if ($status_val == 1){

$this->postNote('Status set to Reviewed');

}

if ($status_val == 2){

$this->postNote('Status set to Responded');

};

// you can add an error check and message here if you want

$sql = 'UPDATE ' . TICKET_TABLE . ' SET work=' .

db_input($status_val) . ' WHERE ' .

'ticket_id='.db_input($this->getId());

db_query($sql);

}

blank

There we go. No need for any new functions. The "what" the "who" and the "when" all wrapped up in one. Woohoo. Just add as many IF's as you have statuses. Note the semi-colons inside the curly braces. These are required since we are running a PHP function inside of another function. Once again, there is probably a much more efficient way to git r done, but, this works and helps you learn about the power of IF!!

BONUS!: In the event that you want to send the client the message about the status change, you can use postMessage in parallel with postNote, like this....

if ($status_val == 1){

$this->postNote('Status set to Reviewed');

$this->postMessage('Your Ticket has been reviewed, someone will contact you shortly.');

}

Here I go again, trying to kill a fly with a shot gun! :

Thanks teryakisan, you save me yet again!

9 days later

trying to put into frontend

teryakisan,

What a fantastic mod! It works great!

I also would like to have this status been shown on the client-side.

I was trying to edit /include/client/viewticket.inc.php

On the top (just under the <?php ) I put the code

$status_arr = array();

$qry = db_query('SELECT * FROM '. STATUS_TABLE);

while($res = db_fetch_array($qry)) {

$status_arr[$res = $res;

}

Then I made a new row in the table

<tr>

<td class="ColLabel"><strong>Voortgang:</strong></td>

<td><span><?=$status_arr[$row;?></span></td>

<td class="ColLabel"><strong>Email:</strong></td>

<td><span><?=$ticket->getEmail()?></span></td>

</tr>

Still it doesn't show the status.. What am I doing wrong?

I have a select drop-down that should simply inform my team members where we stand on the status of an RMA.

I am about to embark on some modifications myself and have a question about your design choice in implementing the simple status field. Specifically, how do you use this field, compared with the existing status enum field? It seems that your Finished is probably about the same as status Closed. Is that right? And everything else would be a variety of Open?

I suppose implementing a separate field gave you more flexibility than extending the status enum?

The reason for simple status to exist at all is because we use our OSTicket installation as a Support Ticketing / RMA system. Simple status is the status for the RMA part of the system, Regular status is for the support ticket part.

6 days later

Is it a fully working mod ?

if I try your mod will it work ?

can I show the status to the client side ?

yep

Yes it is a fully working mod and it does display on the client side. This was developed for a RMA system, which has lots of steps, and keeps the client informed of their RMA status.

Do I follow your first post ? is there a complete code that I could follow ?

I think you did some fix after you did the first post right ?

The full instructions are in post #28, 29, an 30.

I can't find the Email code in staff/ticket.inc.php

2. Next we'll add a new header to the table. I called mine "Progress".

Find this code...

Email

Directly beneath, add this code...

Progress

3. Now we will display the status. At the very top of the page, below the very first <?PHP , add this code...

$status_arr = array("Reviewed","Responded","Quotation Sent","PO Requested","PO Recieved","Awaiting Payment","Payment Recieved","In Transit", "Working", "Finished", "In Return Transit");

Then Find this code...

<td>&nbsp;<?=Format:($row,40)?></td>

Directly below, add this code...

<td nowrap >

<?=$status_arr[$row;?>

</td>

All done, now we have Simple status displaying in staff/tickets.inc.php, MOD completed in next post.

I believe that "email" may have been a field that I added myself. The entry is simply written to the table header, hence the . Good catch.

After implementation. I am getting Error in STATUS when I have click on.

"Problems loading requested admin page. (status)

Possibly access denied, if you believe this is in error please get technical support. "

What could be possibility for above Error?

Yes it is a fully working mod and it does display on the client side. This was developed for a RMA system, which has lots of steps, and keeps the client informed of their RMA status.

I did exactly the steps that you described in #28, 29 and 30.

I don't see any "RMA" simplestatus on the client side! Where do my clients see there "RMA" simplestatus then?

I can only see the "RMA" status in the backend... (when I'm logged in as staff or Admin)

oops!! I added it to my install but didn't update the tutorial. :

in include/client/viewticket.inc.php

under the very first <?php tag add this code...

function showOptionsDrop($selected){ // shows all options but selected...

$string = '';

$sql = 'SELECT * FROM ' . STATUS_TABLE;

$res = db_query($sql);

while ($row = db_fetch_array($res)) {

$k = $row;

$v = $row;

if($selected == $k) // don't double display the selected option

$string .= '<option selected value="'.$k.'">'.$v.'</option>'."\n";

else

$string .= '<option value="'.$k.'">'.$v.'</option>'."\n";

}

return $string;

}

Find this code...

<table align="center" class="infotable" cellspacing="1" cellpadding="3" width="100%" border=0>

Directly below add this code...

<tr>

<th width="100" >Simple Status:</th>

<td nowrap >

<form method="" action="" name="update">

<select name="updatework" width="150" style="width: 150px" disabled="disabled">

<?php echo showOptionsDrop($ticket->getSimpleStatus()); ?>

</select>

</form>

</tr>

Lets also display the status to the client on their open ticket list.

include/client/tickets.inc.php

Find the first block of table headers,around line 100 or so, add...

<th width="150">SimpleStatus</th>

Then, around line 129 or so, add this code...

<td nowrap >

<?if($row == "1")

{?>

<?php echo 'Reviewed'; ?>

<?}?>

<?if($row == "2")

{?>

<?php echo 'Responded'; ?>

<?}?>

<?if($row == "3")

{?>

<?php echo 'Quotation Sent'; ?>

<?}?>

<?if($row == "4")

{?>

<?php echo 'PO Requested'; ?>

<?}?>

<?if($row == "5")

{?>

<?php echo 'PO Recieved'; ?>

<?}?>

<?if($row == "6")

{?>

<span style="color:#F00; text-decoration;"><?php echo 'DFNP'; ?></span>

<?}?>

<?if($row == "7")

{?>

<span style="color:#2A9F00; text-decoration;"><?php echo 'DFP'; ?></span>

<?}?>

<?if($row == "8")

{?>

<?php echo 'Awaiting Payment'; ?>

<?}?>

<?if($row == "9")

{?>

<?php echo 'Payment Recieved'; ?>

<?}?>

<?if($row == "10")

{?>

<?php echo 'In Transit'; ?>

<?}?>

<?if($row == "11")

{?>

<?php echo 'Working'; ?>

<?}?>

<?if($row == "12")

{?>

<?php echo 'Finished'; ?>

<?}?>

<?if($row == "13")

{?>

<?php echo 'In Return Transit'; ?>

<?}?>

</td>

</tr>

There we go. Simple status on the client end. It could probably be prettier and better coded. :

I believe that "email" may have been a field that I added myself. The entry is simply written to the table header, hence the . Good catch.

so can you explain where I add the progress status in ticket.inc.php ?

oops!! I added it to my install but didn't update the tutorial. :

in include/client/viewticket.inc.php

under the very first <?php tag add this code...

...

Find this code...

...

Directly below add this code...

....

Lets also display the status to the client on their open ticket list.

include/client/tickets.inc.php

Find the first block of table headers,around line 100 or so, add...

..

Then, around line 129 or so, add this code...

...

There we go. Simple status on the client end. It could probably be prettier and better coded. :

Thank you so much Teryakisan!

I made an adjustment to the code from Teryakisan, so that the statusses are pulled from the DB instead of the hardcoded statusses in Teryakisan's code...

in include/client/tickets.inc.php

under the very first <?php tag add this code...

$status_arr = array();

$qry = db_query('SELECT * FROM '. STATUS_TABLE);

while($res = db_fetch_array($qry)) {

$status_arr[$res = $res;

}

Then replace to code from Teryakisan that you added around line 129 into:

<? if($row == NULL) {?>

<td><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "1") {?>

<td style="background-color:#FFAA7F"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "2") {?>

<td style="background-color:#FFFFAA"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "3") {?>

<td style="background-color:#D4FFFF"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "4") {?>

<td style="background-color:#D4D4FF"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "5") {?>

<td style="background-color:#D4FF7F"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "6") {?>

<td style="background-color:#9C0"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "7") {?>

<td style="background-color:#9C0"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "8") {?>

<td style="background-color:#9C0"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "9") {?>

<td style="background-color:#9C0"><?=$status_arr[$row;?></td>

<? } ?>

<? if($row == "10") {?>

<td style="background-color:#9C0"><?=$status_arr[$row;?></td>

<? } ?>

19 days later

Thanks for Your work, great MOD Teryakisan:))

BTW, I've got few questions, can you guys provide me to fix some issues?

After implementing code:

1. No options to select in combo box on staff side (ticket view)

2. As qutub110 said, I've problem with new tab Statuses.

This error is displayed:

Problems loading requested admin page. (status)

Possibly access denied, if you believe this is in error please get technical support.

I checked modifications twice, very carefully.

Cheers,

Lucas

Ps. I cannot browse ost_status table in phpmyadmin because it says that table seems to be empty.

Ps2. I did change which was posted by Jorgcoevert (statusses are pulled from the DB) - thanks!!:)

no_status.JPG

no_status1.JPG

a month later

permissions

for some reason my staff needs the ability to delete tickets to change the simple status? is there a way i can chnage this?

7 days later

missing client status

Google translate

Please help me with this:

I can not see the status on the client side.

I followed the steps of teryakisan. on the part of staff there is no problem, the problem is present in the client side. I've looked into several parts and I think it's in the database do not show me status fields. How I can fix this? jorgcoevert follow the steps and I do not display them.

I have a doubt as to insert into the database the following instructions:

mysql> use osTicket;

mysql> create table ost_status (STATUS_ int auto_increment, status_name varchar (255), primary key (STATUS_));

Do not like him from the mysql command, I did it from phopadmin like this:

create table ost_status (STATUS_ int auto_increment, status_name varchar (255), primary key (STATUS_)), and I think the table ost status. But I do not insert any data in the created.

I have doubt that this statement mysql> use osTicket, I'm missing in the database.

Please help with this that took several days trying to fix it

Thanks in advance for your help

Por favor necesito ayuda con lo siguiente:

No puedo ver el estatus en la parte del cliente.

He seguido los pasos de teryakisan . en la parte de staff no hay ningún problema, el problema se presente en la parte del cliente. He mirado en varias partes y creo que es en la base de datos que no me muestras campos en estatus. ¿Como puedo arreglar esto ? segui los pasos de jorgcoevert y tampoco me los muestra.

Tengo una duda respecto a insertar en la base de datos la siguiente instruccion:

mysql> use osticket;

mysql> create table ost_status (status_id int auto_increment, status_name varchar(255), primary key(status_id));

No se como hacerle desde el comando mysql, lo hice desde phpadmin asi:

create table ost_status (status_id int auto_increment, status_name varchar(255), primary key(status_id)); y me creó la tabla ost status. Pero no me inserta ningun dato de los estados.

Tengo la duda de que esta instrucción mysql> use osticket; me quedo haciendo falta en la base de datos.

Por favor ayudenme con esto que llevo varios dias tratando de arreglarlo

Gracias de antemano por su ayuda

client side.jpg

client side1.jpg

staff side.jpg

staff side1.jpg

14 days later

Hi,

Being a junior member, honestly.. i have gone through all the comments.. and got very much confused by reading all of it...: but still wish to have a complete tutorial is single post..

if anyone can help me out in same... i will be really thankful...

Cant rename, delete or add statuses

Hi Teriyakisan,

Let me thank you and Int3grate and many other contributors who actually took out time and put effort into creating a wonderful mod for this wonderful product.

I have installed and worked through your mod, and have got most of the mod working, except for Status tab in Admin panel.

Any changes i do to it, throws an error "Unknown Command!".

Any suggestion on where i might have gone wrong would be greatly appreciated

N.B

The status that you see in the screenshot has been added via phpmyadmin.

ErrorPic.jpg

Not working for me

Hi

Thank you teryakisan for this wonderfull mod..

actually i tried two times to implement this but somehow it is not working for me.

Both times (i followed #28,#29,#30 and also )

But i got stuck at various places, like

a) EMAIL (Email) - also read the discussion on this between tgchen & teryakisan... but not got the alternative for it

(sorry if i am too dumb :( )

b) Also at #58 - (around line 129) -> I am using OST 1.6 ST so difficult to react on this because i have something else on this line numbers.

(again sorry i am too dumb :( )

But somehow believing on myself.. i tried 99.9% percent what ever i got from above mentioned posts.. but when i login to my panel - I saw ZERO results in the list of open, answered, closed, overdue tickets.

(please see attachment for it)

Also when i went to admin panel just to check whether it is able to catch any error - i found following two errors (when ever i tried to click to open, answered, my tickets, closed tickets, overdue.. whatever.. i get these two errors instantly)

a)

Column 'ispublic' in field list is ambiguous

b)

Column 'ispublic' in field list is ambiguous

--------------------------------------------------------------------

please assist this dumb fellow ....:

blank ticket list.jpg

Column 'ispublic' in field list is ambiguous

Hi fackeid,

The error you get is self explanatory. The field ispublic has been defined in more than 1 table in your database, so when you run that sql query, mysql throws an error saying that it doesnt know which table to go to pick the field from.

Solution

1) Change the name of the field in the tables(risky)

You would need to change the field name in every sql query you have used it.

2)

Use aliases

e.g

select ticket.first_field, ticket.second_field, email.first_field, email.second_field

from ost_ticket ticket, ost_email email

where ticket.id_ticket = email.id_ticket;

5 days later

Is this only for the RMA module? or can this also be implemented in the "standard" installation?

23 days later

Hi Teriyakisan,

Let me thank you and Int3grate and many other contributors who actually took out time and put effort into creating a wonderful mod for this wonderful product.

I have installed and worked through your mod, and have got most of the mod working, except for Status tab in Admin panel.

Any changes i do to it, throws an error "Unknown Command!".

Any suggestion on where i might have gone wrong would be greatly appreciated

N.B

The status that you see in the screenshot has been added via phpmyadmin.

I receive this same error. Did anyone ever find a solution??

5 days later

hi ,

I made all but i have a problem

When i hit the button Update nothing happens and i get an error like

"You must select action to perform"

Or when i try to ADD new Status i get "Unkown Command"

Where i`m doing wrong ?

Using 1.6

Edit. All working now i wrote by mistake on other line :)

case 'set_simple_status':

if(!$thisuser->canManageTickets()){

$errors='Perm. Denied. You are not allowed change the RMA status.';

}

if(!$errors)

$ticket->setSimpleStatus($_POST);

break;

9 months later

Hi Teriyakisan,

Let me thank you and Int3grate and many other contributors who actually took out time and put effort into creating a wonderful mod for this wonderful product.

I have installed and worked through your mod, and have got most of the mod working, except for Status tab in Admin panel.

Any changes i do to it, throws an error "Unknown Command!".

Any suggestion on where i might have gone wrong would be greatly appreciated

N.B

The status that you see in the screenshot has been added via phpmyadmin.

Hello arunk - now I have the same problem you dicribed in your post - do you have an answer or a fix for it? Thank you!!! Stefanie :

Experiencing the same problem as arunk - has anyone found a solution. More difficult than finding a street on a (London Map)!

a month later

Hi All,

Just wondering if anyone can shed some light on this issue, I'm experiencing the same thing.

Seems to be reading from the table ok & displaying in both client/staff ticket and viewticket pages, but trying to update the ticket as staff using the dropdown gives "You must select action to perform"

Modifying the value directly in the db record via phpmyadmin works fine.

Any hints would be appreciated :)

Thanks

EDIT:

I think I fixed it. Modified scp\tickets.php - line 200ish

case 'process':

$isdeptmanager=($ticket->getDeptId()==$thisuser->getDeptId())?true;

switch(strtolower($_POST)):

case 'set_simple_status':

if(!$thisuser->canManageTickets()){

$errors='Perm. Denied. You are not allowed change the progress status.';

}

if(!$errors){

$ticket->setSimpleStatus($_POST);

$msg='Progress Status Updated Successfully';

}else{

$errors='Error updating status. Dammos coding is rubbish.';

}

break;

hi ,

I made all but i have a problem

When i hit the button Update nothing happens and i get an error like

"You must select action to perform"

Or when i try to ADD new Status i get "Unkown Command"

Where i`m doing wrong ?

Using 1.6

Edit. All working now i wrote by mistake on other line :)

error.JPG

4 days later

Ost 1.7 rc2

Hello,

Has anyone tried this with 1.7 RC2? I'm trying but lost now.

The problem is viewticket.inc.php is gone now and I have no idea where to add the code that would reside there. Help?

Thanks!

14 days later

Error in Open Tickets, Date, Subject & Department out of order

blank

Please take a look at the pic and see that my Date subject and Department are out of wack, can someone please tell me a fix?

a month later

Update!

Hello everyone,

I am working on updating this Mod tutorial to work with 1.7, using RC4 as a base. I will post it in the 1.7 mods and customization forum when it is ready. Also, I have revamped posts #28, #29, and #30 in this thread to reflect the proper code that you should be searching for. Thanks to everyone for the kind words, really looking forward to creating mods for 1.7ST. See ya'll in the new thread! T.

Update applied and uploaded, See thread (here) for OSt 1.7.

(SecondStatus mod for OSt 1.7)

Write a Reply...