mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 11:30:55 +01:00
Fix del codice
Rimozione della traduzione dell'URL openstamanager.com (se necessaria, introdurre una Impostazione). Correzione nome campo idsedi in sedi per l'utente autenticato.
This commit is contained in:
parent
b568df28fa
commit
8839e00653
@ -14,7 +14,7 @@ if (!isset($resource)) {
|
||||
$elements = (!is_array($elements)) ? explode(',', $elements) : $elements;
|
||||
|
||||
$results = AJAX::select($op, $elements, $search, $page, $length);
|
||||
|
||||
|
||||
echo json_encode($results);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ if (Auth::check()) {
|
||||
</aside><!-- /.content-wrapper -->
|
||||
|
||||
<footer class="main-footer">
|
||||
<a class="hidden-xs" href="'.tr("https://www.openstamanager.com").'" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione").'." target="_blank"><strong>'.tr('OpenSTAManager').'</strong></a>
|
||||
<a class="hidden-xs" href="https://www.openstamanager.com" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione").'." target="_blank"><strong>'.tr('OpenSTAManager').'</strong></a>
|
||||
<span class="pull-right hidden-xs">
|
||||
<strong>'.tr('Versione').'</strong> '.$version.'
|
||||
<small class="text-muted">('.(!empty($revision) ? $revision : tr('In sviluppo')).')</small>
|
||||
|
@ -201,7 +201,7 @@ if (Auth::check()) {
|
||||
<div id="tiny-loader" style="display:none;"></div>
|
||||
|
||||
<header class="main-header">
|
||||
<a href="'.tr("https://www.openstamanager.com").'" class="logo" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione").'" target="_blank">
|
||||
<a href="https://www.openstamanager.com" class="logo" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione").'" target="_blank">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini">'.tr('OSM').'</span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
|
@ -81,15 +81,13 @@ switch (post('op')) {
|
||||
$idanagrafica = $dbo->fetchOne('SELECT GROUP_CONCAT(idanagrafica) AS idanagrafica FROM an_anagrafiche WHERE codice_fiscale = '.prepare(post('codice_fiscale')).' AND idanagrafica != '.prepare($id_record))['idanagrafica'];
|
||||
|
||||
if (!empty($idanagrafica)) {
|
||||
|
||||
$array = explode(',', $idanagrafica);
|
||||
foreach($array as &$value) {
|
||||
foreach ($array as $value) {
|
||||
flash()->warning(tr('Attenzione: il codice fiscale _COD_ è già stato censito _LINK_', [
|
||||
'_COD_' => post('codice_fiscale'),
|
||||
'_LINK_' => Modules::link('Anagrafiche', $value, null, null, ''),
|
||||
'_LINK_' => Modules::link('Anagrafiche', $value, null, null, ''),
|
||||
]));
|
||||
}
|
||||
|
||||
} else {
|
||||
$anagrafica->codice_fiscale = post('codice_fiscale');
|
||||
}
|
||||
@ -103,13 +101,12 @@ switch (post('op')) {
|
||||
|
||||
if (!empty($idanagrafica)) {
|
||||
$array = explode(',', $idanagrafica);
|
||||
foreach($array as &$value) {
|
||||
foreach ($array as $value) {
|
||||
flash()->warning(tr('Attenzione: la partita IVA _IVA_ è già stata censita _LINK_', [
|
||||
'_IVA_' => post('piva'),
|
||||
'_LINK_' => Modules::link('Anagrafiche', $value, null, null, ''),
|
||||
'_LINK_' => Modules::link('Anagrafiche', $value, null, null, ''),
|
||||
]));
|
||||
}
|
||||
|
||||
} else {
|
||||
$anagrafica->partita_iva = post('piva');
|
||||
}
|
||||
|
@ -220,20 +220,20 @@ switch ($resource) {
|
||||
$user = Auth::user();
|
||||
|
||||
$query = "SELECT * FROM (SELECT '0' AS id, CONCAT_WS(' - ', 'Sede legale' , (SELECT CONCAT (citta, ' (', ragione_sociale,')') FROM an_anagrafiche |where|)) AS descrizione UNION SELECT id, CONCAT_WS(' - ', nomesede, citta) FROM an_sedi |where|) AS tab |filter| ORDER BY descrizione";
|
||||
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'id='.prepare($element);
|
||||
}
|
||||
|
||||
$where[] = 'idanagrafica='.prepare($user->idanagrafica);
|
||||
$where[] = 'id IN('.implode(',', $user->idsedi).')';
|
||||
$where[] = 'id IN('.implode(',', $user->sedi).')';
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'nomesede LIKE '.prepare('%'.$search.'%');
|
||||
$search_fields[] = 'citta LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'referenti':
|
||||
|
@ -5,22 +5,20 @@ include_once __DIR__.'/../../core.php';
|
||||
switch (post('op')) {
|
||||
// Aggiunta articolo
|
||||
case 'add':
|
||||
|
||||
|
||||
//Se non specifico il codice articolo lo imposto uguale all'id della riga
|
||||
if (empty(post('codice'))){
|
||||
if (empty(post('codice'))) {
|
||||
$codice = $dbo->fetchOne('SELECT (MAX(id)+1) as codice FROM mg_articoli')['codice'];
|
||||
}else{
|
||||
} else {
|
||||
$codice = post('codice');
|
||||
}
|
||||
|
||||
// Inserisco l'articolo e avviso se esiste un altro articolo con stesso codice.
|
||||
if ($n = $dbo->fetchNum('SELECT * FROM mg_articoli WHERE codice='.prepare($codice)) > 0) {
|
||||
|
||||
flash()->warning(tr('Attenzione: il codice _CODICE_ è già stato utilizzato _N_ volta', [
|
||||
'_CODICE_' => $codice,
|
||||
'_N_' => $n,
|
||||
]));
|
||||
|
||||
}
|
||||
|
||||
$dbo->insert('mg_articoli', [
|
||||
@ -47,12 +45,10 @@ switch (post('op')) {
|
||||
|
||||
// Inserisco l'articolo e avviso se esiste un altro articolo con stesso codice.
|
||||
if ($n = $dbo->fetchNum('SELECT * FROM mg_articoli WHERE codice='.prepare(post('codice')).' AND id != '.$id_record.'') > 0) {
|
||||
|
||||
flash()->warning(tr('Attenzione: il codice _CODICE_ è già stato utilizzato _N_ volta', [
|
||||
'_CODICE_' => post('codice'),
|
||||
'_N_' => $n,
|
||||
]));
|
||||
|
||||
}
|
||||
|
||||
$dbo->update('mg_articoli', [
|
||||
|
@ -390,9 +390,8 @@ if (!empty($elementi)) {
|
||||
<div class="alert alert-error">
|
||||
'.tr('Eliminando questo documento si potrebbero verificare problemi nelle altre sezioni del gestionale').'.
|
||||
</div>';
|
||||
}else{
|
||||
|
||||
?>
|
||||
} else {
|
||||
?>
|
||||
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$sedi = $dbo->fetchArray( '(SELECT "0" AS id, "Sede legale" AS nomesede) UNION (SELECT id, CONCAT(nomesede, " - ", citta ) AS nomesede FROM an_sedi WHERE idanagrafica='.prepare(setting('Azienda predefinita')).')' );
|
||||
$sedi = $dbo->fetchArray('(SELECT "0" AS id, "Sede legale" AS nomesede) UNION (SELECT id, CONCAT(nomesede, " - ", citta ) AS nomesede FROM an_sedi WHERE idanagrafica='.prepare(setting('Azienda predefinita')).')');
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
@ -22,16 +22,16 @@ $sedi = $dbo->fetchArray( '(SELECT "0" AS id, "Sede legale" AS nomesede) UNION (
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($sedi as $sede) {
|
||||
// Lettura movimenti della sede
|
||||
$qta_azienda = $dbo->fetchOne("SELECT SUM(mg_movimenti.qta) AS qta, IF(mg_movimenti.idsede_azienda= 0,'Sede legale',(CONCAT_WS(' - ',an_sedi.nomesede,an_sedi.citta))) as sede FROM mg_movimenti LEFT JOIN an_sedi ON an_sedi.id = mg_movimenti.idsede_azienda WHERE mg_movimenti.idarticolo=".prepare($id_record).' AND idsede_azienda='.prepare($sede['id']).' GROUP BY idsede_azienda');
|
||||
// Lettura movimenti della sede
|
||||
$qta_azienda = $dbo->fetchOne("SELECT SUM(mg_movimenti.qta) AS qta, IF(mg_movimenti.idsede_azienda= 0,'Sede legale',(CONCAT_WS(' - ',an_sedi.nomesede,an_sedi.citta))) as sede FROM mg_movimenti LEFT JOIN an_sedi ON an_sedi.id = mg_movimenti.idsede_azienda WHERE mg_movimenti.idarticolo=".prepare($id_record).' AND idsede_azienda='.prepare($sede['id']).' GROUP BY idsede_azienda');
|
||||
|
||||
// Lettura eventuali movimenti ad una propria sede
|
||||
$qta_controparte = $dbo->fetchOne("SELECT SUM(mg_movimenti.qta) AS qta, IF(mg_movimenti.idsede_controparte= 0,'Sede legale',(CONCAT_WS(' - ',an_sedi.nomesede,an_sedi.citta))) as sede FROM mg_movimenti LEFT JOIN an_sedi ON an_sedi.id = mg_movimenti.idsede_controparte WHERE mg_movimenti.idarticolo=".prepare($id_record)." AND idsede_controparte=".prepare($sede['id'])." GROUP BY idsede_controparte");
|
||||
// Lettura eventuali movimenti ad una propria sede
|
||||
$qta_controparte = $dbo->fetchOne("SELECT SUM(mg_movimenti.qta) AS qta, IF(mg_movimenti.idsede_controparte= 0,'Sede legale',(CONCAT_WS(' - ',an_sedi.nomesede,an_sedi.citta))) as sede FROM mg_movimenti LEFT JOIN an_sedi ON an_sedi.id = mg_movimenti.idsede_controparte WHERE mg_movimenti.idarticolo=".prepare($id_record).' AND idsede_controparte='.prepare($sede['id']).' GROUP BY idsede_controparte');
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.$sede['nomesede'].'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($qta_azienda['qta'] - $qta_controparte['qta'] ).'</td>
|
||||
<td class="text-right">'.Translator::numberToLocale($qta_azienda['qta'] - $qta_controparte['qta']).'</td>
|
||||
</tr>';
|
||||
} ?>
|
||||
</tbody>
|
||||
|
@ -398,7 +398,7 @@ switch (post('op')) {
|
||||
case 'import':
|
||||
|
||||
$rs = $dbo->fetchArray('SELECT * FROM co_contratti_tipiintervento WHERE idcontratto = '.prepare(post('idcontratto')).' AND idtipointervento='.prepare(post('idtipointervento')));
|
||||
|
||||
|
||||
// Se la riga in_tipiintervento esiste, la aggiorno...
|
||||
if (!empty($rs)) {
|
||||
$result = $dbo->query('UPDATE co_contratti_tipiintervento SET '
|
||||
@ -426,7 +426,5 @@ switch (post('op')) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -326,9 +326,9 @@ if (!empty($elementi)) {
|
||||
|
||||
<?php
|
||||
// Eliminazione ddt solo se ho accesso alla sede aziendale
|
||||
$field_name = ( $dir == 'entrata' ) ? 'idsede_partenza' : 'idsede_destinazione';
|
||||
if (in_array($record[$field_name], $user->idsedi)){
|
||||
?>
|
||||
$field_name = ($dir == 'entrata') ? 'idsede_partenza' : 'idsede_destinazione';
|
||||
if (in_array($record[$field_name], $user->sedi)) {
|
||||
?>
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||
</a>
|
||||
|
@ -28,9 +28,8 @@ if (isset($id_record)) {
|
||||
}
|
||||
|
||||
// Se la sede del ddt non è di mia competenza, blocco il ddt in modifica
|
||||
$field_name = ( $dir == 'entrata' ) ? 'idsede_partenza' : 'idsede_destinazione';
|
||||
if (!in_array($record[$field_name], $user->idsedi)){
|
||||
$field_name = ($dir == 'entrata') ? 'idsede_partenza' : 'idsede_destinazione';
|
||||
if (!in_array($record[$field_name], $user->sedi)) {
|
||||
$record['flag_completato'] = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
namespace Modules\DDT;
|
||||
|
||||
use Auth;
|
||||
use Common\Document;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Traits\RecordTrait;
|
||||
use Util\Generator;
|
||||
use Auth;
|
||||
|
||||
class DDT extends Document
|
||||
{
|
||||
@ -70,9 +70,9 @@ class DDT extends Document
|
||||
|
||||
// Imposto, come sede aziendale, la prima sede disponibile come utente
|
||||
if ($direzione == 'entrata') {
|
||||
$model->idsede_partenza = $user->idsedi[0];
|
||||
$model->idsede_partenza = $user->sedi[0];
|
||||
} else {
|
||||
$model->idsede_destinazione = $user->idsedi[0];
|
||||
$model->idsede_destinazione = $user->sedi[0];
|
||||
}
|
||||
|
||||
$model->save();
|
||||
|
@ -47,8 +47,7 @@ $rs = $dbo->fetchArray('SELECT
|
||||
AND NOT in_interventi.id IN (SELECT idintervento FROM co_promemoria WHERE idintervento IS NOT NULL)');
|
||||
foreach ($rs as $key => $value) {
|
||||
$rs[$key]['prezzo'] = Translator::numberToLocale(get_costi_intervento($value['id'])['totale']);
|
||||
$rs[$key]['descrizione_intervento'] = strip_tags ($rs[$key]['descrizione_intervento']);
|
||||
|
||||
$rs[$key]['descrizione_intervento'] = strip_tags($rs[$key]['descrizione_intervento']);
|
||||
}
|
||||
|
||||
// Intervento
|
||||
|
@ -3,8 +3,8 @@
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
use Modules\Fatture\Fattura;
|
||||
use Util\Zip;
|
||||
use Plugins\ExportFE\FatturaElettronica;
|
||||
use Util\Zip;
|
||||
|
||||
switch (post('op')) {
|
||||
case 'export-bulk':
|
||||
@ -65,26 +65,24 @@ switch (post('op')) {
|
||||
break;
|
||||
|
||||
case 'genera-xml':
|
||||
|
||||
$failed = [];
|
||||
$added = [];
|
||||
|
||||
foreach ($id_records as $id) {
|
||||
|
||||
$failed = [];
|
||||
$added = [];
|
||||
|
||||
foreach ($id_records as $id) {
|
||||
$fattura = Fattura::find($id);
|
||||
$fe = new \Plugins\ExportFE\FatturaElettronica($fattura->id);
|
||||
|
||||
|
||||
//se la fattura è emessa e non è stata generata la fattura elettronica
|
||||
if ($fattura->idstatodocumento==3 and !($fe->isGenerated())){
|
||||
if ($fattura->stato->descrizione == 'Emessa' and !($fe->isGenerated())) {
|
||||
$fattura_pa = new FatturaElettronica($id);
|
||||
if (!empty($fattura_pa)) {
|
||||
$file = $fattura_pa->save($upload_dir);
|
||||
$added[] = $fattura->numero_esterno;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$failed[] = $fattura->numero_esterno;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!empty($failed)) {
|
||||
@ -152,7 +150,7 @@ switch (post('op')) {
|
||||
$result = copy($file, $dest);
|
||||
|
||||
if ($result) {
|
||||
$added++;
|
||||
++$added;
|
||||
operationLog('export-xml-bulk', ['id_record' => $r['id']]);
|
||||
} else {
|
||||
$failed[] = $fattura->numero_esterno;
|
||||
@ -161,7 +159,7 @@ switch (post('op')) {
|
||||
}
|
||||
|
||||
// Creazione zip
|
||||
if (extension_loaded('zip') and !empty($added) ) {
|
||||
if (extension_loaded('zip') and !empty($added)) {
|
||||
Zip::create($dir.'tmp/', $zip);
|
||||
|
||||
// Invio al browser il file zip
|
||||
@ -340,7 +338,6 @@ $operations['registra-contabile'] = [
|
||||
];
|
||||
|
||||
if ($module->name == 'Fatture di vendita') {
|
||||
|
||||
$operations['genera-xml'] = [
|
||||
'text' => '<span><i class="fa fa-file-code-o" ></i> '.tr('Genera fatture elettroniche').'</span>',
|
||||
'data' => [
|
||||
@ -352,9 +349,8 @@ if ($module->name == 'Fatture di vendita') {
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$operations['export-bulk'] = [
|
||||
'text' => '<span class="'.((!extension_loaded('zip')) ? 'text-muted disabled' :'').'"><i class="fa fa-file-archive-o" ></i> '.tr('Esporta stampe').'</span>',
|
||||
'text' => '<span class="'.((!extension_loaded('zip')) ? 'text-muted disabled' : '').'"><i class="fa fa-file-archive-o" ></i> '.tr('Esporta stampe').'</span>',
|
||||
'data' => [
|
||||
'title' => '',
|
||||
'msg' => tr('Vuoi davvero esportare i PDF delle fatture selezionate in un archivio ZIP?'),
|
||||
@ -366,7 +362,7 @@ if ($module->name == 'Fatture di vendita') {
|
||||
}
|
||||
|
||||
$operations['export-xml-bulk'] = [
|
||||
'text' => '<span class="'.((!extension_loaded('zip')) ? 'text-muted disabled' :'').'"><i class="fa fa-file-archive-o" ></i> '.tr('Esporta XML').'</span>',
|
||||
'text' => '<span class="'.((!extension_loaded('zip')) ? 'text-muted disabled' : '').'"><i class="fa fa-file-archive-o" ></i> '.tr('Esporta XML').'</span>',
|
||||
'data' => [
|
||||
'title' => '',
|
||||
'msg' => tr('Vuoi davvero esportare le fatture elettroniche selezionate in un archivio ZIP?'),
|
||||
|
@ -183,12 +183,12 @@ if (empty($record['is_fiscale'])) {
|
||||
</div>
|
||||
|
||||
<?php if ($dir == 'entrata') {
|
||||
?>
|
||||
?>
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "<?php echo tr('Agente di riferimento'); ?>", "name": "idagente", "ajax-source": "agenti", "value": "$idagente_fattura$" ]}
|
||||
</div>
|
||||
<?php
|
||||
} ?>
|
||||
} ?>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
@ -632,7 +632,7 @@ echo '
|
||||
session_set("superselect,idanagrafica", $(this).val(), 0);';
|
||||
if ($dir == 'entrata') {
|
||||
echo '$("#idsede_destinazione").selectReset();';
|
||||
}else{
|
||||
} else {
|
||||
echo '$("#idsede_partenza").selectReset();';
|
||||
}
|
||||
echo '
|
||||
@ -677,9 +677,9 @@ if (!empty($note_accredito)) {
|
||||
|
||||
<?php
|
||||
// Eliminazione ddt solo se ho accesso alla sede aziendale
|
||||
$field_name = ( $dir == 'entrata' ) ? 'idsede_partenza' : 'idsede_uscita';
|
||||
if (in_array($record[$field_name], $user->idsedi)){
|
||||
?>
|
||||
$field_name = ($dir == 'entrata') ? 'idsede_partenza' : 'idsede_uscita';
|
||||
if (in_array($record[$field_name], $user->sedi)) {
|
||||
?>
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||
</a>
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\Fatture;
|
||||
|
||||
use Auth;
|
||||
use Common\Document;
|
||||
use Modules\Anagrafiche\Anagrafica;
|
||||
use Modules\Fatture\Components\Riga;
|
||||
@ -10,7 +11,6 @@ use Modules\RitenuteContributi\RitenutaContributi;
|
||||
use Plugins\ExportFE\FatturaElettronica;
|
||||
use Traits\RecordTrait;
|
||||
use Util\Generator;
|
||||
use Auth;
|
||||
|
||||
class Fattura extends Document
|
||||
{
|
||||
@ -89,9 +89,9 @@ class Fattura extends Document
|
||||
|
||||
// Imposto, come sede aziendale, la prima sede disponibile come utente
|
||||
if ($dir == 'entrata') {
|
||||
$model->idsede_destinazione = $user->idsedi[0];
|
||||
$model->idsede_destinazione = $user->sedi[0];
|
||||
} else {
|
||||
$model->idsede_partenza = $user->idsedi[0];
|
||||
$model->idsede_partenza = $user->sedi[0];
|
||||
}
|
||||
$model->addebita_bollo = setting('Addebita marca da bollo al cliente');
|
||||
|
||||
@ -283,7 +283,8 @@ class Fattura extends Document
|
||||
public function isFE()
|
||||
{
|
||||
$file = $this->uploads()->where('name', 'Fattura Elettronica')->first();
|
||||
return (!empty($this->progressivo_invio) and file_exists($file->filepath) );
|
||||
|
||||
return !empty($this->progressivo_invio) and file_exists($file->filepath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,9 +92,9 @@ class Intervento extends Document
|
||||
|
||||
/**
|
||||
* Calcola il nuovo codice di intervento.
|
||||
*
|
||||
*
|
||||
* @param string $data
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getNextCodice($data)
|
||||
|
@ -16,11 +16,8 @@ if (!empty($tecnici)) {
|
||||
<input type="hidden" name="op" value="update">
|
||||
<input type="hidden" name="backto" value="record-list">';
|
||||
|
||||
|
||||
|
||||
foreach ($tecnici as $tecnico) {
|
||||
|
||||
echo '<div class="box box-info collapsable" style="'.((strtolower($tecnico['colore'])=='#ffffff' or empty($tecnico['colore'])) ? '' : 'border-color: '.$tecnico['colore']).'">
|
||||
echo '<div class="box box-info collapsable" style="'.((strtolower($tecnico['colore']) == '#ffffff' or empty($tecnico['colore'])) ? '' : 'border-color: '.$tecnico['colore']).'">
|
||||
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><i class="fa fa-user"></i> '.$tecnico['ragione_sociale'].'</h3>
|
||||
@ -85,8 +82,6 @@ if (!empty($tecnici)) {
|
||||
</button>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
@ -94,7 +89,6 @@ if (!empty($tecnici)) {
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
echo '
|
||||
<div class="pull-right">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check"></i> '.tr('Salva modifiche').'</button>
|
||||
|
@ -8,10 +8,8 @@ switch (filter('op')) {
|
||||
$nome = filter('nome');
|
||||
|
||||
if (isset($nome)) {
|
||||
|
||||
//Se non esiste già una tipo di scadenza con lo stesso nome
|
||||
if ($dbo->fetchNum('SELECT * FROM `co_tipi_scadenze` WHERE `nome`='.prepare($nome).' AND `id`!='.prepare($id_record)) == 0) {
|
||||
|
||||
//nome_prev
|
||||
$nome_prev = $dbo->fetchOne('SELECT nome AS nome_prev FROM `co_tipi_scadenze` WHERE `id`='.prepare($id_record))['nome_prev'];
|
||||
|
||||
@ -34,7 +32,7 @@ switch (filter('op')) {
|
||||
} else {
|
||||
flash()->error(tr("E' già presente una tipologia di _TYPE_ con nome: _NOME_", [
|
||||
'_TYPE_' => 'scadenza',
|
||||
'_NOME_' => $nome,
|
||||
'_NOME_' => $nome,
|
||||
]));
|
||||
}
|
||||
} else {
|
||||
@ -55,16 +53,15 @@ switch (filter('op')) {
|
||||
'descrizione' => $descrizione,
|
||||
]);
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
|
||||
//Aggiungo anche il segmento
|
||||
$dbo->insert('zz_segments', [
|
||||
'id_module' => Modules::get('Scadenzario')['id'],
|
||||
'id_module' => Modules::get('Scadenzario')['id'],
|
||||
'name' => 'Scadenzario '.$nome,
|
||||
'clause' => 'co_scadenziario.tipo="'.$nome.'"',
|
||||
'position' => 'WHR'
|
||||
'position' => 'WHR',
|
||||
]);
|
||||
|
||||
|
||||
if (isAjaxRequest()) {
|
||||
echo json_encode(['id' => $nome, 'text' => $descrizione]);
|
||||
}
|
||||
@ -75,7 +72,7 @@ switch (filter('op')) {
|
||||
} else {
|
||||
flash()->error(tr("E' già presente una tipologia di _TYPE_ con nome: _NOME_", [
|
||||
'_TYPE_' => 'scadenza',
|
||||
'_NOME_' => $nome,
|
||||
'_NOME_' => $nome,
|
||||
]));
|
||||
}
|
||||
} else {
|
||||
|
@ -15,4 +15,4 @@ switch ($resource) {
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -40,18 +40,15 @@ if ($record['can_delete'] and empty($scadenze)) {
|
||||
|
||||
<?php
|
||||
|
||||
if ($record['can_delete']){
|
||||
|
||||
|
||||
if (!empty($scadenze)) {
|
||||
echo '
|
||||
if ($record['can_delete']) {
|
||||
if (!empty($scadenze)) {
|
||||
echo '
|
||||
<div class="alert alert-danger">
|
||||
'.tr('Ci sono _NUM_ scadenze collegate', [
|
||||
'_NUM_' => count($scadenze),
|
||||
]).'.
|
||||
'_NUM_' => count($scadenze),
|
||||
]).'.
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
|
||||
|
@ -40,9 +40,9 @@ switch (filter('op')) {
|
||||
$idanagrafica = filter('idanag');
|
||||
|
||||
$dbo->query('UPDATE zz_users SET password='.prepare(Auth::hashPassword($password)).', idanagrafica='.prepare($idanagrafica).', email='.prepare($email).' WHERE id='.prepare($id_utente));
|
||||
|
||||
|
||||
$dbo->query('DELETE FROM zz_user_sedi WHERE id_user='.prepare($id_utente));
|
||||
foreach(post('idsede') as $i=>$idsede ){
|
||||
foreach (post('idsede') as $i => $idsede) {
|
||||
$dbo->query('INSERT INTO `zz_user_sedi` (`id_user`,`idsede`) VALUES ('.prepare($id_utente).', '.prepare($idsede).')');
|
||||
}
|
||||
|
||||
@ -101,8 +101,8 @@ switch (filter('op')) {
|
||||
flash()->info(tr('Utente aggiunto!'));
|
||||
|
||||
$id_utente = $dbo->lastInsertedID();
|
||||
|
||||
foreach(post('idsede') as $i=>$idsede ){
|
||||
|
||||
foreach (post('idsede') as $i => $idsede) {
|
||||
$dbo->query('INSERT INTO `zz_user_sedi` (`id_user`,`idsede`) VALUES ('.prepare($id_utente).', '.prepare($idsede).')');
|
||||
}
|
||||
}
|
||||
|
@ -44,15 +44,15 @@ if (!empty($utenti)) {
|
||||
}
|
||||
|
||||
$sedi = $dbo->fetchOne('SELECT GROUP_CONCAT(nomesede SEPARATOR ", " ) as nomesede FROM zz_user_sedi INNER JOIN ((SELECT "0" AS id, "Sede legale" AS nomesede) UNION (SELECT id, nomesede FROM an_sedi)) sedi ON zz_user_sedi.idsede=sedi.id WHERE id_user='.prepare($utente['id']).' GROUP BY id_user ')['nomesede'];
|
||||
|
||||
|
||||
echo '
|
||||
<td>'.$sedi.'</td>';
|
||||
|
||||
|
||||
/*
|
||||
* Funzioni per gli utenti
|
||||
*/
|
||||
echo '
|
||||
<td>';
|
||||
<td>';
|
||||
// Disabilitazione utente, se diverso da id_utente #1 (admin)
|
||||
if ($utente['id'] != '1') {
|
||||
if ($utente['enabled'] == 1) {
|
||||
|
@ -34,19 +34,17 @@ if (!empty($id_utente)) {
|
||||
$rs = $dbo->fetchArray('SELECT idanagrafica, username, email FROM zz_users WHERE id='.prepare($id_utente));
|
||||
$username = $rs[0]['username'];
|
||||
$email = $rs[0]['email'];
|
||||
$id_anagrafica = $rs[0]['idanagrafica'];
|
||||
$id_anagrafica = $rs[0]['idanagrafica'];
|
||||
|
||||
// Lettura sedi dell'utente già impostate
|
||||
$idsedi = $dbo->fetchOne('SELECT GROUP_CONCAT(idsede) as idsedi FROM zz_user_sedi WHERE id_user='.prepare($id_utente).' GROUP BY id_user')['idsedi'];
|
||||
|
||||
// Lettura sedi dell'utente già impostate
|
||||
$sedi = $dbo->fetchOne('SELECT GROUP_CONCAT(idsede) as sedi FROM zz_user_sedi WHERE id_user='.prepare($id_utente).' GROUP BY id_user')['sedi'];
|
||||
} else {
|
||||
$op = 'adduser';
|
||||
$message = tr('Aggiungi');
|
||||
|
||||
$username = '';
|
||||
$email = '';
|
||||
$id_anagrafica = '';
|
||||
|
||||
$id_anagrafica = '';
|
||||
}
|
||||
|
||||
$_SESSION['superselect']['idanagrafica'] = $id_anagrafica;
|
||||
@ -107,20 +105,19 @@ if (!$self_edit) {
|
||||
{[ "type": "select", "label": "'.tr('Collega ad una anagrafica').'", "name": "idanag", "required": 1, "ajax-source": "anagrafiche_utenti", "value": "'.$id_anagrafica.'", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica='.$nome_gruppo.'" ]}
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
} else {
|
||||
echo '
|
||||
<input type="hidden" id="idanag" name="idanag" value="'.$id_anagrafica.'">';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "select", "label": "'.tr('Sede').'", "name": "idsede[]", "ajax-source": "sedi", "multiple":"1", "value":"'.$idsedi.'" ]}
|
||||
{[ "type": "select", "label": "'.tr('Sede').'", "name": "idsede[]", "ajax-source": "sedi", "multiple":"1", "value":"'.$sedi.'" ]}
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<button type="button" onclick="do_submit()" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> '.$message.'</button>
|
||||
<div class="clearfix"> </div>
|
||||
</form>
|
||||
|
@ -6,8 +6,7 @@ $operazione = filter('op');
|
||||
|
||||
switch ($operazione) {
|
||||
case 'addreferente':
|
||||
if (!empty(post('nome'))){
|
||||
|
||||
if (!empty(post('nome'))) {
|
||||
$dbo->insert('an_referenti', [
|
||||
'idanagrafica' => $id_parent,
|
||||
'nome' => post('nome'),
|
||||
@ -23,11 +22,8 @@ switch ($operazione) {
|
||||
}
|
||||
|
||||
flash()->info(tr('Aggiunto nuovo referente!'));
|
||||
|
||||
}else{
|
||||
|
||||
} else {
|
||||
flash()->warning(tr('Errore durante aggiunta del referente'));
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -7,8 +7,8 @@ $operazione = filter('op');
|
||||
switch ($operazione) {
|
||||
case 'addsede':
|
||||
|
||||
if (!empty(post('nomesede'))){
|
||||
$dbo->insert('an_sedi', [
|
||||
if (!empty(post('nomesede'))) {
|
||||
$dbo->insert('an_sedi', [
|
||||
'idanagrafica' => $id_parent,
|
||||
'nomesede' => post('nomesede'),
|
||||
'indirizzo' => post('indirizzo'),
|
||||
@ -22,19 +22,16 @@ switch ($operazione) {
|
||||
'id_nazione' => !empty(post('id_nazione')) ? post('id_nazione') : null,
|
||||
'idzona' => post('idzona'),
|
||||
]);
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
if (isAjaxRequest() && !empty($id_record)) {
|
||||
echo json_encode(['id' => $id_record, 'text' => post('nomesede').' - '.post('citta')]);
|
||||
}
|
||||
$id_record = $dbo->lastInsertedID();
|
||||
|
||||
flash()->info(tr('Aggiunta una nuova sede!'));
|
||||
|
||||
}else{
|
||||
if (isAjaxRequest() && !empty($id_record)) {
|
||||
echo json_encode(['id' => $id_record, 'text' => post('nomesede').' - '.post('citta')]);
|
||||
}
|
||||
|
||||
flash()->warning(tr('Errore durante aggiunta della sede'));
|
||||
|
||||
}
|
||||
flash()->info(tr('Aggiunta una nuova sede!'));
|
||||
} else {
|
||||
flash()->warning(tr('Errore durante aggiunta della sede'));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
@ -466,15 +466,14 @@ class Auth extends \Util\Singleton
|
||||
$this->user = User::with('group')->find($user_id);
|
||||
|
||||
// Estraggo le sedi dell'utente loggato
|
||||
$idsedi = $database->fetchArray('SELECT idsede FROM zz_user_sedi WHERE id_user='.prepare($user_id));
|
||||
$sedi = $database->fetchArray('SELECT idsede FROM zz_user_sedi WHERE id_user='.prepare($user_id));
|
||||
|
||||
// Se l'utente non ha sedi, è come se ce le avesse tutte disponibili per retrocompatibilità
|
||||
if (empty($idsedi)){
|
||||
|
||||
$idsedi = $database->fetchArray('SELECT "0" AS idsede UNION SELECT id AS idsede FROM an_sedi WHERE idanagrafica='.prepare($results[0]['idanagrafica']));
|
||||
if (empty($sedi)) {
|
||||
$sedi = $database->fetchArray('SELECT "0" AS idsede UNION SELECT id AS idsede FROM an_sedi WHERE idanagrafica='.prepare($results[0]['idanagrafica']));
|
||||
}
|
||||
|
||||
$this->user['idsedi'] = array_column( $idsedi, 'idsede' );
|
||||
$this->user['sedi'] = array_column($sedi, 'idsede');
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
$this->destory();
|
||||
|
@ -318,7 +318,7 @@ class Query
|
||||
$query = $element['option'];
|
||||
|
||||
// Aggiunta eventuali filtri dai segmenti per eseguire la query filtrata
|
||||
$query = str_replace( '1=1', '1=1 '.Modules::getAdditionalsQuery($element['attributes']['name']), $query );
|
||||
$query = str_replace('1=1', '1=1 '.Modules::getAdditionalsQuery($element['attributes']['name']), $query);
|
||||
$views = self::getViews($element);
|
||||
|
||||
$select = [];
|
||||
|
@ -75,7 +75,7 @@ for ($r = 0; $r < sizeof($rs); ++$r) {
|
||||
$body .= " <td class='first_cell cell-padded'>".$rs[$r]['codice']."</td>\n";
|
||||
$body .= " <td class='table_cell cell-padded'>".$rs[$r]['descrizione']."</td>\n";
|
||||
$body .= " <td class='table_cell text-right cell-padded'>".moneyFormat($rs[$r]['prezzo_vendita'])."</td>\n";
|
||||
$body .= " <td class='table_cell text-right cell-padded'>".Translator::numberToLocale($rs[$r]['qta'])." ".$rs[$r]['um']."</td>\n";
|
||||
$body .= " <td class='table_cell text-right cell-padded'>".Translator::numberToLocale($rs[$r]['qta']).' '.$rs[$r]['um']."</td>\n";
|
||||
$body .= " <td class='table_cell text-right cell-padded'>".moneyFormat($rs[$r]['prezzo_acquisto'])."</td>\n";
|
||||
$body .= " <td class='table_cell text-right cell-padded'>".moneyFormat(($rs[$r]['prezzo_acquisto'] * $rs[$r]['qta']))."</td>\n";
|
||||
$body .= "</tr>\n";
|
||||
|
@ -6,14 +6,11 @@ $module_name = 'Scadenzario';
|
||||
$date_start = $_SESSION['period_start'];
|
||||
$date_end = $_SESSION['period_end'];
|
||||
|
||||
|
||||
|
||||
$module = Modules::get('Scadenzario');
|
||||
$id_module = $module['id'];
|
||||
|
||||
$total = Util\Query::readQuery($module);
|
||||
|
||||
|
||||
// Lettura parametri modulo
|
||||
$module_query = $total['query'];
|
||||
|
||||
@ -39,7 +36,6 @@ $module_query = Modules::replaceAdditionals($id_module, $module_query);
|
||||
|
||||
$scadenze = $dbo->fetchArray($module_query);
|
||||
|
||||
|
||||
// carica report html
|
||||
$report = file_get_contents($docroot.'/templates/scadenzario/scadenzario.html');
|
||||
$body = file_get_contents($docroot.'/templates/scadenzario/scadenzario_body.html');
|
||||
|
Loading…
x
Reference in New Issue
Block a user