<?php
/*
Generated by OutputBooks Team
*/

namespace Trans;

class TransApproval extends TransActivityTracer
{
    private $isNew = false;
    public function __construct()
    {
        parent::__construct();
    }
    public function beforeSave($data)
    {
        goto t7h9i;
        YedBF:
        if (empty($data["\164\162\x61\156\x73\111\144"]) && empty($data["\151\144"])) {
            $this->isNew = true;
        }
        goto Vb0tW;
        Vb0tW:
        if ($ret && !empty($this->oldData)) {
        }
        goto Fd4Qa;
        Fd4Qa:
        return $ret;
        goto tg1Na;
        t7h9i:
        $ret = parent::beforeSave($data);
        goto YedBF;
        tg1Na:
    }
    public function afterSave($data, &$ret)
    {
        goto ncem2;
        Axwo1:
        $data["\151\144"] = $ret["\151\x64"];
        goto GB_xb;
        GB_xb:
        $has_workflow = $this->check_for_approval($data);
        goto TkfOd;
        s9YYp:
        return true;
        goto p5G6N;
        TkfOd:
        if (is_array($has_workflow) && !empty($has_workflow["\167\157\x72\153\106\x6c\x6f\x77\111\144"])) {
            $ret["\x68\141\163\x5f\x61\160\x70\x72\157\x76\x61\x6c"] = 1;
            $ret["\x77\x6f\162\153\106\x6c\x6f\x77\111\x64"] = $has_workflow["\167\x6f\162\153\x46\x6c\x6f\x77\x49\144"];
        }
        goto s9YYp;
        ncem2:
        parent::afterSave($data, $ret);
        goto Axwo1;
        p5G6N:
    }
    public function updatestatus($data)
    {
        goto m77lJ;
        BdLF1:
        if (is_array($has_workflow) && !empty($has_workflow["\167\157\x72\x6b\x46\154\x6f\167\x49\x64"])) {
            $ret["\x68\x61\163\x5f\x61\x70\160\162\157\166\141\x6c"] = 1;
            $ret["\167\x6f\x72\x6b\x46\154\157\167\111\144"] = $has_workflow["\167\x6f\162\153\106\x6c\x6f\167\x49\x64"];
        }
        goto vf82D;
        vf82D:
        return $ret;
        goto Vm1TX;
        m77lJ:
        $ret = parent::updatestatus($data);
        goto eYtbg;
        eYtbg:
        $has_workflow = $this->check_for_approval($data);
        goto BdLF1;
        Vm1TX:
    }
    public function send($data)
    {
        goto SHbAD;
        SHbAD:
        $ret = parent::send($data);
        goto au6sm;
        FxN30:
        return $ret;
        goto jyB5G;
        ky6or:
        if (is_array($has_workflow) && !empty($has_workflow["\167\x6f\x72\x6b\106\x6c\x6f\167\111\x64"])) {
            $ret["\x68\141\163\137\141\x70\160\162\x6f\166\x61\x6c"] = 1;
            $ret["\167\157\x72\153\x46\154\x6f\x77\x49\x64"] = $has_workflow["\167\157\162\153\x46\154\157\167\x49\144"];
        }
        goto FxN30;
        au6sm:
        $has_workflow = $this->check_for_approval($data);
        goto ky6or;
        jyB5G:
    }
    public function delete($trans_id, $is_cancel)
    {
        goto Gf14i;
        Gf14i:
        if (get_user_data("\162\x6f\x6c\145\x43\157\144\145") != "\x41") {
            goto vEsQz;
            vEsQz:
            $trans = $this->CI->db->select("\151\x64\x2c\x20\164\124\x79\160\x65\54\40\151\163\x4c\157\x63\153\x65\144")->from("\164\x72\141\156\x73")->where(array("\143\x49\x64" => $this->cId, "\151\x64" => $trans_id))->get()->row_array();
            goto HZPm2;
            CDnWd:
            if (!empty($has_workflow["\167\x6f\x72\x6b\x46\154\157\x77\111\144"])) {
                goto oITi4;
                xZ3fH:
                if ($ret) {
                    goto KGVnN;
                    nj_iP:
                    $ret["\150\141\x73\x5f\141\x70\160\162\x6f\166\141\154"] = 1;
                    goto vvISb;
                    vvISb:
                    $ret["\x77\157\162\153\106\154\157\x77\x49\144"] = $has_workflow["\167\x6f\x72\153\106\x6c\x6f\167\111\x64"];
                    goto mr95p;
                    KGVnN:
                    $ret = array();
                    goto nj_iP;
                    mr95p:
                }
                goto ez3ux;
                ez3ux:
                return $ret;
                goto iyoRN;
                oITi4:
                $ret = parent::delete($trans_id, true);
                goto xZ3fH;
                iyoRN:
            }
            goto B2PzG;
            HZPm2:
            if (!empty($trans["\x69\163\114\157\x63\x6b\145\144"]) && $trans["\x69\x73\114\157\143\153\x65\144"] == 1) {
                $this->error = "\x54\162\141\x6e\163\141\x63\x74\151\x6f\156\x20\154\x6f\143\x6b\145\x64\54\x20\x63\x61\x6e\47\x74\x20\x64\145\x6c\145\x74\x65\56";
                return false;
            }
            goto QaTbI;
            QaTbI:
            $has_workflow = $this->check_for_approval(array("\x69\x73\116\x65\x77" => false, "\151\163\x44\145\154\x65\164\145" => true, "\164\124\x79\x70\145" => $trans["\x74\x54\x79\160\145"], "\x69\x64" => $trans_id));
            goto CDnWd;
            B2PzG:
        }
        goto AXL3u;
        AXL3u:
        $ret = parent::delete($trans_id, $is_cancel);
        goto YBpFx;
        YBpFx:
        return $ret;
        goto l2RGq;
        l2RGq:
    }
    private function check_for_approval($data)
    {
        goto CH42K;
        CH42K:
        if (get_user_data("\x72\157\x6c\x65\103\157\144\145") == "\101") {
            return array("\167\x6f\x72\x6b\106\154\x6f\167\111\x64" => 0);
        }
        goto PM52U;
        sEeZf:
        $this->CI->load->model("\x77\157\162\x6b\146\154\x6f\167\x4d\157\144\145\154");
        goto MB535;
        MB535:
        $ret = $this->CI->workflowModel->has_workflow($data);
        goto t3L7Z;
        t3L7Z:
        return $ret;
        goto iYuMY;
        PM52U:
        $data["\151\163\116\145\x77"] = $this->isNew;
        goto sEeZf;
        iYuMY:
    }
}
