Compare commits

...

10 Commits

Author SHA1 Message Date
d6f5b82b33 Finish Gramm_MonitoraggioLinee_FixScaricoDaCollo 2022-12-06 12:38:44 +01:00
8019dfecf8 [Monitoraggio Linee]
- Modifiche precall
2022-12-06 12:38:36 +01:00
6252fc9935 Finish Gramm_MonitoraggioLinee_FixScaricoDaCollo 2022-12-06 10:30:17 +01:00
12adae3eb7 [Monitoraggio Linee]
- Fix scrittura "Preparato Da" nella creazione di uno scarico da collo
2022-12-06 10:30:06 +01:00
443f369b5c Finish Gramm_MonitoraggioLinee_FixLoginPermessi 2022-12-06 10:07:42 +01:00
5c3c132830 [Monitoraggio Linee]
- Modifiche al login di gramm
2022-12-06 10:07:36 +01:00
1f64a6500f Merge branch 'hotfix/correzioniMes' 2022-12-05 18:48:58 +01:00
07f0cdcaf6 correzioni modulo login in mes 2022-12-05 18:48:35 +01:00
de57a8b8a6 Merge branch 'hotfix/correzioni_mes' 2022-12-05 18:28:21 +01:00
90759eece7 correzioni tab distinta base
rimosso controllo su evn debug per password
2022-12-05 18:28:03 +01:00
7 changed files with 187 additions and 168 deletions

View File

