public function log($ctx, $appMessages)
 {
     if (!php_Boot::$skip_constructor) {
         $messages = new _hx_array(array());
         $userDetails = $ctx->request->get_clientIP();
         if ((null !== $ctx->session ? $ctx->session->get_id() : null) !== null) {
             $userDetails .= " " . _hx_string_or_null(null !== $ctx->session ? $ctx->session->get_id() : null);
         }
         if (($ctx->auth !== null && $ctx->auth->get_currentUser() !== null ? $ctx->auth->get_currentUser()->get_userID() : null) !== null) {
             $userDetails .= " " . _hx_string_or_null($ctx->auth !== null && $ctx->auth->get_currentUser() !== null ? $ctx->auth->get_currentUser()->get_userID() : null);
         }
         $requestLog = "[" . _hx_string_or_null($ctx->request->get_httpMethod()) . " " . _hx_string_or_null($ctx->request->get_uri()) . "] from [" . _hx_string_or_null($userDetails) . "], response: [" . _hx_string_rec($ctx->response->status, "") . " " . _hx_string_or_null($ctx->response->get_contentType()) . "]";
         $messages->push($requestLog);
         $_g = 0;
         $_g1 = $ctx->messages;
         while ($_g < $_g1->length) {
             $msg = $_g1[$_g];
             ++$_g;
             $messages->push(ufront_log_ServerConsoleLogger::formatMsg($msg));
             unset($msg);
         }
         if ($appMessages !== null) {
             $_g2 = 0;
             while ($_g2 < $appMessages->length) {
                 $msg1 = $appMessages[$_g2];
                 ++$_g2;
                 $messages->push(ufront_log_ServerConsoleLogger::formatMsg($msg1));
                 unset($msg1);
             }
         }
         ufront_log_ServerConsoleLogger::writeLog($messages->join("\n  "), null);
         return ufront_core_SurpriseTools::success();
     }
 }
 static function toString($this1)
 {
     $years = $this1->getYears();
     $months = $this1->getMonths();
     $days = $this1->getDays();
     $hours = $this1->getHours();
     $minutes = $this1->getMinutes();
     $seconds = $this1->getSeconds();
     $parts = new _hx_array(array());
     if ($years !== 0) {
         $parts->push("" . _hx_string_rec($years, "") . "y");
     }
     if ($months !== 0) {
         $parts->push("" . _hx_string_rec($months, "") . "m");
     }
     if ($days !== 0) {
         $parts->push("" . _hx_string_rec($days, "") . "d");
     }
     if ($hours !== 0) {
         $parts->push("" . _hx_string_rec($hours, "") . "hrs");
     }
     if ($minutes !== 0) {
         $parts->push("" . _hx_string_rec($minutes, "") . "min");
     }
     if ($seconds !== 0) {
         $parts->push("" . _hx_string_rec($seconds, "") . "sec");
     }
     return _hx_string_or_null($this1->negative ? "-" : "") . "(" . _hx_string_or_null($parts->length === 0 ? "0sec" : $parts->join(", ")) . ")";
 }
 public function queryString()
 {
     $params = new _hx_array(array());
     $_g = 0;
     $_g1 = $this->query;
     while ($_g < $_g1->length) {
         $param = $_g1[$_g];
         ++$_g;
         $value = null;
         if ($param->encoded) {
             $value = $param->value;
         } else {
             $value = rawurlencode($param->value);
         }
         $params->push(_hx_string_or_null($param->name) . "=" . _hx_string_or_null($value));
         unset($value, $param);
     }
     return $params->join("&");
 }
Пример #4
0
 public function printMultiValueMap($map)
 {
     $lines = new _hx_array(array());
     if (null == $map) {
         throw new HException('null iterable');
     }
     $__hx__it = $map->keys();
     while ($__hx__it->hasNext()) {
         unset($key);
         $key = $__hx__it->next();
         $line = "" . _hx_string_or_null($key) . "=";
         $values = ufront_core__MultiValueMap_MultiValueMap_Impl_::getAll($map, $key);
         $values->sort(isset(Reflect::$compare) ? Reflect::$compare : array("Reflect", "compare"));
         $line .= _hx_string_or_null($values->join(","));
         $lines->push($line);
         unset($values, $line);
     }
     $lines->sort(isset(Reflect::$compare) ? Reflect::$compare : array("Reflect", "compare"));
     return $lines->join("\n");
 }
 public function log($httpContext, $appMessages)
 {
     if (!php_Boot::$skip_constructor) {
         if (ufront_log_RemotingLogger_0($this, $appMessages, $httpContext) && $httpContext->response->get_contentType() === "application/x-haxe-remoting") {
             $results = new _hx_array(array());
             $_g = 0;
             $_g1 = $httpContext->messages;
             while ($_g < $_g1->length) {
                 $msg = $_g1[$_g];
                 ++$_g;
                 $results->push(ufront_log_RemotingLogger::formatMessage($msg));
                 unset($msg);
             }
             if ($results->length > 0) {
                 $httpContext->response->write("\n" . _hx_string_or_null($results->join("\n")));
             }
         }
         return ufront_core_SurpriseTools::success();
     }
 }
Пример #6
0
 static function create()
 {
     $s = new _hx_array(array());
     $_g = 0;
     while ($_g < 8) {
         $i = $_g++;
         $s[$i] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i);
     }
     $s[8] = "-";
     $_g1 = 9;
     while ($_g1 < 13) {
         $i1 = $_g1++;
         $s[$i1] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i1);
     }
     $s[13] = "-";
     $s[14] = "4";
     $_g2 = 15;
     while ($_g2 < 18) {
         $i2 = $_g2++;
         $s[$i2] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i2);
     }
     $s[18] = "-";
     $s[19] = "" . _hx_string_or_null(_hx_char_at("89AB", Math::floor(Math::random() * 4)));
     $_g3 = 20;
     while ($_g3 < 23) {
         $i3 = $_g3++;
         $s[$i3] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i3);
     }
     $s[23] = "-";
     $_g4 = 24;
     while ($_g4 < 36) {
         $i4 = $_g4++;
         $s[$i4] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i4);
     }
     return $s->join("");
 }
 public function log($ctx, $appMessages)
 {
     if (!php_Boot::$skip_constructor) {
         if ($ctx->response->get_contentType() === "text/html" && !$ctx->response->isRedirect()) {
             $results = new _hx_array(array());
             $_g = 0;
             $_g1 = $ctx->messages;
             while ($_g < $_g1->length) {
                 $msg = $_g1[$_g];
                 ++$_g;
                 $results->push(ufront_log_BrowserConsoleLogger::formatMessage($msg));
                 unset($msg);
             }
             if ($results->length > 0) {
                 $script = "\n<script type=\"text/javascript\">\n" . _hx_string_or_null($results->join("\n")) . "\n</script>";
                 $newContent = ufront_web_result_CallJavascriptResult::insertScriptsBeforeBodyTag($ctx->response->getBuffer(), new _hx_array(array($script)));
                 $ctx->response->clearContent();
                 $ctx->response->write($newContent);
             }
         }
         return ufront_core_SurpriseTools::success();
     }
 }
