diff --git a/include/common/importa.php b/include/common/importa.php index 042e02a7c..147e418fb 100644 --- a/include/common/importa.php +++ b/include/common/importa.php @@ -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();'; diff --git a/include/src/Components/Description.php b/include/src/Components/Description.php index 911aa5694..4c59af775 100644 --- a/include/src/Components/Description.php +++ b/include/src/Components/Description.php @@ -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; } diff --git a/lib/functions.js b/lib/functions.js index 039026ce5..f2c2dfbf4 100644 --- a/lib/functions.js +++ b/lib/functions.js @@ -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, ' '); +} diff --git a/lib/functions.php b/lib/functions.php index a2a493c13..7b821c40f 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -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); diff --git a/modules/anagrafiche/edit.php b/modules/anagrafiche/edit.php index 4934f2600..ac0087c17 100644 --- a/modules/anagrafiche/edit.php +++ b/modules/anagrafiche/edit.php @@ -26,7 +26,7 @@ if (!$is_cliente) { ?> -
+
diff --git a/modules/primanota/add.php b/modules/primanota/add.php index ac38dfa35..d737719c7 100644 --- a/modules/primanota/add.php +++ b/modules/primanota/add.php @@ -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; } diff --git a/src/Models/Upload.php b/src/Models/Upload.php index 4e33c2b55..e564ee4f7 100644 --- a/src/Models/Upload.php +++ b/src/Models/Upload.php @@ -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 */ diff --git a/src/Traits/PathTrait.php b/src/Traits/PathTrait.php index bf01244f7..dcb81ed45 100644 --- a/src/Traits/PathTrait.php +++ b/src/Traits/PathTrait.php @@ -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);