mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-11 17:10:40 +01:00
Stile del codice
This commit is contained in:
parent
e71d4dcce2
commit
87246761ea
@ -57,7 +57,6 @@ function customStructure()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$files = glob(DOCROOT.'/'.$dir.'/*/custom/ajax/*.{php,html}', GLOB_BRACE);
|
||||
foreach ($files as $file) {
|
||||
$file = str_replace(DOCROOT.'/', '', $file);
|
||||
@ -77,7 +76,6 @@ function customStructure()
|
||||
$results[] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
@ -51,7 +51,7 @@ class UpdateHook extends CachedManager
|
||||
|
||||
if (!$api['prerelease'] or setting('Abilita canale pre-release per aggiornamenti')) {
|
||||
$version[0] = ltrim($api['tag_name'], 'v');
|
||||
$version[1] = (($api['prerelease']) ? 'prerelease' : 'stable' );
|
||||
$version[1] = (($api['prerelease']) ? 'prerelease' : 'stable');
|
||||
$current = Update::getVersion();
|
||||
|
||||
if (version_compare($current, $version[0]) < 0) {
|
||||
|
@ -4,6 +4,6 @@ include_once __DIR__.'/../../core.php';
|
||||
$stati_fatturabili = ['Bozza', 'Fatturato'];
|
||||
|
||||
echo '
|
||||
<button '.(!in_array($record['stato'], $stati_fatturabili) ? '' : 'disabled').' class="btn btn-info '.(!in_array($record['stato'], $stati_fatturabili) ? '' : 'disabled tip').'" title="'.((!in_array($record['stato'], $stati_fatturabili)) ? '' : tr('Il ddt è fatturabile solo se non si trova nello stato di: ').implode(', ', $stati_fatturabili)).'" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=fattura" data-toggle="modal" data-title="'.tr('Crea fattura').(($dir=='entrata') ? ' di vendita' : ' di acquisto').'">
|
||||
<i class="fa fa-magic"></i> '.tr('Crea fattura').(($dir=='entrata') ? ' di vendita' : ' di acquisto').'
|
||||
<button '.(!in_array($record['stato'], $stati_fatturabili) ? '' : 'disabled').' class="btn btn-info '.(!in_array($record['stato'], $stati_fatturabili) ? '' : 'disabled tip').'" title="'.((!in_array($record['stato'], $stati_fatturabili)) ? '' : tr('Il ddt è fatturabile solo se non si trova nello stato di: ').implode(', ', $stati_fatturabili)).'" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=fattura" data-toggle="modal" data-title="'.tr('Crea fattura').(($dir == 'entrata') ? ' di vendita' : ' di acquisto').'">
|
||||
<i class="fa fa-magic"></i> '.tr('Crea fattura').(($dir == 'entrata') ? ' di vendita' : ' di acquisto').'
|
||||
</button>';
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
|
||||
if (!$record['predefined']) {
|
||||
$attr = '';
|
||||
} else {
|
||||
@ -10,7 +9,6 @@ if (!$record['predefined']) {
|
||||
echo '<div class="alert alert-warning">'.tr('Alcune impostazioni non possono essere modificate per questo template.').'</div>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<form action="" method="post" id="edit-form">
|
||||
<input type="hidden" name="op" value="update">
|
||||
@ -136,13 +134,11 @@ echo '
|
||||
<?php
|
||||
|
||||
if (!$record['predefined']) {
|
||||
|
||||
?>
|
||||
?>
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
@ -14,8 +14,7 @@ echo '
|
||||
</button>';
|
||||
|
||||
if ($module->name == 'Fatture di vendita') {
|
||||
|
||||
$attributi_visibili = $record['dati_aggiuntivi_fe'] != null || $record['stato'] == 'Bozza';
|
||||
$attributi_visibili = $record['dati_aggiuntivi_fe'] != null || $record['stato'] == 'Bozza';
|
||||
|
||||
echo '
|
||||
<a class="btn btn-info '.($attributi_visibili ? '' : 'disabled').'" data-toggle="modal" data-title="'.tr('Dati Fattura Elettronica').'" data-href="'.$structure->fileurl('fe/document-fe.php').'?id_module='.$id_module.'&id_record='.$id_record.'" '.($attributi_visibili ? '' : 'disabled').'>
|
||||
|
@ -159,7 +159,7 @@ if (empty($record['is_fiscale'])) {
|
||||
echo '<script>$("#link-tab_'.$plugin[0]['id'].'").addClass("disabled");</script>';
|
||||
}
|
||||
//Forzo il passaggio della fattura da Bozza ad Emessa per il corretto calcolo del numero.
|
||||
else if ($record['stato']=='Bozza') {
|
||||
elseif ($record['stato'] == 'Bozza') {
|
||||
$query .= " WHERE descrizione IN ('Emessa', 'Bozza')";
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ function add_riferimento(btn, nome, key) {
|
||||
<script>$(document).ready(init)</script>';
|
||||
|
||||
$attributi_editabili = $documento['stato'] != 'Emessa' && $documento['stato'] != 'Parzialmente pagato' && $documento['stato'] != 'Pagato';
|
||||
if (!$attributi_editabili){
|
||||
if (!$attributi_editabili) {
|
||||
echo '<script>
|
||||
$( document ).ready(function() {
|
||||
$(\'.modal-body > form button\').attr(\'disabled\', \'disabled\');
|
||||
|
@ -377,7 +377,7 @@ $riga = $intervento->getRiga($type, $id_riga);
|
||||
if (!empty($tecnico['email'])) {
|
||||
$template = Template::get('Notifica rimozione intervento');
|
||||
|
||||
if (!empty($template)){
|
||||
if (!empty($template)) {
|
||||
$mail = Mail::build(auth()->getUser(), $template, $id_record);
|
||||
$mail->addReceiver($tecnico['email']);
|
||||
$mail->save();
|
||||
|
@ -66,7 +66,7 @@ function add_tecnico($idintervento, $idtecnico, $inizio, $fine, $idcontratto = n
|
||||
if (!empty($anagrafica['email'])) {
|
||||
$template = Template::get('Notifica intervento');
|
||||
|
||||
if (!empty($template)){
|
||||
if (!empty($template)) {
|
||||
$mail = Mail::build(auth()->getUser(), $template, $idintervento);
|
||||
$mail->addReceiver($anagrafica['email']);
|
||||
$mail->save();
|
||||
|
@ -37,7 +37,7 @@ class Articoli extends Resource implements RetrieveInterface, CreateInterface
|
||||
$articolo->um = $data['um'];
|
||||
|
||||
$articolo->prezzo_unitario = $originale->prezzo_vendita;
|
||||
$articolo->costo_unitario = $originale->prezzo_acquisto;
|
||||
$articolo->costo_unitario = $originale->prezzo_acquisto;
|
||||
|
||||
$articolo->save();
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ use API\Interfaces\CreateInterface;
|
||||
use API\Interfaces\RetrieveInterface;
|
||||
use API\Interfaces\UpdateInterface;
|
||||
use API\Resource;
|
||||
use Auth;
|
||||
use Modules;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Modules\Interventi\Intervento;
|
||||
use Modules\Interventi\Stato;
|
||||
use Modules\TipiIntervento\Tipo as TipoSessione;
|
||||
use Auth;
|
||||
|
||||
class Interventi extends Resource implements RetrieveInterface, CreateInterface, UpdateInterface
|
||||
{
|
||||
@ -62,7 +62,6 @@ class Interventi extends Resource implements RetrieveInterface, CreateInterface,
|
||||
|
||||
$module = Modules::get('Interventi');
|
||||
|
||||
|
||||
$query = Modules::replaceAdditionals($module->id, $query);
|
||||
|
||||
return [
|
||||
|
@ -6,7 +6,6 @@ use API\Interfaces\CreateInterface;
|
||||
use API\Interfaces\DeleteInterface;
|
||||
use API\Interfaces\RetrieveInterface;
|
||||
use API\Resource;
|
||||
use Modules\Interventi\Components\Sessione;
|
||||
|
||||
class Sessioni extends Resource implements RetrieveInterface, CreateInterface, DeleteInterface
|
||||
{
|
||||
@ -51,6 +50,5 @@ class Sessioni extends Resource implements RetrieveInterface, CreateInterface, D
|
||||
':id_intervento' => $request['id_intervento'],
|
||||
':id_tecnico' => $user['idanagrafica'],
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ foreach ($raggruppamenti as $mese => $raggruppamento) {
|
||||
echo '
|
||||
<tr id="int_'.$r['id'].'">
|
||||
<td><a target="_blank" >'.Modules::link(Modules::get('Interventi')['id'], $r['id'], $r['codice']).'</a></td>
|
||||
<td><a target="_blank" >'.Modules::link(Modules::get('Anagrafiche')['id'], $r['idanagrafica'],$dbo->fetchOne("SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=".prepare($r['idanagrafica']))['ragione_sociale']).'</td>
|
||||
<td><a target="_blank" >'.Modules::link(Modules::get('Anagrafiche')['id'], $r['idanagrafica'], $dbo->fetchOne('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica='.prepare($r['idanagrafica']))['ragione_sociale']).'</td>
|
||||
<td>'.Translator::dateToLocale($r['data_richiesta']).'</td>
|
||||
<td>'.((empty($r['data_scadenza'])) ? ' - ' : Translator::dateToLocale($r['data_scadenza'])).'</td>
|
||||
<td>'.$dbo->fetchOne("SELECT CONCAT_WS(' - ', codice,descrizione) AS descrizione FROM in_tipiintervento WHERE idtipointervento=".prepare($r['idtipointervento']))['descrizione'].'</td>
|
||||
|
@ -158,7 +158,7 @@ if (!$anagrafiche->isEmpty()) {
|
||||
}
|
||||
|
||||
echo '
|
||||
<tr '.((empty($anagrafica->email) || empty($anagrafica->enable_newsletter)) ? 'class="bg-danger"' : '').'>
|
||||
<tr '.((empty($anagrafica->email) || empty($anagrafica->enable_newsletter)) ? 'class="bg-danger"' : '').'>
|
||||
<td>'.Modules::link('Anagrafiche', $anagrafica->id, $anagrafica->ragione_sociale).'</td>
|
||||
<td class="text-center">'.$anagrafica->email.'</td>
|
||||
<td class="text-center">'.$data.'</td>
|
||||
|
@ -9,11 +9,11 @@ switch (post('op')) {
|
||||
$email = EmailNotification::build($mail);
|
||||
|
||||
// Invio mail
|
||||
if ($email->send()){
|
||||
$mail->sent_at = date("Y-m-d H:i:s");
|
||||
if ($email->send()) {
|
||||
$mail->sent_at = date('Y-m-d H:i:s');
|
||||
$mail->save();
|
||||
flash()->info(tr('Email inviata.'));
|
||||
}else{
|
||||
} else {
|
||||
flash()->error(tr('Errore durante invio email.'));
|
||||
}
|
||||
|
||||
|
@ -5,30 +5,27 @@ include_once __DIR__.'/../../core.php';
|
||||
use Modules\Emails\Mail;
|
||||
|
||||
switch (post('op')) {
|
||||
|
||||
case 'delete-bulk':
|
||||
$i = 0;
|
||||
foreach ($id_records as $id_record) {
|
||||
|
||||
if (isset($id_record)) {
|
||||
$mail = Mail::find($id_record);
|
||||
if (empty($mail->sent_at)) {
|
||||
$mail->delete();
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($i>0){
|
||||
if ($i > 0) {
|
||||
flash()->info(tr($i.' email rimosse dalla coda di invio.'));
|
||||
}else{
|
||||
} else {
|
||||
flash()->warning(tr('Nessuna email rimossa dalla coda di invio.'));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$operations['delete-bulk'] = [
|
||||
'text' => '<span><i class="fa fa-trash"></i> '.tr('Elimina selezionati').'</span>',
|
||||
'data' => [
|
||||
@ -38,5 +35,4 @@ $operations['delete-bulk'] = [
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
return $operations;
|
@ -1,27 +1,23 @@
|
||||
<?php
|
||||
|
||||
if (( $record['attempt'] >= 10) && empty($record['sent_at'])) {
|
||||
|
||||
echo '
|
||||
if (($record['attempt'] >= 10) && empty($record['sent_at'])) {
|
||||
echo '
|
||||
<span class="label label-danger">
|
||||
<i class="fa fa-times"></i> '.tr('Email fallita il: ').Translator::timestampToLocale($record['failed_at']).'
|
||||
</span> ';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<a class="btn btn-warning ask" data-backto="record-edit" data-msg="'.tr("Rimettere in coda l'email?").'" data-op="retry" data-button="'.tr('Rimetti in coda').'" data-class="btn btn-lg btn-warning" >
|
||||
<i class="fa fa-refresh"></i> '.tr('Rimetti in coda').'
|
||||
</a>';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<a class="btn btn-info ask" data-backto="record-edit" data-msg="'.tr("Inviare immediatamente l'email?").'" data-op="send" data-button="'.tr('Invia').'" data-class="btn btn-lg btn-info" >
|
||||
<i class="fa fa-envelope"></i> '.tr('Invia immeditamente').'
|
||||
</a>';
|
||||
|
||||
}else if (!empty($record['sent_at'])) {
|
||||
|
||||
} elseif (!empty($record['sent_at'])) {
|
||||
echo '
|
||||
<span class="label label-success">
|
||||
<i class="fa fa-success"></i> '.tr('Email inviata il: ').Translator::timestampToLocale($record['sent_at']).'
|
||||
</span>';
|
||||
|
||||
}
|
@ -154,11 +154,10 @@ switch (filter('op')) {
|
||||
'description' => $description,
|
||||
'size' => $size,
|
||||
'formattedSize' => FileSystem::formatBytes($size),
|
||||
'count' => (FileSystem::fileCount($dir, ['htaccess'])? : 0),
|
||||
'dbSize' => (($description == "Allegati") ? $dbo->fetchOne("SELECT SUM(`size`) AS dbsize FROM zz_files")["dbsize"] : ""),
|
||||
'dbCount' => (($description == "Allegati") ? $dbo->fetchOne("SELECT COUNT(`id`) AS dbcount FROM zz_files")["dbcount"] : ""),
|
||||
'dbExtensions' => (($description == "Allegati") ? $dbo->fetchArray("SELECT SUBSTRING_INDEX(FILENAME, '.', -1) AS EXTENSION, COUNT(*) AS NUM FROM ZZ_FILES GROUP BY EXTENSION ORDER BY NUM DESC LIMIT 10") : ""),
|
||||
|
||||
'count' => (FileSystem::fileCount($dir, ['htaccess']) ?: 0),
|
||||
'dbSize' => (($description == 'Allegati') ? $dbo->fetchOne('SELECT SUM(`size`) AS dbsize FROM zz_files')['dbsize'] : ''),
|
||||
'dbCount' => (($description == 'Allegati') ? $dbo->fetchOne('SELECT COUNT(`id`) AS dbcount FROM zz_files')['dbcount'] : ''),
|
||||
'dbExtensions' => (($description == 'Allegati') ? $dbo->fetchArray("SELECT SUBSTRING_INDEX(FILENAME, '.', -1) AS EXTENSION, COUNT(*) AS NUM FROM ZZ_FILES GROUP BY EXTENSION ORDER BY NUM DESC LIMIT 10") : ''),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ class Login extends Resource implements CreateInterface
|
||||
$response['google_maps_token'] = setting('Google Maps API key');
|
||||
$response['prezzi_al_tecnico'] = setting('Mostra i prezzi al tecnico');
|
||||
|
||||
|
||||
$response['version'] = Update::getVersion();
|
||||
} else {
|
||||
$response = [
|
||||
|
@ -200,7 +200,6 @@ class FileManager implements ManagerInterface
|
||||
|
||||
$source = array_clean(array_column($categories, 'category'));
|
||||
|
||||
|
||||
$upload_max_filesize = \Util\FileSystem::formatBytes(ini_get('upload_max_filesize'), 0);
|
||||
//remove unit
|
||||
$upload_max_filesize = substr($upload_max_filesize, 0, strrpos($upload_max_filesize, ' '));
|
||||
@ -216,7 +215,7 @@ Dropzone.autoDiscover = false;
|
||||
$(document).ready(function() {
|
||||
var dragdrop = new Dropzone("#'.$attachment_id.' .dropzone", {
|
||||
dictDefaultMessage: "'.tr('Clicca o trascina qui per caricare uno o più file').'.<br>('.tr('Max upload: _SIZE_', [
|
||||
'_SIZE_' => $upload_max_filesize.' MB'
|
||||
'_SIZE_' => $upload_max_filesize.' MB',
|
||||
]).')",
|
||||
paramName: "file",
|
||||
maxFilesize: '.$upload_max_filesize.', // MB
|
||||
|
@ -250,7 +250,7 @@ class Uploads
|
||||
*/
|
||||
public static function delete($filename, $data)
|
||||
{
|
||||
if (!empty($filename)){
|
||||
if (!empty($filename)) {
|
||||
$database = database();
|
||||
|
||||
$name = $database->selectOne('zz_files', ['name'], [
|
||||
@ -281,6 +281,7 @@ class Uploads
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -45,22 +45,22 @@ class FileSystem
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function folderSize($path, $exclusions = array())
|
||||
public static function folderSize($path, $exclusions = [])
|
||||
{
|
||||
$total = 0;
|
||||
$path = realpath($path);
|
||||
|
||||
if ($path !== false && $path != '' && file_exists($path)) {
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object) {
|
||||
if (!in_array($object->getExtension(), $exclusions))
|
||||
if (!in_array($object->getExtension(), $exclusions)) {
|
||||
$total += $object->getSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restituisce il numero di file contenuti nella cartella indicata.
|
||||
*
|
||||
@ -68,26 +68,22 @@ class FileSystem
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function fileCount($path, $exclusions = array())
|
||||
public static function fileCount($path, $exclusions = [])
|
||||
{
|
||||
|
||||
|
||||
$total = 0;
|
||||
$path = realpath($path);
|
||||
|
||||
if ($path !== false && $path != '' && file_exists($path)) {
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object) {
|
||||
if (!in_array($object->getExtension(), $exclusions))
|
||||
$total += 1;
|
||||
if (!in_array($object->getExtension(), $exclusions)) {
|
||||
++$total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Individua la dimensione del file indicato.
|
||||
*
|
||||
|
@ -8,12 +8,12 @@ $has_images = null;
|
||||
$righe = $documento->getRighe();
|
||||
|
||||
foreach ($righe as $riga) {
|
||||
if ($riga->articolo->immagine){
|
||||
if ($riga->articolo->immagine) {
|
||||
$has_images = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$pagamento = $dbo->fetchOne('SELECT * FROM co_pagamenti WHERE id = '.$documento['idpagamento']);
|
||||
if (!empty($pagamento['idconto_vendite'])){
|
||||
if (!empty($pagamento['idconto_vendite'])) {
|
||||
$banca = $dbo->fetchOne('SELECT co_banche.nome, co_banche.iban, co_banche.bic FROM co_banche INNER JOIN co_pianodeiconti3 ON co_banche.id_pianodeiconti3 = co_pianodeiconti3.id WHERE co_pianodeiconti3.id = '.$pagamento['idconto_vendite']);
|
||||
}
|
||||
|
||||
@ -103,10 +103,9 @@ echo "
|
||||
<tr>
|
||||
<th class='text-center'>#</th>";
|
||||
|
||||
if ($has_images){
|
||||
echo "
|
||||
if ($has_images) {
|
||||
echo "
|
||||
<th class='text-center' width='95' >Foto</th>";
|
||||
|
||||
}
|
||||
|
||||
echo "
|
||||
@ -126,7 +125,6 @@ echo '
|
||||
|
||||
<tbody>';
|
||||
|
||||
|
||||
foreach ($righe as $riga) {
|
||||
$r = $riga->toArray();
|
||||
|
||||
@ -135,17 +133,15 @@ foreach ($righe as $riga) {
|
||||
echo '
|
||||
<tr>';
|
||||
|
||||
|
||||
echo"
|
||||
<td class=\"text-center\" style=\"vertical-align: middle\" >
|
||||
".($r['order'] + 1)."</td>";
|
||||
|
||||
echo'
|
||||
<td class="text-center" style="vertical-align: middle" >
|
||||
'.($r['order'] + 1).'</td>';
|
||||
|
||||
if ($has_images) {
|
||||
echo '<td class=\"text-center\" style=\"vertical-align: middle\" >';
|
||||
if (!empty($riga->articolo->immagine)) {
|
||||
echo '<img src="files/articoli/'.$riga->articolo->immagine.'" width="78">';
|
||||
}
|
||||
if (!empty($riga->articolo->immagine)) {
|
||||
echo '<img src="files/articoli/'.$riga->articolo->immagine.'" width="78">';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
@ -304,7 +300,6 @@ echo'
|
||||
|
||||
// CONDIZIONI GENERALI DI FORNITURA
|
||||
|
||||
|
||||
echo '
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user