Пример #8
0
 public function save($q)
 {
     $lead_id = Std::parseInt($q->get("lead_id"));
     $user = S::$user;
     $log_id = false;
     if ($log_id = $this->saveLog($q, null)) {
         $cTable = "custom_" . Std::string($q->get("entry_list_id"));
         haxe_Log::trace(_hx_string_or_null($cTable) . " log_id:" . Std::string($log_id), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 162, "className" => "model.QC", "methodName" => "save")));
         $primary_id = S::$my->real_escape_string($q->get("primary_id"));
         $sql = new StringBuf();
         $sql->add("UPDATE " . _hx_string_or_null($cTable) . " SET ");
         $cFields = S::tableFields("" . _hx_string_or_null($cTable), null);
         haxe_Log::trace("" . _hx_string_or_null($cTable) . " fields:" . _hx_string_or_null($cFields->toString()), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 177, "className" => "model.QC", "methodName" => "save")));
         $cFields->remove($primary_id);
         $bindTypes = "";
         $values2bind = null;
         $i = 0;
         $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes")));
         $sets = new _hx_array(array());
         $_g = 0;
         while ($_g < $cFields->length) {
             $c = $cFields[$_g];
             ++$_g;
             $val = $q->get($c);
             if ($val !== null) {
                 if (Std::is($val, _hx_qtype("String"))) {
                     $values2bind[$i++] = $val;
                 } else {
                     $values2bind[$i++] = $val[0];
                 }
                 $type = $dbFieldTypes->get($c);
                 if (Util::any2bool($type)) {
                     $bindTypes .= _hx_string_or_null($type);
                 } else {
                     $bindTypes .= "s";
                 }
                 $sets->push(_hx_string_or_null($c) . "=?");
                 unset($type);
             }
             unset($val, $c);
         }
         $sql->add($sets->join(","));
         $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, ""));
         $stmt = S::$my->stmt_init();
         haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 199, "className" => "model.QC", "methodName" => "save")));
         $success = $stmt->prepare($sql->b);
         if (!$success) {
             haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 203, "className" => "model.QC", "methodName" => "save")));
             return false;
         }
         $success = myBindParam($stmt, $values2bind, $bindTypes);
         haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 207, "className" => "model.QC", "methodName" => "save")));
         if ($success) {
             $success = $stmt->execute();
             if (!$success) {
                 haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 213, "className" => "model.QC", "methodName" => "save")));
                 return false;
             }
             $sql = new StringBuf();
             $uFields = model_QC::$vicdial_list_fields;
             $uFields->remove($primary_id);
             $bindTypes = "";
             $values2bind = null;
             $i = 0;
             $sql->add("UPDATE vicidial_list SET ");
             $sets = new _hx_array(array());
             $_g1 = 0;
             while ($_g1 < $uFields->length) {
                 $c1 = $uFields[$_g1];
                 ++$_g1;
                 $val1 = $q->get($c1);
                 if ($val1 !== null) {
                     if (Std::is($val1, _hx_qtype("String"))) {
                         $values2bind[$i++] = $val1;
                     } else {
                         $values2bind[$i++] = $val1[0];
                     }
                     $type1 = $dbFieldTypes->get($c1);
                     if (Util::any2bool($type1)) {
                         $bindTypes .= _hx_string_or_null($type1);
                     } else {
                         $bindTypes .= "s";
                     }
                     $sets->push(_hx_string_or_null($c1) . "=?");
                     unset($type1);
                 }
                 unset($val1, $c1);
             }
             $values2bind[$i++] = S::$user;
             $bindTypes .= "s";
             $sets->push("security_phrase=?");
             $values2bind[$i++] = "XX";
             $bindTypes .= "s";
             $sets->push("state=?");
             if (_hx_equal($q->get("status"), "QCOK") || _hx_equal($q->get("status"), "QCBAD")) {
                 $list_id = 10000;
                 if (_hx_equal($q->get("status"), "QCOK")) {
                     $mID = Std::parseInt($q->get("vendor_lead_code"));
                     if ($mID === null) {
                         $mID = S::newMemberID();
                         $values2bind[$i++] = $mID;
                         $bindTypes .= "s";
                         $sets->push("vendor_lead_code=?");
                     }
                 } else {
                     $list_id = 1800;
                 }
                 $entry_list_id = $q->get("entry_list_id");
                 $values2bind[$i++] = $q->get("status");
                 $bindTypes .= "s";
                 $sets->push("`status`=?");
                 $values2bind[$i++] = $list_id;
                 $bindTypes .= "s";
                 $sets->push("list_id=?");
                 $values2bind[$i++] = $entry_list_id;
                 $bindTypes .= "s";
                 $sets->push("entry_list_id=?");
                 $values2bind[$i++] = $q->get("owner");
                 $bindTypes .= "s";
                 $sets->push("owner=?");
             }
             $sql->add($sets->join(","));
             $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, ""));
             $stmt1 = S::$my->stmt_init();
             haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 277, "className" => "model.QC", "methodName" => "save")));
             $success1 = $stmt1->prepare($sql->b);
             if (!$success1) {
                 haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 281, "className" => "model.QC", "methodName" => "save")));
                 return false;
             }
             $success1 = myBindParam($stmt1, $values2bind, $bindTypes);
             haxe_Log::trace("success:" . Std::string($success1), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 287, "className" => "model.QC", "methodName" => "save")));
             if ($success1) {
                 $success1 = $stmt1->execute();
                 if (!$success1) {
                     haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 293, "className" => "model.QC", "methodName" => "save")));
                     return false;
                 } else {
                     return $this->saveLog($q, $log_id) !== false;
                 }
             }
             return false;
         }
     } else {
         haxe_Log::trace("oops", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 306, "className" => "model.QC", "methodName" => "save")));
     }
     return false;
 }
