1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-11 17:10:40 +01:00
This commit is contained in:
MatteoPistorello 2024-04-23 17:15:03 +02:00
commit f4a85c583e
19 changed files with 22 additions and 48 deletions

View File

@ -59,7 +59,7 @@ $plugins = Plugin::where('idmodule_to', $id_module)->where('position', 'tab_main
foreach ($plugins as $plugin) { foreach ($plugins as $plugin) {
echo ' echo '
<li> <li>
<a data-toggle="tab" href="#tab_'.$plugin->id.'" id="link-tab_'.$plugin->id.'">'.$plugin->title.'</a> <a data-toggle="tab" href="#tab_'.$plugin->id.'" id="link-tab_'.$plugin->id.'">'.$plugin->getTranslation('title').'</a>
</li>'; </li>';
} }

View File

@ -456,7 +456,7 @@ switch ($resource) {
case 'regioni': case 'regioni':
if (isset($superselect['id_nazione'])) { if (isset($superselect['id_nazione'])) {
$query = 'SELECT `an_regioni`.`id` AS id, `an_regioni`.`iso2`, CONCAT(CONCAT_WS(\' - \', `an_regioni`.`iso2`, `an_regioni_lang`.`title`), \' (\', `an_nazioni`.`iso2`, \')\') AS descrizione FROM `an_regioni` LEFT JOIN `an_regioni_lang` ON (`an_regioni`.`id` = `an_regioni_lang`.`id_record` AND `an_regioni_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_nazioni` ON `an_regioni`.`id_nazione` = `an_nazioni`.`id` |where| ORDER BY `an_regioni_lang`.`title`'; $query = 'SELECT `an_regioni`.`id` AS id, `an_regioni_lang`.`title` AS descrizione FROM `an_regioni` LEFT JOIN `an_regioni_lang` ON (`an_regioni`.`id` = `an_regioni_lang`.`id_record` AND `an_regioni_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_nazioni` ON `an_regioni`.`id_nazione` = `an_nazioni`.`id` |where| ORDER BY `an_regioni_lang`.`title`';
foreach ($elements as $element) { foreach ($elements as $element) {
$filter[] = '`an_regioni`.`id`='.prepare($element); $filter[] = '`an_regioni`.`id`='.prepare($element);
@ -466,8 +466,6 @@ switch ($resource) {
if (!empty($search)) { if (!empty($search)) {
$search_fields[] = '`an_regioni_lang`.`title` LIKE '.prepare('%'.$search.'%'); $search_fields[] = '`an_regioni_lang`.`title` LIKE '.prepare('%'.$search.'%');
$search_fields[] = '`an_regioni`.`iso2` LIKE '.prepare('%'.$search.'%');
$search_fields[] = 'CONCAT_WS(\' - \', `an_regioni`.`iso2`, `an_regioni_lang`.`title`) LIKE '.prepare('%'.$search.'%');
} }
} }
break; break;

View File

@ -69,8 +69,8 @@ class Anagrafica extends Model
$model->ragione_sociale = $ragione_sociale; $model->ragione_sociale = $ragione_sociale;
$model->nome = $nome; $model->nome = $nome ?: '';
$model->cognome = $cognome; $model->cognome = $cognome ?: '';
$model->codice = static::getNextCodice(); $model->codice = static::getNextCodice();
$model->id_ritenuta_acconto_vendite = setting("Ritenuta d'acconto predefinita"); $model->id_ritenuta_acconto_vendite = setting("Ritenuta d'acconto predefinita");

View File

@ -37,10 +37,9 @@ class Categoria extends Model
protected static $parent_identifier = 'parent'; protected static $parent_identifier = 'parent';
public static function build($nota = null, $colore = null) public static function build($colore = null)
{ {
$model = new static(); $model = new static();
$model->nota = $nota;
$model->colore = $colore; $model->colore = $colore;
$model->save(); $model->save();

View File

@ -32,9 +32,6 @@ switch (filter('op')) {
flash()->error(tr('Questo nome è già stato utilizzato per un altro attributo.')); flash()->error(tr('Questo nome è già stato utilizzato per un altro attributo.'));
} else { } else {
$attributo = Attributo::build(); $attributo = Attributo::build();
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
$attributo->name = $descrizione;
}
$id_record = $dbo->lastInsertedID(); $id_record = $dbo->lastInsertedID();
$attributo->setTranslation('title', $descrizione); $attributo->setTranslation('title', $descrizione);
$attributo->setTranslation('title', $title); $attributo->setTranslation('title', $title);
@ -52,9 +49,6 @@ switch (filter('op')) {
flash()->error(tr('Questo nome è già stato utilizzato per un altro attributo.')); flash()->error(tr('Questo nome è già stato utilizzato per un altro attributo.'));
} else { } else {
$attributo->setTranslation('title', $title); $attributo->setTranslation('title', $title);
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
$attributo->name = $descrizione;
}
$attributo->save(); $attributo->save();
flash()->info(tr('Attributo aggiornato correttamente!')); flash()->info(tr('Attributo aggiornato correttamente!'));

View File

@ -25,10 +25,6 @@ echo '
<input type="hidden" name="backto" value="record-edit"> <input type="hidden" name="backto" value="record-edit">
<div class="row"> <div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "required": 1, "help": "'.tr("Nome univoco dell'attributo").'" ]}
</div>
<div class="col-md-6"> <div class="col-md-6">
{[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]} {[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]}
</div> </div>

View File

@ -31,10 +31,6 @@ echo '
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-md-6">
{[ "type": "span", "label": "'.tr('Nome').'", "name": "nome", "value": "'.$attributo->getTranslation('title').'", "help": "'.tr("Nome univoco dell'attributo").'" ]}
</div>
<div class="col-md-6"> <div class="col-md-6">
{[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "value": "'.$attributo->getTranslation('title').'", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]} {[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "value": "'.$attributo->getTranslation('title').'", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]}
</div> </div>

View File

@ -28,13 +28,10 @@ switch (filter('op')) {
$id_original = filter('id_original') ?: null; $id_original = filter('id_original') ?: null;
if (isset($nome) && isset($nota) && isset($colore)) { if (isset($nome) && isset($nota) && isset($colore)) {
$categoria->nota = $nota;
$categoria->colore = $colore; $categoria->colore = $colore;
$categoria->parent = $id_original ?: null; $categoria->parent = $id_original ?: null;
$categoria->setTranslation('title', $nome); $categoria->setTranslation('title', $nome);
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) { $categoria->setTranslation('note', $nota);
$categoria->name = $descrizione;
}
$categoria->save(); $categoria->save();
flash()->info(tr('Salvataggio completato!')); flash()->info(tr('Salvataggio completato!'));
@ -68,12 +65,10 @@ switch (filter('op')) {
if (!empty($categoria_new)) { if (!empty($categoria_new)) {
flash()->error(tr('Questo nome è già stato utilizzato per un altra categoria.')); flash()->error(tr('Questo nome è già stato utilizzato per un altra categoria.'));
} else { } else {
$categoria = Categoria::build($nota, $colore); $categoria = Categoria::build($colore);
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
$categoria->name = $descrizione;
}
$id_record = $dbo->lastInsertedID(); $id_record = $dbo->lastInsertedID();
$categoria->parent = $id_original; $categoria->parent = $id_original;
$categoria->setTranslation('note', $nota);
$categoria->setTranslation('title', $nome); $categoria->setTranslation('title', $nome);
$categoria->save(); $categoria->save();

View File

@ -43,7 +43,7 @@ use Models\Module;
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "$nota$" ]} {[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "$note$" ]}
</div> </div>
</div> </div>
</div> </div>

View File

@ -33,7 +33,7 @@ echo '
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nome').'", "name": "name", "value": "$title$", "required": 1 ]} {[ "type": "text", "label": "'.tr('Nome').'", "name": "name", "value": "$name$", "required": 1 ]}
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

View File

@ -17,9 +17,6 @@ switch (filter('op')) {
} else { } else {
if (empty($combinazione)) { if (empty($combinazione)) {
$combinazione = Combinazione::build(); $combinazione = Combinazione::build();
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
$combinazione->name = $nome;
}
$id_record = $dbo->lastInsertedID(); $id_record = $dbo->lastInsertedID();
} }
$combinazione->setTranslation('title', $nome); $combinazione->setTranslation('title', $nome);

View File

@ -37,7 +37,7 @@ include_once __DIR__.'/../../core.php';
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "name", "required": 1, "value": "$title$" ]} {[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "name", "required": 1, "value": "$name$" ]}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">

View File

@ -135,7 +135,7 @@ switch ($op) {
$fattura->note_aggiuntive = post('note_aggiuntive'); $fattura->note_aggiuntive = post('note_aggiuntive');
$fattura->idanagrafica = post('idanagrafica'); $fattura->idanagrafica = post('idanagrafica');
$fattura->idagente = post('idagente'); $fattura->idagente = post('idagente') ?: '';
$fattura->idreferente = post('idreferente'); $fattura->idreferente = post('idreferente');
$fattura->idpagamento = post('idpagamento'); $fattura->idpagamento = post('idpagamento');
$fattura->id_banca_azienda = post('id_banca_azienda'); $fattura->id_banca_azienda = post('id_banca_azienda');
@ -764,7 +764,7 @@ switch ($op) {
$fattura->idsede_destinazione = $idsede; $fattura->idsede_destinazione = $idsede;
$fattura->id_ritenuta_contributi = post('id_ritenuta_contributi') ?: null; $fattura->id_ritenuta_contributi = post('id_ritenuta_contributi') ?: null;
$fattura->idreferente = $documento->idreferente; $fattura->idreferente = $documento->idreferente;
$fattura->idagente = $documento->idagente; $fattura->idagente = $documento->idagente ?: '';
$fattura->save(); $fattura->save();

View File

@ -122,7 +122,7 @@ class Fattura extends Document
if ($numero_esterno) { if ($numero_esterno) {
$model->numero_esterno = $numero_esterno; $model->numero_esterno = $numero_esterno;
} }
$model->idagente = $anagrafica->idagente; $model->idagente = $anagrafica->idagente ?: '';
// Sede aziendale scelta tra le sedi disponibili per l'utente // Sede aziendale scelta tra le sedi disponibili per l'utente
$id_sede = $user->sedi[0]; $id_sede = $user->sedi[0];

View File

@ -39,7 +39,7 @@ if (!empty($rs)) {
$data_accettazione = ($preventivo->data_accettazione != '0000-00-00') ? Translator::dateToLocale($preventivo->data_accettazione) : ''; $data_accettazione = ($preventivo->data_accettazione != '0000-00-00') ? Translator::dateToLocale($preventivo->data_accettazione) : '';
$data_conclusione = ($preventivo->data_conclusione != '0000-00-00') ? Translator::dateToLocale($preventivo->data_conclusione) : ''; $data_conclusione = ($preventivo->data_conclusione != '0000-00-00') ? Translator::dateToLocale($preventivo->data_conclusione) : '';
if (strtotime($preventivo->data_conclusione) < strtotime(date('Y-m-d')) && $data_conclusione != '') { if ($data_conclusione != '' && strtotime($preventivo->data_conclusione) < strtotime(date('Y-m-d'))) {
$attr = ' class="danger"'; $attr = ' class="danger"';
} else { } else {
$attr = ''; $attr = '';

View File

@ -60,7 +60,7 @@ switch (post('op')) {
], ['id' => $id_record]); ], ['id' => $id_record]);
$dbo->update('zz_segments_lang', [ $dbo->update('zz_segments_lang', [
'name' => post('name'), 'title' => post('name'),
], ['id_record' => $id_record, 'id_lang' => Models\Locale::getDefault()->id]); ], ['id_record' => $id_record, 'id_lang' => Models\Locale::getDefault()->id]);
// Aggiornamento dei permessi relativi // Aggiornamento dei permessi relativi
@ -95,7 +95,7 @@ switch (post('op')) {
$id_record = $dbo->lastInsertedID(); $id_record = $dbo->lastInsertedID();
$dbo->insert('zz_segments_lang', [ $dbo->insert('zz_segments_lang', [
'name' => post('name'), 'title' => post('name'),
'id_record' => $id_record, 'id_record' => $id_record,
'id_lang' => Models\Locale::getDefault()->id, 'id_lang' => Models\Locale::getDefault()->id,
]); ]);

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../../core.php';
switch ($resource) { switch ($resource) {
case 'tipi_scadenze': case 'tipi_scadenze':
$query = 'SELECT `title` AS `id`, `description` as `descrizione` FROM `co_tipi_scadenze` LEFT JOIN `co_tipi_scadenze_lang` ON (`co_tipi_scadenze_lang`.`id_record` = `co_tipi_scadenze`.`id` AND `co_tipi_scadenze_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') |where| ORDER BY `title` ASC'; $query = 'SELECT `title` AS `id`, `title` as `descrizione` FROM `co_tipi_scadenze` LEFT JOIN `co_tipi_scadenze_lang` ON (`co_tipi_scadenze_lang`.`id_record` = `co_tipi_scadenze`.`id` AND `co_tipi_scadenze_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') |where| ORDER BY `title` ASC';
foreach ($elements as $element) { foreach ($elements as $element) {
$filter[] = '`co_tipi_scadenze`.`id`='.prepare($element); $filter[] = '`co_tipi_scadenze`.`id`='.prepare($element);
@ -29,7 +29,6 @@ switch ($resource) {
if (!empty($search)) { if (!empty($search)) {
$search_fields[] = '`title` LIKE '.prepare('%'.$search.'%'); $search_fields[] = '`title` LIKE '.prepare('%'.$search.'%');
$search_fields[] = '`description` LIKE '.prepare('%'.$search.'%');
} }
break; break;

View File

@ -574,7 +574,7 @@ if (!empty($righe)) {
<div class="box-header"> <div class="box-header">
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-5">
{[ "type": "select", "name": "articoli['.$key.']", "ajax-source": "articoli", "select-options": '.json_encode(['permetti_movimento_a_zero' => 1, 'dir' => 'entrata', 'idanagrafica' => $anagrafica ? $anagrafica->id : '']).', "icon-after": "add|'.(new Module())->getByField('title', 'Articoli', Models\Locale::getPredefined()->id).'|codice='.urlencode($codice_principale).'&descrizione='.urlencode($riga['Descrizione']).'&prezzo_acquisto='.urlencode($riga['PrezzoUnitario']).'", "value": "'.$id_articolo.'", "label": "'.tr('Articolo').'", "extra": "data-id=\''.$key.'\'" ]} {["type": "select", "name": "articoli['.$key.']", "ajax-source": "articoli", "select-options": '.json_encode(['permetti_movimento_a_zero' => 1, 'dir' => 'entrata', 'idanagrafica' => $anagrafica ? $anagrafica->id : '']).', "icon-after": "add|'.(new Module())->getByField('title', 'Articoli', Models\Locale::getPredefined()->id).'|codice='.($codice_principale ? urlencode($codice_principale) : '').'&descrizione='.($riga['Descrizione'] ? urlencode($riga['Descrizione']) : '').'&prezzo_acquisto='. ($riga['PrezzoUnitario'] ? urlencode($riga['PrezzoUnitario']) : '').'", "value": "'.$id_articolo.'", "label": "'.tr('Articolo').'","extra": "data-id=\''.$key.'\'" ]}
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

View File

@ -107,9 +107,9 @@ class FatturaOrdinaria extends FatturaElettronica
} }
} elseif (isset($sm['Importo'])) { } elseif (isset($sm['Importo'])) {
if ($sm['Tipo'] == 'SC') { if ($sm['Tipo'] == 'SC') {
$importo -= $sm['Importo']; $importo -= $sm['Importo'] * $linea['Quantita'];
} else { } else {
$importo += $sm['Importo']; $importo += $sm['Importo'] * $linea['Quantita'];
} }
} }
} }
@ -119,7 +119,7 @@ class FatturaOrdinaria extends FatturaElettronica
$importo = $linea['PrezzoUnitario']; $importo = $linea['PrezzoUnitario'];
} }
$imponibile[$linea['AliquotaIVA']] = ($imponibile[$linea['AliquotaIVA']] ?? 0) + round($importo, 2); $imponibile[$linea['AliquotaIVA']] += round($importo, 2);
} }
// Aggiunta degli arrotondamenti IVA come righe indipendenti // Aggiunta degli arrotondamenti IVA come righe indipendenti