2018-05-11 15:56:08 +02:00
< ? php
include_once __DIR__ . '/../../core.php' ;
?> <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
2018-03-22 12:45:29 +01:00
<!-- DATI SEGMENTO -->
2017-12-15 10:05:08 +01:00
< 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-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
< div class = " col-md-4 " >
2018-05-11 15:56:08 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Nome'); ?> " , " name " : " name " , " required " : 1 , " value " : " $name $ " ]}
2017-12-15 10:05:08 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
< div class = " col-md-4 " >
2018-07-18 15:20:10 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Modulo'); ?> " , " name " : " module " , " required " : 1 , " values " : " query=SELECT id, name AS descrizione FROM zz_modules WHERE ( enabled = 1 AND options != 'custom' ) OR id = <?php echo $record['id_module'] ; ?> ORDER BY name ASC " , " value " : " $id_module $ " , " extra " : " <?php echo ( $record['predefined'] ) ? 'readonly' : ''; ?> " ]}
2018-02-17 14:32:40 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
< div class = " col-md-4 " >
2018-03-21 19:33:33 +01:00
< ? php
2018-07-18 15:20:10 +02:00
//($record['n_sezionali']<2) ? $record['predefined']=1 : '';
2018-03-22 15:40:20 +01:00
?>
2018-07-18 15:20:10 +02: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 ( $record['predefined'] ) ? 'readonly' : ''; ?> " ]}
2018-03-21 19:33:33 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2017-12-15 10:05:08 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2018-08-21 10:11:30 +02:00
< div class = 'row' >
< div class = " col-md-4 " >
{[ " type " : " checkbox " , " label " : " <?php echo tr('Predefinito note di accredito'); ?> " , " name " : " predefined_accredito " , " value " : " $predefined_accredito $ " , " help " : " <?php echo tr('Seleziona per rendere il segmento predefinito per le note di accredito.'); ?> " , " placeholder " : " <?php echo tr('Segmento predefinito per le note di accredito'); ?> " ]}
</ div >
< div class = " col-md-4 " >
{[ " type " : " checkbox " , " label " : " <?php echo tr('Predefinito note di addebito'); ?> " , " name " : " predefined_addebito " , " value " : " $predefined_addebito $ " , " help " : " <?php echo tr('Seleziona per rendere il segmento predefinito per le note di addebito.'); ?> " , " placeholder " : " <?php echo tr('Segmento predefinito per le note di addebito'); ?> " ]}
2018-03-21 19:33:33 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2017-12-15 10:05:08 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
< div class = " row " >
2018-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
< div class = " col-md-8 " >
2018-05-11 15:56:08 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Filtro'); ?> " , " name " : " clause " , " required " : 1 , " value " : " $clause $ " ]}
2018-03-22 12:45:29 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
< div class = " col-md-4 " >
2018-08-11 15:49:46 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Posizione'); ?> " , " name " : " position " , " required " : 1 , " values " : " list= \" WHR \" : \" WHERE \" , \" HVN \" : \" HAVING \" " , " value " : " $position $ " ]}
2018-03-22 12:45:29 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
</ div >
2018-05-11 15:56:08 +02:00
2017-12-15 10:05:08 +01:00
< div class = " row " >
< div class = " col-md-12 " >
2018-08-03 09:34:06 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Note'); ?> " , " name " : " note " , " value " : " $note $ " ]}
2017-12-15 10:05:08 +01:00
</ div >
</ div >
2018-03-22 12:45:29 +01:00
</ div >
</ div >
2018-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
<!-- Campi extra -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
< h3 class = " panel-title " >< ? php echo tr ( 'Extra' ); ?> </h3>
</ div >
< div class = " panel-body " >
< div class = " row " >
2018-05-11 15:56:08 +02:00
2018-03-22 12:45:29 +01:00
< div class = " col-md-3 " >
2018-08-03 09:34:06 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Maschera'); ?> " , " name " : " pattern " , " class " : " alphanumeric-mask " , " value " : " $pattern $ " , " maxlength " : 25 , " placeholder " : " ####/YY " , " extra " : " <?php echo ( $tot > 0) ? 'readonly' : ''; ?> " ]}
2018-03-22 12:45:29 +01:00
</ div >
</ div >
2018-05-11 15:56:08 +02:00
2018-09-04 10:14:42 +02:00
<!-- Istruzioni per il contenuto -->
< div class = " box box-info " >
< div class = " box-header " >
< h3 class = " box-title " >< ? php echo tr ( 'Istruzioni per il campo _FIELD_' , [
'_FIELD_' => tr ( 'Maschera' ),
]); ?> </h3>
</ div >
< div class = " box-body " >
< p >< ? php echo tr ( 'Le seguenti sequenze di testo vengono sostituite nel seguente modo' ); ?> :</p>
< ul >
< ? php
$list = [
'####' => tr ( 'Numero progressivo del documento, con zeri non significativi per raggiungere il numero desiderato di caratteri' ),
'YYYY' => tr ( 'Anno corrente a 4 cifre' ),
'yy' => tr ( 'Anno corrente a 2 cifre' ),
];
foreach ( $list as $key => $value ) {
echo '
< li > '.tr(' _TEXT_ : _FIELD_ ' , [
'_TEXT_' => '<code>' . $key . '</code>' ,
'_FIELD_' => $value ,
]) . '</li>' ;
}
2017-12-15 10:05:08 +01:00
2018-09-04 10:14:42 +02:00
?>
</ ul >
2018-05-11 15:56:08 +02:00
2018-09-04 10:14:42 +02:00
< p >< ? php echo tr ( " E' inoltre possibile aggiungere altri caratteri fissi (come lettere, trattini, eccetera) prima e/o dopo le sequenze di cui sopra " ); ?> .</p>
</ div >
</ div >
2018-05-11 15:56:08 +02:00
2017-12-15 10:05:08 +01:00
</ div >
</ div >
</ form >
2018-02-17 14:32:40 +01:00
< ? php
2018-09-04 10:14:42 +02:00
2018-09-04 12:34:54 +02:00
$array = preg_match ( '/(?<=FROM)\s([^\s]+)\s/' , $record [ 'options' ], $table );
2018-09-04 10:14:42 +02:00
if ( strpos ( $table [ 0 ], 'co_documenti' ) !== false ) {
$righe = $dbo -> fetchArray ( 'SELECT COUNT(*) AS tot FROM ' . $table [ 0 ] . ' WHERE id_segment = ' . prepare ( $id_record ));
$tot = $righe [ 0 ][ 'tot' ];
}
2018-05-11 15:56:08 +02:00
if ( $tot > 0 ) {
2018-09-04 10:14:42 +02:00
echo " <div class='alert alert-danger' style='margin:0px;'> " ;
2018-05-11 15:56:08 +02:00
2018-09-04 10:14:42 +02: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'. " , [
2018-05-11 15:56:08 +02:00
'_TOT_' => $tot ,
2018-07-18 15:20:10 +02:00
'_MODULO_' => $record [ 'modulo' ],
2018-05-11 15:56:08 +02:00
]);
2018-09-04 10:14:42 +02:00
echo '</div>' ;
2018-09-04 12:34:54 +02:00
} elseif ( $records [ 'predefined' ]) {
2018-09-04 10:14:42 +02:00
echo " <div class='alert alert-danger' style='margin:0px;'> " ;
2018-05-11 15:56:08 +02:00
2018-09-04 10:14:42 +02:00
echo tr ( " Questo è il segmento predefinito per il modulo '_MODULO_'. Il comando elimina è stato disattivato. " , [
2018-07-18 15:20:10 +02:00
'_MODULO_' => $record [ 'modulo' ],
2018-05-11 15:56:08 +02:00
]);
2018-09-04 10:14:42 +02:00
echo '</div>' ;
2018-09-04 12:34:54 +02:00
} elseif ( $record [ 'n_sezionali' ] < 2 ) {
2018-09-04 10:14:42 +02:00
echo " <div class='alert alert-danger' style='margin:0px;'> " ;
2018-05-11 15:56:08 +02:00
2018-09-04 10:14:42 +02:00
echo tr ( " Questo è l'unico segmento per il modulo '_MODULO_'. Il comando elimina è stato disattivato. " , [
2018-07-18 15:20:10 +02:00
'_MODULO_' => $record [ 'modulo' ],
2018-05-11 15:56:08 +02:00
]);
2018-09-04 10:14:42 +02:00
echo '</div>' ;
} else {
echo '
2018-05-11 15:56:08 +02:00
< a class = " btn btn-danger ask " data - backto = " record-list " >
< i class = " fa fa-trash " ></ i > '.tr(' Elimina ').'
</ a > ' ;
2018-09-04 10:14:42 +02:00
}
2018-05-11 15:56:08 +02:00
?>