Пример #9
0
 public function alterColumns($db, $name, $columns)
 {
     $notBlank = array(new _hx_lambda(array(&$columns, &$db, &$name), "coopy_SqliteHelper_0"), 'execute');
     $sql = $this->fetchSchema($db, $name);
     $schema = $this->splitSchema($db, $name, $sql);
     $parts = $schema->parts;
     $nparts = new _hx_array(array());
     $new_column_list = new _hx_array(array());
     $ins_column_list = new _hx_array(array());
     $sel_column_list = new _hx_array(array());
     $meta = $schema->columns;
     $_g1 = 0;
     $_g = $columns->length;
     while ($_g1 < $_g) {
         $i = $_g1++;
         $c = $columns[$i];
         if ($c->name !== null) {
             if ($c->prevName !== null) {
                 $sel_column_list->push($c->prevName);
                 $ins_column_list->push($c->name);
             }
             $orig_type = "";
             $orig_primary = false;
             if ($schema->name2column->exists($c->name)) {
                 $m = $schema->name2column->get($c->name);
                 $orig_type = $m->type_value;
                 $orig_primary = $m->primary;
                 unset($m);
             }
             $next_type = $orig_type;
             $next_primary = $orig_primary;
             if ($c->props !== null) {
                 $_g2 = 0;
                 $_g3 = $c->props;
                 while ($_g2 < $_g3->length) {
                     $p = $_g3[$_g2];
                     ++$_g2;
                     if ($p->name === "type") {
                         $next_type = $p->val;
                     }
                     if ($p->name === "key") {
                         $next_primary = "" . Std::string($p->val) === "primary";
                     }
                     unset($p);
                 }
                 unset($_g3, $_g2);
             }
             $part = "" . _hx_string_or_null($c->name);
             if (call_user_func_array($notBlank, array($next_type))) {
                 $part .= " " . _hx_string_or_null($next_type);
             }
             if ($next_primary) {
                 $part .= " PRIMARY KEY";
             }
             $nparts->push($part);
             $new_column_list->push($c->name);
             unset($part, $orig_type, $orig_primary, $next_type, $next_primary);
         }
         unset($i, $c);
     }
     if (!$this->exec($db, "BEGIN TRANSACTION")) {
         return false;
     }
     $c1 = $this->columnListSql($ins_column_list);
     $tname = $db->getQuotedTableName($name);
     if (!$this->exec($db, "CREATE TEMPORARY TABLE __coopy_backup(" . _hx_string_or_null($c1) . ")")) {
         return false;
     }
     if (!$this->exec($db, "INSERT INTO __coopy_backup (" . _hx_string_or_null($c1) . ") SELECT " . _hx_string_or_null($c1) . " FROM " . _hx_string_or_null($tname))) {
         return false;
     }
     if (!$this->exec($db, "DROP TABLE " . _hx_string_or_null($tname))) {
         return false;
     }
     if (!$this->exec($db, _hx_string_or_null($schema->preamble) . "(" . _hx_string_or_null($nparts->join(", ")) . ")")) {
         return false;
     }
     if (!$this->exec($db, "INSERT INTO " . _hx_string_or_null($tname) . " (" . _hx_string_or_null($c1) . ") SELECT " . _hx_string_or_null($c1) . " FROM __coopy_backup")) {
         return false;
     }
     if (!$this->exec($db, "DROP TABLE __coopy_backup")) {
         return false;
     }
     if (!$this->exec($db, "COMMIT")) {
         return false;
     }
     return true;
 }
