2020-07-06 13:19:20 +02:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-09-07 15:04:06 +02:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
2020-07-06 13:19:20 +02:00
|
|
|
|
2020-07-06 14:16:16 +02:00
|
|
|
include_once __DIR__.'/../../core.php';
|
2020-07-06 13:19:20 +02:00
|
|
|
|
|
|
|
// Informazioni generali sulla riga
|
|
|
|
$source_type = $source_type ?: filter('source_type');
|
|
|
|
$source_id = $source_id ?: filter('source_id');
|
2020-07-06 14:16:16 +02:00
|
|
|
if (empty($source_type) || empty($source_id)) {
|
2020-07-06 13:19:20 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$source = $source_type::find($source_id);
|
|
|
|
|
|
|
|
$riferimenti = $source->referenceTargets;
|
|
|
|
$elenco_riferimenti = [];
|
|
|
|
if (!$riferimenti->isEmpty()) {
|
|
|
|
echo '
|
|
|
|
<table class="table table-bordered table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('Riferimento').'</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>';
|
|
|
|
|
|
|
|
foreach ($riferimenti as $riferimento) {
|
|
|
|
$riga = $riferimento->target;
|
2024-05-23 11:36:25 +02:00
|
|
|
$riga_class = $source::class;
|
2020-07-06 13:19:20 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
<tr data-id="'.$riga->id.'" data-type="'.$riga_class.'">
|
|
|
|
<td>
|
2024-05-23 11:36:25 +02:00
|
|
|
<button type="button" class="btn btn-xs btn-danger pull-right" onclick="rimuoviRiferimento(this, \''.addslashes((string) $source_type).'\', \''.$source_id.'\', \''.$riferimento->id.'\')">
|
2020-07-06 13:19:20 +02:00
|
|
|
<i class="fa fa-trash"></i>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
'.$riferimento->target->descrizione.'
|
|
|
|
|
|
|
|
<br>
|
2020-09-22 20:28:37 +02:00
|
|
|
<small>'.reference($riferimento->target->getDocument()).'</small>
|
2020-07-06 13:19:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
|
|
|
|
// Aggiunta all'elenco dei riferimenti
|
|
|
|
$elenco_riferimenti[] = addslashes($riga_class).'|'.$riga->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>';
|
|
|
|
} else {
|
|
|
|
echo '
|
|
|
|
<div class="alert alert-info">
|
2020-08-03 15:29:19 +02:00
|
|
|
<i class="fa fa-info-circle"></i> '.tr('Nessun riferimento presente').'.
|
2020-07-06 13:19:20 +02:00
|
|
|
</div>';
|
|
|
|
}
|