/** * Save the data in the database * * @param PlentySoapObject_SearchOrders $Item */ private function saveInDatabase($Item) { $query = 'REPLACE INTO `plenty_OrderHead` ' . DBUtils::buildInsert(array('OrderID' => $Item->OrderHead->OrderID, 'Currency' => $Item->OrderHead->Currency, 'CustomerID' => $Item->OrderHead->CustomerID, 'CustomerReference' => $Item->OrderHead->CustomerReference, 'DeliveryAddressID' => $Item->OrderHead->DeliveryAddressID, 'DoneTimestamp' => $Item->OrderHead->DoneTimestamp, 'DunningLevel' => $Item->OrderHead->DunningLevel, 'EbaySellerAccount' => $Item->OrderHead->EbaySellerAccount, 'EstimatedTimeOfShipment' => $Item->OrderHead->EstimatedTimeOfShipment, 'ExchangeRatio' => $Item->OrderHead->ExchangeRatio, 'ExternalOrderID' => $Item->OrderHead->ExternalOrderID, 'Invoice' => $Item->OrderHead->Invoice, 'IsNetto' => $Item->OrderHead->IsNetto, 'LastUpdate' => $Item->OrderHead->LastUpdate, 'MethodOfPaymentID' => $Item->OrderHead->MethodOfPaymentID, 'OrderStatus' => $Item->OrderHead->OrderStatus, 'OrderTimestamp' => $Item->OrderHead->OrderTimestamp, 'OrderType' => $Item->OrderHead->OrderType, 'PackageNumber' => $Item->OrderHead->PackageNumber, 'PaidTimestamp' => $Item->OrderHead->PaidTimestamp, 'ParentOrderID' => $Item->OrderHead->ParentOrderID, 'PaymentStatus' => $Item->OrderHead->PaymentStatus, 'ReferrerID' => $Item->OrderHead->ReferrerID, 'RemoteIP' => $Item->OrderHead->RemoteIP, 'ResponsibleID' => $Item->OrderHead->ResponsibleID, 'SalesAgentID' => $Item->OrderHead->SalesAgentID, 'SellerAccount' => $Item->OrderHead->SellerAccount, 'ShippingCosts' => $Item->OrderHead->ShippingCosts, 'ShippingID' => $Item->OrderHead->ShippingID, 'ShippingMethodID' => $Item->OrderHead->ShippingMethodID, 'ShippingProfileID' => $Item->OrderHead->ShippingProfileID, 'StoreID' => $Item->OrderHead->StoreID, 'TotalBrutto' => $Item->OrderHead->TotalBrutto, 'TotalInvoice' => $Item->OrderHead->TotalInvoice, 'TotalNetto' => $Item->OrderHead->TotalNetto, 'TotalVAT' => $Item->OrderHead->TotalVAT, 'WarehouseID' => $Item->OrderHead->WarehouseID)); $this->getLogger()->debug(__FUNCTION__ . ' ' . $query); DBQuery::getInstance()->replace($query); if (isset($Item->OrderHead->IncomingPayments)) { foreach ($Item->OrderHead->IncomingPayments->item as $ItemIncomingPayments) { $query = 'REPLACE INTO `plenty_OrderHead_IncomingPayments` ' . DBUtils::buildInsert(array('ID' => $ItemIncomingPayments->ID, 'ReferenceID' => $ItemIncomingPayments->ReferenceID, 'OrderID' => $Item->OrderHead->OrderID)); $this->getLogger()->debug(__FUNCTION__ . ' ' . $query); DBQuery::getInstance()->replace($query); } } if (isset($Item->OrderHead->IncomingPayments)) { foreach ($Item->OrderHead->IncomingPayments->item as $ItemIncomingPayments) { $query = 'REPLACE INTO `plenty_OrderHead_IncomingPayments` ' . DBUtils::buildInsert(array('ID' => $ItemIncomingPayments->ID, 'ReferenceID' => $ItemIncomingPayments->ReferenceID, 'OrderID' => $Item->OrderHead->OrderID)); $this->getLogger()->debug(__FUNCTION__ . ' ' . $query); DBQuery::getInstance()->replace($query); } } }
/** * Save the data in the database * * @param PlentySoapObject_GetMethodOfPayments $methodOfPayment */ private function saveInDatabase($methodOfPayment) { $activeCountriesOfDelivery = array(); $activeMultishops = array(); /* * parse all active countries of delivery in a string */ if (is_array($methodOfPayment->ActiveCountriesOfDelivery->item)) { foreach ($methodOfPayment->ActiveCountriesOfDelivery->item as $countryOfDelivery) { $activeCountriesOfDelivery[] = $countryOfDelivery->intValue; } } elseif (is_object($methodOfPayment->ActiveCountriesOfDelivery->item)) { $activeCountriesOfDelivery[] = $methodOfPayment->ActiveCountriesOfDelivery->item->intValue; } /* * parse all active multishops in a string */ if (is_array($methodOfPayment->Multishops->item)) { foreach ($methodOfPayment->ActiveCountriesOfDelivery->item as $multishops) { $activeMultishops[] = $multishops->intValue; } } elseif (is_object($methodOfPayment->Multishops->item)) { $activeMultishops[] = $methodOfPayment->Multishops->item->intValue; } $query = 'REPLACE INTO `plenty_method_of_payments` ' . DBUtils::buildInsert(array('method_of_payment_id' => $methodOfPayment->MethodOfPaymentID, 'method_of_payment_name' => $methodOfPayment->Name, 'active_countries' => implode(',', $activeCountriesOfDelivery), 'active_multishops' => implode(',', $activeMultishops))); $this->getLogger()->debug(__FUNCTION__ . ' new MOP ' . $methodOfPayment->MethodOfPaymentID . ' ' . $methodOfPayment->Name); DBQuery::getInstance()->replace($query); }
/** * delete existing data */ private function truncateTable() { DBQuery::getInstance()->truncate('TRUNCATE plenty_vat_config'); }
/** * Save the data in the database * * @param PlentySoapObject_GetWarehouseList $warehouse */ private function saveInDatabase($warehouse) { $query = 'REPLACE INTO `plenty_warehouse` ' . DBUtils::buildInsert(array('warehouse_id' => $warehouse->WarehouseID, 'warehouse_type' => $warehouse->Type, 'warehouse_name' => $warehouse->Name)); $this->getLogger()->debug(__FUNCTION__ . ' ' . $query); DBQuery::getInstance()->replace($query); }
/** * load existing token from db or file * * @param string $soapUser * @return array */ public function loadToken($soapUser) { if (self::SAVE_TOKEN_IN_DB === true) { $query = 'SELECT `soap_token_user_id`, `soap_token` FROM `plenty_soap_token` WHERE `soap_token_user`="' . $soapUser . '" && DAY(`soap_token_inserted`)=DAY(NOW())'; //$this->getLogger()->debug(__FUNCTION__.' '.$query); $result = DBQuery::getInstance()->selectAssoc($query); if (isset($result['soap_token_user_id'])) { return array($result['soap_token_user_id'], $result['soap_token']); } } else { $token = array(); if (is_file($this->dest)) { require $this->dest; if (isset($token[$soapUser]) && $token[$soapUser]['inserted'] == strtotime('today')) { return array($token[$soapUser]['userId'], $token[$soapUser]['usertoken']); } } } return array(); }
/** * Save $this->currentTimestamp in plenty_stock_last_update * */ private function saveCurrentTimestamp2DB4TheNextRetrieval() { if ($this->warehouseId > 0) { $query = 'REPLACE INTO plenty_stock_last_update ' . DBUtils::buildInsert(array('warehouse_id' => $this->warehouseId, 'last_update_timestamp' => $this->currentTimestamp)); DBQuery::getInstance()->replace($query); $this->getLogger()->debug(__FUNCTION__ . ' ' . $query); } }
/** * delete existing data */ private function truncateTable() { DBQuery::getInstance()->truncate('TRUNCATE plenty_order_status'); }
/** * save the data in the database * * @param PlentySoapObject_GetVatConfig $vatConfig * @param integer $countryId */ private function saveInDatabase($vatConfig, $countryId) { $query = 'REPLACE INTO `plenty_vat_config` ' . DBUtils::buildInsert(array('country_id' => $countryId, 'vat_id' => $vatConfig->InternalVATID, 'vat_value' => $vatConfig->VATValue)); $this->getLogger()->debug(__FUNCTION__ . ' ' . $query); DBQuery::getInstance()->replace($query); }
/** * delete existing data */ private function truncateTable() { DBQuery::getInstance()->truncate('TRUNCATE plenty_countries_of_delivery'); }
/** * Save the data in the database * * @param PlentySoapObject_GetCountriesOfDelivery $countryOfDelivery */ private function saveInDatabase($countryOfDelivery) { $query = 'REPLACE INTO `plenty_countries_of_delivery` ' . DBUtils::buildInsert(array('country_id' => $countryOfDelivery->CountryID, 'active' => $countryOfDelivery->CountryActive, 'country_name' => $countryOfDelivery->CountryName, 'iso_code_2' => $countryOfDelivery->CountryISO2)); $this->getLogger()->debug(__FUNCTION__ . ' ' . $query); DBQuery::getInstance()->replace($query); }
/** * delete existing data */ private function truncateTable() { DBQuery::getInstance()->truncate('TRUNCATE plenty_method_of_payments'); }
/** * delete existing data */ private function truncateTable() { DBQuery::getInstance()->truncate('TRUNCATE plenty_warehouse'); }
/** * * * @param mixed $mValue * @param boolean $bDontStripSlashes * * @return mixed */ public static function quoteSmart($mValue) { if (is_object($mValue) || is_array($mValue)) { return self::quoteSmartObject($mValue); } if ($mValue == '""') { return ""; } /* * Quote if not numeric */ if (!is_numeric($mValue)) { if (!self::$DBQuery instanceof DBQuery) { self::$DBQuery = DBQuery::getInstance(); } $mValue = self::$DBQuery->escapeString($mValue); } return $mValue; }
/** * Save the data in the database * * @param PlentySoapObject_GetOrderStatus $orderStatus */ private function saveInDatabase($orderStatus) { $query = 'REPLACE INTO `plenty_order_status` ' . DBUtils::buildInsert(array('order_status' => $orderStatus->OrderStatus, 'lang' => $this->sLang, 'status_name' => $orderStatus->OrderStatusName)); $this->getLogger()->debug(__FUNCTION__ . ' ' . $query); DBQuery::getInstance()->replace($query); }