<commit_before><?

//require_once("app/httpspost.php");

class Footprint
{
    var $assignee_override;

    //if id is null, we will do insert. If not, update
    public function __construct($id = null)
    {
        $this->id = $id; 

        $model = new Override();
        $this->assignee_override = $model->get();

        $this->submitter = "OSG-GOC";
        $this->status = "Engineering";
        $this->priority_number = "4";
        $this->description = "";
        $this->title = "no title";
        $this->meta = "";
        $this->metadata = array();
        $this->resetCC();
        $this->resetAssignee();
        $this->ab_fields = array();
        $this->project_fields = array();

        //notification suppression
        $this->suppress_assignees = false;
        $this->suppress_submitter = false;
        $this->suppress_ccs = false;

        //process update flags
        if($id === null) {
            //insert
            $f = true; //insert everything by default
            $this->addAssignee($this->chooseGOCAssignee()); //auto assign someone
            $this->setOriginatingVO("other"); 
            $this->setDestinationVO("other"); 
            $this->setNextAction("ENG Action");
            $this->setNextActionTime(time());
            $this->setTicketType("Problem__fRequest");
            $this->setReadyToClose("No");
        } else {
            //update
            $f = false; //don't update anything by default
        }

        //update flag - we will only send fields to FP that are true.
        $this->b_submitter = $f;
        $this->b_title = $f;
        $this->b_assignees = $f;
        $this->b_cc = $f;
        $this->b_priority = $f;
        $this->b_status = $f;
        $this->b_desc = $f;
        $this->b_contact = $f;
        $this->b_proj = $f;
    }

    public function suppress_assignees() { $this->suppress_assignees = true; } //set to not send assignee emails
    public function suppress_submitter() { $this->suppress_submitter = true; } //set to not send assignee emails
    public function suppress_ccs() { $this->suppress_ccs = true; } //set to not send assignee emails

    public function resetCC()
    {
        $this->permanent_cc = array();
        $this->b_cc = true;
    }

    public function resetAssignee()
    {
        $this->assignees = array();
        $this->b_assignees = true;
    }

    public function setTitle($v) { $this->title = $v; $this->b_title = true; }
    public function setSubmitter($v) { $this->submitter = $v; $this->b_submitter = true; }
    public function setName($v) { 
        //split first name and the last name
        $pos = strpos(trim($v), " ");
        if($pos === false) {
            $first_name = $v;
            $last_name = "";
        } else {
            $first_name = substr($v, 0, $pos);
            $last_name = substr($v, $pos+1);
        }

        $this->ab_fields["First__bName"] = $first_name;
        $this->ab_fields["Last__bName"] = $last_name;
        $this->b_contact = true; 
    }
    public function setOfficePhone($v) { $this->ab_fields["Office__bPhone"] = $v; $this->b_contact = true; }
    public function setEmail($v) { $this->ab_fields["Email__baddress"] = $v; $this->b_contact = true; }


    static public function GetStatusList()
    {
        return array(
            "Engineering",
            "Customer", 
            "Network Administration",
            "Support Agency",
            "Vendor",
            "Resolved",
            "Closed");
    }
    public function setStatus($v) { $this->status = $v; $this->b_status = true; }

    static public function GetPriorityList()
    {
        return array(
            "1" => "Critical",
            "2" => "High",
            "3" => "Elevated",
            "4" => "Normal"
        );
    }

    public function setPriority($v) { $this->priority_number = $v; $this->b_priority = true; } 

    public function addDescription($v) { 
        $this->description .= $v; 
        $this->b_desc = true;
    }
    public function addMeta($v) { 
        $this->meta .= $v;
        $this->b_desc = true;
    }
    public function setMetadata($key, $value) {
        $this->metadata[$key] = $value;
    }
    public function addAssignee($v, $bClear = false) { 
        if($bClear) {
            $this->resetAssignee();
        } 

        //apply override
        if(isset($this->assignee_override[$v])) {
            $newv = $this->assignee_override[$v];
            $this->addMeta("Original assignee $v was overridden by $newv\n");
            $v = $newv;
        }
        
        $this->assignees[] = $v;//no unparsing necessary
        $this->b_assignees = true;
    }<commit_msg>Made sure that metadata always ends with newline character (I need to test it by submitting a ticket at least once..)<commit_after><?

//require_once("app/httpspost.php");

class Footprint
{
    var $assignee_override;

