1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-18 04:20:50 +01:00

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

View File

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

View File

@ -272,15 +272,12 @@ $(document).ready(function () {
if (hash && hash != '#tab_0') { if (hash && hash != '#tab_0') {
$('ul.nav-tabs a[href="' + hash + '"]').tab('show').trigger('shown.bs.tab'); $('ul.nav-tabs a[href="' + hash + '"]').tab('show').trigger('shown.bs.tab');
} else { } else {
location.hash = ''; removeHash();
} }
$(window).bind("hashchange", function(){ $(window).bind('beforeunload', function(){
var hash = location.hash; if (location.hash == '#tab_0') {
console.log(hash); removeHash();
if (!hash || hash == '#tab_0') {
location.hash = '';
} }
}); });
@ -1784,3 +1781,7 @@ function submitAjax(form, data = {}, callback = null, errorCallback = null) {
return valid; return valid;
} }
function removeHash() {
history.replaceState(null, null, ' ');
}

View File

@ -283,6 +283,7 @@ function redirectOperation($id_module, $id_record)
if (!empty($backto)) { if (!empty($backto)) {
$hash = filter('hash'); $hash = filter('hash');
$hash = !starts_with($hash, '#') ? '#'.$hash : $hash; $hash = !starts_with($hash, '#') ? '#'.$hash : $hash;
$hash = $hash == '#tab_0' ? '' : $hash;
if ($backto == 'record-edit') { if ($backto == 'record-edit') {
redirect(ROOTDIR.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.$hash); 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> <fieldset>
<input type="hidden" name="backto" value="record-edit"> <input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update"> <input type="hidden" name="op" value="update">

View File

@ -33,7 +33,7 @@ $id_scadenze = $id_scadenze ? explode(',', $id_scadenze) : [];
// Scadenze // Scadenze
foreach ($id_scadenze as $id_scadenza) { 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)); $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']; $id_documenti[] = $scadenza['iddocumento'];
continue; continue;
} }

View File

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

View File

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