function editTask($modo, $id, $asunto, $estimado, $descripcion, $estado, $fechaInicio, $fechaVence, $contacto, $prioridad, $asignado, $tipoRelacion, $idRelacion, $idUsuarioLogueado) { date_default_timezone_set('America/Bogota'); $fecha = date("Y/m/d h:i:s"); $log = new IOManager(); //Realiza el query en la base de datos $mysqli = makeSqlConnection(); $descripcion = getTabs($descripcion); //--Si es un task nuevo, lo crea------------------------------------------------------------ if ($modo == 'agregar') { $id = md5($asunto . $fecha); $sql5 = "INSERT INTO tasks (id,name,date_entered,created_by) VALUES ('{$id}','{$asunto}','{$fecha}','{$idUsuarioLogueado}')"; $res5 = $mysqli->query($sql5); $log->log($sql5); if (!$res5) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } $sql6 = "INSERT INTO tasks_cstm (id_c) VALUES ('{$id}')"; $res6 = $mysqli->query($sql6); if (!$res6) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } } //function editTask($metodo,$id,$asunto,$estimado,$descripcion,$estado,$fechaInicio,$fechaVence,$contacto,$prioridad,$asignado,$tipoRelacion,$idRelacion,$idUsuarioLogueado) //--Edita la tabla tasks------------------------------------------------------------------- $sql = "UPDATE tasks SET \n\tname = '{$asunto}',\n\tdate_modified = STR_TO_DATE('{$fecha}','%Y/%m/%d %H:%i:%s'),\n\tmodified_user_id = '{$idUsuarioLogueado}', \n\tdescription = '{$descripcion}', \n\tassigned_user_id = '{$asignado}',\n\tstatus = '{$estado}',\n\tparent_type = '{$tipoRelacion}',\n\tparent_id = '{$idRelacion}',\n\tcontact_id = '{$contacto}',\n\tpriority = '{$prioridad}' "; if ($fechaInicio != 'null' && !empty($fechaInicio)) { $sql = $sql . ",date_start = STR_TO_DATE('{$fechaInicio}','%Y-%m-%d %H:%i:%s') "; } if ($fechaVence != 'null' && !empty($fechaVence)) { $sql = $sql . ",date_due = STR_TO_DATE('{$fechaVence}','%Y-%m-%d %H:%i:%s') "; } $sql = $sql . " WHERE id = '{$id}'"; $res = $mysqli->query($sql); $log->log($sql); if (!$res) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } //--Edita la tabla CSTM ------------------------------------------------------------------------------ $sql2 = "UPDATE tasks_cstm SET \n\ttrabajo_estimado_c = '{$estimado}' "; $sql2 = $sql2 . "WHERE id_c = '{$id}'"; $log->log($sql2); $res2 = $mysqli->query($sql2); if (!$res2) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } if ($res && $res2) { $array = array("respuesta" => "OK", "id" => $id); $log->log("OK"); return json_encode($array); } else { $log->log("fail"); $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } }
function commandRouter($action) { switch ($action) { case 'login': loginUser(); break; case 'createUser': createUser(); break; case 'getUser': getUser(); break; case 'deleteUser': deleteUser(); break; case 'updateUser': updateUser(); break; case 'addTab': addTab(); break; case 'delTab': delTab(); break; case 'editTab': editTab(); break; case 'getTabs': getTabs(); break; case 'addNote': addNote(); break; case 'delNote': delNote(); break; case 'editNote': editNote(); break; case 'getNotes': getNotes(); break; default: break; } }
} // Tabbing for ($i = 0; $i < count($pixi); $i++) { if ($pixi[$i] == '{') { $output = $output . getTabs() . '"' . $pixi[$i] . "\",\n"; $tabs++; continue; } else { if ($pixi[$i] == '}') { $tabs--; } } if ($pixi[$i] == '') { $output = $output . "\n"; } else { $output = $output . getTabs() . '"' . $pixi[$i] . "\",\n"; } } $output = rtrim($output); if (substr($output, -1) == ',') { $output = substr($output, 0, -1); } } $output .= "];"; ?> <!doctype html> <html> <head> <meta charset="UTF-8" /> <title>phaser - ShaderToy Convertor</title> <style>
function editOpportunity($modo, $id, $date_entered, $energia_c, $id_c, $assigned_user_id, $comunicaciones_c, $amount, $amount_usdollar, $nameAccount, $description, $name, $valoroportunidad_c, $date_closed, $probability, $fuente_c, $iluminacion_c, $created_by, $usuario_final_c, $currency_id, $tipo_c, $date_modified, $modified_user_id, $nameCampaign, $deleted, $campaign_id, $lead_source, $medio_c, $idAccount, $opportunity_type, $assigned_user_name, $sales_stage, $next_step) { date_default_timezone_set('America/Bogota'); $fecha = date("Y/m/d h:i:s"); $description = getTabs($description); //Realiza el query en la base de datos $mysqli = makeSqlConnection(); $sql = ""; $sql2 = ""; $sql5 = ""; $sql6 = ""; //--Si es un opportunity nuevo, lo crea------------------------------------------------------------ if ($modo == 'agregar') { $id = md5($name . $fecha); $sql5 = "INSERT INTO opportunities (id,name,date_entered,created_by,deleted) \n\t\t\tVALUES ('{$id}','{$name}',now(),'{$created_by}','0')"; $res5 = $mysqli->query($sql5); if (!$res5) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } $sql6 = "INSERT INTO opportunities_cstm (id_c) VALUES ('{$id}')"; $res6 = $mysqli->query($sql6); if (!$res6) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } //------------------------------------------------------------------------------------------------------------------------------------------ //Inserta relacion entre account y opportunity ------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------------------------------ $idBeanRel = md5($name . $id . $fecha); $sql9 = "INSERT INTO accounts_opportunities (id,opportunity_id,date_modified,deleted,account_id) \n\t\t\t\tVALUES ('{$idBeanRel}','{$id}',now(),0,'{$idAccount}')"; $res9 = $mysqli->query($sql9); if (!$res9) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } //------------------------------------------------------------------------------------------------------------------------------------------ //Inserta relacion entre contact y opportunity ------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------------------------------ /*if($idContacto != null) { $idBeanRel = md5($idContacto.$fecha); $sql10 = "INSERT INTO opportunities_contacts (id,opportunity_id,contact_id,date_modified) VALUES ('$idBeanRel','$id','$idContacto','$fecha')"; $res10 = $mysqli->query($sql10); if(!$res10) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } }*/ } //--Edita la tabla opportunities------------------------------------------------------------------- $sql = "UPDATE opportunities SET \n\tname = '{$name}',\n\tdate_modified = now(),\n\tmodified_user_id = '{$modified_user_id}', \n\tdescription = '{$description}', \n\tassigned_user_id = '{$assigned_user_id}',\n\topportunity_type = '{$opportunity_type}',\n\tcampaign_id = '{$campaign_id}',\n\tlead_source = '{$lead_source}',\n\tamount_usdollar = '{$amount_usdollar}',\n\tcurrency_id ='{$currency_id}',\n\tnext_step = '{$next_step}',\n\tsales_stage = '{$sales_stage}' "; if ($date_closed != '' && $date_closed != 'null') { $sql = $sql . ",date_closed = STR_TO_DATE('{$date_closed}','%Y-%m-%d %H:%i:%s') "; } if (ctype_digit((string) $probability)) { $sql = $sql . ",probability = '{$probability}' "; } $sql = $sql . "WHERE id = '{$id}'"; $res = $mysqli->query($sql); if (!$res) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } //--Edita la tabla CSTM ------------------------------------------------------------------------------ $sql2 = "UPDATE opportunities_cstm SET \n\tmedio_c = '{$medio_c}', \n\ttipo_c = '{$tipo_c}', \n\tenergia_c = '{$energia_c}',\n\tcomunicaciones_c = '{$comunicaciones_c}',\n\tiluminacion_c = '{$iluminacion_c}',\n\tusuario_final_c = '{$usuario_final_c}',\n\tfuente_c = '{$fuente_c}' "; if (ctype_digit((string) $valoroportunidad_c)) { $sql2 = $sql2 . ",valoroportunidad_c = '{$valoroportunidad_c}' "; } $sql2 = $sql2 . "WHERE id_c = '{$id}'"; $res2 = $mysqli->query($sql2); if (!$res2) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } //--Edita el account asociado a la oportunidad ------------------------------------------------------ $sql3 = "UPDATE accounts_opportunities SET account_id = '{$idAccount}',date_modified = now() WHERE opportunity_id = '{$id}'"; $res3 = $mysqli->query($sql3); if (!$res3) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } if ($res && $res2) { $array = array("respuesta" => "OK"); return json_encode($array); } else { $array = array("respuesta" => "FAIL", "error" => $mysqli->error, "SQL1" => $sql, "SQL2" => $sql2, "SQL5" => $sql5, "SQL6" => $sql6); return json_encode($array); } }
} } } $retval |= network_lan_configure(); $retval |= services_dyndns_configure(); // update applications that depends on network settings // config_unlock(); } // $savemsg = get_std_save_message($retval); } } // stop here if redirected if (defined('REDIRECT_REQ')) { exit; } // render the page content require 'fbegin.inc'; // prepare logical groups to show tabs $arrTabs[] = array('url' => '#tab-1', 'label' => _('Interface') . '/' . _('Dns')); $arrTabs[] = array('url' => '#tab-2', 'label' => _('Topology') . '/' . _('Dynamic DNS')); $arrTabs[] = array('url' => '#tab-3', 'label' => _('Routing')); getTabs($arrTabs, true); // wrap the form to make tabs working $form->set_formTpl('<div id="sets">' . $form->get_formTpl() . '</div>'); // render form $form->renderForm(); $msg = _('After you click "Save", all current calls will be dropped. You may also have to do one or more of the following steps before you can access your PBX again:') . '<ul><li>' . _('restart system') . '</li>' . '<li>' . _('change the IP address of your computer') . '</li>' . '<li>' . _('access the web UI using the new IP address') . '</li></ul>'; showSaveWarning($msg); require 'fend.inc';
function editCall($modo, $id, $asunto, $resultado, $descripcion, $direccion, $estado, $fechaInicio, $duracion_horas, $duracion_min, $parent_id, $parent_type, $idCampana, $idUsuario, $idAsignado, $idContacto = null) { date_default_timezone_set('America/Bogota'); $fecha = date("Y/m/d h:i:s"); $mysqli = makeSqlConnection(); $descripcion = getTabs($descripcion); //--Si es un opportunity nuevo, lo crea------------------------------------------------------------ if ($modo == 'agregar') { $id = md5($asunto . $fecha); $sql5 = "INSERT INTO calls (id,name,created_by,date_entered,assigned_user_id) VALUES ('{$id}','{$asunto}','{$idUsuario}',now(),'{$idAsignado}')"; $res5 = $mysqli->query($sql5); if (!$res5) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } $sql6 = "INSERT INTO calls_cstm (id_c) VALUES ('{$id}')"; $res6 = $mysqli->query($sql6); if (!$res6) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } //------------------------------------------------------------------------------------------------------------------------------------------ //Inserta relacion entre contact y calls ------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------------------------------ if ($idContacto != null) { $idBeanRel = md5($idContacto . $fecha); $sql10 = "INSERT INTO calls_contacts (id,call_id,contact_id,date_modified) \n\t\t\t\t\tVALUES ('{$idBeanRel}','{$id}','{$idContacto}','{$fecha}')"; $res10 = $mysqli->query($sql10); if (!$res10) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } } } //--Edita la tabla calls ------------------------------------------------------------------- $sql = "UPDATE calls SET \n\tname = '{$asunto}',\n\tdate_modified = now(),\n\tmodified_user_id = '{$idUsuario}', \n\tdescription = '{$descripcion}', \n\tstatus = '{$estado}',\n\tdirection = '{$direccion}' "; if ($fechaInicio != '' && $fechaInicio != '<null>') { $sql = $sql . ",date_start = '{$fechaInicio}' "; } if ($parent_id != '' && $parent_id != '<null>') { $sql = $sql . ",parent_id = '{$parent_id}' "; } if ($parent_type != '' && $parent_type != '<null>') { $sql = $sql . ",parent_type = '{$parent_type}' "; } if (ctype_digit((string) $duracion_min)) { $sql = $sql . ",duration_minutes = '{$duracion_min}' "; } if (ctype_digit((string) $duracion_horas)) { $sql = $sql . ",duration_hours = '{$duracion_horas}' "; } $sql = $sql . "WHERE id = '{$id}'"; $res = $mysqli->query($sql); if (!$res) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } //--Edita la tabla calls_cstm ------------------------------------------------------------------- $sql2 = "UPDATE calls_cstm SET resultadodelallamada_c = '{$resultado}' WHERE id_c = '{$id}'"; $res2 = $mysqli->query($sql2); if (!$res2) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } //--Edita la campana del call ------------------------------------------------------------------- $sql3 = "DELETE FROM calls_campaigns_1_c WHERE calls_campaigns_1calls_ida = '{$id}'"; $res3 = $mysqli->query($sql3); $id_temp = md5($fecha . $id); $sql3 = "INSERT INTO calls_campaigns_1_c (id,calls_campaigns_1calls_ida) VALUES ('{$id_temp}','{$id}')"; $res3 = $mysqli->query($sql3); $sql3 = "UPDATE calls_campaigns_1_c SET calls_campaigns_1campaigns_idb = '{$idCampana}' WHERE calls_campaigns_1calls_ida = '{$id}'"; $res3 = $mysqli->query($sql3); if (!$res3) { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } if ($res && $res2 && $res3) { $array = array("respuesta" => "OK"); return json_encode($array); } else { $array = array("respuesta" => "FAIL", "error" => $mysqli->error); return json_encode($array); } }