Пример #10
0
 public function fieldFormat($fields)
 {
     $fieldsWithFormat = new _hx_array(array());
     $sF = _hx_explode(",", $fields);
     $dbQueryFormats = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbQueryFormats")));
     $qKeys = new _hx_array(array());
     $it = $dbQueryFormats->keys();
     while ($it->hasNext()) {
         $qKeys->push($it->next());
     }
     $_g = 0;
     while ($_g < $sF->length) {
         $f = $sF[$_g];
         ++$_g;
         if (Lambda::has($qKeys, $f)) {
             $format = $dbQueryFormats->get($f);
             $fieldsWithFormat->push(_hx_string_or_null($format[0]) . "(" . _hx_string_or_null(S::$my->real_escape_string($f)) . ", \"" . _hx_string_or_null($format[1]) . "\") AS `" . _hx_string_or_null($f) . "`");
             unset($format);
         } else {
             $fieldsWithFormat->push(S::$my->real_escape_string($f));
         }
         unset($f);
     }
     return $fieldsWithFormat->join(",");
 }
Пример #11
0
 public function save($q)
 {
     $lead_id = Std::parseInt($q->get("lead_id"));
     $res = S::$my->query("INSERT INTO vicidial_lead_log SELECT * FROM (SELECT NULL AS log_id," . _hx_string_rec($lead_id, "") . " AS lead_id,NOW() AS entry_date) AS ll JOIN (SELECT modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM `vicidial_list`WHERE `lead_id`=" . _hx_string_rec($lead_id, "") . ")AS vl", null);
     $log_id = S::$my->insert_id;
     if ($log_id > 0) {
         $cTable = "custom_" . Std::string($q->get("entry_list_id"));
         haxe_Log::trace(_hx_string_or_null($cTable) . " log_id:" . _hx_string_rec($log_id, ""), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 110, "className" => "model.QC", "methodName" => "save")));
         if ($this->checkOrCreateCustomTable($cTable, null)) {
             $cLogTable = _hx_string_or_null($cTable) . "_log";
             $res = S::$my->query("INSERT INTO " . _hx_string_or_null($cLogTable) . " SELECT * FROM (SELECT " . _hx_string_rec($log_id, "") . " AS log_id) AS ll JOIN (SELECT * FROM `" . _hx_string_or_null($cTable) . "`WHERE `lead_id`=" . _hx_string_rec($lead_id, "") . ")AS cl", null);
             haxe_Log::trace("INSERT INTO " . _hx_string_or_null($cLogTable) . " ..." . _hx_string_or_null(S::$my->error) . "<", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 117, "className" => "model.QC", "methodName" => "save")));
             if (S::$my->error === "") {
                 $primary_id = S::$my->real_escape_string($q->get("primary_id"));
                 $sql = new StringBuf();
                 $sql->add("UPDATE " . _hx_string_or_null($cTable) . " SET ");
                 $cFields = S::tableFields("" . _hx_string_or_null($cTable), null);
                 haxe_Log::trace("" . _hx_string_or_null($cTable) . " fields:" . _hx_string_or_null($cFields->toString()), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 125, "className" => "model.QC", "methodName" => "save")));
                 $cFields->remove($primary_id);
                 $bindTypes = "";
                 $values2bind = null;
                 $i = 0;
                 $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes")));
                 $sets = new _hx_array(array());
                 $_g = 0;
                 while ($_g < $cFields->length) {
                     $c = $cFields[$_g];
                     ++$_g;
                     $val = $q->get($c);
                     if ($val !== null) {
                         if (Std::is($val, _hx_qtype("String"))) {
                             $values2bind[$i++] = $val;
                         } else {
                             $values2bind[$i++] = $val[0];
                         }
                         $type = $dbFieldTypes->get($c);
                         if (Util::any2bool($type)) {
                             $bindTypes .= _hx_string_or_null($type);
                         } else {
                             $bindTypes .= "s";
                         }
                         $sets->push(_hx_string_or_null($c) . "=?");
                         unset($type);
                     }
                     unset($val, $c);
                 }
                 $sql->add($sets->join(","));
                 $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, ""));
                 $stmt = S::$my->stmt_init();
                 haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 147, "className" => "model.QC", "methodName" => "save")));
                 $success = $stmt->prepare($sql->b);
                 if (!$success) {
                     haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 151, "className" => "model.QC", "methodName" => "save")));
                     return false;
                 }
                 $success = myBindParam($stmt, $values2bind, $bindTypes);
                 haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 155, "className" => "model.QC", "methodName" => "save")));
                 if ($success) {
                     $success = $stmt->execute();
                     if (!$success) {
                         haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 161, "className" => "model.QC", "methodName" => "save")));
                         return false;
                     }
                     $sql = new StringBuf();
                     $uFields = model_QC::$vicdial_list_fields;
                     $uFields->remove($primary_id);
                     $bindTypes = "";
                     $values2bind = null;
                     $i = 0;
                     $sql->add("UPDATE vicidial_list SET ");
                     $sets = new _hx_array(array());
                     $_g1 = 0;
                     while ($_g1 < $uFields->length) {
                         $c1 = $uFields[$_g1];
                         ++$_g1;
                         $val1 = $q->get($c1);
                         if ($val1 !== null) {
                             if (Std::is($val1, _hx_qtype("String"))) {
                                 $values2bind[$i++] = $val1;
                             } else {
                                 $values2bind[$i++] = $val1[0];
                             }
                             $type1 = $dbFieldTypes->get($c1);
                             if (Util::any2bool($type1)) {
                                 $bindTypes .= _hx_string_or_null($type1);
                             } else {
                                 $bindTypes .= "s";
                             }
                             $sets->push(_hx_string_or_null($c1) . "=?");
                             unset($type1);
                         }
                         unset($val1, $c1);
                     }
                     $values2bind[$i++] = S::$user;
                     $bindTypes .= "s";
                     $sets->push("security_phrase=?");
                     if (_hx_equal($q->get("status"), "MITGL")) {
                         $list_id = 10000;
                         $mID = Std::parseInt($q->get("vendor_lead_code"));
                         if ($mID === null) {
                             $mID = S::newMemberID();
                             $values2bind[$i++] = $mID;
                             $bindTypes .= "s";
                             $sets->push("vendor_lead_code=?");
                         }
                         $entry_list_id = $q->get("entry_list_id");
                         $values2bind[$i++] = $q->get("status");
                         $bindTypes .= "s";
                         $sets->push("`status`=?");
                         $values2bind[$i++] = $list_id;
                         $bindTypes .= "s";
                         $sets->push("list_id=?");
                         $values2bind[$i++] = $entry_list_id;
                         $bindTypes .= "s";
                         $sets->push("entry_list_id=?");
                         $values2bind[$i++] = $q->get("user");
                         $bindTypes .= "s";
                         $sets->push("owner=?");
                     }
                     $sql->add($sets->join(","));
                     $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, ""));
                     $stmt1 = S::$my->stmt_init();
                     haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 216, "className" => "model.QC", "methodName" => "save")));
                     $success1 = $stmt1->prepare($sql->b);
                     if (!$success1) {
                         haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 220, "className" => "model.QC", "methodName" => "save")));
                         return false;
                     }
                     $success1 = myBindParam($stmt1, $values2bind, $bindTypes);
                     haxe_Log::trace("success:" . Std::string($success1), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 224, "className" => "model.QC", "methodName" => "save")));
                     if ($success1) {
                         $success1 = $stmt1->execute();
                         if (!$success1) {
                             haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 230, "className" => "model.QC", "methodName" => "save")));
                             return false;
                         }
                         return true;
                     }
                     return false;
                 }
             } else {
                 haxe_Log::trace("oops", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 240, "className" => "model.QC", "methodName" => "save")));
             }
         }
     }
     return false;
 }
