Fix per visualizzazione scadenze multiple in periodi diversi e pagate parzialmente

This commit is contained in:
loviuz 2021-01-07 12:21:17 +01:00
parent 8f74291a8a
commit 6a786640f9
2 changed files with 10 additions and 5 deletions

View File

@ -190,7 +190,16 @@ if ($totale_da_pagare != 0) {
</div> </div>
</form> </form>
{( "name": "filelist_and_upload", "id_module": "$id_module$", "id_record": "$id_record$" )} <?php
$id_scadenza = $id_record;
// Forzatura per allegare file sempre al primo record
if (!empty($documento)) {
$id_scadenza = $dbo->fetchOne('SELECT id FROM co_scadenziario WHERE iddocumento='.prepare($documento->id).' ORDER BY id')['id'];
}
?>
{( "name": "filelist_and_upload", "id_module": "$id_module$", "id_record": "<?php echo $id_scadenza; ?>" )}
{( "name": "log_email", "id_module": "$id_module$", "id_record": "$id_record$" )} {( "name": "log_email", "id_module": "$id_module$", "id_record": "$id_record$" )}

View File

@ -33,8 +33,4 @@ if (isset($id_record)) {
$scadenze = $dbo->fetchArray('SELECT * FROM co_scadenziario WHERE id = '.prepare($id_record).' ORDER BY scadenza ASC'); $scadenze = $dbo->fetchArray('SELECT * FROM co_scadenziario WHERE id = '.prepare($id_record).' ORDER BY scadenza ASC');
$totale_da_pagare = sum(array_column($scadenze, 'da_pagare')); $totale_da_pagare = sum(array_column($scadenze, 'da_pagare'));
} }
if ($scadenze[0]['id'] != $id_record) {
redirect(base_path().'/editor.php?id_module='.$id_module.'&id_record='.$scadenze[0]['id']);
}
} }