Archive for the ‘ PHP ’ Category

Erstmal muss folgende Anleitung befolgt werden:

—–

If you want to customize the ticket number in your osTicket System, then this modification is for you. As we know, the ticketID field in ost_ticket table has the field type as int(11). It means that this field can only contains of the numerical data. Sometimes you want to change that original ticket number from which contains of the six digits numerical data become something which contains of the alpha-numeric characters. For example, you want to add the Custom prefix which in this case contains of letters, then you have to alter that field type, for instance, become varchar(12).

  1. Alter your ost_ticket table by changing the type of ticketID field, from int(11) become varchar(12). Adjust the value: 12 with your requirement.
  2. Open your \include\class.misc.php file, and find this code:
    30
    
            return mt_rand($start,$end);

    then replace with:

    30
    
            return "Custom".mt_rand($start,$end);
  3. Open your login.php file, and find this code:
    44
    45
    
        //See if we can fetch local ticket id associated with the ID given
        if(!$errors && is_numeric($ticketID) && Validator::is_email($email) && ($tid=Ticket::getIdByExtId($ticketID))) {

    then replace with this following code:

    44
    45
    
        //See if we can fetch local ticket id associated with the ID given
        if(!$errors && Validator::is_email($email) && ($tid=Ticket::getIdByExtId($ticketID))) {
  4. Open your \include\staff\tickets.inc.php file, and find this code:
    136
    
            if(is_numeric($searchTerm)){

    then replace with this following code:

    136
    
            if($searchTerm){
  5. Open your \include\ajax.tickets.php file, and find this code:
    49
    
            if(is_numeric($input)) {

    then replace with this following code:

    49
    
            if($input) {

    Find again this code:

    71
    
            if(!$params['tid'] or !is_numeric($params['tid']))

    then replace with this following code:

    71
    
            if(!$params['tid'])

    Find again this code:

    104
    
            if(!$params['id'] or !is_numeric($params['id']))

    then replace with this following code:

    104
    
            if(!$params['id'])
  6. Open your tickets.php file, and find this code:
    if(($id=$_REQUEST['id']?$_REQUEST['id']:$_POST['ticket_id']) && is_numeric($id)) {
        //id given fetch the ticket info and check perm.
        $ticket= new Ticket(Ticket::getIdByExtId((int)$id));

    then replace with this following code:

    if(($id=$_REQUEST['id']?$_REQUEST['id']:$_POST['ticket_id']) && $id) {
        //id given fetch the ticket info and check perm.
        $ticket= new Ticket(Ticket::getIdByExtId($id));

In this example, you want to add the Custom prefix into the ticket number.

——-

Und dann noch der fehlende letzte Schritt von mir:

——-

in include\class.ticket.php

Line 1331 and 1332 search for:

$extId=$id; //To make things really easy we are going to use autoincrement ticket_id.
db_query(‘UPDATE ‘.TICKET_TABLE.’ SET ticketID=’.db_input($extId).’ WHERE ticket_id=’.$id);

replace with:

$extId=$id; //To make things really easy we are going to use autoincrement ticket_id.
db_query(‘UPDATE ‘.TICKET_TABLE.’ SET ticketID=”Custom’.db_input($extId).’” WHERE ticket_id=’.$id);

——-

Suche Confixx-Schnittstelle per PHP

Derzeit suche ich ein PHP-Script welches es ermöglicht Confixx 3.x Professional anzusteuern.

Wer über ein solchen verfügt bzw. weiß wo es so eines zu finden gibt, der gebe mir bitte bescheid. :-)

Standardmäßig ist PHP so eingestellt, das ein Script maximal 30 Sekunden Zeit hat seine Aufgaben durchzuführen. Danach wird es so zu sagen “gekilled”.

Um diesem entgegen zu wirken gibt es einen bestimmten Befehl der wie folgt lautet:

ini_set(“max_execution_time”,”false”);

// keine Laufzeit, Script läuft teoretisch bis alles durchgeführt wurde, egal wie lange dieses dauert

ini_set(“max_execution_time”,”60″)

// Script läuft maximal 60 Sekunden

Ich persönlich nutze diesen Befehl eigentlich nur, wenn die Ausführung länger als 30 Sekunden dauert, da auf externe Quelle zugegriffen werden muss und deren Response gebraucht wird oder um eine gute Endschlosschleife zu erzeugen.