Fix minori

This commit is contained in:
Luca 2018-11-02 18:39:24 +01:00
parent 652ec3509f
commit e946fd6ad0
3 changed files with 8 additions and 8 deletions

View File

@ -127,7 +127,7 @@ class Fattura extends Model
// Recupero maschera per questo segmento
$maschera = static::getMaschera($id_segment);
$ultima_fattura = $database->fetchOne('SELECT numero FROM co_documenti WHERE YEAR(data) = :year AND id_segment = :id_segment '.(($direzione == 'uscita') ? 'ORDER BY CAST(numero AS UNSIGNED) DESC' : static::getMascheraOrder($maschera)), [
$ultima_fattura = $database->fetchOne('SELECT numero FROM co_documenti WHERE YEAR(data) = :year AND id_segment = :id_segment '.static::getMascheraOrder($maschera, 'numero'), [
':year' => date('Y', strtotime($data)),
':id_segment' => $id_segment,
]);
@ -157,7 +157,7 @@ class Fattura extends Model
// Recupero maschera per questo segmento
$maschera = static::getMaschera($id_segment);
$ultima_fattura = $database->fetchOne('SELECT numero_esterno FROM co_documenti WHERE YEAR(data) = :year AND id_segment = :id_segment '.static::getMascheraOrder($maschera), [
$ultima_fattura = $database->fetchOne('SELECT numero_esterno FROM co_documenti WHERE YEAR(data) = :year AND id_segment = :id_segment '.static::getMascheraOrder($maschera, 'numero_esterno'), [
':year' => date('Y', strtotime($data)),
':id_segment' => $id_segment,
]);
@ -195,7 +195,7 @@ class Fattura extends Model
*
* @return string
*/
protected static function getMascheraOrder($maschera)
protected static function getMascheraOrder($maschera, $order_by)
{
// Estraggo blocchi di caratteri standard
preg_match('/[#]+/', $maschera, $m1);
@ -203,9 +203,9 @@ class Fattura extends Model
$pos1 = strpos($maschera, $m1[0]);
if ($pos1 == 0) {
$query = 'ORDER BY CAST(numero_esterno AS UNSIGNED) DESC';
$query = 'ORDER BY CAST('.$order_by.' AS UNSIGNED) DESC';
} else {
$query = 'ORDER BY numero_esterno DESC';
$query = 'ORDER BY '.$order_by.' DESC';
}
return $query;

View File

@ -12,14 +12,14 @@ include_once __DIR__.'/../../core.php';
</div>
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Maschera'); ?>", "name": "pattern", "class": "alphanumeric-mask", "value": "$pattern$", "maxlength": 25, "placeholder":"####/yy" ]}
{[ "type": "text", "label": "<?php echo tr('Maschera'); ?>", "name": "pattern", "class": "alphanumeric-mask", "value": "$pattern$", "maxlength": 25, "placeholder":"####/YYYY" ]}
</div>
</div>
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Modulo'); ?>", "name": "module", "required": 1, "values": "query=SELECT id, IF(title!='', title, name) AS descrizione FROM zz_modules WHERE enabled = 1 AND options != 'custom' ORDER BY descrizione ASC", "value": "$id_module$" ]}
{[ "type": "select", "label": "<?php echo tr('Modulo'); ?>", "name": "module", "required": 1, "values": "query=SELECT id, IF(title!='', title, name) AS descrizione FROM zz_modules WHERE enabled = 1 AND options != 'custom' ORDER BY descrizione ASC", "value": "" ]}
</div>
<div class="col-md-6">

View File

@ -81,7 +81,7 @@ if (str_contains($current_module['option'], '|segment|')) {
<div class="panel-body">
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Maschera'); ?>", "name": "pattern", "class": "alphanumeric-mask", "value": "$pattern$", "maxlength": 25, "placeholder":"####/YY", "extra": "<?php echo ($tot > 0) ? 'readonly' : ''; ?>" ]}
{[ "type": "text", "label": "<?php echo tr('Maschera'); ?>", "name": "pattern", "class": "alphanumeric-mask", "value": "$pattern$", "maxlength": 25, "placeholder":"####/YYYY", "extra": "<?php echo ($tot > 0) ? 'readonly' : ''; ?>" ]}
</div>
<div class="col-md-6">