0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 13.59.58.68


Current Path : /var/www/html/univadmin/src/
Upload File :
Current File : /var/www/html/univadmin/src/savePostNotification.php

<?php

function savePostNotification($aobj_context)
{
    //$valuationType = $aobj_context->mobj_data['valuationType'];
    $univcode = $aobj_context->mobj_data['univcode'];
    $req = $aobj_context->req_body['data'];
    $fdescpn = $aobj_context->req_body['descpn'];
     
    $fpostno = $req['fpostno'];
    $fdeggrp = $req['fdeggrp'];
    $fusertype=$req['fusertype'];
    $flabel = $req['flabel'];
    //$fdescpn= $req['fdescpn'];
    $ffilepath = $req['ffilepath'];
    $ffromdate = $req['ffromdate'];
    $ftodate = $req['ftodate'];
    $forder = $req['forder'];
    $fcreatedate = $req['fcreatedate'];
    $fcolour = $req['fcolour'];
    $fnew = $req['fnew'];
    $sameFile = $aobj_context->mobj_data['samefile'];


    $query = "select * from postnotfn where fpostno = '{$fpostno}'";
//    var_dump($query);
   
    $result = $aobj_context->pobj_db->GetAll($query);
    
    if(sizeof($result)>0)
    {
        $file = '';
        $description="";

        if($sameFile == 'No'|| $sameFile == 'F' ){
            $file = "ffilepath = '{$ffilepath}',";
        }
        if($fdescpn != ""){
            $description = "fdescpn = '{$fdescpn}',";
        }
        $updateQuery = "update postnotfn set fdeggrp='{$fdeggrp}', 
        fusertype='{$fusertype}', flabel ='{$flabel}', $description 
        $file ffromdate = date_format(STR_TO_DATE('{$ffromdate}','%d/%m/%Y'),'%Y-%m-%d'), 
        ftodate=date_format(STR_TO_DATE('{$ftodate}','%d/%m/%Y'),'%Y-%m-%d'),
        forder = '{$forder}', 
        fupdatedate= NOW(), fcolour = '{$fcolour}', fnew = '{$fnew}' 
        where fpostno = '{$fpostno}'";

        // var_dump($updateQuery);

        $update = $aobj_context->pobj_db->Execute($updateQuery);
        if($update){
            $arr['msg'] = "Updated successfully.";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
            return;
        }else{
            $arr['msg']="Notification is not updated successfully, please try later";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;
        }        
    }
    else
    {
        $insertQuery = "insert into postnotfn 
        (fdeggrp,fusertype,flabel,fdescpn,ffilepath,ffromdate,ftodate,forder,fcreatedate) 
        values('$fdeggrp','{$fusertype}','{$flabel}','{$fdescpn}','{$ffilepath}',
        date_format(STR_TO_DATE('{$ffromdate}','%d/%m/%Y'),'%Y-%m-%d'),
        date_format(STR_TO_DATE('{$ftodate}','%d/%m/%Y'),'%Y-%m-%d')
       ,'{$forder}',NOW())";
        
        $insertResult = $aobj_context->pobj_db->Execute($insertQuery);
        if($insertResult){
            $arr['msg']="Notification Added successfully";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
            return;

        }else{
            $arr['msg']="Notification is not inserted successfully, please try later";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;

        }


    }   
}

?>