mirror of
https://github.com/devcode-it/openstamanager.git
synced 2024-12-23 22:03:18 +01:00
Aggiunta validazione per matricola Impianti
This commit is contained in:
parent
d0da5b8b55
commit
13f105527a
@ -27,7 +27,7 @@ $id_anagrafica = filter('id_anagrafica');
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{[ "type": "text", "label": "<?php echo tr('Matricola'); ?>", "name": "matricola", "required": 1, "class": "text-center alphanumeric-mask", "maxlength": 25 ]}
|
||||
{[ "type": "text", "label": "<?php echo tr('Matricola'); ?>", "name": "matricola", "required": 1, "class": "text-center alphanumeric-mask", "maxlength": 25, "validation": "matricola" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
|
@ -48,7 +48,7 @@ if (!empty($record['immagine'])) {
|
||||
<div class="col-md-9">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "<?php echo tr('Matricola'); ?>", "name": "matricola", "required": 1, "class": "text-center", "maxlength": 25, "value": "$matricola$" ]}
|
||||
{[ "type": "text", "label": "<?php echo tr('Matricola'); ?>", "name": "matricola", "required": 1, "class": "text-center", "maxlength": 25, "value": "$matricola$", "validation": "matricola" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
42
modules/impianti/validation.php
Normal file
42
modules/impianti/validation.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||
* Copyright (C) DevCode s.r.l.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Modules\Impianti\Impianto;
|
||||
|
||||
$name = filter('name');
|
||||
$value = filter('value');
|
||||
|
||||
switch ($name) {
|
||||
case 'matricola':
|
||||
$disponibile = Impianto::where([
|
||||
['matricola', $value],
|
||||
['id', '<>', $id_record],
|
||||
])->count() == 0;
|
||||
|
||||
$message = $disponibile ? tr('La matricola è disponbile') : tr('La matricola è già utilizzata in un altro impianto');
|
||||
|
||||
$response = [
|
||||
'result' => $disponibile,
|
||||
'message' => $message,
|
||||
];
|
||||
|
||||
break;
|
||||
}
|
Loading…
Reference in New Issue
Block a user