Bugfix minori

This commit is contained in:
Thomas Zilio 2019-07-25 15:48:28 +02:00
parent 854c3255dc
commit d6149265bf
8 changed files with 39 additions and 14 deletions

View File

@ -325,6 +325,7 @@ echo '
function ricalcola_totale() {
totale = 0.00;
totale_qta = 0;
$('input[id*=qta_]').each(function() {
qta = $(this).val().toEnglish();
@ -347,6 +348,8 @@ echo '
if(subtot) {
totale += subtot * qta + iva * qta;
}
totale_qta += qta;
});
$('#totale').html((totale.toLocale()) + " " + globals.currency);
@ -355,7 +358,7 @@ echo '
if (empty($options['allow-empty'])) {
echo '
if (tot_qta > 0)
if (totale_qta > 0)
$("#submit_btn").show();
else
$("#submit_btn").hide();';

View File

@ -95,10 +95,17 @@ abstract class Description extends Model
throw new \InvalidArgumentException();
}
if ($this->hasOriginal()) {
$original = $this->getOriginal();
}
$this->qta = 0;
$result = parent::delete();
$this->parent->fixStato($this);
// Fix stato automatico
if ($this->hasOriginal()) {
$original->parent->fixStato($this);
}
return $result;
}
@ -214,7 +221,12 @@ abstract class Description extends Model
{
$result = parent::save($options);
$this->parent->fixStato($this);
// Fix stato automatico
if ($this->hasOriginal()) {
$original = $this->getOriginal();
$original->parent->fixStato($this);
}
return $result;
}

View File

@ -272,18 +272,15 @@ $(document).ready(function () {
if (hash && hash != '#tab_0') {
$('ul.nav-tabs a[href="' + hash + '"]').tab('show').trigger('shown.bs.tab');
} else {
location.hash = '';
removeHash();
}
$(window).bind("hashchange", function(){
var hash = location.hash;
console.log(hash);
if (!hash || hash == '#tab_0') {
location.hash = '';
$(window).bind('beforeunload', function(){
if (location.hash == '#tab_0') {
removeHash();
}
});
// Nel caso la navigazione sia da mobile, disabilito il ritorno al punto precedente
if (!isMobile.any()) {
// Salvo lo scroll per riportare qui l'utente al reload
@ -1784,3 +1781,7 @@ function submitAjax(form, data = {}, callback = null, errorCallback = null) {
return valid;
}
function removeHash() {
history.replaceState(null, null, ' ');
}

View File

@ -283,6 +283,7 @@ function redirectOperation($id_module, $id_record)
if (!empty($backto)) {
$hash = filter('hash');
$hash = !starts_with($hash, '#') ? '#'.$hash : $hash;
$hash = $hash == '#tab_0' ? '' : $hash;
if ($backto == 'record-edit') {
redirect(ROOTDIR.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.$hash);

View File

@ -26,7 +26,7 @@ if (!$is_cliente) {
?>
<form action="" method="post" id="edit-form" autocomplete="<?php echo setting('Autocomple web form')?>" >
<form action="" method="post" id="edit-form" autocomplete="<?php echo setting('Autocomple web form'); ?>" >
<fieldset>
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">

View File

@ -33,7 +33,7 @@ $id_scadenze = $id_scadenze ? explode(',', $id_scadenze) : [];
// Scadenze
foreach ($id_scadenze as $id_scadenza) {
$scadenza = $dbo->fetchOne('SELECT descrizione, scadenza, iddocumento, SUM(da_pagare - pagato) AS rata FROM co_scadenziario WHERE id='.prepare($id_scadenza));
if (!empty($scadenza['iddocumento'])){
if (!empty($scadenza['iddocumento'])) {
$id_documenti[] = $scadenza['iddocumento'];
continue;
}

View File

@ -103,6 +103,14 @@ class Upload extends Model
return $this->directory.'/'.$this->filename;
}
/**
* @return string
*/
public function getFileurlAttribute()
{
return str_replace('\\', '/', $this->filepath);
}
/**
* @return string
*/

View File

@ -37,7 +37,7 @@ trait PathTrait
*/
public function fileurl($file)
{
$filepath = App::filepath($this->path.'|custom|', $file);
$filepath = $this->filepath($file);
$result = str_replace(DOCROOT, ROOTDIR, $filepath);
$result = str_replace('\\', '/', $result);