    //if id is null, we will do insert. If not, update
    public function __construct($id = null)
    {
        $this->id = $id; 

        $model = new Override();
        $this->assignee_override = $model->get();

        $this->submitter = "OSG-GOC";
        $this->status = "Engineering";
        $this->priority_number = "4";
        $this->description = "";
        $this->title = "no title";
        $this->meta = "";
        $this->metadata = array();
        $this->resetCC();
        $this->resetAssignee();
        $this->ab_fields = array();
        $this->project_fields = array();

        //notification suppression
        $this->suppress_assignees = false;
        $this->suppress_submitter = false;
        $this->suppress_ccs = false;

        //process update flags
        if($id === null) {
            //insert
            $f = true; //insert everything by default
            $this->addAssignee($this->chooseGOCAssignee()); //auto assign someone
            $this->setOriginatingVO("other"); 
            $this->setDestinationVO("other"); 
            $this->setNextAction("ENG Action");
            $this->setNextActionTime(time());
            $this->setTicketType("Problem__fRequest");
            $this->setReadyToClose("No");
        } else {
            //update
            $f = false; //don't update anything by default
        }

        //update flag - we will only send fields to FP that are true.
        $this->b_submitter = $f;
        $this->b_title = $f;
        $this->b_assignees = $f;
        $this->b_cc = $f;
        $this->b_priority = $f;
        $this->b_status = $f;
        $this->b_desc = $f;
        $this->b_contact = $f;
        $this->b_proj = $f;
    }

    public function suppress_assignees() { $this->suppress_assignees = true; } //set to not send assignee emails
    public function suppress_submitter() { $this->suppress_submitter = true; } //set to not send assignee emails
    public function suppress_ccs() { $this->suppress_ccs = true; } //set to not send assignee emails

    public function resetCC()
    {
        $this->permanent_cc = array();
        $this->b_cc = true;
    }

    public function resetAssignee()
    {
        $this->assignees = array();
        $this->b_assignees = true;
    }

    public function setTitle($v) { $this->title = $v; $this->b_title = true; }
    public function setSubmitter($v) { $this->submitter = $v; $this->b_submitter = true; }
    public function setName($v) { 
        //split first name and the last name
        $pos = strpos(trim($v), " ");
        if($pos === false) {
            $first_name = $v;
            $last_name = "";
        } else {
            $first_name = substr($v, 0, $pos);
            $last_name = substr($v, $pos+1);
        }

        $this->ab_fields["First__bName"] = $first_name;
        $this->ab_fields["Last__bName"] = $last_name;
        $this->b_contact = true; 
    }
    public function setOfficePhone($v) { $this->ab_fields["Office__bPhone"] = $v; $this->b_contact = true; }
    public function setEmail($v) { $this->ab_fields["Email__baddress"] = $v; $this->b_contact = true; }


    static public function GetStatusList()
    {
        return array(
            "Engineering",
            "Customer", 
            "Network Administration",
            "Support Agency",
            "Vendor",
            "Resolved",
            "Closed");
    }
    public function setStatus($v) { $this->status = $v; $this->b_status = true; }

    static public function GetPriorityList()
    {
        return array(
            "1" => "Critical",
            "2" => "High",
            "3" => "Elevated",
            "4" => "Normal"
        );
    }

    public function setPriority($v) { $this->priority_number = $v; $this->b_priority = true; } 

    public function addDescription($v) { 
        $this->description .= $v; 
        $this->b_desc = true;
    }
    public function addMeta($v) { 
        $this->meta .= trim($v)."\n"; //make sure there is newline at the end
        $this->b_desc = true;
    }
    public function setMetadata($key, $value) {
        $this->metadata[$key] = $value;
    }
    public function addAssignee($v, $bClear = false) { 
        if($bClear) {
            $this->resetAssignee();
        } 

        //apply override
        if(isset($this->assignee_override[$v])) {
            $newv = $this->assignee_override[$v];
            $this->addMeta("Original assignee $v was overridden by $newv\n");
            $v = $newv;
        }
        
        $this->assignees[] = $v;//no unparsing necessary
        $this->b_assignees = true;
    }
{'fraction_non_alphanumeric': 0.1528260183138617, 'fraction_numerical': 0.0014735291021997685, 'mean_word_length': 2.0041100221308885, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 145, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1039307', 'n_tokens_mistral': 2995, 'n_tokens_neox': 2866, 'n_words': 654}