Funzione input per HTML semplificato
This commit is contained in:
parent
4f157aa519
commit
23befd5c81
|
@ -5,6 +5,7 @@
|
|||
*
|
||||
* @since 2.4.2
|
||||
*/
|
||||
use HTMLBuilder\HTMLBuilder;
|
||||
|
||||
/**
|
||||
* Restituisce l'oggetto dedicato alla gestione della connessione con il database.
|
||||
|
@ -261,3 +262,17 @@ function moneyFormat($number, $decimals = null)
|
|||
'_CURRENCY_' => currency(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce il numero indicato formattato come una valuta secondo la configurazione del sistema.
|
||||
*
|
||||
* @param array $json
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 2.4.11
|
||||
*/
|
||||
function input(array $json)
|
||||
{
|
||||
return HTMLBuilder::parse($json);
|
||||
}
|
||||
|
|
|
@ -106,5 +106,4 @@ class Articolo extends Model
|
|||
{
|
||||
return $this->hasMany(ArticoloIntervento::class, 'idarticolo');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ if ($module['name'] == 'Ddt di vendita') {
|
|||
|
||||
$id_tipoddt = $dbo->fetchOne("SELECT id FROM dt_tipiddt WHERE descrizione='Ddt in uscita'")['id'];
|
||||
|
||||
$tipo_anagrafica = tr('Cliente');
|
||||
$label = tr('Destinatario');
|
||||
$tipo_anagrafica = tr('Cliente');
|
||||
$label = tr('Destinatario');
|
||||
} else {
|
||||
$dir = 'uscita';
|
||||
|
||||
$id_tipoddt = $dbo->fetchOne("SELECT id FROM dt_tipiddt WHERE descrizione='Ddt in entrata'")['id'];
|
||||
|
||||
$tipo_anagrafica = tr('Fornitore');
|
||||
$label = tr('Mittente');
|
||||
$tipo_anagrafica = tr('Fornitore');
|
||||
$label = tr('Mittente');
|
||||
}
|
||||
|
||||
$id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idanagrafica'];
|
||||
|
|
|
@ -498,7 +498,7 @@ if (!$block_edit) {
|
|||
</div>';
|
||||
|
||||
// Lettura preventivi accettati, in attesa di conferma o in lavorazione
|
||||
$prev_query = 'SELECT COUNT(*) AS tot FROM co_preventivi WHERE idanagrafica='.prepare($record['idanagrafica'])." AND idstato IN(SELECT id FROM co_statipreventivi WHERE is_fatturabile = 1) AND default_revision=1 AND co_preventivi.id IN (SELECT idpreventivo FROM co_righe_preventivi WHERE co_righe_preventivi.idpreventivo = co_preventivi.id AND (qta - qta_evasa) > 0)";
|
||||
$prev_query = 'SELECT COUNT(*) AS tot FROM co_preventivi WHERE idanagrafica='.prepare($record['idanagrafica']).' AND idstato IN(SELECT id FROM co_statipreventivi WHERE is_fatturabile = 1) AND default_revision=1 AND co_preventivi.id IN (SELECT idpreventivo FROM co_righe_preventivi WHERE co_righe_preventivi.idpreventivo = co_preventivi.id AND (qta - qta_evasa) > 0)';
|
||||
$preventivi = $dbo->fetchArray($prev_query)[0]['tot'];
|
||||
echo '
|
||||
<div class="tip" style="display:inline;">
|
||||
|
|
|
@ -52,7 +52,7 @@ if ($options != '' && $options != 'menu' && $options != 'custom') {
|
|||
$module_query = Util\Query::getQuery(Module::find($id_record));
|
||||
|
||||
$beautiful_query = nl2br(htmlentities($module_query));
|
||||
$beautiful_query = str_replace(' ',' ',$beautiful_query);
|
||||
$beautiful_query = str_replace(' ', ' ', $beautiful_query);
|
||||
|
||||
echo '
|
||||
<div class="row">
|
||||
|
|
|
@ -157,6 +157,36 @@ class HTMLBuilder
|
|||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Esegue la sostituzione per un singolo tag personalizzato con il relativo codice HTML.
|
||||
*
|
||||
* @param array $json
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function parse(array $json)
|
||||
{
|
||||
$result = null;
|
||||
try {
|
||||
$result = self::generate($json);
|
||||
} catch (\Exception $exception) {
|
||||
logger()->error($exception->getMessage(), [
|
||||
'code' => $exception->getCode(),
|
||||
'message' => $exception->getMessage(),
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
'trace' => $exception->getTraceAsString(),
|
||||
]);
|
||||
}
|
||||
|
||||
// Ricorsione
|
||||
if ($depth < self::$max_recursion) {
|
||||
$result = self::replace($result, $depth + 1);
|
||||
}
|
||||
|
||||
return !empty($result) ? $result : json_encode($json);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce il nome della classe resposabile per la gestione di una determinata tipologia di tag di input.
|
||||
*
|
||||
|
|
|
@ -38,8 +38,9 @@ abstract class CachedManager extends Manager
|
|||
$cache = database()->selectOne('zz_hook_cache', '*', ['hook_id' => $hook->id], ['id' => 'DESC']);
|
||||
|
||||
// Interpretazione della cache
|
||||
if (isset($cache['results']))
|
||||
$cache['results'] = json_decode($cache['results'], true);
|
||||
if (isset($cache['results'])) {
|
||||
$cache['results'] = json_decode($cache['results'], true);
|
||||
}
|
||||
|
||||
self::$cache = $cache;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue