Version Notes
Retail version of the youstice resolution system package
Download this release
Release Info
| Developer | Youstice |
| Extension | Youstice |
| Version | 1.226.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.5.5 to 1.226.1
app/code/community/Youstice/YousticeResolutionSystem/SDK/Local.php
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
class Youstice_Local implements Youstice_LocalInterface {
|
| 16 |
|
| 17 |
protected $connection = null;
|
| 18 |
-
protected $
|
| 19 |
protected $db_driver;
|
| 20 |
protected $session;
|
| 21 |
protected $cached = array();
|
|
@@ -28,8 +28,10 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 28 |
public function __construct(array $db)
|
| 29 |
{
|
| 30 |
$this->connection = $this->getPdoConnection($db);
|
| 31 |
-
$this->table_prefix = isset($db['prefix']) ? $db['prefix'] : '';
|
| 32 |
$this->db_driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
|
|
|
|
|
|
|
|
|
|
| 33 |
}
|
| 34 |
|
| 35 |
private function getPdoConnection(array $db)
|
|
@@ -119,6 +121,25 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 119 |
|
| 120 |
return $connection_string;
|
| 121 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
/**
|
| 124 |
*
|
|
@@ -209,7 +230,7 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 209 |
//try to find filled report
|
| 210 |
$query_filled = $this->prepareRegexpQuery(
|
| 211 |
'SELECT code, user_id, status, remaining_time, UNIX_TIMESTAMP(created_at) created_at, UNIX_TIMESTAMP(updated_at) updated_at '
|
| 212 |
-
. 'FROM ' . $this->
|
| 213 |
. 'WHERE code ' . $searchBy . ' ? AND status IS NOT NULL '
|
| 214 |
. 'ORDER BY created_at DESC, code DESC '
|
| 215 |
. 'LIMIT 1');
|
|
@@ -221,7 +242,7 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 221 |
{
|
| 222 |
$query_last = $this->prepareRegexpQuery(
|
| 223 |
'SELECT code, user_id, status, remaining_time, UNIX_TIMESTAMP(created_at) created_at, UNIX_TIMESTAMP(updated_at) updated_at '
|
| 224 |
-
. 'FROM ' . $this->
|
| 225 |
. 'WHERE code ' . $searchBy . ' ? '
|
| 226 |
. 'ORDER BY created_at DESC, code DESC '
|
| 227 |
. 'LIMIT 1');
|
|
@@ -242,12 +263,12 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 242 |
$this->connection->beginTransaction();
|
| 243 |
$this->lockTable();
|
| 244 |
|
| 245 |
-
$query_count = $this->prepareRegexpQuery('SELECT count(1) count FROM ' . $this->
|
| 246 |
$result_count = $this->executeQueryFetch($query_count, array('^' . $code . '__[0-9]*$'));
|
| 247 |
|
| 248 |
$code .= '__' . ($result_count['count'] + 1);
|
| 249 |
|
| 250 |
-
$stmt = $this->connection->prepare('INSERT INTO ' . $this->
|
| 251 |
(code, user_id, status, remaining_time, created_at, updated_at) VALUES (?, ?, null, ?, NOW(), NOW())');
|
| 252 |
|
| 253 |
try {
|
|
@@ -272,7 +293,7 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 272 |
if (!trim($status))
|
| 273 |
return;
|
| 274 |
|
| 275 |
-
$stmt = $this->connection->prepare('UPDATE ' . $this->
|
| 276 |
|
| 277 |
return $stmt->execute(array($status, $code));
|
| 278 |
}
|
|
@@ -282,14 +303,14 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 282 |
if ((int) $time < 0 || $time == null)
|
| 283 |
return;
|
| 284 |
|
| 285 |
-
$stmt = $this->connection->prepare('UPDATE ' . $this->
|
| 286 |
|
| 287 |
return $stmt->execute(array($time, $code));
|
| 288 |
}
|
| 289 |
|
| 290 |
public function getReportsByUser($user_id)
|
| 291 |
{
|
| 292 |
-
$stmt = $this->connection->prepare('SELECT * FROM ' . $this->
|
| 293 |
$stmt->execute(array($user_id));
|
| 294 |
|
| 295 |
return $stmt->fetchAll();
|
|
@@ -316,10 +337,10 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 316 |
{
|
| 317 |
if ($this->db_driver == 'pgsql')
|
| 318 |
{
|
| 319 |
-
$this->connection->exec('LOCK TABLE ' . $this->
|
| 320 |
} else
|
| 321 |
{
|
| 322 |
-
$this->connection->exec('LOCK TABLES ' . $this->
|
| 323 |
}
|
| 324 |
}
|
| 325 |
|
|
@@ -355,7 +376,7 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 355 |
|
| 356 |
protected function installPrepareQueries()
|
| 357 |
{
|
| 358 |
-
return array('CREATE TABLE IF NOT EXISTS ' . $this->
|
| 359 |
code VARCHAR(255) NOT NULL DEFAULT '',
|
| 360 |
user_id int(10) unsigned NOT NULL,
|
| 361 |
status VARCHAR(200) NULL,
|
|
@@ -371,7 +392,7 @@ class Youstice_Local implements Youstice_LocalInterface {
|
|
| 371 |
if ($this->session !== null)
|
| 372 |
$this->session->destroy();
|
| 373 |
|
| 374 |
-
return $this->connection->query('DROP TABLE IF EXISTS
|
| 375 |
}
|
| 376 |
|
| 377 |
}
|
| 15 |
class Youstice_Local implements Youstice_LocalInterface {
|
| 16 |
|
| 17 |
protected $connection = null;
|
| 18 |
+
protected $table_name;
|
| 19 |
protected $db_driver;
|
| 20 |
protected $session;
|
| 21 |
protected $cached = array();
|
| 28 |
public function __construct(array $db)
|
| 29 |
{
|
| 30 |
$this->connection = $this->getPdoConnection($db);
|
|
|
|
| 31 |
$this->db_driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
|
| 32 |
+
|
| 33 |
+
$prefix = isset($db['prefix']) ? $db['prefix'] : '';
|
| 34 |
+
$this->table_name = $this->escapeTableName($prefix);
|
| 35 |
}
|
| 36 |
|
| 37 |
private function getPdoConnection(array $db)
|
| 121 |
|
| 122 |
return $connection_string;
|
| 123 |
}
|
| 124 |
+
|
| 125 |
+
private function escapeTableName($prefix)
|
| 126 |
+
{
|
| 127 |
+
if($this->db_driver == 'mysql') {
|
| 128 |
+
$prefix = str_replace('`', '``', $prefix);
|
| 129 |
+
$prefix = str_replace('\\', '\\\\', $prefix);
|
| 130 |
+
|
| 131 |
+
return '`' . $prefix . 'yrs_reports`';
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
if($this->db_driver == 'sqlsrv') {
|
| 135 |
+
$prefix = str_replace('[', '[]', $prefix);
|
| 136 |
+
$prefix = str_replace('\\', '\\\\', $prefix);
|
| 137 |
+
|
| 138 |
+
return '[' . $prefix . 'yrs_reports]';
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
return '"' . $prefix . 'yrs_reports"';
|
| 142 |
+
}
|
| 143 |
|
| 144 |
/**
|
| 145 |
*
|
| 230 |
//try to find filled report
|
| 231 |
$query_filled = $this->prepareRegexpQuery(
|
| 232 |
'SELECT code, user_id, status, remaining_time, UNIX_TIMESTAMP(created_at) created_at, UNIX_TIMESTAMP(updated_at) updated_at '
|
| 233 |
+
. 'FROM ' . $this->table_name . ' '
|
| 234 |
. 'WHERE code ' . $searchBy . ' ? AND status IS NOT NULL '
|
| 235 |
. 'ORDER BY created_at DESC, code DESC '
|
| 236 |
. 'LIMIT 1');
|
| 242 |
{
|
| 243 |
$query_last = $this->prepareRegexpQuery(
|
| 244 |
'SELECT code, user_id, status, remaining_time, UNIX_TIMESTAMP(created_at) created_at, UNIX_TIMESTAMP(updated_at) updated_at '
|
| 245 |
+
. 'FROM ' . $this->table_name . ' '
|
| 246 |
. 'WHERE code ' . $searchBy . ' ? '
|
| 247 |
. 'ORDER BY created_at DESC, code DESC '
|
| 248 |
. 'LIMIT 1');
|
| 263 |
$this->connection->beginTransaction();
|
| 264 |
$this->lockTable();
|
| 265 |
|
| 266 |
+
$query_count = $this->prepareRegexpQuery('SELECT count(1) count FROM ' . $this->table_name . ' WHERE code REGEXP ?');
|
| 267 |
$result_count = $this->executeQueryFetch($query_count, array('^' . $code . '__[0-9]*$'));
|
| 268 |
|
| 269 |
$code .= '__' . ($result_count['count'] + 1);
|
| 270 |
|
| 271 |
+
$stmt = $this->connection->prepare('INSERT INTO ' . $this->table_name . '
|
| 272 |
(code, user_id, status, remaining_time, created_at, updated_at) VALUES (?, ?, null, ?, NOW(), NOW())');
|
| 273 |
|
| 274 |
try {
|
| 293 |
if (!trim($status))
|
| 294 |
return;
|
| 295 |
|
| 296 |
+
$stmt = $this->connection->prepare('UPDATE ' . $this->table_name . ' SET status = ?, updated_at = NOW() WHERE code = ?');
|
| 297 |
|
| 298 |
return $stmt->execute(array($status, $code));
|
| 299 |
}
|
| 303 |
if ((int) $time < 0 || $time == null)
|
| 304 |
return;
|
| 305 |
|
| 306 |
+
$stmt = $this->connection->prepare('UPDATE ' . $this->table_name . ' SET remaining_time = ?, updated_at = NOW() WHERE code = ?');
|
| 307 |
|
| 308 |
return $stmt->execute(array($time, $code));
|
| 309 |
}
|
| 310 |
|
| 311 |
public function getReportsByUser($user_id)
|
| 312 |
{
|
| 313 |
+
$stmt = $this->connection->prepare('SELECT * FROM ' . $this->table_name . ' WHERE user_id = ?');
|
| 314 |
$stmt->execute(array($user_id));
|
| 315 |
|
| 316 |
return $stmt->fetchAll();
|
| 337 |
{
|
| 338 |
if ($this->db_driver == 'pgsql')
|
| 339 |
{
|
| 340 |
+
$this->connection->exec('LOCK TABLE ' . $this->table_name . ' IN ACCESS EXCLUSIVE MODE');
|
| 341 |
} else
|
| 342 |
{
|
| 343 |
+
$this->connection->exec('LOCK TABLES ' . $this->table_name . ' WRITE');
|
| 344 |
}
|
| 345 |
}
|
| 346 |
|
| 376 |
|
| 377 |
protected function installPrepareQueries()
|
| 378 |
{
|
| 379 |
+
return array('CREATE TABLE IF NOT EXISTS ' . $this->table_name . " (
|
| 380 |
code VARCHAR(255) NOT NULL DEFAULT '',
|
| 381 |
user_id int(10) unsigned NOT NULL,
|
| 382 |
status VARCHAR(200) NULL,
|
| 392 |
if ($this->session !== null)
|
| 393 |
$this->session->destroy();
|
| 394 |
|
| 395 |
+
return $this->connection->query('DROP TABLE IF EXISTS ' . $this->table_name);
|
| 396 |
}
|
| 397 |
|
| 398 |
}
|
app/code/community/Youstice/YousticeResolutionSystem/controllers/IndexController.php
CHANGED
|
@@ -162,7 +162,7 @@ class Youstice_YousticeResolutionSystem_IndexController extends Mage_Core_Contro
|
|
| 162 |
$orderId = (int)$params['order_id'];
|
| 163 |
|
| 164 |
$order = Mage::getModel('sales/order')->load($orderId);
|
| 165 |
-
|
| 166 |
if ($this->api->getCustomerId() !== $order['customer_id'])
|
| 167 |
exit;
|
| 168 |
|
| 162 |
$orderId = (int)$params['order_id'];
|
| 163 |
|
| 164 |
$order = Mage::getModel('sales/order')->load($orderId);
|
| 165 |
+
|
| 166 |
if ($this->api->getCustomerId() !== $order['customer_id'])
|
| 167 |
exit;
|
| 168 |
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Youstice</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
<description>Your online youstice</description>
|
| 11 |
<notes>Retail version of the youstice resolution system package</notes>
|
| 12 |
<authors><author><name>Youstice</name><user>Youstice</user><email>info@youstice.com</email></author></authors>
|
| 13 |
-
<date>2015-02-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecommunity"><dir name="Youstice"><dir name="YousticeResolutionSystem"><dir name="Helper"><file name="ApiSingleton.php" hash="37f05528eca3a4ae9dd156831e3a09a5"/></dir><dir name="SDK"><file name="Api.php" hash="a0bcb30607f0e3c9787891c9457df76c"/><dir name="Helpers"><file name="HelperFunctions.php" hash="58fb74b2aef5f65b1f177b8ca5d6eab4"/><file name="LanguageCodes.php" hash="d6fea8fc0e0f0a09e214dc4de78e9883"/></dir><file name="Local.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.3.0</min><max>10.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Youstice</name>
|
| 4 |
+
<version>1.226.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>Your online youstice</description>
|
| 11 |
<notes>Retail version of the youstice resolution system package</notes>
|
| 12 |
<authors><author><name>Youstice</name><user>Youstice</user><email>info@youstice.com</email></author></authors>
|
| 13 |
+
<date>2015-02-18</date>
|
| 14 |
+
<time>11:28:58</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Youstice"><dir name="YousticeResolutionSystem"><dir name="Helper"><file name="ApiSingleton.php" hash="37f05528eca3a4ae9dd156831e3a09a5"/></dir><dir name="SDK"><file name="Api.php" hash="a0bcb30607f0e3c9787891c9457df76c"/><dir name="Helpers"><file name="HelperFunctions.php" hash="58fb74b2aef5f65b1f177b8ca5d6eab4"/><file name="LanguageCodes.php" hash="d6fea8fc0e0f0a09e214dc4de78e9883"/></dir><file name="Local.php" hash="2dce1671bcc19ca4a9105363a4bf565f"/><file name="LocalInterface.php" hash="0c5c0aa59c3d07b9f20772e7f12a0fa1"/><dir name="Providers"><file name="SessionProvider.php" hash="90d811d9d73a0651af38c2df00b91467"/><file name="SessionProviderInterface.php" hash="df678e30107fe22b7140262be6ab8361"/></dir><file name="Remote.php" hash="3a96dfbc0b08363a6d449be194018a72"/><dir name="Reports"><file name="BaseReport.php" hash="7228bf34cb41f7314b2a8bdf5f07c1b4"/><file name="OrderReport.php" hash="5eac58c771e3a39c0a9a49417c53831d"/><file name="ProductReport.php" hash="71ce3ecabd7b0912be653f2b7b2662cf"/><file name="WebReport.php" hash="15c4d7d43b5a054a41cf420d033f915e"/></dir><file name="Request.php" hash="e9685cf1f24a32b9ddcb95368c6c1203"/><file name="ShopItem.php" hash="ba28026aef2865433a258d50dd015660"/><file name="ShopOrder.php" hash="dd97b5ecdba73a552be6dc127c0f27dd"/><file name="ShopProduct.php" hash="b85df78aecc1313a572d288da145323f"/><file name="SimpleApi.php" hash="3bc52595d6c630190331f6370a4cb1fa"/><file name="Tools.php" hash="ce2bba77d083f2cb74a56bb826f970ce"/><file name="Translator.php" hash="e463e16d3bbf1f765ab563f9bf63b919"/><dir name="Widgets"><file name="OrderDetail.php" hash="a9128b170a1d3cc9d51cb84727b4c46c"/><file name="OrderDetailButton.php" hash="0a070b700596246bfc84b142d2fac779"/><file name="OrderReportButton.php" hash="93baf83cfb90ebecbcb51ba695a59307"/><file name="OrdersPage.php" hash="ff0dfdd1fbbb77e633d98c57436e935f"/><file name="ProductReportButton.php" hash="83bb7921379b8b66bd3c731e07da42d0"/><file name="ReportClaimsForm.php" hash="73e36515f7dea0f9bef2cfc0346535f3"/><file name="ShowButtons.php" hash="a76e11c748434e3c07dbb8e38cba9b2e"/><file name="WebReportButton.php" hash="d2266f276f9b2906694fa32a924871d9"/></dir><dir name="languageStrings"><file name="cs.php" hash="52198658b4dc0cb2ef3d62d9888c4841"/><file name="de.php" hash="35fe75e49b3f236460e59a1c84529d7a"/><file name="en.php" hash="76215e7c165407b498b27219d47a29b6"/><file name="es.php" hash="3b0e9a0d066c39183079473d7e63a67f"/><file name="fr.php" hash="e9cbdb88a5563ad8981e14feb35d822a"/><file name="pt.php" hash="e6c0cf239ea77447f4d9cf09a0729755"/><file name="ru.php" hash="47a3eda2999c1dd55ea058f77d6e8b10"/><file name="sk.php" hash="b29c3d3d3fea7500b05a555063e8b12e"/></dir></dir><dir name="controllers"><file name="AdminController.php" hash="de146da6598df8ccfd9697c516b1044c"/><file name="IndexController.php" hash="30d1a3be0880a8c9393339ab74c87f57"/></dir><dir name="etc"><file name="adminhtml.xml" hash="cedaa07c7d693302a23daaad79fcca3d"/><file name="config.xml" hash="9eb822794f463a1993a0b7b9be414137"/></dir><dir name="sql"><dir name="youstice_setup"><file name="mysql4-install-0.9.8.php" hash="f8aaefdf6e687a48645392956fb76ffa"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="youstice_layout_update.xml" hash="1cb43a482e15bea8cd356999d8b66f3e"/></dir><dir name="template"><dir name="youstice"><file name="baseUrl.phtml" hash="3d4dacc70fad8853838edb17774750a3"/><file name="reportClaims.phtml" hash="91251ca1bb8a9e6f6453ca7e979f53fb"/><file name="reportClaimsOgTags.phtml" hash="c149c54db5885d8045eff405dac24c2e"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="youstice_layout_update.xml" hash="f5a64acda38bcb12c039fe13f340f9de"/></dir><dir name="template"><dir name="youstice"><file name="adminForm.phtml" hash="5c81cbfd47bf26ad7beb9b32619c2f62"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Youstice_YousticeResolutionSystem.xml" hash="96f910a20f7fa55ccd25f82da9974341"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="youstice.css" hash="4097610e91c36600f67fc2d6e421c07b"/><file name="youstice_magento.css" hash="9a88cdb943794db3fa4d2f171ce83d63"/><dir name="fancybox"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancybox_loading.gif" hash="328cc0f6c78211485058d460e80f4fa8"/><file name="fancybox_loading@2x.gif" hash="f92938639fa894a0e8ded1c3368abe98"/><file name="fancybox_overlay.png" hash="77aeaa52715b898b73c74d68c630330e"/><file name="fancybox_sprite.png" hash="783d4031fe50c3d83c960911e1fbc705"/><file name="fancybox_sprite@2x.png" hash="ed9970ce22242421e66ff150aa97fe5f"/><file name="jquery.fancybox.css" hash="6c55951ce1e3115711f63f99b7501f3a"/></dir></dir><dir name="images"><dir name="youstice"><file name="logo.png" hash="64c2b8699997d46dce66e75da28c247b"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><file name="yousticeAdmin.css" hash="d5cf0ee9616b202df9fce3fb084ddd22"/><dir name="images"><dir name="youstice"><file name="screenshot_1.png" hash="fd032fb3ccdc167ed588e6a962acc973"/><file name="screenshot_2.png" hash="b9c9308c0ea193cbf84d70b4635d1f22"/><file name="screenshot_3.png" hash="defd41dc513159eb5a58c26d95030fc4"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="youstice"><file name="admin.js" hash="94c0295707277b801da120abaf47b1be"/><file name="jquery.fancybox.js" hash="921e9cb04ad6e2559869ec845c5be39b"/><file name="jquery.min.js" hash="96ef50d4f9b32f3413c46f83c12b279e"/><file name="logoWidget.js" hash="92e0f982382f4dd47b3db05304139b5e"/><file name="orders.js" hash="33c3436a301b8a7646084795a4a37a9a"/><file name="products.js" hash="8dcdd7a917ec0a095bfc1447cbed0c01"/><file name="reportClaims.js" hash="2f3fce230dfc8a1c359f43df04fd83dc"/></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.3.0</min><max>10.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
