mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-01 08:26:53 +01:00
Formattazione codice
This commit is contained in:
parent
d92f1b980e
commit
652917b137
@ -460,10 +460,10 @@ class CSV extends CSVImporter
|
||||
protected function aggiornaDettaglioPrezzi(Articolo $articolo, $dettagli)
|
||||
{
|
||||
// Listini
|
||||
if ($dettagli['partita_iva']){
|
||||
if ($dettagli['partita_iva']) {
|
||||
$anagrafica = Anagrafica::where('piva', $dettagli['partita_iva'])->first();
|
||||
}
|
||||
|
||||
|
||||
if (empty($anagrafica)) {
|
||||
$anagrafica = Anagrafica::build($dettagli['anagrafica_listino']);
|
||||
$anagrafica->piva = $dettagli['partita_iva'];
|
||||
|
@ -110,7 +110,7 @@ if (!empty($elementi)) {
|
||||
|
||||
foreach ($elementi as $elemento) {
|
||||
$descrizione = tr('Impianto _MATRICOLA_', [
|
||||
'_MATRICOLA_' => $elemento['matricola']
|
||||
'_MATRICOLA_' => $elemento['matricola'],
|
||||
]);
|
||||
$modulo = 'Impianti';
|
||||
$id = $elemento['id'];
|
||||
|
@ -38,7 +38,7 @@ if (filter('op') == 'link_impianti') {
|
||||
'id_module' => $id_module,
|
||||
'id_record' => $id_record,
|
||||
'id_module_from' => $modulo_impianti['id'],
|
||||
'id_record_from' => $matricola
|
||||
'id_record_from' => $matricola,
|
||||
]);
|
||||
|
||||
$components = $dbo->fetchArray('SELECT * FROM my_componenti WHERE id_impianto = '.prepare($matricola));
|
||||
@ -54,7 +54,7 @@ if (filter('op') == 'link_impianti') {
|
||||
if (!in_array($matricola, $matricole_old)) {
|
||||
$dbo->query('INSERT INTO my_impianti_interventi(idimpianto, idintervento) VALUES('.prepare($matricola).', '.prepare($id_record).')');
|
||||
|
||||
$checks_impianti = $dbo->fetchArray('SELECT * FROM zz_checks WHERE id_module = '.prepare( $modulo_impianti['id']).' AND id_record = '.prepare($matricola));
|
||||
$checks_impianti = $dbo->fetchArray('SELECT * FROM zz_checks WHERE id_module = '.prepare($modulo_impianti['id']).' AND id_record = '.prepare($matricola));
|
||||
foreach ($checks_impianti as $check_impianto) {
|
||||
$id_parent_new = null;
|
||||
if ($check_impianto['id_parent']) {
|
||||
@ -141,22 +141,22 @@ if (!empty($impianti)) {
|
||||
<th class="text-center" width="5%">Checklist</th>
|
||||
</tr>';
|
||||
|
||||
$impianti_collegati = $dbo->fetchArray('SELECT * FROM my_impianti_interventi INNER JOIN my_impianti ON my_impianti_interventi.idimpianto = my_impianti.id WHERE idintervento = '.prepare($id_record));
|
||||
foreach ($impianti_collegati as $impianto) {
|
||||
$checks = Check::where('id_module_from', $modulo_impianti['id'])->where('id_record_from', $impianto['id'])->where('id_module', $id_module)->where('id_record', $id_record)->where('id_parent', null)->get();
|
||||
$impianti_collegati = $dbo->fetchArray('SELECT * FROM my_impianti_interventi INNER JOIN my_impianti ON my_impianti_interventi.idimpianto = my_impianti.id WHERE idintervento = '.prepare($id_record));
|
||||
foreach ($impianti_collegati as $impianto) {
|
||||
$checks = Check::where('id_module_from', $modulo_impianti['id'])->where('id_record_from', $impianto['id'])->where('id_module', $id_module)->where('id_record', $id_record)->where('id_parent', null)->get();
|
||||
|
||||
$type = 'muted';
|
||||
$class = 'disabled';
|
||||
$icon = 'circle-o';
|
||||
$icon2 = 'remove';
|
||||
if (sizeof($checks)) {
|
||||
$class = '';
|
||||
$icon = 'plus';
|
||||
$checks_not_verified = $checks->where('checked_at', null)->count();
|
||||
$type = $checks_not_verified ? 'warning' : 'success';
|
||||
$icon2 = $checks_not_verified ? 'clock-o' : 'check';
|
||||
}
|
||||
echo '
|
||||
$type = 'muted';
|
||||
$class = 'disabled';
|
||||
$icon = 'circle-o';
|
||||
$icon2 = 'remove';
|
||||
if (sizeof($checks)) {
|
||||
$class = '';
|
||||
$icon = 'plus';
|
||||
$checks_not_verified = $checks->where('checked_at', null)->count();
|
||||
$type = $checks_not_verified ? 'warning' : 'success';
|
||||
$icon2 = $checks_not_verified ? 'clock-o' : 'check';
|
||||
}
|
||||
echo '
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<button type="button" class="btn btn-xs btn-default '.$class.'" onclick="toggleDettagli(this)">
|
||||
@ -173,10 +173,10 @@ if (!empty($impianti)) {
|
||||
<input type="hidden" name="backto" value="record-edit">
|
||||
<input type="hidden" name="id_impianto" value="'.$impianto['id'].'">';
|
||||
|
||||
$inseriti = $dbo->fetchArray('SELECT * FROM my_componenti_interventi WHERE id_intervento = '.prepare($id_record));
|
||||
$ids = array_column($inseriti, 'id_componente');
|
||||
$inseriti = $dbo->fetchArray('SELECT * FROM my_componenti_interventi WHERE id_intervento = '.prepare($id_record));
|
||||
$ids = array_column($inseriti, 'id_componente');
|
||||
|
||||
echo '
|
||||
echo '
|
||||
{[ "type": "select", "multiple": 1, "name": "componenti[]", "id": "componenti_'.$impianto['id'].'", "ajax-source": "componenti", "select-options": {"matricola": '.$impianto['id'].'}, "value": "'.implode(',', $ids).'", "readonly": "'.!empty($readonly).'", "disabled": "'.!empty($disabled).'", "icon-after": "<button type=\"submit\" class=\"btn btn-success\" '.$disabled.'> <i class=\"fa fa-check\"></i> '.tr('Salva').'</button>" ]}
|
||||
</form>
|
||||
</td>
|
||||
@ -187,16 +187,16 @@ if (!empty($impianti)) {
|
||||
<td colspan="7">
|
||||
<table class="table">
|
||||
<tbody class="sort check-impianto" data-sonof="0">';
|
||||
foreach ($checks as $check) {
|
||||
echo renderChecklist($check);
|
||||
}
|
||||
echo '
|
||||
foreach ($checks as $check) {
|
||||
echo renderChecklist($check);
|
||||
}
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
</div>
|
||||
</div>';
|
||||
|
@ -17,14 +17,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Modules\Impianti;
|
||||
|
||||
use Common\SimpleModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Traits\HierarchyTrait;
|
||||
|
||||
|
||||
class Categoria extends Model
|
||||
{
|
||||
use SimpleModelTrait;
|
||||
|
@ -22,7 +22,6 @@ namespace Modules\Impianti;
|
||||
use Common\SimpleModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Modules\Impianti\Categoria;
|
||||
|
||||
class Impianto extends Model
|
||||
{
|
||||
@ -35,6 +34,7 @@ class Impianto extends Model
|
||||
{
|
||||
return $this->belongsTo(Anagrafica::class, 'idanagrafica');
|
||||
}
|
||||
|
||||
public static function build($matricola, $nome, Categoria $categoria, $anagrafica)
|
||||
{
|
||||
$model = new static();
|
||||
@ -53,5 +53,4 @@ class Impianto extends Model
|
||||
{
|
||||
return $this->belongsTo(Categoria::class, 'id_categoria');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ use Modules;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Modules\Anagrafiche\Sede;
|
||||
use Modules\Anagrafiche\Tipo;
|
||||
use Modules\Impianti\Impianto;
|
||||
use Modules\Impianti\Categoria;
|
||||
use Modules\Impianti\Impianto;
|
||||
use Uploads;
|
||||
|
||||
/**
|
||||
@ -103,7 +103,7 @@ class CSV extends CSVImporter
|
||||
if (!empty($anagrafica)) {
|
||||
$url = $record['immagine'];
|
||||
unset($record['immagine']);
|
||||
|
||||
|
||||
// Gestione categoria e sottocategoria
|
||||
$categoria = null;
|
||||
$sottocategoria = null;
|
||||
@ -130,7 +130,7 @@ class CSV extends CSVImporter
|
||||
$sottocategoria->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Individuazione impianto e generazione
|
||||
$impianto = null;
|
||||
|
||||
@ -140,13 +140,13 @@ class CSV extends CSVImporter
|
||||
}
|
||||
if (empty($impianto)) {
|
||||
$impianto = Impianto::build($record['matricola'], $record['nome'], $categoria, $record['cliente']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!empty($record['data'])) {
|
||||
$impianto->data = $record['data'];
|
||||
$impianto->save();
|
||||
}
|
||||
|
||||
|
||||
$impianto->id_sottocategoria = $sottocategoria['id'];
|
||||
$impianto->save();
|
||||
|
||||
@ -166,31 +166,29 @@ class CSV extends CSVImporter
|
||||
->where('idanagrafica', $anagrafica->idanagrafica)
|
||||
->first();
|
||||
$impianto->idsede = $sede->id;
|
||||
$impianto->save();
|
||||
|
||||
$impianto->save();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Gestione immagine
|
||||
if (!empty($url) && !empty($record['import_immagine'])) {
|
||||
$file_content = file_get_contents($url);
|
||||
|
||||
|
||||
if (!empty($file_content)) {
|
||||
if ($record['import_immagine'] == 2 || $record['import_immagine'] == 4) {
|
||||
Uploads::deleteLinked([
|
||||
'id_module' => Modules::get('Impianti')['id'],
|
||||
'id_record' => $impianto->id,
|
||||
]);
|
||||
|
||||
|
||||
$database->update('mg_articoli', [
|
||||
'immagine' => '',
|
||||
], [
|
||||
'id' => $impianto->id,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$name = 'immagine_'.$impianto->id.'.'.Upload::getExtensionFromMimeType($file_content);
|
||||
|
||||
|
||||
$upload = Uploads::upload($file_content, [
|
||||
'name' => 'Immagine',
|
||||
'category' => 'Immagini',
|
||||
@ -201,7 +199,7 @@ class CSV extends CSVImporter
|
||||
'thumbnails' => true,
|
||||
]);
|
||||
$filename = $upload->filename;
|
||||
|
||||
|
||||
if ($record['import_immagine'] == 1 || $record['import_immagine'] == 2) {
|
||||
if (!empty($filename)) {
|
||||
$database->update('mg_articoli', [
|
||||
@ -213,19 +211,18 @@ class CSV extends CSVImporter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unset($record['import_immagine']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function getExample()
|
||||
{
|
||||
return [
|
||||
['Matricola', 'Nome', 'Categoria', 'Immagine', 'Data installazione', 'Cliente', 'Telefono', 'Sede'],
|
||||
['00001', 'Marca', 'Lavatrice','https://immagini.com/immagine.jpg', '01/10/2023', 'Mario Rossi', '04444444', 'Sede2'],
|
||||
['00001', 'Marca', 'Lavatrice', 'https://immagini.com/immagine.jpg', '01/10/2023', 'Mario Rossi', '04444444', 'Sede2'],
|
||||
['00002', 'Marca2', 'Lavastoviglie', 'https://immagini.com/immagine2.jpg', '12/09/2023', 'Mario Rossi', '04444444', 'Sede2'],
|
||||
['00003', 'Marca3', 'Frigorifero','https://immagini.com/immagine3.jpg', '20/09/2023', 'Mario Rossi', '04444444', 'Sede2'],
|
||||
['00003', 'Marca3', 'Frigorifero', 'https://immagini.com/immagine3.jpg', '20/09/2023', 'Mario Rossi', '04444444', 'Sede2'],
|
||||
['00004', 'Marca4', 'Caldaia', 'https://immagini.com/immagine4.jpg', '06/11/2023', 'Mario Rossi', '04444444', 'Sede2'],
|
||||
[],
|
||||
['Import immagine = 1 -> Permette di importare l\'immagine come principale dell\'impianto mantenendo gli altri allegati già presenti'],
|
||||
@ -234,4 +231,4 @@ class CSV extends CSVImporter
|
||||
['Import immagine = 4 -> Permette di importare l\'immagine come allegato dell\'impianto rimuovendo tutti gli allegati presenti'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ namespace Modules\Interventi\Import;
|
||||
use Importer\CSVImporter;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Modules\Impianti\Impianto;
|
||||
use Modules\Interventi\Components\Sessione;
|
||||
use Modules\Interventi\Intervento;
|
||||
use Modules\Interventi\Stato;
|
||||
use Modules\TipiIntervento\Tipo;
|
||||
use Modules\Interventi\Components\Sessione;
|
||||
|
||||
/**
|
||||
* Struttura per la gestione delle operazioni di importazione (da CSV) degli Interventi.
|
||||
@ -44,7 +44,7 @@ class CSV extends CSVImporter
|
||||
],
|
||||
[
|
||||
'field' => 'telefono',
|
||||
'label' => 'Telefono',
|
||||
'label' => 'Telefono',
|
||||
],
|
||||
[
|
||||
'field' => 'data',
|
||||
@ -66,7 +66,7 @@ class CSV extends CSVImporter
|
||||
'field' => 'tipo',
|
||||
'label' => 'Tipo',
|
||||
],
|
||||
[
|
||||
[
|
||||
'field' => 'note',
|
||||
'label' => 'Note',
|
||||
],
|
||||
@ -98,7 +98,7 @@ class CSV extends CSVImporter
|
||||
$anagrafica = Anagrafica::where('telefono', $record['telefono'])->first();
|
||||
}
|
||||
|
||||
if (!empty($record['impianto'])){
|
||||
if (!empty($record['impianto'])) {
|
||||
$impianto = Impianto::where('matricola', $record['impianto'])->first();
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ class CSV extends CSVImporter
|
||||
// Crea l'intervento
|
||||
if (empty($intervento)) {
|
||||
$intervento = Intervento::build($anagrafica, $tipo, $stato, $record['data_richiesta']);
|
||||
}
|
||||
}
|
||||
unset($record['codice']);
|
||||
unset($record['data']);
|
||||
unset($record['ora_inizio']);
|
||||
@ -154,18 +154,18 @@ class CSV extends CSVImporter
|
||||
|
||||
$intervento->save();
|
||||
|
||||
$inizio = date('Y-m-d H:i', strtotime($record['data'] . ' ' . $record['ora_inizio']));
|
||||
$fine= '';
|
||||
$inizio = date('Y-m-d H:i', strtotime($record['data'].' '.$record['ora_inizio']));
|
||||
$fine = '';
|
||||
|
||||
// Verifica il tecnico e inserisce la sessione
|
||||
$anagrafica_t = Anagrafica::where('ragione_sociale', $record['tecnico'])->first();
|
||||
$tipo = $database->fetchOne('SELECT idtipoanagrafica FROM an_tipianagrafiche_anagrafiche WHERE idanagrafica = '.prepare($anagrafica_t['idanagrafica']));
|
||||
$tecnico = TipoAnagrafica::where('descrizione','Tecnico')->first();
|
||||
$tecnico = TipoAnagrafica::where('descrizione', 'Tecnico')->first();
|
||||
|
||||
if ($tipo = $tecnico['idtipoanagrafica']){
|
||||
if ($tipo = $tecnico['idtipoanagrafica']) {
|
||||
$anagrafica_t['tipo'] = $tecnico['descrizione'];
|
||||
}
|
||||
|
||||
|
||||
if (!empty($record['data']) && !empty($record['ora_inizio']) && !empty($record['tecnico'])) {
|
||||
$sessione = Sessione::build($intervento, $anagrafica_t, $inizio, $fine);
|
||||
$sessione->save();
|
||||
@ -177,8 +177,8 @@ class CSV extends CSVImporter
|
||||
{
|
||||
return [
|
||||
['Codice', 'Telefono', 'Data', 'Data richiesta', 'Ora', 'Tecnico', 'Tipo', 'Note', 'Impianto', 'Richiesta', 'Descrizione', 'Stato'],
|
||||
['001', '044444444', '07/11/2023','03/11/2023', '18:30', 'Stefano Bianchi', '', '', '00000000001', 'Manutenzione ordinaria', 'eseguito intervento di manutenzione', 'Bozza'],
|
||||
['002', '044444444', '08/11/2023', '04/11/2023', '11:20', 'Stefano Bianchi', '', '', '00000000002', 'Manutenzione ordinaria', 'eseguito intervento di manutenzione', '']
|
||||
['001', '044444444', '07/11/2023', '03/11/2023', '18:30', 'Stefano Bianchi', '', '', '00000000001', 'Manutenzione ordinaria', 'eseguito intervento di manutenzione', 'Bozza'],
|
||||
['002', '044444444', '08/11/2023', '04/11/2023', '11:20', 'Stefano Bianchi', '', '', '00000000002', 'Manutenzione ordinaria', 'eseguito intervento di manutenzione', ''],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ class FatturaElettronica
|
||||
|
||||
if (!empty($element['riferimento_linea']['id'])) {
|
||||
$dati['RiferimentoNumeroLinea'] = $element['riferimento_linea']['id'];
|
||||
} else if (!empty($element['riferimento_linea'])) {
|
||||
} elseif (!empty($element['riferimento_linea'])) {
|
||||
$dati['RiferimentoNumeroLinea'] = $element['riferimento_linea'];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user