This commit is contained in:
Luca 2022-06-10 16:11:40 +02:00
commit a9e882f485
5 changed files with 57 additions and 13 deletions

View File

@ -400,8 +400,10 @@ if (Auth::check()) {
<li class="nav-button" > <li class="nav-button" >
<p style="padding:10px 15px;">&nbsp;</p> <p style="padding:10px 15px;">&nbsp;</p>
</li> </li>';
if ($user->gruppo == 'Amministratori') {
echo '
<li class="dropdown notifications-menu nav-button"> <li class="dropdown notifications-menu nav-button">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i> <i class="fa fa-bell-o"></i>
@ -426,8 +428,10 @@ if (Auth::check()) {
<li class="nav-button"><a href="'.base_path().'/log.php" class="tip nav-button" title="'.tr('Log accessi').'"> <li class="nav-button"><a href="'.base_path().'/log.php" class="tip nav-button" title="'.tr('Log accessi').'">
<i class="fa fa-book"></i> <i class="fa fa-book"></i>
</a></li> </a></li>';
}
echo '
<li class="nav-button"><a href="'.base_path().'/info.php" class="tip nav-button" title="'.tr('Informazioni').'"> <li class="nav-button"><a href="'.base_path().'/info.php" class="tip nav-button" title="'.tr('Informazioni').'">
<i class="fa fa-info"></i> <i class="fa fa-info"></i>
</a></li> </a></li>

View File

@ -119,4 +119,22 @@ switch (post('op')) {
$dbo->query("DELETE FROM co_scadenziario WHERE id='".$id_record."'"); $dbo->query("DELETE FROM co_scadenziario WHERE id='".$id_record."'");
flash()->info(tr('Scadenza eliminata!')); flash()->info(tr('Scadenza eliminata!'));
break; break;
case 'allega_fattura':
$id_documento = post('iddocumento');
$print_predefined = $dbo->selectOne('zz_prints', '*', ['predefined' => 1, 'id_module' => Modules::get('Fatture di vendita')['id']]);
$print = Prints::render($print_predefined['id'], $id_documento, null, true);
$name = 'Fattura di vendita';
$upload = Uploads::upload($print['pdf'], [
'name' => $name,
'original_name' => $name.'.pdf',
'category' => 'Generale',
'id_module' => $id_module,
'id_record' => $id_record,
]);
flash()->info(tr('Stampa allegata correttamente!'));
break;
} }

View File

@ -0,0 +1,29 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
if (!empty($record['iddocumento'])) {
$fattura_allegata = $dbo->selectOne('zz_files', 'id', ['id_module' => $id_module, 'id_record' => $id_record, 'original' => 'Fattura di vendita.pdf'])['id'];
echo '
<button type="button" class="btn btn-warning ask btn-warning '.(empty($fattura_allegata
) ? '' : 'disabled').'" id="allega-fattura" data-msg="'.tr('Allegare la stampa della fattura?').'" data-op="allega_fattura" data-iddocumento="'.$record['iddocumento'].'" data-button="'.tr('Allega').'" data-class="btn btn-lg btn-warning" data-backto="record-edit" >
<i class="fa fa-paperclip"></i> '.tr('Allega fattura').'
</button>';
}

View File

@ -214,16 +214,7 @@ if ($totale_da_pagare != 0) {
</div> </div>
</form> </form>
<?php {( "name": "filelist_and_upload", "id_module": "$id_module$", "id_record": "<?php echo $id_record; ?>" )}
$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$" )}
@ -284,7 +275,8 @@ if (!empty($documento)) {
if ($dir == 'uscita') { if ($dir == 'uscita') {
echo ' echo '
$("#email-button").remove();'; $("#email-button").remove();
$("#allega-fattura").remove();';
} }
echo ' echo '
}); });

View File

@ -27,6 +27,7 @@ if (isset($id_record)) {
// Scelgo la query in base alla scadenza // Scelgo la query in base alla scadenza
if (!empty($documento)) { if (!empty($documento)) {
$id_record = $dbo->fetchOne('SELECT id FROM co_scadenziario WHERE iddocumento='.prepare($documento->id).' ORDER BY id')['id'];
$scadenze = $dbo->fetchArray('SELECT * FROM co_scadenziario WHERE iddocumento = '.prepare($documento->id).' ORDER BY scadenza ASC'); $scadenze = $dbo->fetchArray('SELECT * FROM co_scadenziario WHERE iddocumento = '.prepare($documento->id).' ORDER BY scadenza ASC');
$totale_da_pagare = $documento->netto; $totale_da_pagare = $documento->netto;
} else { } else {