remodification of dual load of custom info
Showing
1 changed file
with
45 additions
and
21 deletions
| ... | @@ -228,14 +228,46 @@ class DialerController extends Controller | ... | @@ -228,14 +228,46 @@ class DialerController extends Controller |
| 228 | } | 228 | } |
| 229 | $wakka->setPersonKey($users[0]['id'], "status", "Incall"); | 229 | $wakka->setPersonKey($users[0]['id'], "status", "Incall"); |
| 230 | // $searchresult = '<div style="clear:both"></div><div id=divworking></div><div style="clear:both"></div>'; | 230 | // $searchresult = '<div style="clear:both"></div><div id=divworking></div><div style="clear:both"></div>'; |
| 231 | |||
| 232 | if (!empty($users)) { | ||
| 233 | if (sizeof($users) >= 1) { | ||
| 231 | $searchresult = "<div style='clear:both'></div><div id=divworking></div><div style='clear:both'></div><script>showRecruit(\"" . $users[0]['id'] . "\",\"" . $enable . "\");</script>"; | 234 | $searchresult = "<div style='clear:both'></div><div id=divworking></div><div style='clear:both'></div><script>showRecruit(\"" . $users[0]['id'] . "\",\"" . $enable . "\");</script>"; |
| 232 | 235 | ||
| 236 | |||
| 237 | $searchresult .= "<script>kSetDData('C','crmid','" . $users[0]['id'] . "');kSetDData('C','callnumber','$callnumber');</script>"; | ||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | $searchresult .= "<div id=internalid_matchlist></div><script> | ||
| 242 | doAjax('record?action=quicksearch','maintextsearch_1_txt=" . $users[0]['clientinternalid'] . "&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | ||
| 243 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | ||
| 244 | }); | ||
| 245 | |||
| 246 | doAjax('dialer?action=agentcall&users=" . urlencode(json_encode($users)) . "&callnumber=" . $callnumber . "&client=" . $client. "&mDialerState=" . $kstychDialer['mDialerState'] . "','','', 'ajax_manualdial','singlefail','POST',function(retstr){ | ||
| 247 | console.log(retstr.responseText); | ||
| 248 | doAjax('dialer?action=dialcall&sipid="retstr.responseText"','','', 'ajax_manualdial','singlefail','POST'); | ||
| 249 | }); | ||
| 250 | </script>"; | ||
| 251 | |||
| 252 | |||
| 253 | return Response::make($searchresult); | ||
| 254 | } else { | ||
| 255 | return Response::make($searchresult . "<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','Multiple Records Found!');createSearchRecordDiv('dialersearchbox');</script>"); | ||
| 256 | } | ||
| 257 | } else return Response::make($searchresult .= "<div id=internalid_matchlist></div><script>createSearchRecordDiv('internalid_matchlist');</script>"); | ||
| 258 | } | ||
| 259 | if ($action == "agentcall") { | ||
| 260 | $wakka = new KHRMSLib(); | ||
| 261 | $users=json_decode(html_entity_decode(Input::get("users"))); | ||
| 262 | $callnumber=Input::get("callnumber"); | ||
| 263 | $client=Input::get("client"); | ||
| 264 | $mDialerState=Input::get("mDialerState"); | ||
| 233 | if (!empty($users)) { | 265 | if (!empty($users)) { |
| 234 | if (sizeof($users) >= 1) { | 266 | if (sizeof($users) >= 1) { |
| 235 | $users[0]['peopledata'] = preg_replace_callback('!s:(\d+):"(.*?)";!', function ($m) { | 267 | $users[0]->peopledata = preg_replace_callback('!s:(\d+):"(.*?)";!', function ($m) { |
| 236 | return "s:" . strlen($m[2]) . ":\"" . $m[2] . "\";"; | 268 | return "s:" . strlen($m[2]) . ":\"" . $m[2] . "\";"; |
| 237 | }, $users[0]['peopledata']); | 269 | }, $users[0]->peopledata); |
| 238 | $ppldata = unserialize($users[0]['peopledata']); | 270 | $ppldata = unserialize($users[0]->peopledata); |
| 239 | if (!isset($ppldata['client'])) $ppldata['client'] = ""; | 271 | if (!isset($ppldata['client'])) $ppldata['client'] = ""; |
| 240 | if (!isset($ppldata['department'])) $ppldata['department'] = ""; | 272 | if (!isset($ppldata['department'])) $ppldata['department'] = ""; |
| 241 | 273 | ||
| ... | @@ -252,7 +284,6 @@ class DialerController extends Controller | ... | @@ -252,7 +284,6 @@ class DialerController extends Controller |
| 252 | $callerid = $calleridarr[0]; | 284 | $callerid = $calleridarr[0]; |
| 253 | $dspan = $calleridarr[1]; | 285 | $dspan = $calleridarr[1]; |
| 254 | } | 286 | } |
| 255 | |||
| 256 | //see if user is online on this sipid | 287 | //see if user is online on this sipid |
| 257 | $userstatus = false; | 288 | $userstatus = false; |
| 258 | if (Auth::user()->sessiontype == '1') { //Mobile Session | 289 | if (Auth::user()->sessiontype == '1') { //Mobile Session |
| ... | @@ -302,7 +333,7 @@ class DialerController extends Controller | ... | @@ -302,7 +333,7 @@ class DialerController extends Controller |
| 302 | if ($dialline) { | 333 | if ($dialline) { |
| 303 | $dialline->status = "Blocked"; | 334 | $dialline->status = "Blocked"; |
| 304 | $dialline->user_id = Auth::user()->id; | 335 | $dialline->user_id = Auth::user()->id; |
| 305 | $dialline->number = $users[0]['mobile']; | 336 | $dialline->number = $users[0]->mobile; |
| 306 | $dialline->regexstr = $client; | 337 | $dialline->regexstr = $client; |
| 307 | $dialline->save(); | 338 | $dialline->save(); |
| 308 | 339 | ||
| ... | @@ -312,19 +343,18 @@ class DialerController extends Controller | ... | @@ -312,19 +343,18 @@ class DialerController extends Controller |
| 312 | $userlog = UserLog::where('user_id', '=', Auth::user()->id)->orderBy("id", "DESC")->first(); | 343 | $userlog = UserLog::where('user_id', '=', Auth::user()->id)->orderBy("id", "DESC")->first(); |
| 313 | $ts_Wait = $userlog->getLastTs($sipid->id, $nowts); | 344 | $ts_Wait = $userlog->getLastTs($sipid->id, $nowts); |
| 314 | $userlog->save(); | 345 | $userlog->save(); |
| 315 | |||
| 316 | //start the call log | 346 | //start the call log |
| 317 | $crmcall = new CRMCall(); | 347 | $crmcall = new CRMCall(); |
| 318 | $crmcall->number = $callnumber; | 348 | $crmcall->number = $callnumber; |
| 319 | $crmcall->user_id = Auth::user()->id; | 349 | $crmcall->user_id = Auth::user()->id; |
| 320 | $crmcall->sipid_id = $sipid->id; | 350 | $crmcall->sipid_id = 1; |
| 321 | $crmcall->crm_id = $users[0]['id']; | 351 | $crmcall->crm_id = $users[0]->id; |
| 322 | $crmcall->lan = $users[0]['lan']; | 352 | $crmcall->lan = $users[0]->lan; |
| 323 | //$crmcall->client=$ppldata['client']; | 353 | //$crmcall->client=$ppldata['client']; |
| 324 | $crmcall->client = $client; | 354 | $crmcall->client = "$client"; |
| 325 | $crmcall->department = $ppldata['department']; | 355 | $crmcall->department = $ppldata['department']; |
| 326 | $crmcall->state = 'New'; | 356 | $crmcall->state = 'New'; |
| 327 | $crmcall->type = $kstychDialer['mDialerState']; | 357 | $crmcall->type = "$mDialerState"; |
| 328 | $crmcall->dialline_id = $dialline->id; | 358 | $crmcall->dialline_id = $dialline->id; |
| 329 | 359 | ||
| 330 | $crmcall->setTs('ts_Wait', $ts_Wait); | 360 | $crmcall->setTs('ts_Wait', $ts_Wait); |
| ... | @@ -352,17 +382,11 @@ class DialerController extends Controller | ... | @@ -352,17 +382,11 @@ class DialerController extends Controller |
| 352 | // $newqueue->custToMagentConf($sipid, $crmcall, $callerid, $dialline); | 382 | // $newqueue->custToMagentConf($sipid, $crmcall, $callerid, $dialline); |
| 353 | // } | 383 | // } |
| 354 | $sipid=$sipid->toArray(); | 384 | $sipid=$sipid->toArray(); |
| 355 | $searchresult .= "<script>kSetDData('C','callid','" . $crmcall->id . "');kSetDData('C','crmid','" . $users[0]['id'] . "');kSetDData('C','callnumber','$callnumber');</script>"; | ||
| 356 | |||
| 357 | 385 | ||
| 386 | $searchresult .= " | ||
| 387 | " . urlencode(json_encode($sipid)) . "&callnumber=" . $callnumber . "&callerid=" . urlencode(json_encode($callerid)) . "&crmcall=" . urlencode(json_encode($crmcall)) ."&sipid1=".urlencode(json_encode($sipid))."&dialline=" . urlencode(json_encode($dialline)) . "; | ||
| 358 | 388 | ||
| 359 | $searchresult .= "<div id=internalid_matchlist></div><script> | 389 | "; |
| 360 | doAjax('record?action=quicksearch','maintextsearch_1_txt=" . $users[0]['clientinternalid'] . "&maintextsearch_1_span=InternalID','internalid_matchlist','searchMutex', 'searchxhr','POST',function(retstr){ | ||
| 361 | if(retstr.responseText.indexOf('No Records Found!')>-1)$('#internalid_matchlist').html(''); | ||
| 362 | }); | ||
| 363 | |||
| 364 | doAjax('dialer?action=dialcall&sipid=" . urlencode(json_encode($sipid)) . "&callnumber=" . $callnumber . "&callerid=" . urlencode(json_encode($callerid)) . "&crmcall=" . urlencode(json_encode($crmcall)) ."&sipid1=".urlencode(json_encode($sipid))."&dialline=" . urlencode(json_encode($dialline)) . "','','', 'ajax_manualdial','singlefail','POST'); | ||
| 365 | </script>"; | ||
| 366 | 390 | ||
| 367 | 391 | ||
| 368 | return Response::make($searchresult); | 392 | return Response::make($searchresult); |
| ... | @@ -373,7 +397,7 @@ class DialerController extends Controller | ... | @@ -373,7 +397,7 @@ class DialerController extends Controller |
| 373 | return Response::make("<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','You Are Not Connected!');</script>"); | 397 | return Response::make("<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','You Are Not Connected!');</script>"); |
| 374 | } | 398 | } |
| 375 | } else { | 399 | } else { |
| 376 | $wakka->setPersonKey($users[0]['id'], "status", "NoNumber"); | 400 | $wakka->setPersonKey($users[0]->id, "status", "NoNumber"); |
| 377 | 401 | ||
| 378 | return Response::make($searchresult . "<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>"); | 402 | return Response::make($searchresult . "<script>kstychCall['crmid']=0;kSetDData('C','previewcrmid','');simpleNotification('error','topRight','No Number in Record!');</script>"); |
| 379 | } | 403 | } | ... | ... |
-
Please register or sign in to post a comment