Пример #12
0
 public function save_pay_source($q)
 {
     $account = php_Lib::hashOfAssociativeArray($q->get("account"));
     haxe_Log::trace(Std::string($account) . ":" . Std::string(model_Clients_15($this, $account, $q)), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 676, "className" => "model.Clients", "methodName" => "save_pay_source")));
     $pIt = $account->keys();
     $user = S::$user;
     while ($pIt->hasNext()) {
         $pay_source_id = $pIt->next();
         $log_id = $this->save_pay_source_log($pay_source_id, null);
         if (!$log_id) {
             return false;
         }
         $sql = new StringBuf();
         $uFields = model_Clients::$pay_source_fields;
         $uFields->remove("pay_source_id");
         $bindTypes = "";
         $values2bind = null;
         $i = 0;
         $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes")));
         $sets = new _hx_array(array());
         $sql->add("UPDATE fly_crm.pay_source SET ");
         $_g = 0;
         while ($_g < $uFields->length) {
             $c = $uFields[$_g];
             ++$_g;
             haxe_Log::trace(_hx_string_or_null($c) . ":" . Std::string(Type::typeof($q->get($c))), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 699, "className" => "model.Clients", "methodName" => "save_pay_source")));
             $p = $q->get($c);
             $val = null;
             if ($p !== null) {
                 if (!Std::is($p, _hx_qtype("String"))) {
                     $valMap = php_Lib::hashOfAssociativeArray($q->get($c));
                     $val = $valMap->get(Std::string($pay_source_id));
                     unset($valMap);
                 } else {
                     $val = $p;
                 }
                 $values2bind[$i++] = $val;
                 $type = $dbFieldTypes->get($c);
                 if (Util::any2bool($type)) {
                     $bindTypes .= _hx_string_or_null($type);
                 } else {
                     $bindTypes .= "s";
                 }
                 $sets->push(_hx_string_or_null($c) . "=?");
                 unset($type);
             }
             unset($val, $p, $c);
         }
         unset($_g);
         if ($sets->length === 0) {
             continue;
         }
         $sql->add($sets->join(","));
         $sql->add(" WHERE pay_source_id=" . _hx_string_rec($pay_source_id, ""));
         $stmt = S::$my->stmt_init();
         haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 727, "className" => "model.Clients", "methodName" => "save_pay_source")));
         $success = $stmt->prepare($sql->b);
         if (!$success) {
             haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 731, "className" => "model.Clients", "methodName" => "save_pay_source")));
             return false;
         }
         haxe_Log::trace($values2bind, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 735, "className" => "model.Clients", "methodName" => "save_pay_source")));
         $success = myBindParam($stmt, $values2bind, $bindTypes);
         haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 737, "className" => "model.Clients", "methodName" => "save_pay_source")));
         if ($success) {
             $success = $stmt->execute();
             if (!$success) {
                 haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 743, "className" => "model.Clients", "methodName" => "save_pay_source")));
                 return false;
             }
             $this->save_pay_source_log($pay_source_id, $log_id);
             if (!$pIt->hasNext()) {
                 return true;
             }
         }
         unset($values2bind, $uFields, $success, $stmt, $sql, $sets, $pay_source_id, $log_id, $i, $dbFieldTypes, $bindTypes);
     }
     return false;
 }