1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-16 19:40:44 +01:00

Correzione warning sulle classi per le righe Documenti

This commit is contained in:
Dasc3er 2020-09-23 18:36:33 +02:00
parent 11f79330e5
commit aacc381179
37 changed files with 121 additions and 341 deletions

View File

@ -78,7 +78,7 @@ if (!empty($query)) {
// Allineamento delle righe // Allineamento delle righe
$align = []; $align = [];
$row = $rows[0] ?: []; $row = isset($rows[0]) ? $rows[0] : [];
foreach ($row as $field => $value) { foreach ($row as $field => $value) {
$value = trim($value); $value = trim($value);

View File

@ -27,7 +27,7 @@ if (!isset($resource)) {
// Opzioni di selezione sugli elementi // Opzioni di selezione sugli elementi
$options = filter('options') ?: []; $options = filter('options') ?: [];
$options_compatibility = $_SESSION['superselect'] ?: []; $options_compatibility = session_get('superselect', []);
$options = array_merge($options_compatibility, $options); $options = array_merge($options_compatibility, $options);
// Preselezione su $elements dichiarato da file precedente // Preselezione su $elements dichiarato da file precedente

View File

@ -176,7 +176,7 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
foreach ($bulk as $key => $value) { foreach ($bulk as $key => $value) {
$text = is_array($value) ? $value['text'] : $value; $text = is_array($value) ? $value['text'] : $value;
$data = is_array($value) ? $value['data'] : []; $data = is_array($value['data']) ? $value['data'] : [];
$extra = []; $extra = [];
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
$extra[] = 'data-'.$k.'="'.prepareToField(\HTMLBuilder\HTMLBuilder::replace($v)).'"'; $extra[] = 'data-'.$k.'="'.prepareToField(\HTMLBuilder\HTMLBuilder::replace($v)).'"';

View File

@ -47,6 +47,7 @@ if (!$is_cliente) {
} }
} }
$nazione_anagrafica = $anagrafica->sedeLegale->nazione;
?> ?>
<form action="" method="post" id="edit-form" autocomplete="<?php echo setting('Autocompletamento form'); ?>" > <form action="" method="post" id="edit-form" autocomplete="<?php echo setting('Autocompletamento form'); ?>" >
@ -129,7 +130,7 @@ if (!$is_cliente) {
$help_codice_destinatario .= ' <b>'.tr("Non è necessario comunicare il proprio codice destinatario ai fornitori in quanto è sufficiente che questo sia registrato nel portale del Sistema Di Interscambio dell'Agenzia Entrate (SDI)").'.</b>'; $help_codice_destinatario .= ' <b>'.tr("Non è necessario comunicare il proprio codice destinatario ai fornitori in quanto è sufficiente che questo sia registrato nel portale del Sistema Di Interscambio dell'Agenzia Entrate (SDI)").'.</b>';
} }
?> ?>
{[ "type": "text", "label": "<?php echo ($record['tipo'] == 'Ente pubblico') ? tr('Codice unico ufficio') : tr('Codice destinatario'); ?>", "name": "codice_destinatario", "required": 0, "class": "text-center text-uppercase alphanumeric-mask", "value": "$codice_destinatario$", "maxlength": <?php echo ($record['tipo'] == 'Ente pubblico') ? '6' : '7'; ?>, "help": "<?php echo tr($help_codice_destinatario); ?>", "readonly": "<?php echo intval($anagrafica->sedeLegale->nazione->iso2 != 'IT'); ?>" ]} {[ "type": "text", "label": "<?php echo ($record['tipo'] == 'Ente pubblico') ? tr('Codice unico ufficio') : tr('Codice destinatario'); ?>", "name": "codice_destinatario", "required": 0, "class": "text-center text-uppercase alphanumeric-mask", "value": "$codice_destinatario$", "maxlength": <?php echo ($record['tipo'] == 'Ente pubblico') ? '6' : '7'; ?>, "help": "<?php echo tr($help_codice_destinatario); ?>", "readonly": "<?php echo intval($nazione_anagrafica ? $nazione_anagrafica->iso2 != 'IT' : 0); ?>" ]}
</div> </div>
<div class="col-md-4"> <div class="col-md-4">

View File

@ -20,8 +20,6 @@
namespace Modules\Contratti\Components; namespace Modules\Contratti\Components;
use Common\Components\Article; use Common\Components\Article;
use Modules\Articoli\Articolo as Original;
use Modules\Contratti\Contratto;
class Articolo extends Article class Articolo extends Article
{ {
@ -30,16 +28,4 @@ class Articolo extends Article
public $movimenta_magazzino = false; public $movimenta_magazzino = false;
protected $table = 'co_righe_contratti'; protected $table = 'co_righe_contratti';
/**
* Crea un nuovo articolo collegato ad un contratto.
*
* @return self
*/
public static function build(Contratto $contratto, Original $articolo)
{
$model = parent::build($contratto, $articolo);
return $model;
}
} }

View File

@ -20,23 +20,10 @@
namespace Modules\Contratti\Components; namespace Modules\Contratti\Components;
use Common\Components\Description; use Common\Components\Description;
use Modules\Contratti\Contratto;
class Descrizione extends Description class Descrizione extends Description
{ {
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_contratti'; protected $table = 'co_righe_contratti';
/**
* Crea una nuova riga collegata ad un contratto.
*
* @return self
*/
public static function build(Contratto $contratto)
{
$model = parent::build($contratto);
return $model;
}
} }

View File

@ -20,23 +20,10 @@
namespace Modules\Contratti\Components; namespace Modules\Contratti\Components;
use Common\Components\Row; use Common\Components\Row;
use Modules\Contratti\Contratto;
class Riga extends Row class Riga extends Row
{ {
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_contratti'; protected $table = 'co_righe_contratti';
/**
* Crea una nuova riga collegata ad un contratto.
*
* @return self
*/
public static function build(Contratto $contratto)
{
$model = parent::build($contratto);
return $model;
}
} }

View File

@ -20,23 +20,10 @@
namespace Modules\Contratti\Components; namespace Modules\Contratti\Components;
use Common\Components\Discount; use Common\Components\Discount;
use Modules\Contratti\Contratto;
class Sconto extends Discount class Sconto extends Discount
{ {
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_contratti'; protected $table = 'co_righe_contratti';
/**
* Crea un nuovo sconto collegato ad un contratto.
*
* @return self
*/
public static function build(Contratto $contratto)
{
$model = parent::build($contratto);
return $model;
}
} }

View File

@ -29,16 +29,4 @@ class Articolo extends Article
protected $table = 'dt_righe_ddt'; protected $table = 'dt_righe_ddt';
protected $serialRowID = 'ddt'; protected $serialRowID = 'ddt';
/**
* Crea un nuovo articolo collegato ad una ddt.
*
* @return self
*/
public static function build(DDT $ddt, Original $articolo)
{
$model = parent::build($ddt, $articolo);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Descrizione extends Description
use RelationTrait; use RelationTrait;
protected $table = 'dt_righe_ddt'; protected $table = 'dt_righe_ddt';
/**
* Crea una nuova riga collegata ad una ddt.
*
* @return self
*/
public static function build(DDT $ddt)
{
$model = parent::build($ddt);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Riga extends Row
use RelationTrait; use RelationTrait;
protected $table = 'dt_righe_ddt'; protected $table = 'dt_righe_ddt';
/**
* Crea una nuova riga collegata ad una ddt.
*
* @return self
*/
public static function build(DDT $ddt)
{
$model = parent::build($ddt);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Sconto extends Discount
use RelationTrait; use RelationTrait;
protected $table = 'dt_righe_ddt'; protected $table = 'dt_righe_ddt';
/**
* Crea un nuovo sconto collegato ad un ddt.
*
* @return self
*/
public static function build(DDT $ddt)
{
$model = parent::build($ddt);
return $model;
}
} }

View File

@ -20,7 +20,7 @@
namespace Modules\DDT; namespace Modules\DDT;
use Auth; use Auth;
use Common\Components\Description; use Common\Components\Component;
use Common\Document; use Common\Document;
use Modules\Anagrafiche\Anagrafica; use Modules\Anagrafiche\Anagrafica;
use Traits\RecordTrait; use Traits\RecordTrait;
@ -204,7 +204,7 @@ class DDT extends Document
* Effettua un controllo sui campi del documento. * Effettua un controllo sui campi del documento.
* Viene richiamato dalle modifiche alle righe del documento. * Viene richiamato dalle modifiche alle righe del documento.
*/ */
public function triggerEvasione(Description $trigger) public function triggerEvasione(Component $trigger)
{ {
parent::triggerEvasione($trigger); parent::triggerEvasione($trigger);

View File

@ -20,9 +20,10 @@
namespace Modules\Fatture\Components; namespace Modules\Fatture\Components;
use Common\Components\Article; use Common\Components\Article;
use Modules\Articoli\Articolo as Original;
use Modules\Fatture\Fattura;
/**
* @extends Article<\Modules\Fatture\Fattura>
*/
class Articolo extends Article class Articolo extends Article
{ {
use RelationTrait; use RelationTrait;
@ -30,18 +31,6 @@ class Articolo extends Article
protected $table = 'co_righe_documenti'; protected $table = 'co_righe_documenti';
protected $serialRowID = 'documento'; protected $serialRowID = 'documento';
/**
* Crea un nuovo articolo collegato ad una fattura.
*
* @return self
*/
public static function build(Fattura $fattura, Original $articolo)
{
$model = parent::build($fattura, $articolo);
return $model;
}
public function movimenta($qta) public function movimenta($qta)
{ {
if (!$this->movimenta_magazzino) { if (!$this->movimenta_magazzino) {

View File

@ -20,23 +20,13 @@
namespace Modules\Fatture\Components; namespace Modules\Fatture\Components;
use Common\Components\Description; use Common\Components\Description;
use Modules\Fatture\Fattura;
/**
* @extends Description<\Modules\Fatture\Fattura>
*/
class Descrizione extends Description class Descrizione extends Description
{ {
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_documenti'; protected $table = 'co_righe_documenti';
/**
* Crea una nuova riga collegata ad una fattura.
*
* @return self
*/
public static function build(Fattura $fattura)
{
$model = parent::build($fattura);
return $model;
}
} }

View File

@ -20,23 +20,13 @@
namespace Modules\Fatture\Components; namespace Modules\Fatture\Components;
use Common\Components\Row; use Common\Components\Row;
use Modules\Fatture\Fattura;
/**
* @extends Row<\Modules\Fatture\Fattura>
*/
class Riga extends Row class Riga extends Row
{ {
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_documenti'; protected $table = 'co_righe_documenti';
/**
* Crea una nuova riga collegata ad una fattura.
*
* @return self
*/
public static function build(Fattura $fattura)
{
$model = parent::build($fattura);
return $model;
}
} }

View File

@ -20,23 +20,13 @@
namespace Modules\Fatture\Components; namespace Modules\Fatture\Components;
use Common\Components\Discount; use Common\Components\Discount;
use Modules\Fatture\Fattura;
/**
* @extends Discount<\Modules\Fatture\Fattura>
*/
class Sconto extends Discount class Sconto extends Discount
{ {
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_documenti'; protected $table = 'co_righe_documenti';
/**
* Crea un nuovo sconto collegato ad una fattura.
*
* @return self
*/
public static function build(Fattura $fattura)
{
$model = parent::build($fattura);
return $model;
}
} }

View File

@ -29,14 +29,4 @@ class Articolo extends Article
protected $table = 'in_righe_interventi'; protected $table = 'in_righe_interventi';
protected $serialRowID = 'intervento'; protected $serialRowID = 'intervento';
/**
* Crea una nuova riga collegata ad un intervento.
*
* @return self
*/
public static function build(Intervento $intervento, Original $articolo)
{
return parent::build($intervento, $articolo);
}
} }

View File

@ -27,16 +27,4 @@ class Riga extends Row
use RelationTrait; use RelationTrait;
protected $table = 'in_righe_interventi'; protected $table = 'in_righe_interventi';
/**
* Crea una nuova riga collegata ad un intervento.
*
* @return self
*/
public static function build(Intervento $intervento)
{
$model = parent::build($intervento);
return $model;
}
} }

View File

@ -27,18 +27,4 @@ class Sconto extends Discount
use RelationTrait; use RelationTrait;
protected $table = 'in_righe_interventi'; protected $table = 'in_righe_interventi';
/**
* Crea un nuovo sconto collegata ad un intervento.
*
* @return self
*/
public static function build(Intervento $intervento)
{
$model = parent::build($intervento);
$model->prezzo_unitario = 0;
return $model;
}
} }

View File

@ -399,7 +399,7 @@ class Sessione extends Model
*/ */
public function getMarginePercentualeAttribute() public function getMarginePercentualeAttribute()
{ {
return (1 - ($this->spesa / $this->imponibile)) * 100; return $this->imponibile ? (1 - ($this->spesa / $this->imponibile)) * 100 : 100;
} }
public function getIvaIndetraibileAttribute() public function getIvaIndetraibileAttribute()

View File

@ -31,16 +31,4 @@ class Articolo extends Article
protected $table = 'or_righe_ordini'; protected $table = 'or_righe_ordini';
protected $serialRowID = 'ordine'; protected $serialRowID = 'ordine';
/**
* Crea un nuovo articolo collegato ad una ordine.
*
* @return self
*/
public static function build(Ordine $ordine, Original $articolo)
{
$model = parent::build($ordine, $articolo);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Descrizione extends Description
use RelationTrait; use RelationTrait;
protected $table = 'or_righe_ordini'; protected $table = 'or_righe_ordini';
/**
* Crea una nuova riga collegata ad una ordine.
*
* @return self
*/
public static function build(Ordine $ordine)
{
$model = parent::build($ordine);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Riga extends Row
use RelationTrait; use RelationTrait;
protected $table = 'or_righe_ordini'; protected $table = 'or_righe_ordini';
/**
* Crea una nuova riga collegata ad una ordine.
*
* @return self
*/
public static function build(Ordine $ordine)
{
$model = parent::build($ordine);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Sconto extends Discount
use RelationTrait; use RelationTrait;
protected $table = 'or_righe_ordini'; protected $table = 'or_righe_ordini';
/**
* Crea un nuovo sconto collegato ad un ordine.
*
* @return self
*/
public static function build(Ordine $ordine)
{
$model = parent::build($ordine);
return $model;
}
} }

View File

@ -30,16 +30,4 @@ class Articolo extends Article
public $movimenta_magazzino = false; public $movimenta_magazzino = false;
protected $table = 'co_righe_preventivi'; protected $table = 'co_righe_preventivi';
/**
* Crea un nuovo articolo collegato ad una preventivo.
*
* @return self
*/
public static function build(Preventivo $preventivo, Original $articolo)
{
$model = parent::build($preventivo, $articolo);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Descrizione extends Description
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_preventivi'; protected $table = 'co_righe_preventivi';
/**
* Crea una nuova riga collegata ad una preventivo.
*
* @return self
*/
public static function build(Preventivo $preventivo)
{
$model = parent::build($preventivo);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Riga extends Row
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_preventivi'; protected $table = 'co_righe_preventivi';
/**
* Crea una nuova riga collegata ad una preventivo.
*
* @return self
*/
public static function build(Preventivo $preventivo)
{
$model = parent::build($preventivo);
return $model;
}
} }

View File

@ -27,16 +27,4 @@ class Sconto extends Discount
use RelationTrait; use RelationTrait;
protected $table = 'co_righe_preventivi'; protected $table = 'co_righe_preventivi';
/**
* Crea un nuovo sconto collegato ad un preventivo.
*
* @return self
*/
public static function build(Preventivo $preventivo)
{
$model = parent::build($preventivo);
return $model;
}
} }

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
include_once __DIR__.'/../../../core.php'; include_once __DIR__.'/../../core.php';
use Modules\Contratti\Contratto; use Modules\Contratti\Contratto;
use Modules\Contratti\Stato; use Modules\Contratti\Stato;

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
include_once __DIR__.'/../../../core.php'; include_once __DIR__.'/../../core.php';
$revisione_principale = $dbo->fetchOne('SELECT master_revision FROM co_preventivi WHERE id = '.prepare($id_record)); $revisione_principale = $dbo->fetchOne('SELECT master_revision FROM co_preventivi WHERE id = '.prepare($id_record));

View File

@ -290,7 +290,7 @@ abstract class Accounting extends Component
*/ */
public function getMarginePercentualeAttribute() public function getMarginePercentualeAttribute()
{ {
return (1 - ($this->spesa / $this->imponibile)) * 100; return $this->imponibile ? (1 - ($this->spesa / $this->imponibile)) * 100 : 100;
} }
/** /**

View File

@ -35,6 +35,8 @@ use InvalidArgumentException;
* @property string original_type * @property string original_type
* @property string original_id * @property string original_id
* *
* @template T
*
* @since 2.4.18 * @since 2.4.18
*/ */
abstract class Component extends Model abstract class Component extends Model
@ -285,6 +287,8 @@ abstract class Component extends Model
* *
* @param string $type * @param string $type
* @param string $id * @param string $id
*
* @return array
*/ */
public function impostaOrigine($type, $id) public function impostaOrigine($type, $id)
{ {
@ -314,6 +318,7 @@ abstract class Component extends Model
* Imposta il proprietario dell'oggetto e l'ordine relativo all'interno delle righe. * Imposta il proprietario dell'oggetto e l'ordine relativo all'interno delle righe.
* *
* @param Document $document Documento di riferimento * @param Document $document Documento di riferimento
* @psalm-param T $document
*/ */
public function setDocument(Document $document) public function setDocument(Document $document)
{ {
@ -327,6 +332,7 @@ abstract class Component extends Model
/** /**
* @return Document * @return Document
* @psalm-return T
*/ */
public function getDocument() public function getDocument()
{ {
@ -335,6 +341,9 @@ abstract class Component extends Model
abstract public function document(); abstract public function document();
/**
* @return string
*/
abstract public function getDocumentID(); abstract public function getDocumentID();
public function save(array $options = []) public function save(array $options = [])

View File

@ -22,13 +22,8 @@ namespace Common;
use Common\Components\Component; use Common\Components\Component;
use Illuminate\Database\Eloquent\Model as Model; use Illuminate\Database\Eloquent\Model as Model;
abstract class Document extends Model implements ReferenceInterface abstract class Document extends Model implements ReferenceInterface, DocumentInterface
{ {
/**
* Restituisce la collezione di righe e articoli con valori rilevanti per i conti.
*
* @return iterable
*/
public function getRighe() public function getRighe()
{ {
$results = $this->mergeCollections($this->descrizioni, $this->righe, $this->articoli, $this->sconti); $results = $this->mergeCollections($this->descrizioni, $this->righe, $this->articoli, $this->sconti);
@ -38,14 +33,6 @@ abstract class Document extends Model implements ReferenceInterface
}); });
} }
/**
* Restituisce la riga identificata dall'ID indicato.
*
* @param $type
* @param $id
*
* @return mixed
*/
public function getRiga($type, $id) public function getRiga($type, $id)
{ {
$righe = $this->getRighe(); $righe = $this->getRighe();
@ -55,12 +42,6 @@ abstract class Document extends Model implements ReferenceInterface
}); });
} }
/**
* Restituisce la collezione di righe e articoli con valori rilevanti per i conti, raggruppate sulla base dei documenti di provenienza.
* La chiave è la serializzazione del documento di origine, oppure null in caso non esista.
*
* @return iterable
*/
public function getRigheRaggruppate() public function getRigheRaggruppate()
{ {
$righe = $this->getRighe(); $righe = $this->getRighe();
@ -88,6 +69,16 @@ abstract class Document extends Model implements ReferenceInterface
abstract public function getDirezioneAttribute(); abstract public function getDirezioneAttribute();
public function triggerEvasione(Component $trigger)
{
$this->setRelations([]);
}
public function triggerComponent(Component $trigger)
{
$this->setRelations([]);
}
/** /**
* Calcola l'imponibile del documento. * Calcola l'imponibile del documento.
* *
@ -165,7 +156,7 @@ abstract class Document extends Model implements ReferenceInterface
*/ */
public function getMarginePercentualeAttribute() public function getMarginePercentualeAttribute()
{ {
return (1 - ($this->spesa / ($this->totale_imponibile))) * 100; return $this->imponibile ? (1 - ($this->spesa / $this->totale_imponibile)) * 100 : 100;
} }
public function delete() public function delete()
@ -188,24 +179,6 @@ abstract class Document extends Model implements ReferenceInterface
return parent::delete(); return parent::delete();
} }
/**
* Metodo richiamato a seguito di modifiche sull'evasione generale delle righe del documento.
* Utilizzabile per l'impostazione automatica degli stati.
*/
public function triggerEvasione(Component $trigger)
{
$this->setRelations([]);
}
/**
* Metodo richiamato a seguito della modifica o creazione di una riga del documento.
* Utilizzabile per limpostazione automatica di campi statici del documento.
*/
public function triggerComponent(Component $trigger)
{
$this->setRelations([]);
}
public function toArray() public function toArray()
{ {
$array = parent::toArray(); $array = parent::toArray();

View File

@ -0,0 +1,69 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* 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/>.
*/
namespace Common;
use Common\Components\Component;
interface DocumentInterface
{
/**
* Restituisce la collezione di righe e articoli con valori rilevanti per i conti.
*
* @return iterable
*/
public function getRighe();
/**
* Restituisce la riga identificata dall'ID indicato.
*
* @param $type
* @param $id
*
* @return mixed
*/
public function getRiga($type, $id);
/**
* Restituisce la collezione di righe e articoli con valori rilevanti per i conti, raggruppate sulla base dei documenti di provenienza.
* La chiave è la serializzazione del documento di origine, oppure null in caso non esista.
*
* @return iterable
*/
public function getRigheRaggruppate();
/**
* Restituisce la direzione in relazione al flusso di denaro impostata per il documento.
*
* @return string 'entrata'|'uscita'
*/
public function getDirezioneAttribute();
/**
* Metodo richiamato a seguito di modifiche sull'evasione generale delle righe del documento.
* Utilizzabile per l'impostazione automatica degli stati.
*/
public function triggerEvasione(Component $trigger);
/**
* Metodo richiamato a seguito della modifica o creazione di una riga del documento.
* Utilizzabile per l'impostazione automatica di campi statici del documento.
*/
public function triggerComponent(Component $trigger);
}

View File

@ -62,7 +62,7 @@ class SelectHandler implements HandlerInterface
unset($values['select-source']); unset($values['select-source']);
// Informazioni aggiuntive per il select // Informazioni aggiuntive per il select
$infos = $values['select-options'] ?: []; $infos = isset($values['select-options']) ? $values['select-options'] : [];
$values['data-select-options'] = json_encode($infos); $values['data-select-options'] = json_encode($infos);
unset($values['select-options']); unset($values['select-options']);
@ -170,7 +170,7 @@ class SelectHandler implements HandlerInterface
} }
$html .= ' $html .= '
<option value="'.prepareToField($element['id']).'" '.implode(' ', $attributes).($element['disabled'] ? 'disabled' : '').'>'.$element['text'].'</option>'; <option value="'.prepareToField($element['id']).'" '.implode(' ', $attributes).(!empty($element['disabled']) ? 'disabled' : '').'>'.$element['text'].'</option>';
} }
return $html; return $html;

View File

@ -229,11 +229,13 @@ class Generator
$query = $field.' DESC'; $query = $field.' DESC';
// Estraggo blocchi di caratteri standard // Estraggo blocchi di caratteri standard
preg_match('/[#]+/', $maschera, $m1); preg_match('/[#]+/', $maschera, $matches);
$pos1 = strpos($maschera, (string) $m1[0]); if (!empty($matches)) {
if ($pos1 == 0) { $pos1 = strpos($maschera, (string) $matches[0]);
$query = 'CAST('.$field.' AS UNSIGNED) DESC'; if ($pos1 == 0) {
$query = 'CAST('.$field.' AS UNSIGNED) DESC';
}
} }
return $query; return $query;