public function getMyRoutes($userid) { $userid = (int) $userid; $result = array("status" => false, "message" => "", "routes" => array()); if ($userid > 0) { $db = new clsDBdbConnection(); $partner_id = CCDLookUp("partner_id", "tap_users", "id = {$userid}", $db); if ($partner_id > 0) { $collection = array("type" => "FeatureCollection", "features" => array()); $sql = "select name,ST_AsGeoJSON(coordinates) as coordinates,description,style from tap_routes where partner_id = {$partner_id} and status_id = 2 "; $db->query($sql); while ($db->next_record()) { $name = $db->f("name"); $geometry = json_decode($db->f("coordinates")); // Decoding the json geometry into a json object $description = $db->f("description"); $style = $db->f("style"); $feature = $this->buildFeature($name, $geometry, $description, $style); array_push($collection["features"], $feature); } $result["routes"] = json_encode($collection, JSON_NUMERIC_CHECK); } else { $result["message"] = "Invalid Partner ID"; } $db->close(); return $result; } else { $result["message"] = "Invalid User ID"; return $result; } }
public function isPackageValid($guid) { $db = new clsDBdbConnection(); $guid = $db->esc($guid); $package_id = (int) CCDLookUp("id", "packages", "guid = '{$guid}' and status_id = 2", $db); if ($package_id > 0) { return true; } else { return false; } $db->close(); }
function Validate() { $Validation = true; $Where = ""; if ($this->EditMode) { $Where = " AND NOT (" . $this->ds->Where . ")"; } if (CCDLookUp("COUNT(*)", "lookup_states", "state_id=" . $this->ds->ToSQL($this->state_id->GetValue(), $this->state_id->DataType) . $Where, $this->ds) > 0) { $this->state_id->Errors->addError("The value in field State Abr is already in database."); } $Validation = $this->state_id->Validate() && $Validation; $Validation = $this->state_desc->Validate() && $Validation; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); return $this->Errors->Count() == 0 && $Validation; }
function contacts_list_alm_customers_contacts_jobposition_BeforeShow(&$sender) { $contacts_list_alm_customers_contacts_jobposition_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $contacts_list; //Compatibility //End contacts_list_alm_customers_contacts_jobposition_BeforeShow //DLookup @31-19EF80C6 global $DBdbConnection; $Page = CCGetParentPage($sender); $ccs_result = CCDLookUp("jobposition", "alm_jobpositions", "id = " . $sender->GetValue(), $Page->Connections["dbConnection"]); $Container->jobposition->SetValue($ccs_result); //End DLookup //Close contacts_list_alm_customers_contacts_jobposition_BeforeShow @23-61DF92A4 return $contacts_list_alm_customers_contacts_jobposition_BeforeShow; }
function companies_list_alm_customers_city_BeforeShow(&$sender) { $companies_list_alm_customers_city_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $companies_list; //Compatibility //End companies_list_alm_customers_city_BeforeShow //DLookup @19-F591DF25 global $DBdbConnection; $Page = CCGetParentPage($sender); $ccs_result = CCDLookUp("city", "alm_city", "id = " . $sender->getValue(), $Page->Connections["dbConnection"]); $Component->SetValue($ccs_result); //End DLookup //Close companies_list_alm_customers_city_BeforeShow @18-79F86585 return $companies_list_alm_customers_city_BeforeShow; }
function users_reassignuser_content_alm_customers_city_BeforeShow(&$sender) { $users_reassignuser_content_alm_customers_city_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $users_reassignuser_content; //Compatibility //End users_reassignuser_content_alm_customers_city_BeforeShow //DLookup @26-F591DF25 global $DBdbConnection; $Page = CCGetParentPage($sender); $ccs_result = CCDLookUp("city", "alm_city", "id = " . $sender->getValue(), $Page->Connections["dbConnection"]); $Component->SetValue($ccs_result); //End DLookup //Close users_reassignuser_content_alm_customers_city_BeforeShow @25-0EB4FE56 return $users_reassignuser_content_alm_customers_city_BeforeShow; }
function contacts_subhobbies_list_alm_contacts_subhobbies_hobbie_id_BeforeShow(&$sender) { $contacts_subhobbies_list_alm_contacts_subhobbies_hobbie_id_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $contacts_subhobbies_list; //Compatibility //End contacts_subhobbies_list_alm_contacts_subhobbies_hobbie_id_BeforeShow //DLookup @19-26E83348 global $DBdbConnection; $Page = CCGetParentPage($sender); $ccs_result = CCDLookUp("hobbies", "alm_customers_contacts_hobbies", "id = " . $sender->GetValue(), $Page->Connections["dbConnection"]); $Container->hobbie_id->SetValue($ccs_result); //End DLookup //Close contacts_subhobbies_list_alm_contacts_subhobbies_hobbie_id_BeforeShow @12-A3D4ECBA return $contacts_subhobbies_list_alm_contacts_subhobbies_hobbie_id_BeforeShow; }
function licensing_list_alm_customers_city_BeforeShow(&$sender) { $licensing_list_alm_customers_city_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $licensing_list; //Compatibility //End licensing_list_alm_customers_city_BeforeShow //DLookup @22-F591DF25 global $DBdbConnection; $Page = CCGetParentPage($sender); $ccs_result = CCDLookUp("city", "alm_city", "id = " . $sender->getValue(), $Page->Connections["dbConnection"]); $Component->SetValue($ccs_result); //End DLookup //Close licensing_list_alm_customers_city_BeforeShow @21-C38C102A return $licensing_list_alm_customers_city_BeforeShow; }
function charges1_charge_OnValidate() { //charges1_charge_OnValidate @10-D55FB1E0 //Custom Code @22-2A29BDB7 global $charges1; global $accounting; global $regcharges; global $finalamount; $dba = new clsDBNetConnect(); $dba->connect(); $dba->query("SELECT * FROM users WHERE user_id='" . CCGetUserID() . "'"); $dbL = new clsDBNetConnect(); $dbL->connect(); while ($dba->next_record()) { $clook = $dba->f("country_id"); $city = $dba->f("city"); $state = $dba->f("state_id"); $addr = $dba->f("address1"); $zip = $dba->f("zip"); $usid = $dba->f("user_id"); $email = $dba->f("email"); $country = CCDLookUp("country_desc", "lookup_countries", "country_id='" . $clook . "'", $dbL); } $payment_config = array("method" => "cc", "login" => $accounting["authorize"], "tran_key" => $accounting["authorize_tran_key"], "currency_code" => $regcharges["currencycode"]); $customer_info = array("first_name" => $charges1->FirstName->GetValue(), "last_name" => $charges1->LastName->GetValue(), "address" => $addr, "city" => $city, "state" => $state, "zip" => $zip, "country" => $country, "cust_id" => $usid, "email" => $email); $credit_card_info = array("card_num" => $charges1->CCNumber->GetValue(), "exp_date" => $charges1->ExpDate->GetValue(), "card_code" => $charges1->CardCode->GetValue(), "charge_type" => "AUTH_CAPTURE"); $payment =& new payment_authorizenet($payment_config); $payment->setCustomerIP($_SERVER["REMOTE_ADDR"]); $payment->enableCustomerEmails(TRUE); $payment->addCustomerInfo($customer_info, "billing"); $result = $payment->doPayment(rand(), "Classified Ad Listing Fee", $charges1->charge->GetValue(), "no", $credit_card_info); if (!$result) { $result_code = $payment->response_code; // 2 = declined, 3 = error if ($result_code == 2) { $charges1->charge->Errors->addError("The Card has been declined. Please make sure the Name, CC Number, and Expiration date are correct."); } if ($result_code == 3) { $charges1->charge->Errors->addError("There was an error trying to process your card. Please make sure the Name, CC Number, and Expiration date are correct."); } } $finalamount = $payment->x_amount; //End Custom Code }
public function uploadUserPhoto($file, $params = array()) { if (!empty($file) && strlen($params["guid"]) > 0) { $db = new clsDBdbConnection(); $options = Options::getConsoleOptions(); $uploadTo = $options["console_users_url"]; $tmpFile = $file["file"]["tmp_name"]; $fileName = $file["file"]["name"]; $targetPath = dirname(__FILE__) . "/.." . $uploadTo; //because dirname will be positioned in include folder $fileExt = "." . pathinfo($fileName, PATHINFO_EXTENSION); $targetFilename = Options::getUUIDv6() . $fileExt; $targetFile = $targetPath . $targetFilename; //Updating an existing image, which will replace the existing one for the new $params["guid"] = $db->esc($params["guid"]); $existing_photo = CCDLookUp("photo", "alm_users", "guid = '{$params["guid"]}'", $db); $existing_photo = trim($existing_photo); if (strlen($existing_photo) > 0) { //Get the existing image name to re-use it and replace image on upload $targetFilename = $existing_photo; $targetFile = $targetPath . $targetFilename; } if (move_uploaded_file($tmpFile, $targetFile)) { //File successfully uploaded $params["image_name"] = $targetFilename; //Saving db file reference $this->saveCustomerImage($params); $db->close(); return true; } else { $db->close(); return false; } /* $log = new Logger('almlogs'); $log->pushHandler(new StreamHandler(MAIN_LOG, Logger::WARNING)); $log->addWarning($params["guid"].LOG_LINESEPARATOR); $log->addWarning($params["title"].LOG_LINESEPARATOR); */ } else { return false; } }
function clsRecorditems() { global $FileName; ################ # Begin check users id # ################ $user_id_in = CCGetSession("UserID"); $item_in = CCGetFromGet("ItemNum", ""); // obtains posted item number $check = new clsDBNetConnect(); // create a new db connection if (CCDLookUp("ItemNum", "items", "user_id='" . $user_id_in . "' AND ItemNum='" . $item_in . "'", $check) == $item_in) { $this->Visible = true; // belongs to user so show form } else { $this->Visible = false; // does not belong to user so do not show form CCSecurityRedirect("3;3", "login.php", $FileName, CCGetQueryString("QueryString", "")); // set illegalgroup and redirect to login page } unset($check); // close temp db connection ############### # End check users id # ############### $this->Visible = true; $this->Errors = new clsErrors(); $this->ds = new clsitemsDataSource(); $this->UpdateAllowed = true; if ($this->Visible) { $this->ComponentName = "items"; $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $this->ComponentName); $CCSForm = CCGetFromGet("ccsForm", ""); $this->FormSubmitted = $CCSForm == $this->ComponentName; $Method = $this->FormSubmitted ? ccsPost : ccsGet; $this->ItemNum = new clsControl(ccsLabel, "ItemNum", "ItemNum", ccsInteger, "", CCGetRequestParam("ItemNum", $Method)); $this->title = new clsControl(ccsLabel, "title", "title", ccsText, "", CCGetRequestParam("title", $Method)); $this->added_description = new clsControl(ccsTextArea, "added_description", "Added Description", ccsMemo, "", CCGetRequestParam("added_description", $Method)); $this->Update = new clsButton("Update"); $this->Cancel = new clsButton("Cancel"); $this->dateadded = new clsControl(ccsHidden, "dateadded", "Dateadded", ccsText, "", CCGetRequestParam("dateadded", $Method)); } }
function header_lbusername_BeforeShow(&$sender) { $header_lbusername_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $header; //Compatibility //End header_lbusername_BeforeShow //DLookup @3-A9AF6E5C global $DBdbConnection; $Page = CCGetParentPage($sender); $ccs_result = CCDLookUp("fullname", "alm_users", "id = " . CCGetUserID(), $Page->Connections["dbConnection"]); $Component->SetValue($ccs_result); //End DLookup //Custom Code @4-2A29BDB7 // ------------------------- // Write your own code here. $sender->SetValue(ucwords($sender->GetValue())); // ------------------------- //End Custom Code //Close header_lbusername_BeforeShow @2-B95CD6EB return $header_lbusername_BeforeShow; }
function Validate() { global $CCSLocales; $Validation = true; $Where = ""; if ($this->EditMode && strlen($this->DataSource->Where)) { $Where = " AND NOT (" . $this->DataSource->Where . ")"; } $this->DataSource->user_login->SetValue($this->user_login->GetValue()); if (CCDLookUp("COUNT(*)", "users", "user_login="******"CCS_UniqueValue", "Username")); } $Validation = $this->user_login->Validate() && $Validation; $Validation = $this->user_password->Validate() && $Validation; $Validation = $this->pwrd->Validate() && $Validation; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this); $Validation = $Validation && $this->user_login->Errors->Count() == 0; $Validation = $Validation && $this->user_password->Errors->Count() == 0; $Validation = $Validation && $this->pwrd->Errors->Count() == 0; return $this->Errors->Count() == 0 && $Validation; }
public function getOrderCheckinSummary($orderid) { $result = array("status" => false, "message" => "", "order_detail" => array()); if ($orderid > 0) { $db = new clsDBdbConnection(); $venue_id = CCDLookUp("venue_id", "ppconsole_users", "id = {$userid}", $db); $sql = "select a.datecreated,a.status_id,a.id,b.package_id,b.quantity,c.email,d.title,d.title_summary from orders a,order_detail b,customers c,packages d\n where a.id = {$orderid} and b.order_id = a.id and c.id = a.customer_id and d.id = b.package_id "; $db->query($sql); $db->next_record(); $order_detail["datecreated"] = $db->f("datecreated"); $order_detail["order_id"] = $db->f("id"); $order_detail["email"] = $db->f("email"); $order_detail["title"] = $db->f("title"); $order_detail["title_summary"] = $db->f("title_summary"); //Get amount of checkins allowed $quantity = $db->f("quantity"); $package_id = $db->f("package_id"); $status_id = $db->f("status_id"); $tickets_qty = CCDLookUp("tickets_qty", "packages", "id = {$package_id}", $db); $total_checkins = $tickets_qty * $quantity; $order_detail["total_checkins"] = $total_checkins; //How many times already checked-in $total_checkins_done = CCDLookUp("count(id)", "ppconsole_ticketscheckin", "order_id = {$orderid}", $db); $order_detail["checkins_left"] = $total_checkins - $total_checkins_done; $order_detail["total_checkins_done"] = $total_checkins_done; //Getting status_id colors $order_status = CCDLookUp("status_name", "order_status", "id = {$status_id}", $db); $order_status_style = CCDLookUp("css_color", "order_status", "id = {$status_id}", $db); $order_detail["order_status"] = $order_status; $order_detail["order_status_style"] = $order_status_style; $db->close(); $result["status"] = true; $result["message"] = "Order summary successfully."; $result["order_detail"] = $order_detail; return $result; } else { $result["status"] = false; $result["message"] = "Invalid Order ID."; return $result; } }
function Validate() { global $now; $Validation = true; $Where = ""; $ckdb = new clsDBNetConnect(); $ckdb->connect(); if ($this->EditMode) { $Where = " AND NOT (" . $this->ds->Where . ")"; } if (CCDLookUp("COUNT(*)", "users", "user_login="******"The Username <b>\"" . $this->user_login->GetValue() . "\"</b> is already taken."); } if (CCDLookUp("COUNT(*)", "users", "email=" . $this->ds->ToSQL($this->email->GetValue(), $this->email->DataType) . $Where, $this->ds) > 0) { $this->email->Errors->addError("The Email Address <b>\"" . $this->email->GetValue() . "\"</b> is in use by another member."); } if ($now["bounceout"] == 1) { if ($this->age->GetValue() == $now["bouceout_id"]) { header("location: ./index.php"); exit; } } $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); $Validation = $this->user_login->Validate() && $Validation; $Validation = $this->email->Validate() && $Validation; $Validation = $this->first_name->Validate() && $Validation; $Validation = $this->last_name->Validate() && $Validation; $Validation = $this->address1->Validate() && $Validation; $Validation = $this->address2->Validate() && $Validation; $Validation = $this->city->Validate() && $Validation; $Validation = $this->state_id->Validate() && $Validation; $Validation = $this->zip->Validate() && $Validation; $Validation = $this->country_id->Validate() && $Validation; $Validation = $this->phone_day->Validate() && $Validation; $Validation = $this->phone_evn->Validate() && $Validation; $Validation = $this->fax->Validate() && $Validation; $Validation = $this->age->Validate() && $Validation; //$Validation = ($this->gender->Validate() && $Validation); //$Validation = ($this->education->Validate() && $Validation); //$Validation = ($this->income->Validate() && $Validation); //$Validation = ($this->newsletter->Validate() && $Validation); //$Validation = ($this->newstype->Validate() && $Validation); $Validation = $this->agreement_id->Validate() && $Validation; //$Validation = ($this->user_password->Validate() && $Validation); //$Validation = ($this->date_created->Validate() && $Validation); //$Validation = ($this->ip_insert->Validate() && $Validation); //$Validation = ($this->ip_update->Validate() && $Validation); //$Validation = ($this->status->Validate() && $Validation); return $this->Errors->Count() == 0 && $Validation; }
function UpdateRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate"); $this->ds->ItemNumLabel->SetValue($this->ItemNumLabel->GetValue()); $this->ds->UserIDLabel->SetValue($this->UserIDLabel->GetValue()); $this->ds->StartedLabel->SetValue($this->StartedLabel->GetValue()); $this->ds->ClosesLabel->SetValue($this->ClosesLabel->GetValue()); $this->ds->title->SetValue($this->title->GetValue()); $this->ds->status->SetValue($this->status->GetValue()); $this->ds->end_reason->SetValue($this->end_reason->GetValue()); $this->ds->category->SetValue($this->category->GetValue()); $this->ds->close->SetValue($this->close->GetValue()); $this->ds->asking_price->SetValue($this->asking_price->GetValue()); $this->ds->make_offer->SetValue($this->make_offer->GetValue()); $this->ds->quantity->SetValue($this->quantity->GetValue()); $this->ds->city_town->SetValue($this->city_town->GetValue()); $this->ds->states->SetValue($this->states->GetValue()); $this->ds->description->SetValue($this->description->GetValue()); $this->ds->dateadded->SetValue($this->dateadded->GetValue()); $this->ds->added_description->SetValue($this->added_description->GetValue()); $this->ds->image_one->SetValue($this->image_one->GetValue()); $this->ds->image_two->SetValue($this->image_two->GetValue()); $this->ds->image_three->SetValue($this->image_three->GetValue()); $this->ds->image_four->SetValue($this->image_four->GetValue()); $this->ds->image_five->SetValue($this->image_five->GetValue()); $this->ds->bold->SetValue($this->bold->GetValue()); $this->ds->background->SetValue($this->background->GetValue()); $this->ds->cat_featured->SetValue($this->cat_featured->GetValue()); $this->ds->home_featured->SetValue($this->home_featured->GetValue()); $this->ds->gallery_featured->SetValue($this->gallery_featured->GetValue()); $this->ds->image_preview->SetValue($this->image_preview->GetValue()); $this->ds->slide_show->SetValue($this->slide_show->GetValue()); $this->ds->counter->SetValue($this->counter->GetValue()); $this->ds->hits->SetValue($this->hits->GetValue()); $this->ds->user_id->SetValue($this->user_id->GetValue()); $this->ds->started->SetValue($this->started->GetValue()); $ld = new clsDBDBNetConnect(); $ld->connect(); if ($this->close->GetValue() != 979) { $thedays = CCDLookUp("days", "lookup_listing_dates", "date_id='" . $this->closes->GetValue() . "'", $ld); $this->ds->closes->SetValue(86400 * $thedays + time()); } if ($this->close->GetValue() == 979) { $this->ds->closes->SetValue($this->ds->closes->GetValue()); } unset($ld); $this->ds->ItemNum->SetValue($this->ItemNum->GetValue()); $this->ds->Update(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate"); if ($this->ds->Errors->Count() > 0) { echo "Error in Record " . $this->ComponentName . " / Update Operation"; $this->ds->Errors->Clear(); $this->Errors->AddError("Database command error."); } return $this->Errors->Count() == 0; }
function Show() { global $Tpl; if (!$this->Visible) { return; } $ShownRecords = 0; $this->ds->Parameters["urlSUBID"] = CCGetFromGet("SUBID", ""); $this->ds->Prepare(); $this->ds->Open(); $GridBlock = "Grid " . $this->ComponentName; $Tpl->block_path = $GridBlock; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); $is_next_record = $this->ds->next_record(); if ($is_next_record && $ShownRecords < $this->PageSize) { do { $this->ds->SetValues(); $Tpl->block_path = $GridBlock . "/Row"; $this->Go->SetValue($this->ds->Go->GetValue()); $this->Go->Parameters = CCGetQueryString("QueryString", array("ccsForm", "cat_id", "SUBID", "categoriesPage")); $this->Go->Parameters = CCAddParam($this->Go->Parameters, "SUBID", $this->ds->f("cat_id")); $this->Go->Page = "CategoriesList.php"; $this->name->SetValue($this->ds->name->GetValue()); $this->weight->SetValue($this->ds->weight->GetValue()); $this->Edit->Parameters = CCGetQueryString("QueryString", array("ccsForm")); $this->Edit->Parameters = CCAddParam($this->Edit->Parameters, "cat_id", $this->ds->f("cat_id")); $this->Edit->Page = "CategoriesMaintanence.php"; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->Go->Show(); $this->name->Show(); $this->weight->Show(); $this->Edit->Show(); $Tpl->block_path = $GridBlock; $Tpl->parse("Row", true); $ShownRecords++; $is_next_record = $this->ds->next_record(); } while ($is_next_record && $ShownRecords < $this->PageSize); } else { $Tpl->parse("NoRecords", false); } $findout = ""; if (CCGetFromGet("SUBID", "") != 1 && CCGetFromGet("SUBID", "") != "") { $dr = new clsDBNetConnect(); $dr->connect(); $loc = CCGetFromGet("SUBID", ""); $find = CCDLookUp("sub_cat_id", "categories", "cat_id='" . $loc . "'", $dr); $findout = "<a href=\"CategoriesList.php?SUBID=" . $find . "\">Back Up One</a>"; unset($dr); } $Tpl->SetVar("GoBack", $findout); $this->AddNew->SetValue(1); $this->Navigator->TotalPages = $this->ds->PageCount(); $this->Sorter_name->Show(); $this->AddNew->Show(); $this->Navigator->Show(); $Tpl->parse("", false); $Tpl->block_path = ""; }
public function isOrderExpired($orderid, $userid) { $result = array("status" => false, "message" => "", "expired" => false); $orderid = (int) $orderid; if ($orderid > 0) { $db = new clsDBdbConnection(); $customer_id = CCDLookUp("customer_id", "orders", "id = {$orderid}", $db); $statusid_order = CCDLookUp("status_id", "orders", "id = {$orderid}", $db); //Orders after paid will expire 15 days after arrival date, configurable in options $arrival_date = CCDLookUp("arrivaldate", "customer_tripinfo", "customer_id = {$customer_id}", $db); $options = new Options(); $ordersOptions = $options->getOrdersOptions(); $expiration_indays = (int) $ordersOptions["orders_expiration_indays"]; if (strtotime($arrival_date) > 0) { $expiration_date = date("Y-m-d", strtotime($arrival_date . " + {$expiration_indays} days")); } else { $expiration_date = "0000-00-00"; } //This will show a warning when a paid order is already expired if ($statusid_order == 3) { $today = strtotime(date("Y-m-d")); $expirationDate = strtotime($expiration_date); if ($today > $expirationDate) { $result["status"] = true; $result["expired"] = true; $result["message"] = "Order has expired"; //Expire all assigned tickets to this order $this->setExpireOrderTickets($orderid, $userid); } else { $result["status"] = true; $result["expired"] = false; $result["message"] = "Order is valid"; } } else { $result["status"] = false; $result["expired"] = false; $result["message"] = "Order is not paid"; } $db->close(); return $result; } else { $result["status"] = false; $result["expired"] = false; $result["message"] = "There is no order id"; return $result; } }
function InsertRow() { global $EP; global $now; $db2 = new clsDBNetConnect(); $EP["EMAIL:REPLY_TO_USER_ID"] = $this->to_user_id->GetValue(); $EP["EMAIL:REPLY_TO_USERNAME"] = CCDLookUp("user_login", "users", "user_id='" . $this->to_user_id->GetValue() . "'", $db2); $EP["EMAIL:REPLY_MESSAGE"] = $this->message->GetValue(); $EP["EMAIL:REPLY_FROM_USER_ID"] = CCGetUserID(); $EP["EMAIL:REPLY_FROM_USERNAME"] = CCGetUserLogin(); $EP["EMAIL:REPLY_SUBJECT"] = $this->subject->GetValue(); /* $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert"); $this->ds->subject->SetValue($newsubject); $this->ds->message->SetValue($newmessage); $this->ds->to_user_id->SetValue($this->to_user_id->GetValue()); $this->ds->from_user_id->SetValue($CCGetUserID()); $this->ds->emaildate->SetValue($time()); $this->ds->been_read->SetValue(0); $this->ds->Insert(); */ mailout("EmailReply", 0, $this->to_user_id->GetValue(), CCGetUserID(), time(), $EP); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert"); if ($this->ds->Errors->Count() > 0) { echo "Error in Record " . $this->ComponentName . " / Insert Operation"; $this->ds->Errors->Clear(); $this->Errors->AddError("Database command error."); } return $this->Errors->Count() == 0; }
function InsertRow() { global $EP; global $now; $db2 = new clsDBNetConnect(); $db2->connect(); $EP["EMAIL:MAO_TO_SELLER_ID"] = $this->to_user_id->GetValue(); $EP["EMAIL:MAO_TO_SELLER_USERNAME"] = CCDLookUp("user_login", "users", "user_id='" . $this->to_user_id->GetValue() . "'", $db2); $EP["EMAIL:MAO_MESSAGE"] = $this->message->GetValue(); $EP["EMAIL:MAO_FROM_BUYER_ID"] = CCGetUserID(); $EP["EMAIL:MAO_FROM_BUYER_USERNAME"] = CCGetUserLogin(); $EP["EMAIL:MAO_ITEM_NUMBER"] = $this->item_id->GetValue(); $EP["EMAIL:MAO_TITLE"] = CCDLookUp("title", "items", "ItemNum='" . $this->item_id->GetValue() . "'", $db2); $EP["EMAIL:MAO_AMOUNT"] = $this->subject->GetValue(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert"); /* $this->ds->subject->SetValue($newsubject); $this->ds->message->SetValue($newmessage); $this->ds->item_id->SetValue($this->item_id->GetValue()); $this->ds->to_user_id->SetValue($this->to_user_id->GetValue()); $this->ds->from_user_id->SetValue(CCGetUserID()); $this->ds->emaildate->SetValue(time()); $this->ds->Insert(); */ mailout("MakeAnOffer", 0, $this->to_user_id->GetValue(), CCGetUserID(), time(), $EP); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert"); if ($this->ds->Errors->Count() > 0) { echo "Error in Record " . $this->ComponentName . " / Insert Operation"; $this->ds->Errors->Clear(); $this->Errors->AddError("Database command error."); } return $this->Errors->Count() == 0; }
public function setPaymentTerminal($payment_type, $currency_id, $approval_number, $payment_amount, $orderid, $userid) { $orderid = (int) $orderid; $result = array("status" => false, "message" => ""); if ($orderid > 0) { $db = new clsDBdbConnection(); $currency_id = (int) $currency_id; $order_total = (double) CCDLookUp("total", "orders", "id = {$orderid}", $db); $payment_amount = (double) $payment_amount; $payment_type = (int) $payment_type; $approval_number = $db->esc($approval_number); if ($payment_amount >= $order_total) { if (strlen($approval_number) > 0 && $payment_type > 0) { $guid = Options::getUUIDv6(); $amount_residual = $payment_amount - $order_total; $total_paid = $payment_amount - $amount_residual; $sql = "insert into ppconsole_payments(guid,currency_id,order_id,total_paid,amount_received,amount_residual,created_userid,approval_number,paymenttype_id)\n values('{$guid}',{$currency_id},{$orderid},{$total_paid},{$payment_amount},{$amount_residual},{$userid},'{$approval_number}',{$payment_type}) "; $db->query($sql); $db->next_record(); //Update order status after payment confirmation $sql = "update orders set status_id = 3,modified_iduser = {$userid} where id = {$orderid}"; $db->query($sql); $db->next_record(); $result["status"] = true; $result["message"] = "Order has been paid successfully"; //Notify the customer and notification list that payment for the order has been approved $this->setNotificationOrderPaid($orderid, $userid); } else { $result["status"] = false; $result["message"] = "Invalid approval number or payment type"; } } else { $result["status"] = false; $result["message"] = "Input amount is less than order total"; } $db->close(); return $result; } else { $result["status"] = false; $result["message"] = "Invalid order id"; return $result; } }
function Show() { global $Tpl; global $now; if (!$this->Visible) { return; } $ShownRecords = 0; $this->ds->Parameters["sesUserID"] = CCGetSession("UserID"); $this->ds->Prepare(); $this->ds->Open(); $GridBlock = "Grid " . $this->ComponentName; $Tpl->block_path = $GridBlock; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); $is_next_record = $this->ds->next_record(); if ($is_next_record && $ShownRecords < $this->PageSize) { do { $this->ds->SetValues(); $Tpl->block_path = $GridBlock . "/Row"; if ($this->ds->been_read->GetValue() == 1) { $this->been_read->SetValue("class=\"ltdt\""); } else { $this->been_read->SetValue(""); } $this->subject->SetValue($this->ds->subject->GetValue()); $twodays = $this->ds->emaildate->GetValue(); $theday = getdate($twodays); $lastofyear = substr($theday["year"], -2); $enddate = $theday["mon"] . "/" . $theday["mday"] . "/" . $lastofyear; $this->emaildate->SetValue(date("F j, Y, g:i a", $this->ds->emaildate->GetValue())); if ($this->ds->from_user_id->GetValue() != "" && is_numeric($this->ds->from_user_id->GetValue()) && $this->ds->from_user_id->GetValue() != 1000000000) { $lookupdb = new clsDBNetConnect(); $lookupdb->connect(); $thename = CCDLookUp("user_login", "users", "user_id='" . $this->ds->from_user_id->GetValue() . "'", $lookupdb); $this->from_user_id->SetValue($thename); unset($lookupdb); } else { $this->from_user_id->SetValue($now["sitename"]); } $this->email_id->SetValue($this->ds->email_id->GetValue()); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->been_read->Show(); $this->subject->Show(); $this->emaildate->Show(); $this->from_user_id->Show(); $this->email_id->Show(); $Tpl->block_path = $GridBlock; $Tpl->parse("Row", true); $ShownRecords++; $is_next_record = $this->ds->next_record(); } while ($is_next_record && $ShownRecords < $this->PageSize); } else { $Tpl->parse("NoRecords", false); } $this->Navigator->TotalPages = $this->ds->PageCount(); $this->Sorter_subject->Show(); $this->Sorter_emaildate->Show(); $this->Navigator->Show(); $Tpl->parse("", false); $Tpl->block_path = ""; }
function UpdateRow() { global $closes; global $valid; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate"); $this->ds->category->SetValue($this->category->GetValue()); $this->ds->title->SetValue($this->title->GetValue()); $this->ds->item_paypal->SetValue($this->item_paypal->GetValue()); $this->ds->quantity->SetValue($this->quantity->GetValue()); $this->ds->ship1->SetValue($this->ship1->GetValue()); $this->ds->shipfee1->SetValue($this->shipfee1->GetValue()); $this->ds->ship2->SetValue($this->ship2->GetValue()); $this->ds->shipfee2->SetValue($this->shipfee2->GetValue()); $this->ds->ship3->SetValue($this->ship3->GetValue()); $this->ds->shipfee3->SetValue($this->shipfee3->GetValue()); $this->ds->ship4->SetValue($this->ship4->GetValue()); $this->ds->shipfee4->SetValue($this->shipfee4->GetValue()); $this->ds->ship5->SetValue($this->ship5->GetValue()); $this->ds->shipfee5->SetValue($this->shipfee5->GetValue()); if ($this->asking_price->GetValue() == NULL) { $Asking = 0.0; } elseif ($this->asking_price->GetValue() == 0) { $Asking = 0.0; } else { $Asking = $this->asking_price->GetValue(); } $this->ds->asking_price->SetValue($Asking); $this->ds->make_offer->SetValue($this->make_offer->GetValue()); $this->ds->description->SetValue($this->description->GetValue()); $this->ds->image_preview->SetValue($this->image_preview->GetValue()); $this->ds->slide_show->SetValue($this->slide_show->GetValue()); $this->ds->city_town->SetValue($this->city_town->GetValue()); $this->ds->state_province->SetValue($this->state_province->GetValue()); $this->ds->country->SetValue($this->country->GetValue()); if ($valid) { $this->ds->fakeuser->SetValue($this->fakeuser->GetValue()); $this->ds->startnow->SetValue($this->startnow->GetValue()); $this->ds->addtime->SetValue($this->addtime->GetValue()); } $tempdb = new clsDBNetConnect(); $tempdb->connect(); $this->ds->close->SetValue($this->close->GetValue()); $this->ds->closes->SetValue(86400 * CCDLookUp("days", "lookup_listing_dates", "date_id='" . $this->close->GetValue() . "'", $tempdb) + time()); $this->ds->started->SetValue(time()); $this->ds->home_featured->SetValue($this->home_featured->GetValue()); $this->ds->gallery_featured->SetValue($this->gallery_featured->GetValue()); $this->ds->cat_featured->SetValue($this->cat_featured->GetValue()); $this->ds->bold->SetValue($this->bold->GetValue()); $this->ds->background->SetValue($this->background->GetValue()); $this->ds->counter->SetValue($this->counter->GetValue()); $this->ds->ItemNum->SetValue($this->ItemNum->GetValue()); CCSetSession("RecentItemNum", $this->ItemNum->GetValue()); if (!$valid) { $this->ds->user_id->SetValue(CCGetUserID()); } else { $this->ds->user_id->SetValue($this->fakeuser->GetValue()); } $this->ds->status->SetValue(0); $this->ds->image_five->SetValue($this->image_five->GetValue()); $this->ds->image_four->SetValue($this->image_four->GetValue()); $this->ds->image_three->SetValue($this->image_three->GetValue()); $this->ds->image_two->SetValue($this->image_two->GetValue()); $this->ds->image_one->SetValue($this->image_one->GetValue()); $this->ds->Update(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate"); if ($this->ds->Errors->Count() > 0) { echo "Error in Record " . $this->ComponentName . " / Update Operation"; $this->ds->Errors->Clear(); $this->Errors->AddError("Database command error."); } return $this->Errors->Count() == 0; }
function Show() { global $Tpl; global $FileName; $Error = ""; if (!$this->Visible) { return; } $this->ds->open(); $RecordBlock = "Record " . $this->ComponentName; $Tpl->block_path = $RecordBlock; if ($this->EditMode) { if ($this->Errors->Count() == 0) { if ($this->ds->Errors->Count() > 0) { echo "Error in Record watchlist"; } else { if ($this->ds->next_record()) { $this->ds->SetValues(); if (!$this->FormSubmitted) { $lookupdb = new clsDBNetConnect(); $lookupdb->connect(); if (CCGetFromGet("ItemNum", "")) { $newtitle = CCDLookUp("title", "items", "ItemNum='" . CCGetFromGet("ItemNum", "") . "'", $lookupdb); } $this->ItemTitle->SetValue($newtitle); $this->itemID->SetValue(CCGetFromGet("ItemNum", "")); $this->user_id->SetValue(CCGetUserID()); unset($lookupdb); } } else { $this->EditMode = false; } } } } $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); if ($this->FormSubmitted) { $Error .= $this->ItemTitle->Errors->ToString(); $Error .= $this->itemID->Errors->ToString(); $Error .= $this->user_id->Errors->ToString(); $Error .= $this->Errors->ToString(); $Error .= $this->ds->Errors->ToString(); $Tpl->SetVar("Error", $Error); $Tpl->Parse("Error", false); } $Tpl->SetVar("Action", $this->HTMLFormAction); $this->Insert->Visible = !$this->EditMode; $lookupdb = new clsDBNetConnect(); $lookupdb->connect(); if (CCGetFromGet("ItemNum", "")) { $newtitle = CCDLookUp("title", "items", "ItemNum='" . CCGetFromGet("ItemNum", "") . "'", $lookupdb); } $this->ItemTitle->SetValue($newtitle); $this->itemID->SetValue(CCGetFromGet("ItemNum", "")); $this->user_id->SetValue(CCGetUserID()); unset($lookupdb); $this->ItemTitle->Show(); $this->Insert->Show(); $this->Cancel->Show(); $this->itemID->Show(); $this->user_id->Show(); $Tpl->parse("", false); $Tpl->block_path = ""; }
public function deleteSubHobbies($params = array()) { $result = array("status" => false, "message" => ""); $guid = $params["guid"]; if (strlen($guid) > 0) { //This operation will also delete contacts associated to the customer $db = new clsDBdbConnection(); $guid = $db->esc($guid); $subhobbie_id = (int) CCDLookUp("id", "alm_customers_contacts_subhobbies", "guid = '{$guid}' ", $db); if ($subhobbie_id > 0) { //Deleting contacts $sql = "delete from alm_customers_contacts_subhobbies where id = {$subhobbie_id}"; $db->query($sql); } $db->close(); $result["status"] = true; $result["message"] = "Command executed successfully."; return $result; } else { $result["status"] = false; $result["message"] = "Invalid GUID"; return $result; } }
function startlistingnow($ItemNum, $UserID) { global $now; global $EP; global $regcharges; CCSetSession("ItemNum", $ItemNum); $db = new clsDBNetConnect(); $db->connect(); $whereif = "ItemNum='" . $ItemNum . "'"; $days = CCDLookUp("close", "items", $whereif, $db); $dayslk = CCDLookUp("days", "lookup_listing_dates", "date_id='" . $days . "'", $db); $dayscal = 86400 * $dayslk + time(); $approval = groupApprovalSpec(); if ($approval["required"] && $now["approv_priority"] || $approval["required"] && !$now["approv_priority"] && !$approval["notrequired"]) { $stat = 99; } else { $stat = 1; } $sql = "select `acct_credit_used` from items where ItemNum = '" . $ItemNum . "'"; $db->query($sql); if ($db->next_record()) { if ($db->f("acct_credit_used") > 0) { $sql = "insert into `charges` (`user_id`, `date`, `charge`, `cause`) Values ('" . $UserID . "', '" . time() . "', '-" . $db->f("acct_credit_used") . "', 'Account Credit Used to Start Item Number: " . $ItemNum . "')"; $db->query($sql); } } $sql = "UPDATE items SET status='" . $stat . "', started=" . time() . ", closes=" . $dayscal . " WHERE ItemNum='" . $ItemNum . "'"; $db->query($sql); $sql = "select * from used_coupons where ItemNum = '" . $ItemNum . "'"; $db->query($sql); if ($db->next_record()) { $sql = "UPDATE used_coupons SET `used`='1' WHERE ItemNum='" . $ItemNum . "'"; $db->query($sql); } $sql = "select * from used_tokens where ItemNum = '" . $ItemNum . "'"; $db->query($sql); if ($db->next_record()) { $sql = "UPDATE used_tokens SET `date`='" . time() . "' WHERE ItemNum='" . $ItemNum . "'"; $db->query($sql); } unset($db); unset($sql); CCSetSession("RecentItemNum", ""); $lookdb = new clsDBNetConnect(); $lookdb->connect(); $lookdb->query("SELECT * FROM users WHERE user_id='" . $UserID . "'"); if ($lookdb->next_record()) { $ld = array("first" => $lookdb->f("first_name"), "ID" => $lookdb->f("user_id"), "user_password" => $lookdb->f("user_password"), "last" => $lookdb->f("last_name"), "email" => $lookdb->f("email"), "address" => $lookdb->f("address1"), "address2" => $lookdb->f("address2"), "state" => $lookdb->f("state_id"), "zip" => $lookdb->f("zip"), "city" => $lookdb->f("city"), "phonedy" => $lookdb->f("phone_day"), "phoneevn" => $lookdb->f("phone_evn"), "fax" => $lookdb->f("fax"), "ip" => $lookdb->f("ip_insert"), "date_created" => $lookdb->f("date_created")); } $nb = new clsDBNetConnect(); $nb->connect(); $nb->query("SELECT * FROM items WHERE " . $whereif); if ($nb->next_record()) { $ls = array("itemID" => $nb->f("itemID"), "ItemNum" => $nb->f("ItemNum"), "category" => $nb->f("category"), "title" => $nb->f("title"), "started" => $nb->f("started"), "close" => $nb->f("close"), "closes" => $nb->f("closes"), "bold" => $nb->f("bold"), "background" => $nb->f("background"), "cat_featured" => $nb->f("cat_featured"), "home_featured" => $nb->f("home_featured"), "gallery_featured" => $nb->f("gallery_featured"), "image_preview" => $nb->f("image_preview"), "slide_show" => $nb->f("slide_show"), "counter" => $nb->f("counter"), "make_offer" => $nb->f("make_offer"), "image_one" => $nb->f("image_one"), "image_two" => $nb->f("image_two"), "image_three" => $nb->f("image_three"), "image_four" => $nb->f("image_four"), "image_five" => $nb->f("image_five"), "asking_price" => $nb->f("asking_price"), "quantity" => $nb->f("quantity"), "city" => $nb->f("city_town"), "state" => $nb->f("state_province")); } $lbold = pode($ls["bold"], $regcharges["bold_fee"]); $lhome = pode($ls["home_featured"], $regcharges["home_fee"]); $lback = pode($ls["background"], $regcharges["high_fee"]); $lcat = pode($ls["cat_featured"], $regcharges["cat_fee"]); $lgal = pode($ls["gallery_featured"], $regcharges["gallery_fee"]); $lipre = pode($ls["image_preview"], $regcharges["image_pre_fee"]); $lslide = pode($ls["slide_show"], $regcharges["slide_fee"]); $lcount = pode($ls["counter"], $regcharges["counter_fee"]); $li1 = podeimg($ls["image_one"], $regcharges["upload_fee"]); $li2 = podeimg($ls["image_two"], $regcharges["upload_fee"]); $li3 = podeimg($ls["image_three"], $regcharges["upload_fee"]); $li4 = podeimg($ls["image_four"], $regcharges["upload_fee"]); $li5 = podeimg($ls["image_five"], $regcharges["upload_fee"]); if ($ls["make_offer"] == 1) { $make = "Make Offer"; } if ($ls["make_offer"] == 0) { $make = ""; } $gf1 = new clsDBNetConnect(); $gf1->connect(); $gf2 = new clsDBNetConnect(); $gf2->connect(); $gf3 = new clsDBNetConnect(); $gf3->connect(); $EP["EMAIL:AD_ITEM_NUMBER"] = $ls["ItemNum"]; $EP["EMAIL:AD_CATEGORY_ID"] = $ls["category"]; $EP["EMAIL:AD_CATEGORY"] = CCDLookUp("name", "categories", "cat_id='" . $ls["category"] . "'", $gf1); $EP["EMAIL:AD_TITLE"] = $ls["title"]; $EP["EMAIL:AD_STARTED"] = date("F j, Y, g:i a", $ls["started"]); $EP["EMAIL:AD_CLOSES"] = date("F j, Y, g:i a", $ls["closes"]); $EP["EMAIL:AD_DAYS_RUNNING"] = CCDLookUp("days", "lookup_listing_dates", "date_id='" . $ls["close"] . "'", $gf2); $EP["EMAIL:AD_BOLD_CHARGE"] = $lbold; $EP["EMAIL:AD_HIGHLIGHTED_CHARGE"] = $lback; $EP["EMAIL:AD_CATEGORY_FEATURED_CHARGE"] = $lcat; $EP["EMAIL:AD_GALLERY_CHARGE"] = $lgal; $EP["EMAIL:AD_IMAGE_PREVIEW_CHARGE"] = $lipre; $EP["EMAIL:AD_HOME_PAGE_CHARGE"] = $lhome; $EP["EMAIL:AD_SLIDE_SHOW_CHARGE"] = $lslide; $EP["EMAIL:AD_COUNTER_CHARGE"] = $lcount; $EP["EMAIL:AD_DAYS_FEE"] = CCDLookUp("fee", "lookup_listing_dates", "date_id='" . $ls["close"] . "'", $gf3); $EP["EMAIL:AD_IMAGE_ONE_CHARGE"] = $li1; $EP["EMAIL:AD_IMAGE_TWO_CHARGE"] = $li2; $EP["EMAIL:AD_IMAGE_THREE_CHARGE"] = $li3; $EP["EMAIL:AD_IMAGE_FOUR_CHARGE"] = $li4; $EP["EMAIL:AD_IMAGE_FIVE_CHARGE"] = $li5; $EP["EMAIL:AD_MAKE_OFFER"] = $make; $EP["EMAIL:AD_ASKING_PRICE"] = $ls["asking_price"]; $EP["EMAIL:AD_QUANTITY"] = $ls["quantity"]; $EP["EMAIL:AD_CITY"] = $ls["city"]; $EP["EMAIL:AD_STATE_PROVINCE"] = $ls["state"]; $EP["EMAIL:CURRENT_USERNAME"] = CCGetUserLogin(); $EP["EMAIL:CURRENT_USERID"] = $ld["ID"]; $EP["EMAIL:CURRENT_USER_PASSWORD"] = $ld["user_password"]; $EP["EMAIL:CURRENT_USER_FIRST_NAME"] = $ld["first"]; $EP["EMAIL:CURRENT_USER_LAST_NAME"] = $ld["last"]; $EP["EMAIL:CURRENT_USER_EMAIL"] = $ld["email"]; $EP["EMAIL:CURRENT_USER_ADDRESS"] = $ld["address"]; $EP["EMAIL:CURRENT_USER_ADDRESS2"] = $ld["address2"]; $EP["EMAIL:CURRENT_USER_STATE"] = $ld["state"]; $EP["EMAIL:CURRENT_USER_CITY"] = $ld["city"]; $EP["EMAIL:CURRENT_USER_ZIP"] = $ld["zip"]; $EP["EMAIL:CURRENT_USER_DAY_PHONE"] = $ld["phonedy"]; $EP["EMAIL:CURRENT_USER_EVN_PHONE"] = $ld["phoneevn"]; $EP["EMAIL:CURRENT_USER_FAX"] = $ld["fax"]; $EP["EMAIL:CURRENT_USER_IP"] = getenv("REMOTE_ADDR"); $EP["EMAIL:CURRENT_USER__REGISTERED_IP"] = $ld["ip"]; $EP["EMAIL:CURRENT_USER_DATE_SIGNEDUP"] = date("F j, Y, g:i a", $ld["date_created"]); if ($stat == 99) { mailout("NewListingApproval", $now["notifyads"], $ld["ID"], 1000000000, time(), $EP); } else { mailout("NewListing", $now["notifyads"], $ld["ID"], 1000000000, time(), $EP); index_listing($ItemNum); $db = new clsDBNetConnect(); $query = "Select * from custom_textarea_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("value"), "ta", $db->f("field_id")); } $query = "Select * from custom_textbox_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("value"), "tb", $db->f("field_id")); } $query = "Select * from custom_dropdown_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("option_id"), "dd", $db->f("field_id"), $db->f("option_id")); } add_catcounts($ls["category"]); } //End Custom Code return $stat; }
public function exportZones($zone_guid, $customer_type_id, $route_id, $userid) { $result = array("status" => false, "message" => "", "excel" => ""); $userid = (int) $userid; $route_id = (int) $route_id; if (strlen($zone_guid) > 0 || strlen($customer_type_id) > 0 || $route_id > 0) { $db = new clsDBdbConnection(); $zone_guid = $db->esc($zone_guid); $zone_id = (int) CCDLookUp("id", "tap_zones", "guid = '{$zone_guid}'", $db); if ($zone_id > 0 || strlen($customer_type_id) > 0 || $route_id > 0) { $zone_name = CCDLookUp("description", "tap_zones", "id = {$zone_id}", $db); $username = CCDLookUp("username", "tap_users", "id = {$userid}", $db); $partner_id = (int) CCDLookUp("partner_id", "tap_users", "id = {$userid}", $db); $partner_name = CCDLookUp("partner", "tap_partners", "id = {$partner_id}", $db); $route_name = CCDLookUp("name", "tap_routes", "id = {$route_id}", $db); $customer_type = ""; //Only look for customer type if chosen as search criteria if (strlen($customer_type_id) > 0) { //Get all customer_types $sql_types = "select customer_type from customer_types where id in ({$customer_type_id}) "; $db->query($sql_types); while ($db->next_record()) { $customer_type .= $db->f("customer_type") . ","; } } $customer_type = rtrim($customer_type, ","); $customer_type = ltrim($customer_type, ","); //Build Excel Sheet $sheet = new PHPExcel(); $sheet->getProperties()->setCreator("User : {$username}")->setTitle("ZONE: {$zone_name}"); $cont = 12; $fieldrow = 12; $sheet->setActiveSheetIndex(0)->setCellValue("A7", "CUSTOMERS LIST"); $sheet->setActiveSheetIndex(0)->setCellValue("A8", "ZONE: {$zone_name}"); $sheet->setActiveSheetIndex(0)->setCellValue("A9", "ROUTE: {$route_name}"); $sheet->setActiveSheetIndex(0)->setCellValue("A10", "CUSTOMER TYPES: {$customer_type}"); //Get customer map sql parameters $customers = new Customers(); $sql = $customers->buildSearchSQLZoneCatRoute($zone_id, $customer_type_id, $route_id); $db->query($sql); while ($db->next_record()) { //$sql = select a.id,a.guid,a.name,a.address,a.phone,a.lat,a.lng from customers a, tap_zones b $customer_id = $db->f("id"); $customer_name = $db->f("name"); $customer_address = $db->f("address"); $customer_phone = $db->f("phone"); $customer_lat = $db->f("lat"); $customer_lng = $db->f("lng"); $customer_partner_id = $db->f("partner_id"); $customer_type = $db->f("customer_type"); $direct_customer = "YES"; if ($partner_id != $customer_partner_id) { $direct_customer = "NO"; } $sheet->setActiveSheetIndex(0)->setCellValue("A{$fieldrow}", "CUSTOMER ID"); $sheet->setActiveSheetIndex(0)->setCellValue("B{$fieldrow}", "CUSTOMER NAME"); $sheet->setActiveSheetIndex(0)->setCellValue("C{$fieldrow}", "CUSTOMER ADDRESS"); $sheet->setActiveSheetIndex(0)->setCellValue("D{$fieldrow}", "CUSTOMER PHONE"); $sheet->setActiveSheetIndex(0)->setCellValue("E{$fieldrow}", "CUSTOMER LAT"); $sheet->setActiveSheetIndex(0)->setCellValue("F{$fieldrow}", "CUSTOMER LNG"); $sheet->setActiveSheetIndex(0)->setCellValue("G{$fieldrow}", "DIRECT CUSTOMER"); $sheet->setActiveSheetIndex(0)->setCellValue("H{$fieldrow}", "CUSTOMER CATEGORY"); //Detail $sheet->setActiveSheetIndex(0)->getCell("A{$cont}")->setValueExplicit($customer_id, PHPExcel_Cell_DataType::TYPE_STRING); $sheet->setActiveSheetIndex(0)->setCellValue("B{$cont}", $customer_name); $sheet->setActiveSheetIndex(0)->setCellValue("C{$cont}", $customer_address); $sheet->setActiveSheetIndex(0)->setCellValue("D{$cont}", $customer_phone); $sheet->setActiveSheetIndex(0)->setCellValue("E{$cont}", $customer_lat); $sheet->setActiveSheetIndex(0)->setCellValue("F{$cont}", $customer_lng); $sheet->setActiveSheetIndex(0)->setCellValue("G{$cont}", $direct_customer); $sheet->setActiveSheetIndex(0)->setCellValue("H{$cont}", $customer_type); $cont++; } //Apply autosize to all the columns for ($cont = "A"; $cont <= "K"; $cont++) { $sheet->getActiveSheet()->getColumnDimension($cont)->setAutoSize(true); } $sheet->getActiveSheet()->setTitle("ZONE CONTENT LIST - {$partner_name}"); //$sheet->getActiveSheet()->getHeaderFooter()->setOddHeader("&L&G&C&HZONE CONTENT LIST - $partner_name"); //Setup the logo for the excel sheet /* $sheetImage = new PHPExcel_Worksheet_HeaderFooterDrawing(); $sheetImage->setName("logo"); $sheetImage->setDescription("logo"); $sheetImage->setPath("Styles/theme/mainlogo.png"); $sheetImage->setCoordinates('A1'); $sheetImage->setOffsetX(110); $sheetImage->setHeight(70); $sheetImage->setWorksheet($sheet->getActiveSheet()); */ $sheet->setActiveSheetIndex(0); $sheetWriter = PHPExcel_IOFactory::createWriter($sheet, 'Excel5'); //header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); //header('Content-Disposition: attachment;filename="rifasinst_ganadores.xls"'); //header("Cache-Control: max-age=0"); //$sheetWriter->save("php://output"); $result["status"] = true; $result["message"] = "Excel generated successfully"; $result["excel"] = $sheetWriter; } else { $result["status"] = false; $result["message"] = "Invalid Zone ID"; } $db->close(); return $result; } else { $result["status"] = false; $result["message"] = "Invalid Zone GUID"; } }
public function bulkRenew($params = array()) { $result = array("status" => false, "message" => ""); $grantNumber = $params["grant_number"]; $newGrantNumber = $params["newgrant_number"]; $expedDate = $params["expedition_date"]; $expirDate = $params["expiration_date"]; $userId = $params["user_id"]; if (strlen($grantNumber) > 0 && strlen($newGrantNumber) > 0 && strlen($expedDate) > 0 && strlen($expirDate) > 0) { $db = new \clsDBdbConnection(); $db2 = new \clsDBdbConnection(); $fields_array = array("id", "guid", "id_suite", "id_product_type", "id_licensed_by", "id_license_type", "id_product_tag", "id_license_sector", "id_reseller", "id_customer", "id_product", "id_license_granttype", "msrp_price", "nodes", "id_license_status", "licensed_amount", "channel_sku", "grant_number", "registered_date", "serial_number", "currency"); $fields = implode(",", $fields_array); $sql = "select {$fields} from alm_licensing where grant_number = '{$grantNumber}' "; $db->query($sql); $parentGuid = CCDLookUp("guid", "alm_licensing", "grant_number = '{$grantNumber}' and id_license_status = 2 limit 1", $db2); while ($db->next_record()) { $licenseType = $db->f("id_license_type"); $licenseStatus = $db->f("id_license_status"); if ($licenseStatus == 3) { $guid = \uuid_create(); /** * Only adds parent license guid to support licenses */ $newParentGuid = ""; if ($licenseType == 10 || $licenseType == 11 || $licenseType == 13) { $newParentGuid = $parentGuid; } $nodes = $db->f('nodes'); $licensedAmount = $db->f('licensed_amount'); $channelSku = $db->f('channel_sku'); $msrpPrince = $db->f('msrp_price'); $registeredDate = $db->f('registered_date'); if (strlen($registeredDate) <= 0) { $registeredDate = null; } $serialNumber = $db->f('serial_number'); $currency = $db->f('currency'); $expiredGuid = $db->f('guid'); $idSuite = (int) $db->f('id_suite'); $idProductType = (int) $db->f('id_product_type'); $idLicenseType = (int) $db->f('id_license_type'); $idProductTag = (int) $db->f('id_product_tag'); $idLicenseBy = (int) $db->f('id_licensed_by'); $idLicenseSector = (int) $db->f('id_license_sector'); $idReseller = (int) $db->f('id_reseller'); $idCustomer = (int) $db->f('id_customer'); $idLicenseStatus = 2; $idProduct = (int) $db->f('id_product'); $idLicenseGrantType = (int) $db->f('id_license_granttype'); $sql2 = "insert into alm_licensing (id_suite,id_product_type,id_license_type,id_product_tag,id_licensed_by,id_license_sector,id_reseller,\n\t\t\t\t\tid_customer,id_license_status,id_product,id_license_granttype,guid,nodes,licensed_amount,channel_sku,msrp_price,grant_number,expedition_date,\n\t\t\t\t\texpiration_date,registered_date,serial_number,currency,created_iduser,expired_license_guid,parent_license_guid)\n\t\t\t\t\tvalues({$idSuite}, {$idProductType}, {$idLicenseType}, {$idProductTag}, {$idLicenseBy}, {$idLicenseSector}, {$idReseller}, {$idCustomer}, {$idLicenseStatus}, {$idProduct},\n\t\t\t\t\t{$idLicenseGrantType}, '{$guid}', '{$nodes}', '{$licensedAmount}', '{$channelSku}', '{$msrpPrince}', '{$newGrantNumber}','{$expedDate}', '{$expirDate}',\n\t\t\t\t '{$registeredDate}', '{$serialNumber}', '{$currency}', {$userId}, '{$expiredGuid}', '{$newParentGuid}')"; $db2->query($sql2); $this->setLicenseArchivedByGuid(array("guid" => $expiredGuid)); } else { //If not expired might be a perpetual, which we update its grant number to match the new grant if ($licenseStatus == 2 && ($licenseType == 7 || $licenseType == 12)) { $perpetualGuid = $db->f('guid'); $sql3 = "update alm_licensing set grant_number = '{$newGrantNumber}' where guid = '{$perpetualGuid}' "; $db2->query($sql3); } } } $db2->close(); $db->close(); $result["status"] = true; $result["message"] = "Bulk renewal executed successfully"; return $result; } else { $result["status"] = false; $result["message"] = "Invalid fields"; return $result; } }
function Show() { global $Tpl; global $now; if (!$this->Visible) { return; } $ShownRecords = 0; $this->ds->Parameters["sesUserID"] = CCGetSession("UserID"); $this->ds->Prepare(); $this->ds->Open(); $GridBlock = "Grid " . $this->ComponentName; $Tpl->block_path = $GridBlock; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); $is_next_record = $this->ds->next_record(); if ($is_next_record && $ShownRecords < $this->PageSize) { do { $this->ds->SetValues(); $Tpl->block_path = $GridBlock . "/Row"; $this->comment->SetValue($this->ds->comment->GetValue()); $twodays = $this->ds->date->GetValue(); $theday = getdate($twodays); $lastofyear = substr($theday["year"], -2); $enddate = $theday["mon"] . "/" . $theday["mday"] . "/" . $lastofyear; $this->date->SetValue(date("F j, Y, g:i a", $this->ds->date->GetValue())); if ($this->ds->doing_rating->GetValue() != "" && is_numeric($this->ds->doing_rating->GetValue()) && $this->ds->doing_rating->GetValue() != 1000000000) { $lookupdb = new clsDBNetConnect(); $lookupdb->connect(); $thename = CCDLookUp("user_login", "users", "user_id='" . $this->ds->doing_rating->GetValue() . "'", $lookupdb); $this->doing_rating->SetValue($thename); unset($lookupdb); } else { $this->doing_rating->SetValue($now["sitename"]); } $this->id->SetValue($this->ds->id->GetValue()); $this->ItemNum->SetValue($this->ds->ItemNum->GetValue()); if ($this->ds->rating->GetValue() == 1) { $this->rating->SetValue("<img src=\"images/positive.gif\">"); } if ($this->ds->rating->GetValue() == 0) { $this->rating->SetValue("<img src=\"images/neutral.gif\">"); } if ($this->ds->rating->GetValue() == -1) { $this->rating->SetValue("<img src=\"images/negative.gif\">"); } if ($this->ds->buysell->GetValue() == 1) { $this->buysell->SetValue("Buyer"); } if ($this->ds->buysell->GetValue() == 0) { $this->buysell->SetValue("Seller"); } $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->comment->Show(); $this->date->Show(); $this->doing_rating->Show(); $this->buysell->Show(); $this->id->Show(); $this->ItemNum->Show(); $this->rating->Show(); $counter = new clsDBNetConnect(); $query = "select * from feedback where `counter` = '" . $this->ds->id->GetValue() . "'"; $counter->query($query); if ($counter->next_record()) { $Tpl->SetBlockVar("counter", ""); $Tpl->setVar("countercomment", stripslashes($counter->f("comment"))); $Tpl->setVar("countericon", "<img src=\"images/CounterComment.gif\">"); $Tpl->setVar("counterlink", ""); $Tpl->parse("counter", ""); } else { $Tpl->SetBlockVar("counter", ""); $Tpl->setVar("countercomment", ""); $Tpl->setVar("countericon", ""); if (CCGetUserID() == $_GET["user_id"]) { $Tpl->setVar("counterlink", "<a href=\"RateUser.php?id=" . $this->ds->id->GetValue() . "\"> <i>Comment on this rating</i></a>"); } } $Tpl->block_path = $GridBlock; $Tpl->parse("Row", true); $ShownRecords++; $is_next_record = $this->ds->next_record(); } while ($is_next_record && $ShownRecords < $this->PageSize); } else { $Tpl->parse("NoRecords", false); } $this->Navigator->TotalPages = $this->ds->PageCount(); $this->Sorter_doing_rating->Show(); $this->Sorter_date->Show(); $this->Navigator->Show(); $Tpl->parse("", false); $Tpl->block_path = ""; }
function Show() { global $Tpl; global $now; if (!$this->Visible) { return; } $ShownRecords = 0; $this->ds->Parameters["sesUserID"] = CCGetSession("UserID"); $this->ds->Prepare(); $this->ds->Open(); $GridBlock = "Grid " . $this->ComponentName; $Tpl->block_path = $GridBlock; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); $is_next_record = $this->ds->next_record(); if ($is_next_record && $ShownRecords < $this->PageSize) { do { $this->ds->SetValues(); $User_id = $this->ds->user_id->GetValue(); $Tpl->block_path = $GridBlock . "/Row"; $this->title->SetValue($this->ds->title->GetValue()); $twodays = $this->ds->date->GetValue(); $theday = getdate($twodays); $lastofyear = substr($theday["year"], -2); $enddate = $theday["mon"] . "/" . $theday["mday"] . "/" . $lastofyear; $this->date->SetValue(date("F j, Y, g:i a", $this->ds->date->GetValue())); if ($this->ds->user_id->GetValue() != "" && is_numeric($this->ds->user_id->GetValue()) && $this->ds->user_id->GetValue() != 1000000000) { $lookupdb = new clsDBNetConnect(); $lookupdb->connect(); $thename = CCDLookUp("user_login", "users", "user_id='" . $this->ds->user_id->GetValue() . "'", $lookupdb); $this->user_id->SetValue($thename); unset($lookupdb); } else { $this->user_id->SetValue($now["sitename"]); } $this->id->SetValue($this->ds->id->GetValue()); $this->ItemNum->SetValue($this->ds->ItemNum->GetValue()); $this->amt_received->SetValue($this->ds->amt_received->GetValue()); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->title->Show(); $this->date->Show(); $this->user_id->Show(); $this->id->Show(); $this->ItemNum->Show(); $this->amt_received->Show(); $db = new clsDBNetConnect(); $db->query("select * from feedback where `purchase_id` = '" . $this->ds->id->GetValue() . "' and `doing_rating` = '" . CCGetUserID() . "'"); if (!$db->next_record()) { $Tpl->setVar("feedbacklink", "<a href=\"RateUser.php?ItemNum=" . $this->ds->ItemNum->GetValue() . "&purchase_id=" . $this->ds->id->GetValue() . "\">Leave Feedback</a>"); } else { $Tpl->setVar("feedbacklink", "<a href=\"Feedback.php?user_id=" . $User_id . "\">View This User's Feedback</a>"); } $Tpl->block_path = $GridBlock; $Tpl->parse("Row", true); $ShownRecords++; $is_next_record = $this->ds->next_record(); } while ($is_next_record && $ShownRecords < $this->PageSize); } else { $Tpl->parse("NoRecords", false); } $this->Navigator->TotalPages = $this->ds->PageCount(); $this->Sorter_title->Show(); $this->Sorter_date->Show(); $this->Navigator->Show(); $Tpl->parse("", false); $Tpl->block_path = ""; }