@@ -1,6 +1,7 @@
<?php
class IMSApi {
class IMSApi
{
const serviceRootPath = "ems-api/";
private $contentType = null;
private $serviceName = null;
@@ -205,10 +206,10 @@ class IMSApi {
return array("username" => $profileDb, "password" => $profileDb);
} else if (!is_null($this->authUsername) && !is_null($this->authPassword)) {
return array("username" => $this->authUsername, "password" => $this->authPassword);
} else if (\User::is_authenticated() && isset($_SESSION["password"])) {
return array("username" => $_SESSION["username"], "password" => $_SESSION["password"]);
} else if (!is_null($this->authUsername)) {
return array("username" => $this->authUsername);
} else if (\User::is_authenticated() && isset($_SESSION["password"])) {
return array("username" => $_SESSION["username"], "password" => $_SESSION["password"]);
}
return null;
@@ -239,7 +240,13 @@ class IMSApi {
$credentials = $this->get_authCredentials();
if (!is_null($credentials)) {
$Rest->authUsername($credentials["username"])->authPassword($credentials["password"]);
if (array_get($credentials, "username")) {
$Rest->authUsername($credentials["username"]);
}
if (array_get($credentials, "password")) {
$Rest->authPassword($credentials["password"]);
}
} else {
return $Ret->set_error("Credenziali di autenticazione al servizio <i>" . $this->serviceName . "</i> non valide");
}

View File

@@ -2126,15 +2126,12 @@ WHERE data_ord = '[dataOrd]'
public static function authorize($data) {
$userName = $data["username"];
$password = $data["password"];
$md5User = "";
$IMSApi = new IMSApi;
$IMSApi->post("loginWeb")
->profileDB("")
->anonymousAuth()
->queryParam("username", $userName)
->queryParam("password", $password)
->queryParam("md5User", $md5User);
->queryParam("password", $password);
$ret = $IMSApi->asText()->send();
@@ -2149,7 +2146,7 @@ WHERE data_ord = '[dataOrd]'
public static function check_editSessionExpired() {
$Ret = new Ret;
if (self::isAdminUser() || PVM::isDebugEnv() || self::sessionValid()) {
if (self::isAdminUser() || self::sessionValid()) {
$Ret->set_boolean(true); // richiesta password non necessaria
} else {
$Ret->set_boolean(false);
@@ -2168,7 +2165,7 @@ WHERE data_ord = '[dataOrd]'
if ($minutiScadenza) {
$now = new DateTime();
$start = $_SESSION["monitoraggioLinee_lastScaricoLoginTimestamp"];
$start = array_get($_SESSION, "monitoraggioLinee_lastScaricoLoginTimestamp");
if ($start) {
$end = clone($start);
@@ -2269,10 +2266,6 @@ WHERE data_ord = '[dataOrd]'
->set("codProd", $dtbOrdt[0]["cod_prod"])
->set("partitaMag", $dtbOrdt[0]["partita_mag"]);
if (array_get($_SESSION, "monitoraggioLinee_loggedUser")) {
$dtbDoct->set("compilatoDa", $_SESSION["monitoraggioLinee_loggedUser"]);;
}
$dtbDocr = new EntityItem("dtb_docr");
$qtaDoc = min(array($row["quantity"], $row["qta_col"]));
@@ -2296,6 +2289,10 @@ WHERE data_ord = '[dataOrd]'
$entityList->push($dtbDoct);
}
if (array_get($_SESSION, "monitoraggioLinee_loggedUser")) {
$entityList->authUsername($_SESSION["monitoraggioLinee_loggedUser"]);
}
$ret = $entityList->send();
}
@@ -2432,10 +2429,6 @@ WHERE data_ord = '[dataOrd]'
->set("serDoc", $primaRiga["ser_doc"])
->set("numDoc", $primaRiga["num_doc"]);
if (array_get($_SESSION, "monitoraggioLinee_loggedUser")) {
$dtbDoct->set("modificatoDa", $_SESSION["monitoraggioLinee_loggedUser"]);;
}
if ($qtaInserita > $qtaIniziale) {
$dtbDocr = new EntityItem("dtb_docr");
$qtaDiff = $qtaInserita - $qtaIniziale;
@@ -2486,6 +2479,10 @@ WHERE data_ord = '[dataOrd]'
}
}
if (array_get($_SESSION, "monitoraggioLinee_loggedUser")) {
$dtbDoct->authUsername($_SESSION["monitoraggioLinee_loggedUser"]);
}
$ret = $dtbDoct->send();
}
@@ -2567,13 +2564,7 @@ WHERE data_ord = '[dataOrd]'
if (count($righe) === count($righeScarico)) {
$dtbDoct->delete();
} else {
$dtbDoct
->update();
if (array_get($_SESSION, "monitoraggioLinee_loggedUser")) {
$dtbDoct->set("modificatoDa", $_SESSION["monitoraggioLinee_loggedUser"]);;
}
$dtbDoct->update();
}
$primaRiga = $righeScarico[0];
@@ -2594,6 +2585,10 @@ WHERE data_ord = '[dataOrd]'
$dtbDoct->set("dtbDocr")->append($dtbDocr);
}
if (array_get($_SESSION, "monitoraggioLinee_loggedUser")) {
$dtbDoct->authUsername($_SESSION["monitoraggioLinee_loggedUser"]);
}
$ret = $dtbDoct->send();
}

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,4 @@
<input class="form-control" placeholder="Password" id="password" type="password"
aria-describedby="password-addon"/>
</div>
<button class="btn btn-md btn-primary btn-block my-20" type="submit">
<i class="fa fa-sign-in"></i> Login
</button>
</form>

View File

@@ -13,13 +13,21 @@
</td>
<td class="td_qtaGiacenza text-center">
<span class="qtaGiacenza" data-qta="<%= qtaGiacenza %>">
<%=
Number(qtaGiacenza).toLocaleString("en", {
<!-- Se il numero è positivo oppure uno zero negativo (dovuto ad arrotondamenti) lo mostro positivo-->
<%
qta = Number(qtaGiacenza).toLocaleString("en", {
maximumFractionDigits: 2,
minimumFractionDigits: 0,
roundingMode: "ceil"
}).replaceAll(",", "'")
%>
<% if (qtaGiacenza > -0.01) { %>
<%= Math.abs(qta) %>
<% } else { %>
<%= qta %>
<% } %>
<%= untMis %>
</span>
</td>

View File

@@ -574,78 +574,80 @@ if (!is_null($ordineLav["note"])) {
?>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h4>Report</h4>
<div class="row">
<div class="col-xs-12">
<h4>Report</h4>
<table class="table table-striped table-hover">
<thead>
<tr>
<th colspan="2">Nome</th>
<th></th>
</tr>
</thead>
<tbody>
<?php if (count($reports) > 0) { ?>
<?php foreach ($reports as $report) { ?>
<tr>
<td style="width: 30px;"><i class="fa fa-file"></i></td>
<td><?= $report["title"] ?></td>
<td class="text-center">
<button type="button" class="btn btn-sm btn-default <?= $report["class"] ?>">
<i class="fa fa-file-pdf text-danger"></i> <span
class="text-muted">Visualizza</span>
</button>
</td>
<table class="table table-striped table-hover">
<thead>
<tr>
<th colspan="2">Nome</th>
<th></th>
</tr>
</thead>
<tbody>
<?php if (count($reports) > 0) { ?>
<?php foreach ($reports as $report) { ?>
<tr>
<td style="width: 30px;"><i class="fa fa-file"></i></td>
<td><?= $report["title"] ?></td>
<td class="text-center">
<button type="button" class="btn btn-sm btn-default <?= $report["class"] ?>">
<i class="fa fa-file-pdf text-danger"></i> <span
class="text-muted">Visualizza</span>
</button>
</td>
</tr>
<?php } ?>
<?php } else { ?>
<tr class="text-center">
<td colspan="3">Nessun report</td>
</tr>
<?php } ?>
<?php } else { ?>
<tr class="text-center">
<td colspan="3">Nessun report</td>
</tr>
<?php } ?>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
<div id="popup_tab-db" class="tab-pane pt-20">
<table class="table table-striped table-hover table-text-middle"
data-order_key="<?= Utility::B64JSON_stringify($data["key"]) ?>">
<thead>
<tr>
<th>Cod. Mat. Prima</th>
<th>Descrizione</th>
<th>Qta x <?= $ordineLav["qta_standard"] . " " . $ordineLav["unt_mis_standard"] ?></th>
<th>Note</th>
</tr>
</thead>
<tbody>
<?php foreach ($arr_dist_materiali as $materiale) { ?>
<tr>
<td style="text-align: center">
<?= $materiale["cod_mart"] ?>
</td>
<td>
<?= $materiale["descrizione_estesa"] ?>
</td>
<td style="text-align: center">
<?= $materiale["qta_std"] ?> <?= $materiale["unt_mis_dist"] ?>
</td>
<td>
<?= $materiale["note"] ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<hr>
<div>
<h4 style="font-weight: bold; padding-bottom: 4px">Dati Tecnici:</h4>
<h5><?= $ordineLav["dati_tecnici"] ?></h5>
</div>
</div>
</div>
<div id="popup_tab-db" class="tab-pane pt-20">
<table class="table table-striped table-hover table-text-middle"
data-order_key="<?= Utility::B64JSON_stringify($data["key"]) ?>">
<thead>
<tr>
<th>Cod. Mat. Prima</th>
<th>Descrizione</th>
<th>Qta x <?= $ordineLav["qta_standard"] . " " . $ordineLav["unt_mis_standard"] ?></th>
<th>Note</th>
</tr>
</thead>
<tbody>
<?php foreach ($arr_dist_materiali as $materiale) { ?>
<tr>
<td style="text-align: center">
<?= $materiale["cod_mart"] ?>
</td>
<td>
<?= $materiale["descrizione_estesa"] ?>
</td>
<td style="text-align: center">
<?= $materiale["qta_std"] ?> <?= $materiale["unt_mis_dist"] ?>
</td>
<td>
<?= $materiale["note"] ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<hr>
<div>
<h4 style="font-weight: bold; padding-bottom: 4px">Dati Tecnici:</h4>
<h5><?= $ordineLav["dati_tecnici"] ?></h5>
</div>
</div>
<?php
$html = Utility\Str::remove_multiple_spaces(@ob_get_clean());
$Ret->set_string($html)->set_data($retData);

View File

@@ -1604,30 +1604,33 @@ let _ordini = {
$row.find(".btnEliminaScarico").on("click", function () {
const $btn = $(this);
const ajax = new Ajax();
const orderKey = _ordini.orderKey;
ajax.post("eliminaScarico")
.data({
order_key: orderKey,
riga: row,
})
.confirmModal({
style: "danger",
title: "Elimina Scarico",
message: "Sei sicuro di voler eliminare lo scarico?"
})
.$toDisable($row)
.$button($btn)
.noticeAsToast()
.onSuccess({
toast: "Quantità scarico modificata con successo",
callback: function (ret) {
const scarichiArticolo = ret.returnData.scarichiArticolo;
self.loadScarichiArticolo(scarichiArticolo);
}
})
.execute();
self.start_adminSession(function () {
const ajax = new Ajax();
const orderKey = _ordini.orderKey;
ajax.post("eliminaScarico")
.data({
order_key: orderKey,
riga: row,
})
.confirmModal({
style: "danger",
title: "Elimina Scarico",
message: "Sei sicuro di voler eliminare lo scarico?"
})
.$toDisable($row)
.$button($btn)
.noticeAsToast()
.onSuccess({
toast: "Quantità scarico modificata con successo",
callback: function (ret) {
const scarichiArticolo = ret.returnData.scarichiArticolo;
self.loadScarichiArticolo(scarichiArticolo);
}
})
.execute();
});
});
self.tableScarichi.find("tbody").append($row);
@@ -1817,9 +1820,11 @@ let _ordini = {
return d;
},
start_adminSession: function (callbackSuccess) {
new Ajax()
.get("check_editSessionExpired")
const ajax = new Ajax();
ajax.get("check_editSessionExpired")
.waitModal()
.noticeAsToast()
.onSuccess(function (ret) {
if (ret.returnBoolean) {
callbackSuccess();
@@ -1836,56 +1841,61 @@ let _ordini = {
const html = _monitoraggioLinee.module.get_template("loginForm");
const modalBoxAccess = new ModalBox();
modalBoxAccess.onBeforeShow(function ($div) {
$("#form-signin").on("submit", function (e) {
e.preventDefault();
const $form = $(this);
const $username = $("#username");
const $password = $("#password");
if ($username.valueIsEmpty()) {
$username.set_fieldError().select();
}
if ($password.valueIsEmpty()) {
$password.set_fieldError();
if (!$username.valueIsEmpty()) {
$password.select();
}
}
if (!$username.valueIsEmpty() && !$password.valueIsEmpty()) {
const $result = $("#login_result");
$result.addClass("hidden");
const $btSubmit = $form.find("button[type='submit']");
$btSubmit.bs_element_setStyle("primary");
$password.attr("type", "password");
$form.find("input").blur();
_ordini.send_loginRequest().then(function (ret) {
if (ret.returnId === 1) {
modalBoxAccess.close();
callbackSuccess();
} else if (ret.returnId === -1) {
const modalBox = new ModalBox();
$btSubmit.bs_element_setStyle("danger");
$result.bs_element_setStyle("danger").html(ret.errorText).removeClass("hidden");
modalBox.danger(ret.errorText);
}
});
}
});
})
modalBoxAccess
.onShow(function ($div) {
$div.find("input[type='password']").focus();
$div.find("#username").focus();
})
.confirmOnEnter()
.content(html)
.title("Accesso personale autorizzato")
.noBtn().sm().primary().show();
.okOnly()
.btOK({
text: "Login",
style: "primary",
icon: "sign-in",
onClick: function (e, $bt, $div) {
e.preventDefault();
const $form = $(this);
const $username = $("#username");
const $password = $("#password");
if ($username.valueIsEmpty()) {
$username.set_fieldError().select();
}
if ($password.valueIsEmpty()) {
$password.set_fieldError();
if (!$username.valueIsEmpty()) {
$password.select();
}
}
if (!$username.valueIsEmpty() && !$password.valueIsEmpty()) {
const $result = $("#login_result");
$result.addClass("hidden");
const $btSubmit = $form.find("button[type='submit']");
$btSubmit.bs_element_setStyle("primary");
$password.attr("type", "password");
$form.find("input").blur();
_ordini.send_loginRequest().then(function (ret) {
if (ret.returnId === 1) {
modalBoxAccess.close();
callbackSuccess();
} else if (ret.returnId === -1) {
const modalBox = new ModalBox();
$btSubmit.bs_element_setStyle("danger");
$result.bs_element_setStyle("danger").html(ret.errorText).removeClass("hidden");
modalBox.danger(ret.errorText);
}
});
}
}
}).sm().primary().show();
};
},