2018-02-23 16:04:50 +01:00
< form action = " " method = " post " id = " edit-form " >
2017-12-15 10:05:08 +01:00
< input type = " hidden " name = " backto " value = " record-edit " >
< input type = " hidden " name = " op " value = " update " >
2018-02-17 14:32:40 +01:00
< input type = " hidden " name = " id_record " value = " <?php echo $id_record ; ?> " >
2017-12-15 10:05:08 +01:00
<!-- DATI ARTICOLO -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2018-03-21 16:57:31 +01:00
< h3 class = " panel-title " >< ? php echo tr ( 'Segmento' ); ?> </h3>
2017-12-15 10:05:08 +01:00
</ div >
2018-02-17 14:32:40 +01:00
2017-12-15 10:05:08 +01:00
< div class = " panel-body " >
< div class = " row " >
2018-03-21 16:57:31 +01:00
2017-12-15 10:05:08 +01:00
< div class = " col-md-3 " >
2018-03-21 16:57:31 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Nome'); ?> " , " name " : " name " , " required " : 1 , " class " : " " , " value " : " $name $ " , " extra " : " " ]}
2017-12-15 10:05:08 +01:00
</ div >
2018-03-21 16:57:31 +01:00
2017-12-15 10:05:08 +01:00
< div class = " col-md-3 " >
2018-03-21 16:57:31 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Maschera'); ?> " , " name " : " pattern " , " required " : 1 , " class " : " alphanumeric-mask " , " value " : " $pattern $ " , " maxlength " : 25 , " placeholder " : " ####/YY " , " extra " : " " ]}
2018-02-17 14:32:40 +01:00
</ div >
2018-03-21 16:57:31 +01:00
2017-12-15 10:05:08 +01:00
< div class = " col-md-3 " >
2018-03-21 21:25:17 +01:00
{[ " type " : " select " , " label " : " <?php echo tr('Modulo'); ?> " , " name " : " id_module_ " , " required " : 1 , " class " : " " , " values " : " list= \" 14 \" : \" Fatture di vendita \" , \" 15 \" : \" Fatture di acquisto \" " , " value " : " $id_module $ " , " extra " : " <?php echo ( $records[0] ['predefined']) ? 'readonly' : ''; ?> " ]}
2018-02-17 14:32:40 +01:00
</ div >
2018-03-21 16:57:31 +01:00
2018-03-21 19:33:33 +01:00
< div class = " col-md-3 " >
< ? php
( $records [ 0 ][ 'n_sezionali' ] < 2 ) ? $records [ 0 ][ 'predefined' ] = 1 : '' ;
?>
2018-03-21 20:56:13 +01:00
{[ " type " : " checkbox " , " label " : " <?php echo tr('Predefinito'); ?> " , " name " : " predefined " , " value " : " $predefined $ " , " help " : " <?php echo tr('Seleziona per rendere il segmento predefinito.'); ?> " , " placeholder " : " <?php echo tr('Segmento predefinito'); ?> " , " extra " : " <?php echo ( $records[0] ['predefined']) ? 'readonly' : ''; ?> " ]}
2018-03-21 19:33:33 +01:00
</ div >
2017-12-15 10:05:08 +01:00
</ div >
2018-02-17 14:32:40 +01:00
2017-12-15 10:05:08 +01:00
< div class = " row " >
< div class = " col-md-12 " >
2018-02-22 11:07:52 +01:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Note'); ?> " , " name " : " note " , " required " : 0 , " class " : " " , " value " : " $note $ " , " extra " : " " ]}
2017-12-15 10:05:08 +01:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 " >
2018-02-17 14:32:40 +01:00
2017-12-15 10:05:08 +01:00
< div class = " alert alert-info " style = " margin:0; " >
2018-03-20 01:27:59 +01:00
< h3 style = " margin:0; " >< ? php echo tr ( 'Istruzioni per il campo _FIELD_' , [
2018-02-22 11:07:52 +01:00
'_FIELD_' => tr ( 'Maschera' ),
]); ?> </h3>
2018-02-17 14:32:40 +01:00
2018-02-22 11:07:52 +01:00
< p >< font style = 'font-size:20px;' >< b > ####</b></font> <?php echo tr('Questi caratteri vengono sostituiti con il numero progressivo della fattura, vengono aggiunti zeri non significativi per raggiungere il numero desiderato di caratteri'); ?>.</p>
2018-02-17 14:32:40 +01:00
2018-02-22 11:07:52 +01:00
< p >< font style = 'font-size:20px;' >< b > YYYY </ b ></ font > < ? php echo tr ( " Questi caratteri vengono sosituiti con l'anno corrente a 4 cifre, è possibile specificare l'anno a 2 cifre con _YY_ " , [
'_YY_' => 'YY' ,
]); ?> .</p>
2017-12-15 10:05:08 +01:00
2018-02-22 11:07:52 +01:00
< p >< ? php echo tr ( " E' possibile aggiungere altri caratteri fissi, come lettere, trattini, eccetera, prima e/o dopo e/o tra le maschere _####_ e _YYYY_ " , [
'_####_' => '####' ,
'_YYYY_' => 'YYYY' ,
]); ?> .</p>
2017-12-15 10:05:08 +01:00
</ p >
</ div >
</ div >
</ div >
</ div >
</ div >
</ form >
2018-02-17 14:32:40 +01:00
< ? php
2018-03-21 19:33:33 +01:00
$array = preg_match ( '/(?<=FROM)\s([^\s]+)\s/' , $records [ 0 ][ 'options' ], $table );
2018-03-21 20:56:13 +01:00
$righe = $dbo -> fetchArray ( " SELECT COUNT(*) AS tot FROM " . $table [ 0 ] . " WHERE id_segment = " . prepare ( $id_record ));
$tot = $righe [ 0 ][ 'tot' ];
2018-03-21 19:33:33 +01:00
if ( $tot > 0 ) {
2018-03-20 01:23:17 +01:00
echo " <div class='alert alert-danger' style='margin:0px;'> " ;
2018-03-21 19:33:33 +01:00
echo tr ( " Ci sono _TOT_ righe collegate al segmento per il modulo '_MODULO_'. Il comando elimina è stato disattivato, eliminare le righe per attivare il comando 'Elimina segmento'. " , [
'_TOT_' => $tot ,
2018-03-21 16:57:31 +01:00
'_MODULO_' => $records [ 0 ][ 'modulo' ],
2018-03-20 01:23:17 +01:00
]);
echo " </div> " ;
2018-03-21 20:56:13 +01:00
}
else if ( $records [ 0 ][ 'predefined' ]) {
2018-03-20 01:23:17 +01:00
echo " <div class='alert alert-danger' style='margin:0px;'> " ;
2018-03-21 20:56:13 +01:00
echo tr ( " Questo è il segmento predefinito per il modulo '_MODULO_'. Il comando elimina è stato disattivato. " , [
2018-03-21 16:57:31 +01:00
'_MODULO_' => $records [ 0 ][ 'modulo' ],
2018-03-20 01:23:17 +01:00
]);
echo " </div> " ;
2018-03-21 20:56:13 +01:00
}
else if ( $records [ 0 ][ 'n_sezionali' ] < 2 ) {
2018-03-21 19:33:33 +01:00
echo " <div class='alert alert-danger' style='margin:0px;'> " ;
2018-03-21 20:56:13 +01:00
echo tr ( " Questo è l'unico segmento per il modulo '_MODULO_'. Il comando elimina è stato disattivato. " , [
2018-03-21 19:33:33 +01:00
'_MODULO_' => $records [ 0 ][ 'modulo' ],
]);
echo " </div> " ;
}
else {
2018-03-21 20:56:13 +01:00
echo '
< a class = " btn btn-danger ask " data - backto = " record-list " >
< i class = " fa fa-trash " ></ i > '.tr(' Elimina ').'
</ a > ' ;
2017-12-15 10:05:08 +01:00
2018-03-21 20:56:13 +01:00
}
?>