Browse Source

* MigrationData with as400 and MAV sync
* termporary fix in CSVImporter.php about escaping fields
* ADDED new routes about as400 and MAV sync
* NEW: now it's possible to give order to MENU
* added dualframe logic
* moved some test source code file into 'test' folder
* UPDATED dbschema.sql file
* FIX: small changes for errors.tpl

Giancarlo Voci 8 years ago
parent
commit
fd5b6e0a66

+ 4 - 1
cfg/config - dimatec.ini

@@ -30,4 +30,7 @@ pass=ZrgzkvJrOKnNSCnPnGz3u{A6eHSNXVvs
 
 [VERTICALSTORAGE]
 ; Magazzino verticale ICAM
-;MV_ADDRESS=192.168.253.130
+;MV_ADDRESS=192.168.0.39
+MV_ADDRESS=192.168.253.130
+DB2_ADDRESS=192.168.0.100
+

+ 0 - 1
cfg/config-test.bin

@@ -1 +0,0 @@
-eJx1kWtvmzAUhr9b8n9A0T5smsYlkEtbWZoDHtByibhE1aoKEeIQFMAMSNYmyn+fSdvt0yzZsnzec87zHj/lJVunZfcMAY4j3/GxgUZdm0kjCHSsW0RAQhTEBILYRodCgsAgi9hEYwiIp/uG7ZloFEc/vs15gmWblsN3hLa8JIXgHgcifWmKlqLzuS8q+vnLV1WZqFNZli8XXiv00Kh67X6VtzvW9ahkWVoOt7uGtT1SVXl6t1nXaUURq8qi3vMmm/Whoy1qGesh4NEm7TqUF2mdpW3Jhvj1xXfNm/mcbeefIFhay2SJIwvpt1KdF/WL1Oya2XBwOo7p4sdk4djeQxLZLklCoiNlLEPA6wvLtN9BsMAhiQMHSW8YEIR2RDzsEmQUVdrTDALHN/1Ej8PId0nA7X5/z7lcJD43rsppJ72rHZYzsalzCGzd95IhNY7+l1Ny8aF/kw9EIS1p1gu/d0W2E7JD17OKtkJWctcCrdN1yR19cFwRNx+IEDzpfkDE7Zp/93Xgys1YVKZzUREVjRu+Tn0ia5oKwZ6+Il3+txRFm2nyWJUnMy4cRvyzzU/7433rP9ReqNfL2jyphzOeUiv0HlfH7tpwRYLI1rHDeQJskufBgZvm6elU1Ew40rYv+J9TgWtcHnNXCTaMgIThX7bxRBUVldP9AXW4y/8=

+ 1 - 1
cfg/config.bin

@@ -1 +1 @@
-eJx1kWtvmzAUhr9b8n9A0T5smsYl5NZGluaAB7RcIi5RtapChDgEBTADkrWJ8t9n0nT7NEu2fHnPOc97/JwVbJ0U7QsEOAo928M6GrRNKg0g0LBmEgEJoR8RCCILHXIJAp0sIgMNISCu5umWa6BBFP74NuMBpmWYNp8h2vKUFIIH7Iv0tc4bis7nLi/p5y9fVWWsTmRZvlx4rsBFg/Kt/VXc71jboYKlSdHv5jVrOqSq8mS+WVdJSREri7za8yKb9aGlDWoY6/pDnbQtyvKkSpOmYBDMb1eeY9zNZmw7+wTB0lzGSxyaSLuXqiyvXqV6V0/7hdNxTAc/xQvbch/j0HJIHBANKUMZAp5NWCbdDoIFDkjk20h6x4AgsELiYocgPS+TjqYQ2J7hxVoUhJ5DfG73+y3mcpF437gqo610U9ssY2JdZRBYmufGfWgU/i+m4OJD9y7viQJa0LQTfu/ydCekh7ZjJW2EtOCuBVol64I7+uC4Im4+ECF41jyfiNs1/+5rw5W7oahMZqIiKiNu+Nr1sTwaqRDs6RvS5H9DUUbTkTxU5fGUC/sW/2yy0/740HiPlRto1bIyTurhjCfUDNyn1bG9FlwRP7Q0bHMeHxvkpXfgJFlyOuUVE4606XL+51TgGoe/OasY67pPguAv23CsiorK6f4AeBPL/w==
+eJx1kVmPmzAUhd8t+T+gqA+tqrJmnchSCbjADEvEEo06GiFCHIICmAJJZxLlv9dkMu1DWyQjsM+5/s69T1lB10nRPkOgRqFne6qOBm2TCgMINFUzMYe40I8wBJGFDrkAgY4XkYFkCLCrebrlGmgQhd++TJnBtAzTZitEW1aSQHCv+jx5qfOGoPO5y0vy8dNnRRopY1EULxdWK3DRoHxtfxR3O9p2qKBpUvRf85o2HVIUcTzfrKukJIiWRV7t2SWb9aElDWoo7fqfOmlblOVJlSZNQSGY37Y8x5hNp3Q7/QDB0lzGSzU0kXYnVFlevQj1rp70L0bHMB31MV7YlvsQh5aD4wBrSJJFCFg1bpl0OwgWaoAj30bCGwYEgRViV3Uw0vMy6UgKge0ZXqxFQeg52Gdxv948l4vA+sZUGWmFm9qmGeXrKoPA0jw37q1R+D9PwcSH7k3eEwWkIGnH/dzl6Y5LD21HS9JwacFSc6RK1gVL9M5xRdy8I0LwpHk+5rdrNu5rw6WZzEvjKS/x0pAFvnZ9JA6HCgR78oo08c8jScPJUJQVcTRhwr7F35vstD/eN95D5QZatayMk3I4q2NiBu7j6theL1xhP7Q01WY8vmrg5z6Bk2TJ6ZRXlDuSpsvZzAnHNA47c1axqus+DoLfbCKvzNiM/j6QRwovKQxbX8j/cEnidYS/AOy/18o=

+ 53 - 1
dbschema.sql

@@ -2,9 +2,15 @@
 
 SET NAMES utf8;
 SET time_zone = '+00:00';
+SET foreign_key_checks = 0;
+SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
 
 SET NAMES utf8mb4;
 
+DROP DATABASE IF EXISTS `omlink`;
+CREATE DATABASE `omlink` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
+USE `omlink`;
+
 DROP TABLE IF EXISTS `articles`;
 CREATE TABLE `articles` (
   `stazione` varchar(255) NOT NULL,
@@ -41,6 +47,19 @@ CREATE TABLE `distinte` (
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
+INSERT INTO `distinte` (`id`, `idUtente`, `commessa`, `barcode`, `descrizione`, `data_creazione`, `time_creazione`, `qta_prelevare`, `qta_mancante`, `deleted`) VALUES
+(1,	1,	'180300428900200     ',	'FAA C245-DX    ',	'COMPASSO L245/230 DX.MANIGLIA GRIG.',	'2018-09-17',	'18:18:56',	1,	0,	0),
+(2,	1,	'180300428900300     ',	'FAA C245-SX    ',	'COMPASSO L245/230 SX-MANIGLIA GRIG.',	'2018-09-17',	'18:18:56',	1,	0,	0),
+(3,	1,	'180300428900100     ',	'F23 1450X650S  ',	'FINESTRA COMPASSO C/SERIGRAFIA GRIG',	'2018-09-17',	'18:18:56',	1,	0,	0),
+(4,	1,	'180300428900500     ',	'F23 1450X650S  ',	'FINESTRA COMPASSO C/SERIGRAFIA GRIG',	'2018-09-17',	'18:18:56',	1,	0,	0),
+(5,	1,	'180800430200200     ',	'030 M16TSI     ',	'PLAFON.MODUL.16W/12V ARGENTO INTERR',	'2018-09-17',	'18:18:56',	1,	0,	0),
+(6,	1,	'180300430200100     ',	'030 PL13S      ',	'LAMPADA COMP.NEON12V/13W ARG.      ',	'2018-09-17',	'18:18:56',	1,	0,	0),
+(7,	1,	'180907376100500     ',	'015 G10-Z8     ',	'RACCORDO DIRITTO 10MM/TUBO 8MM X VK',	'2018-09-17',	'18:18:56',	5,	0,	0),
+(8,	1,	'180907376100100     ',	'018 2006.998   ',	'AERATORE 22X1 F PER RUBINETTI      ',	'2018-09-17',	'18:18:56',	10,	0,	0),
+(9,	1,	'180907376100200     ',	'018 2006.999   ',	'AERATORE 24X1 M PER MONOLEVA CROMO ',	'2018-09-17',	'18:18:56',	10,	0,	0),
+(10,	1,	'180907376100100     ',	'030 HA10X10Y   ',	'LAMPADINA ALOG.12V/10W G4 BLIS.10PZ',	'2018-09-17',	'18:18:56',	1,	0,	0),
+(11,	1,	'180907376100400     ',	'015 50410.14Y  ',	'TUBO GAS AP 450 CON SECURITY IT-BL.',	'2018-09-17',	'18:18:56',	3,	0,	0),
+(12,	1,	'180907382700500     ',	'F48 MAN-P      ',	'MANIGLIA POLYFIX X FIN.F20/23/24/26',	'2018-09-17',	'18:18:56',	1,	0,	0);
 
 DROP TABLE IF EXISTS `label_bindings`;
 CREATE TABLE `label_bindings` (
@@ -55,6 +74,37 @@ CREATE TABLE `label_bindings` (
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
+INSERT INTO `label_bindings` (`id`, `label_id`, `barcode`, `descrizione`, `template_id`, `esl_datafields`, `qr_code`, `qta_prelevare`) VALUES
+(1,	'0105E104',	'180300428900100',	'180300428900100',	'dimatec2_2',	'{\"Q.ta\":0,\"Commessa\":\"180300428900100\"}',	NULL,	0),
+(2,	'011133B5',	'180300428900200',	'180300428900200',	'dimatec2_2',	'{\"Q.ta\":0,\"Commessa\":\"180300428900200\"}',	NULL,	0),
+(3,	'0105A8DE',	'180300428900300',	'180300428900300',	'dimatec2_2',	'{\"Q.ta\":0,\"Commessa\":\"180300428900300\"}',	NULL,	0),
+(5,	'010423C5',	'180300428900500',	'180300428900500',	'dimatec2_2',	'{\"Q.ta\":0,\"Commessa\":\"180300428900500\"}',	NULL,	0),
+(6,	'011282AF',	'180300430200100',	'180300430200100',	'dimatec2_2',	'{\"Q.ta\":0,\"Commessa\":\"180300430200100\"}',	NULL,	0);
+
+DROP TABLE IF EXISTS `notifications`;
+CREATE TABLE `notifications` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `code` int(11) NOT NULL DEFAULT 0,
+  `caption` varchar(255) NOT NULL,
+  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
+  `link` varchar(255) NOT NULL DEFAULT '#',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+INSERT INTO `notifications` (`id`, `code`, `caption`, `timestamp`, `link`) VALUES
+(1,	12,	'Battery labels low',	'2018-09-12 10:09:09',	'/bind'),
+(2,	12,	'Battery labels low',	'2018-09-12 10:09:09',	'/bind'),
+(3,	11,	'FindBox server doesn\'t respond',	'2018-09-12 10:09:27',	'/');
+
+DROP TABLE IF EXISTS `queuesystem`;
+CREATE TABLE `queuesystem` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `servicename` varchar(255) NOT NULL,
+  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
+  `command` varchar(5000) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4;
+
 
 DROP TABLE IF EXISTS `users`;
 CREATE TABLE `users` (
@@ -65,5 +115,7 @@ CREATE TABLE `users` (
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
+INSERT INTO `users` (`id`, `username`, `saltedpassword`, `roles`) VALUES
+(1,	'operatore1',	'$2y$10$Vd0Uv.h848Xj8HtuqMBO.OvSLp8ycQpSgveHb.bH4tl72iTCgpvay',	'a:1:{i:0;s:10:\"importdata\";}');
 
--- 2018-08-06 15:23:14
+-- 2018-09-18 13:19:15

+ 2 - 0
index.php

@@ -9,6 +9,8 @@
 
 // Init Framework
 require_once 'lib/f3/base.php';
+
+/** @var \Base $f3 */
 $f3 = \Base::instance();
 
 // Initialize App Menu

+ 10 - 9
src/Modules/Dimatec/Dimatec.php

@@ -8,9 +8,6 @@
 
 namespace Modules\Dimatec;
 
-use DB\SQL\Mapper;
-use OpenMind\FindBox\FindBoxCoreSystem;
-use OpenMind\FindBox\SmartESL;
 use OpenMind\System\PluginStrategy;
 
 class Dimatec extends PluginStrategy
@@ -22,20 +19,24 @@ class Dimatec extends PluginStrategy
 
     \F3::config('cfg/labels.ini', true);
 
-    // Definisco il namespace del gestore delle pagine
-    define('KITTING_SYSTEM', 'Modules\KittingDynamic');
-
     $this->AddRoute('GET|POST /pick2light/@step', __NAMESPACE__ . '\Pages->Pick2Light');
     $this->AddRoute("GET|POST /bind", __NAMESPACE__ . '\Pages->Bind');
-    $this->AddRoute("GET|POST /dualframe", __NAMESPACE__ . '\Pages->IcamControlIFrame');
-    $this->AddRoute("GET|POST /mav2as400", __NAMESPACE__ . '\Pages->MAV2AS400');
+    $this->AddRoute("GET /dualframe", __NAMESPACE__ . '\Dimatec->IcamControlIFrame');
+    $this->AddRoute("GET /mav2as400", __NAMESPACE__ . '\Pages->MAV2AS400');
+    $this->AddRoute('GET /as4002mav', __NAMESPACE__ . '\Pages->AS4002MAV');
 
     $imgClass = 'shadow p-3 rounded bg-white';
 
-    $this->AddMenuItem('mav2as400', ['url' => 'mav2as400', 'imgClass' => $imgClass, 'image' => 'ui/images/mav2as400.png']);
+    $this->AddMenuItem('mav2as400', ['order' => 1, 'url' => 'mav2as400', 'imgClass' => $imgClass, 'image' => 'ui/images/mav2as400.png', 'permissionName' => 'importdata']);
+    $this->AddMenuItem('as4002mav', ['order' => 2, 'url' => 'as4002mav', 'imgClass' => $imgClass, 'image' => 'ui/images/import.png', 'permissionName' => 'importdata']);
     $this->AddMenuItem('bind', ['url' => 'bind', 'imgClass' => $imgClass, 'image' => 'ui/images/bind.png']);
     $this->AddMenuItem('pick2light', ['url' => 'pick2light/1', 'imgClass' => $imgClass, 'image' => 'ui/images/magazzinoverticale.png']);
   }
+
+  public function IcamControlIFrame($f3)
+  {
+    echo \Template::instance()->render('icamcontrol.tpl');
+  }
 }
 
 /** @var \Modules\Dimatec\Dimatec $Dimatec */

+ 210 - 0
src/Modules/Dimatec/MigrationData.php

@@ -0,0 +1,210 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Giancarlo
+ * Date: 19/09/2018
+ * Time: 12:10
+ */
+
+namespace Modules\Dimatec;
+
+use DB\SQL;
+
+class MigrationData
+{
+  /** @var SQL $dbHandle DB2 */
+  private $dbHandle;
+
+  /** @var \SoapClient $soapClient MAV client */
+  private $soapClient;
+
+  // SOAPACTION
+  private $soapAction = 'http://servizi_xchange.org/ImportLists';
+
+  // Internal variables
+  private $finalXml;
+  private $listXml;
+
+  /**
+   * Create the connection client to a SOAP server
+   * @param string $serverAddress IP Address
+   */
+  public function SoapConnector(string $serverAddress)
+  {
+    $this->soapClient = new \SoapClient("http://$serverAddress/servizi_xchange.asmx?wsdl", array(
+      'trace' => true,
+      'exceptions' => true,
+      'cache_wsdl' => false,
+    ));
+  }
+
+  /**
+   * PDO constructor.
+   * @param string $serverAddress IP Address
+   */
+  public function DatabaseConnector(string $serverAddress)
+  {
+    $this->dbHandle = new SQL(
+      "odbc:Driver={iSeries Access ODBC Driver};DefaultLibraries=SMEDAT_DIM;SYSTEM=$serverAddress;",
+      'icam', 'icam',
+      array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION));
+  }
+
+  /**
+   * @param $sql
+   * @param int $mode default \PDO::FETCH_ASSOC
+   * @return array
+   */
+  public function query($sql, $mode = \PDO::FETCH_ASSOC): array
+  {
+    return $this->dbHandle->exec($sql, $mode);
+  }
+
+  /**
+   * @param $result
+   * @return int row count
+   */
+  public function toCSV($result): int
+  {
+    $count = 0;
+    foreach($result as $key => $value) {
+      $arr = [];
+      array_map(function ($v) use (&$arr) {
+        $arr[] = str_pad(ltrim(rtrim($v)), 5, ' ');
+      }, $value);
+
+      echo join('|', $arr);
+      echo PHP_EOL;
+      $count++;
+    }
+    return $count;
+  }
+
+  private function soapAddHead(string $extCode, string $operation, string $name, string $description)
+  {
+    $this->listXml .= <<<EOF
+        <ser:ListHead>
+          <ser:external_list_code>$extCode</ser:external_list_code>
+          <ser:operation_type>VISUALIZZAZIONE</ser:operation_type>
+          <ser:operation>$operation</ser:operation>
+          <ser:name>$name</ser:name>
+          <ser:description>$description</ser:description>
+          <ser:user_id>sa</ser:user_id>
+        </ser:ListHead>
+
+EOF;
+  }
+
+  private function soapAddArticle(string $id, int $quantity, $description)
+  {
+    $this->listXml .= <<<EOF
+        <ser:ListDetail>
+          <ser:item_id>$id</ser:item_id>
+          <ser:quantity>$quantity</ser:quantity>
+          <ser:description>$description</ser:description>
+        </ser:ListDetail>
+EOF;
+  }
+
+  /**
+   * Send to as400 a list of all articles contained into MAV
+   * @param $data
+   * @return bool
+   */
+  public function copyAllToAS400($data): bool
+  {
+    $this->dbHandle->exec("TRUNCATE TABLE INTMUB0F");
+    foreach($data as $key => $value) {
+      $this->dbHandle->exec("INSERT INTO INTMUB0F (UXSTAT, UXCOAP, UXQTGC, UXQTMA) VALUES (10, '${value['UXCOAP']}', ${value['UXQTGC']}, ${value['UXQTMA']})");
+    }
+  }
+
+  /**
+   *  Per comodità questa funzione serve per interpretare meglio il campo MXTIPM, indica solamente il valore 'C' come Carico, e scarico stringa vuota o spazio
+   *
+   * @param string $operation
+   * @return string
+   */
+  private function fixOperationTypeValue(string $operation)
+  {
+    return ($operation == 'CARICO') ? "MXTIPM == 'C'" : "MXTIPM <> 'C'";
+  }
+
+  /**
+   * Ritorna la query di massificazione dalla tabella INTMAVOF
+   *
+   * @param string $operationType values: 'CARICO' or 'SCARICO'
+   * @return string
+   */
+  public function strQueryMassificata(string $operationType): string
+  {
+    $filter = $this->fixOperationTypeValue($operationType);
+
+    return <<<EOF
+SELECT tb1.MXARTI, tb1.MXQTMI, tb1.MXDESC, tb2.qty FROM INTMAV0F AS tb1
+JOIN (SELECT MXARTI, sum(MXQTMI) AS qty FROM INTMAV0F WHERE $filter GROUP BY MXARTI) AS tb2
+ON tb1.MXARTI = tb2.mxarti
+WHERE $filter
+ORDER BY tb1.MXARTI, tb1.MXIDDM
+EOF;
+
+  }
+
+  /**
+   * Compile xml soap from $data
+   *
+   * @param string $operationType values: 'CARICO' or 'SCARICO'
+   * @param iterable $data
+   */
+  public function soapCompileFrom(iterable $data, string $operationType)
+  {
+    $idList = 'ID-' . uniqid();
+    $dateTime = date("d/m/Y alle H:i:s");
+    $operationType = $operationType == 'CARICO' ? 'CARICO' : 'SCARICO';
+
+    foreach($data as $row) {
+
+      // List Head
+      $this->soapAddHead($idList, $operationType, "Lista di $operationType da as400 del $dateTime", '');
+      $descArti = trim($row['MXDESC']); // trim($row['MXCORD']) . ' ' . trim(substr($row['MXRIFC'], 7)) . ' ' . trim($row['MXDESC']);
+
+      // List Article
+      $this->soapAddArticle($row['MXARTI'], $row['QTY'], $descArti);
+    }
+
+    $this->finalXml = <<<EOF
+<?xml version="1.0" encoding="utf-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://servizi_xchange.org/">
+  <soapenv:Header/>
+  <soapenv:Body>
+    <ser:ImportLists>
+      <ser:InputLists>
+        <ser:ListToImport>
+$this->listXml
+        </ser:ListToImport>
+      </ser:InputLists>
+      <ser:Output_Type>0</ser:Output_Type>
+    </ser:ImportLists>
+  </soapenv:Body>
+</soapenv:Envelope>
+EOF;
+
+  }
+
+  /**
+   * Send xml to SoapService of ICAM
+   * @param $xmlSoap
+   * @return bool true if successful
+   */
+  public function sendToIcam($xmlSoap): bool
+  {
+    global $f3;
+
+    $ws_url = 'http://' . $f3->get('VERTICALSTORAGE.MV_ADDRESS') . '/servizi_xchange.asmx';
+
+    $ret = $this->soapClient->__doRequest($xmlSoap, $ws_url, $this->soapAction, SOAP_1_1);
+
+    return is_string($ret);
+  }
+
+}

+ 28 - 2
src/Modules/Dimatec/Pages.php

@@ -194,11 +194,37 @@ class Pages extends Controller
     echo \Template::instance()->render('masterpage.tpl');
   }
 
-  public function IcamControlIFrame($f3)
+
+  /**
+   * Import lists from as400 to MAV
+   * @param $f3
+   */
+  public function AS4002MAV($f3)
   {
-    echo \Template::instance()->render('icamcontrol.tpl');
+    $migData = new MigrationData();
+
+    $migData->SoapConnector($f3->get('VERTICALSTORAGE.MV_ADDRESS'));
+    $migData->DatabaseConnector($f3->get('VERTICALSTORAGE.DB2_ADDRESS'));
+
+    // Get lists from as400
+    $data = $migData->query($migData->strQueryMassificata('SCARICO'));
+
+    // Compile xml for SOAP
+    $migData->soapCompileFrom($data, 'SCARICO');
+
+    if (!$migData->sendToIcam($this->finalXml))
+      $f3->set('IMPORT_RESULT', "Errore durante l'invio della lista al Magazzino Verticale.<br/><br/>Controllare la console ICAM per gli errori.");
+    else
+      $f3->set('IMPORT_RESULT', 'Liste inviate correttamente al Magazzino Verticale');
+
+    $f3->set('CONTENT', 'import.tpl');
+    echo \Template::instance()->render('masterpage.tpl');
   }
 
+  /**
+   * Send list of all goods loaded into MAV to as400
+   * @param $f3
+   */
   public function MAV2AS400($f3)
   {
     echo \Template::instance()->render('masterpage.tpl');

+ 2 - 1
src/OpenMind/DataManager/CSVImporter.php

@@ -139,9 +139,10 @@ class CSVImporter
    */
   private function importOnDatabase(string $fileName, array $data)
   {
+    global $f3;
     $this->dbMysql->query("TRUNCATE TABLE `distinte`");
     foreach($data as $dataRow) {
-      $descr = $this->dbMysql->escape_string($dataRow[10]);
+      $descr = $dataRow[10];
       $sql = <<<EOL
 INSERT INTO distinte (
 origine, consegna, commessa, ordine_produzione, data_creazione, time_creazione, destinazione_merci, barcode, descrizione, qta_prelevare, qta_mancante

+ 0 - 1
src/OpenMind/System/Notifications.php

@@ -12,7 +12,6 @@ use DB\SQL\Mapper;
 
 class Notifications extends Mapper
 {
-  /** @var \Base $f3 */
   private $f3;
 
   // Used internally

+ 3 - 2
src/OpenMind/System/PluginStrategy.php

@@ -104,7 +104,8 @@ class PluginStrategy implements IPluginStrategy
       'url' => '',
       'isDisabled' => false,
       'image' => '',
-      'permissionName' => null
+      'permissionName' => null,
+      'order' => 99999
     ];
 
     $newMenu = array_merge($defaults, $options);
@@ -112,7 +113,7 @@ class PluginStrategy implements IPluginStrategy
     $globalMenuUpdated = $f3->get('GLOBALMENU');
     $globalMenuUpdated[$menuName] = $newMenu;
 
-    // If user logged check permi
+    // If user logged check permission
     $user = User::Restore();
     if (!$user->dry()) {
       $hasMenuPermissionRequirements = !is_null($newMenu['permissionName']);

+ 0 - 1
src/OpenMind/System/QueueSystem.php

@@ -12,7 +12,6 @@ use DB\SQL\Mapper;
 
 class QueueSystem extends Mapper
 {
-  /** @var \Base $f3 */
   private $f3;
   private $serviceName;
 

+ 4 - 1
src/OpenMind/System/User.php

@@ -66,6 +66,9 @@ class User extends Mapper
    */
   public function hasPermission(string $permissionName): bool
   {
-    return in_array($permissionName, $this->userRoles);
+    if($this->userRoles)
+      return in_array($permissionName, $this->userRoles);
+    else
+      return false;
   }
 }

+ 1 - 1
src/OpenMind/Web/Controller.php

@@ -24,7 +24,7 @@ class Controller
     $this->sanitizedPostRequest = $f3->clean($f3->get('POST'));
     $this->dbHandle = $f3->get('DB');
 
-    if (!$f3->exists('SESSION.user') && !in_array($f3->get('PATTERN'), ['/loginform', '/'])) {
+    if (!$f3->exists('SESSION.user') && !in_array($f3->get('PATTERN'), ['/loginform', '/', '/dualframe'])) {
       $f3->reroute('/');
       return;
     }

+ 18 - 9
src/OpenMind/Web/Web.php

@@ -14,10 +14,19 @@ class Pages extends Controller
 {
   public function HomeMenu($f3)
   {
+    // Sort menus buy 'order' option
+    usort($f3->ref('GLOBALMENU'), function ($menu1, $menu2) {
+      return $menu1['order'] <=> $menu2['order'];
+    });
+
     $f3->set('CONTENT', 'homemenu.tpl');
     echo \Template::instance()->render('masterpage.tpl');
   }
 
+  /**
+   * @deprecated Unused import for this project
+   * @param $f3
+   */
   public function Import($f3)
   {
     $output = '';
@@ -45,21 +54,21 @@ class Web extends PluginStrategy
   public function __construct()
   {
     // Services
-    $this->AddRoute('GET /importdata', __NAMESPACE__ . '\Pages->Import');
+    //$this->AddRoute('GET /importdata', __NAMESPACE__ . '\Pages->Import');
     $this->AddRoute('GET /homemenu', __NAMESPACE__ . '\Pages->HomeMenu');
     $this->AddRoute('GET /', __NAMESPACE__ . '\Login->Login');
     $this->AddRoute("POST /loginform", __NAMESPACE__ . '\Login->LoginForm');
     $this->AddRoute("GET /logout", __NAMESPACE__ . '\Login->Logout');
 
-    // Menu
-    $this->AddMenuItem('genericimport', [
-      'url' => 'importdata',
-      'imgClass' => 'shadow p-3 rounded bg-white',
-      'image' => 'ui/images/import.png',
-      'permissionName' => 'importdata'
-    ]);
+    /*    // Menu
+        $this->AddMenuItem('genericimport', [
+          'url' => 'importdata',
+          'imgClass' => 'shadow p-3 rounded bg-white',
+          'image' => 'ui/images/import.png',
+          'permissionName' => 'importdata'
+        ]);*/
 
-    // Add permission roles
+    // Add to Global permission roles
     $roles = new UserRoles();
     $roles->add('importdata');
   }

+ 0 - 26
test.xml

@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://servizi_xchange.org/">
-  <soapenv:Header/>
-  <soapenv:Body>
-    <ser:ImportLists>
-      <!--Optional:-->
-      <ser:InputLists>
-        <!--Zero or more repetitions:-->
-        <ser:ListToImport>
-          <!--Optional:-->
-          <ser:ListHead>
-            <ser:external_list_code>test3</ser:external_list_code>
-            <ser:operation_type>SCARICO</ser:operation_type>
-            <ser:operation>SCARICO</ser:operation>
-            <ser:user_id>sa</ser:user_id>
-          </ser:ListHead>
-          <ser:ListDetail>
-            <ser:item_id>00003092070</ser:item_id>
-            <ser:quantity>1</ser:quantity>
-          </ser:ListDetail>
-        </ser:ListToImport>
-      </ser:InputLists>
-      <ser:Output_Type>0</ser:Output_Type>
-    </ser:ImportLists>
-  </soapenv:Body>
-</soapenv:Envelope>

+ 7 - 1
conn_odbc_ibm.php → test/conn_odbc_ibm.php

@@ -42,6 +42,7 @@ class MigrationData
 
   public function transferData($pdoResult)
   {
+    $this->query("TRUNCATE TABLE INTMUB0F");
     $count = 0;
     foreach($pdoResult as $key => $value) {
       echo "INSERT INTO INTMUB0F (UXSTAT, UXCOAP, UXQTGC, UXQTMA) VALUES (10, '${value['UXCOAP']}', ${value['UXQTGC']}, ${value['UXQTMA']})" . PHP_EOL;
@@ -59,7 +60,12 @@ try {
   $mav = new MigrationData("sqlsrv:Server=192.168.0.39;Database=icamdbstore", 'sa', 'sa');
   $res = $mav->query('SELECT item_id AS UXCOAP, max_load_unit AS UXQTMA, position_quantity AS UXQTGC FROM vw_item_positions');
 
-  $db2 = new MigrationData('odbc:dicamas400', 'icam', 'icam');
+  $db2 = new MigrationData(
+    "odbc:Driver={iSeries Access ODBC Driver};DefaultLibraries=SMEDAT_DIM;SYSTEM=192.168.0.100;Uid=icam;Pwd=icam",
+    'icam',
+    'icam'
+  );
+
   $db2->transferData($res);
 
 } catch (PDOException $exception) {

+ 0 - 0
omlinkimporter.php → test/omlinkimporter.php


+ 42 - 0
test/test.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://servizi_xchange.org/">
+  <soapenv:Header/>
+  <soapenv:Body>
+    <ser:ImportLists>
+      <!--Optional:-->
+      <ser:InputLists>
+        <!--Zero or more repetitions:-->
+        <ser:ListToImport>
+          <!--Optional:-->
+          <ser:ListHead>
+            <ser:external_list_code>test130</ser:external_list_code>
+            <ser:operation_type>SCARICO</ser:operation_type>
+            <ser:operation>SCARICO</ser:operation>
+            <ser:name>T100123A</ser:name>
+            <ser:description>Lista di esempio by OpenMind</ser:description>
+            <ser:user_id>sa</ser:user_id>
+          </ser:ListHead>
+          <ser:ListDetail>
+            <ser:item_id>00003092070</ser:item_id>
+            <ser:quantity>10</ser:quantity>
+            <ser:description>descrizione articolo 1</ser:description>
+          </ser:ListDetail>
+          <ser:ListHead>
+            <ser:external_list_code>test130</ser:external_list_code>
+            <ser:operation_type>SCARICO</ser:operation_type>
+            <ser:operation>SCARICO</ser:operation>
+            <ser:name>T100123A</ser:name>
+            <ser:description>Lista di esempio by OpenMind</ser:description>
+            <ser:user_id>sa</ser:user_id>
+          </ser:ListHead>
+          <ser:ListDetail>
+            <ser:item_id>000423326021</ser:item_id>
+            <ser:quantity>2</ser:quantity>
+            <ser:description>descrizione articolo 2</ser:description>
+          </ser:ListDetail>
+        </ser:ListToImport>
+      </ser:InputLists>
+      <ser:Output_Type>0</ser:Output_Type>
+    </ser:ImportLists>
+  </soapenv:Body>
+</soapenv:Envelope>

+ 0 - 0
verticalstorageimporter.php → test/verticalstorageimporter.php


+ 8 - 3
ui/css/omlink.scss

@@ -46,9 +46,14 @@ body {
   unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
 }
 
-.error_body {
-  background-image: url('ui/images/error_bg.png');
-  background-repeat: no-repeat;
+.error_body:before {
+  content: "";
+  position: absolute;
+  left: 0;
+  top: 0;
+  width: 100%;
+  height: 100%;
+  background: url('ui/images/error_bg.png');
   background-size: cover;
 }
 

+ 19 - 17
ui/errors.tpl

@@ -1,26 +1,28 @@
 <!DOCTYPE html>
 <html lang="it">
 <head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>{{@SITENAME}} error page</title>
-    <link type="text/css" rel="stylesheet" href="{{@BASEURL}}/bundle.css"/>
+	<meta charset="UTF-8">
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<title>{{@SITENAME}} error page</title>
+	<link type="text/css" rel="stylesheet" href="{{@BASEURL}}/bundle.css"/>
 </head>
 <body class="bg-light error_body">
 
-<div class="container-fluid h-100">
-    <div class="row h-100">
-        <div class="col-md-12 d-flex justify-content-center">
-            <div class="card bg-white m-1 p-2">
-                <h1 class="text-center text-info">{{@ERROR.code}} {{@ERROR.status}}</h1>
-                <br/>
-                <h3 class="text-success">Dettaglio errore:</h3>
-                <p style="color: black">{{@ERROR.text | raw}}</p>
-                <h3 class="text-success">Debug Trace:</h3>
-                <pre style="font-size: 0.8rem">{{@ERROR.trace | raw}}</pre>
-            </div>
-        </div>
-    </div>
+<div class="container-fluid">
+	<div class="row">
+		<div class="col-md-6 mx-auto">
+			<div class="card bg-white m-1 p-2">
+				<h1 class="text-center text-info">{{@ERROR.code}} {{@ERROR.status}}</h1>
+				<br/>
+				<h3 class="text-success">Dettaglio errore:</h3>
+				<p style="color: black">{{@ERROR.text | raw}}</p>
+				<h3 class="text-success">Debug Trace:</h3>
+				<pre style="font-size: 0.8rem">{{@ERROR.trace | raw}}</pre>
+				<br/>
+				<a class="text-uppercase" href="{{@BASEURL}}">Torna alla pagina principale.</a>
+			</div>
+		</div>
+	</div>
 </div>
 
 <script src="{{@BASEURL}}/bundle.js"></script>

+ 1 - 1
ui/icamcontrol.tpl

@@ -19,7 +19,7 @@
 			<iframe class="h-100 w-100" src="http://localhost/omlink"></iframe>
 		</div>
 		<div class="col h-100">
-			<iframe class="h-100 w-100" src="http://192.168.253.128/"></iframe>
+			<iframe class="h-100 w-100" src="http://{{@VERTICALSTORAGE.MV_ADDRESS}}/"></iframe>
 		</div>
 	</div>
 </div>

+ 1 - 1
ui/js/omlink.js

@@ -67,5 +67,5 @@ $(function () {
 
   setInterval(() => {
     refreshNotificationArea();
-  }, 5000);
+  }, 60000);
 });