-
-
- Item list
-
-
-
-
- CALL item_getList(#warehouse, CURDATE(), #realm, #rate)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/rest/client/supplant.php b/rest/client/supplant.php
index 4b2dbf49..4ef83402 100644
--- a/rest/client/supplant.php
+++ b/rest/client/supplant.php
@@ -18,12 +18,12 @@ class Supplant extends Vn\Web\JsonRequest {
if (!$isClient)
throw new Web\ForbiddenException(s('The user is not a client'));
- $isWorker = $db->getValue(
- 'SELECT COUNT(*) > 0 FROM vn.worker WHERE id = #',
+ $hasAccount = $db->getValue(
+ 'SELECT COUNT(*) > 0 FROM account.account WHERE id = #',
[$userId]
);
- if ($isWorker)
- throw new Web\ForbiddenException(s('Workers cannot be supplanted'));
+ if ($hasAccount)
+ throw new Web\ForbiddenException(s('The user is not impersonable'));
return $this->service->createToken($_REQUEST['supplantUser']);
}
diff --git a/rest/core/set-password.php b/rest/core/set-password.php
deleted file mode 100644
index 5ceaa87b..00000000
--- a/rest/core/set-password.php
+++ /dev/null
@@ -1,28 +0,0 @@
-getValue(
- 'SELECT id FROM account.user WHERE `name` = #',
- [$setUser]
- );
- $db->query('CALL account.user_setPassword(#, #)',
- [$userId, $setPassword]);
- Account::sync($db, $setUser, $setPassword);
- return TRUE;
- }
-}
-
diff --git a/rest/edi/sql/bucket.sql b/rest/edi/sql/bucket.sql
deleted file mode 100644
index 9b2d2dfa..00000000
--- a/rest/edi/sql/bucket.sql
+++ /dev/null
@@ -1,14 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE bucket
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12)
- SET
- bucket_id = @col2,
- bucket_type_id = @col4,
- description = @col5,
- x_size = @col6,
- y_size = @col7,
- z_size = @col8,
- entry_date = STR_TO_DATE(@col10, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col11, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col12, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/bucket_type.sql b/rest/edi/sql/bucket_type.sql
deleted file mode 100644
index 11bcc7f0..00000000
--- a/rest/edi/sql/bucket_type.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE bucket_type
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6)
- SET
- bucket_type_id = @col2,
- description = @col3,
- entry_date = STR_TO_DATE(@col4, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col5, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col6, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/feature.sql b/rest/edi/sql/feature.sql
deleted file mode 100644
index a5d2833c..00000000
--- a/rest/edi/sql/feature.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE `feature`
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7)
- SET
- item_id = @col2,
- feature_type_id = @col3,
- feature_value = @col4,
- entry_date = STR_TO_DATE(@col5, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col6, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col7, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/genus.sql b/rest/edi/sql/genus.sql
deleted file mode 100644
index 0e60fd79..00000000
--- a/rest/edi/sql/genus.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE genus
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6)
- SET
- genus_id = @col2,
- latin_genus_name = @col3,
- entry_date = STR_TO_DATE(@col4, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col5, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col6, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/item.sql b/rest/edi/sql/item.sql
deleted file mode 100644
index 1c348439..00000000
--- a/rest/edi/sql/item.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE item
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12)
- SET
- id = @col2,
- product_name = @col4,
- name = @col5,
- plant_id = @col7,
- group_id = @col9,
- entry_date = STR_TO_DATE(@col10, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col11, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col12, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/item_feature.sql b/rest/edi/sql/item_feature.sql
deleted file mode 100644
index 81ddbc73..00000000
--- a/rest/edi/sql/item_feature.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE `item_feature`
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8)
- SET
- item_id = @col2,
- feature = @col3,
- regulation_type = @col4,
- presentation_order = @col5,
- entry_date = STR_TO_DATE(@col6, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col7, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col8, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/item_group.sql b/rest/edi/sql/item_group.sql
deleted file mode 100644
index cbdc1328..00000000
--- a/rest/edi/sql/item_group.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE item_group
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6)
- SET
- group_code = @col2,
- dutch_group_description = @col3,
- entry_date = STR_TO_DATE(@col4, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col5, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col6, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/plant.sql b/rest/edi/sql/plant.sql
deleted file mode 100644
index ba969afa..00000000
--- a/rest/edi/sql/plant.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE plant
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9)
- SET
- plant_id = @col3,
- genus_id = @col4,
- specie_id = @col5,
- entry_date = STR_TO_DATE(@col7, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col8, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col9, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/specie.sql b/rest/edi/sql/specie.sql
deleted file mode 100644
index 883d97b7..00000000
--- a/rest/edi/sql/specie.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE specie
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7)
- SET
- specie_id = @col2,
- genus_id = @col3,
- latin_species_name = @col4,
- entry_date = STR_TO_DATE(@col5, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col6, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col7, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/supplier.sql b/rest/edi/sql/supplier.sql
deleted file mode 100644
index 636d0a0b..00000000
--- a/rest/edi/sql/supplier.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE supplier
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12, @col13, @col14, @col15, @col16, @col17, @col18, @col19, @col20)
- SET
- GLNAddressCode = @col2,
- supplier_id = @col4,
- company_name = @col3,
- entry_date = STR_TO_DATE(@col9, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col10, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col11, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/type.sql b/rest/edi/sql/type.sql
deleted file mode 100644
index 77c0883d..00000000
--- a/rest/edi/sql/type.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE `type`
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7)
- SET
- type_id = @col2,
- type_group_id = @col3,
- description = @col4,
- entry_date = STR_TO_DATE(@col5, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col6, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col7, '%Y%m%d%H%i')
diff --git a/rest/edi/sql/value.sql b/rest/edi/sql/value.sql
deleted file mode 100644
index 288b8c10..00000000
--- a/rest/edi/sql/value.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-LOAD DATA LOCAL INFILE #file
- INTO TABLE `value`
- FIELDS TERMINATED BY ';'
- LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7)
- SET
- type_id = @col2,
- type_value = @col3,
- type_description = @col4,
- entry_date = STR_TO_DATE(@col5, '%Y%m%d'),
- expiry_date = IFNULL(NULL,STR_TO_DATE(@col6, '%Y%m%d')),
- change_date_time = STR_TO_DATE(@col7, '%Y%m%d%H%i')
diff --git a/rest/edi/update.php b/rest/edi/update.php
deleted file mode 100644
index 87ca6d21..00000000
--- a/rest/edi/update.php
+++ /dev/null
@@ -1,113 +0,0 @@
-selectDb('edi');
- $db->getHandler()->options(MYSQLI_OPT_LOCAL_INFILE, TRUE);
-
- $tmpDir = '/tmp/floricode';
-
- // Establish the FTP connection
-
- $ftpConf = $db->getRow('SELECT host, user, password FROM ftpConfig');
-
- echo "Openning FTP connection to {$ftpConf['host']}\n";
- $ftpConn = ftp_connect($ftpConf['host']);
-
- if (!$ftpConn)
- throw new Exception('Can not connect to '. $ftpConf['host']);
-
- if (!ftp_login($ftpConn, $ftpConf['user'], $ftpConf['password']))
- throw new Exception('Can not login to '. $ftpConf['user'] .'@'. $ftpConf['host']);
- ftp_pasv($ftpConn, true);
-
- // Gets the list with the tables to update
-
- set_time_limit(0);
-
- $res = $db->query(
- 'SELECT fileName, toTable, file, updated FROM fileConfig');
-
- $dwFiles = [];
-
- if (!file_exists($tmpDir))
- mkdir($tmpDir);
-
- while ($row = $res->fetch_assoc())
- try {
- $file = $row['file'];
- $table = $row['toTable'];
- $baseName = $row['fileName'];
-
- if ($row['updated']) {
- $updated = DateTime::createFromFormat('Y-m-d', $row['updated']);
- $updated->setTime(0, 0, 0);
- } else
- $updated = NULL;
-
- $remoteFile = "codes/$file.ZIP";
- $zipFile = "$tmpDir/$file.zip";
- $ucDir = "$tmpDir/$file";
-
- // Downloads and decompress the file with the data
-
- if (!isset($dwFiles[$file])) {
- $dwFiles[$file] = TRUE;
-
- echo "Downloading $remoteFile\n";
- if (!ftp_get($ftpConn, $zipFile, $remoteFile, FTP_BINARY))
- throw new Exception("Error downloading $remoteFile to $zipFile");
-
- $zip = new ZipArchive;
-
- if ($zip->open($zipFile) !== TRUE)
- throw new Exception("Can not open $zipFile");
-
- @mkdir($ucDir, 0774, TRUE);
-
- if (!$zip->extractTo($ucDir))
- throw new Exception("Can not uncompress file $zipFile");
-
- $zip->close();
- unlink($zipFile);
- }
-
- foreach (glob("$ucDir/$baseName*.txt") as $fileName)
- break;
-
- if (empty($fileName))
- throw new Exception("Import file for table $table does not exist");
-
- // If data is updated, omits the table
-
- $lastUpdated = substr($fileName, -10, 6);
- $lastUpdated = DateTime::createFromFormat('dmy', $lastUpdated);
- $lastUpdated->setTime(0, 0, 0);
-
- if (isset($updated) && $lastUpdated <= $updated) {
- echo "Table $table is updated, omitted\n";
- continue;
- }
-
- // Updates the table
-
- echo "Dumping data to table $table\n";
-
- $db->query("START TRANSACTION");
- $db->query("DELETE FROM {$db->quote($table)}");
- $db->queryFromFile(__DIR__."/sql/$table", ['file' => $fileName]);
- $db->query("UPDATE fileConfig SET updated = # WHERE fileName = #",
- [$lastUpdated, $baseName]
- );
- $db->query("COMMIT");
- } catch (Exception $e) {
- error_log($e->getMessage());
- $db->query('ROLLBACK');
- }
-
- shell_exec("rm -R $tmpDir");
- ftp_close($ftpConn);
-
- echo "Update completed\n";
- }
-}
diff --git a/rest/image/image.php b/rest/image/image.php
index 0e6cae0f..0c104851 100644
--- a/rest/image/image.php
+++ b/rest/image/image.php
@@ -20,7 +20,13 @@ class Image {
$image = imagecreatefrompng($srcFile);
break;
case IMAGETYPE_GIF:
- $image = imagecreatefromgif ($srcFile);
+ $image = imagecreatefromgif($srcFile);
+ break;
+ case IMAGETYPE_WEBP:
+ $image = imagecreatefromwebp($srcFile);
+ break;
+ case IMAGETYPE_BMP:
+ $image = imagecreatefrombmp($srcFile);
break;
default:
throw new UserException(s('Bad file format'));
diff --git a/rest/core/IndieFlower.ttf b/rest/misc/IndieFlower.ttf
similarity index 100%
rename from rest/core/IndieFlower.ttf
rename to rest/misc/IndieFlower.ttf
diff --git a/rest/misc/access-version.php b/rest/misc/access-version.php
deleted file mode 100644
index 63f74a8d..00000000
--- a/rest/misc/access-version.php
+++ /dev/null
@@ -1,74 +0,0 @@
-app->getName() .'/vn-access';
- $headFile = "$accessDir/$appName.7z";
- $archiveRelPath = ".archive/$appName/$newVersion.7z";
- $archiveFullPath = "$accessDir/$archiveRelPath";
-
- // Updates the application
-
- rename($moduleFile['tmp_name'], $archiveFullPath);
- chmod($archiveFullPath, 0644);
-
- @unlink($headFile);
- symlink($archiveRelPath, $headFile);
-
- return TRUE;
- }
-}
diff --git a/rest/core/captcha.php b/rest/misc/captcha.php
similarity index 100%
rename from rest/core/captcha.php
rename to rest/misc/captcha.php
diff --git a/rest/core/account.php b/rest/user/account.php
similarity index 100%
rename from rest/core/account.php
rename to rest/user/account.php
diff --git a/rest/core/recover-password.php b/rest/user/recover-password.php
similarity index 100%
rename from rest/core/recover-password.php
rename to rest/user/recover-password.php
diff --git a/rest/core/restore-password.php b/rest/user/restore-password.php
similarity index 100%
rename from rest/core/restore-password.php
rename to rest/user/restore-password.php
diff --git a/rest/core/supplant.php b/rest/user/supplant.php
similarity index 100%
rename from rest/core/supplant.php
rename to rest/user/supplant.php