1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-24 15:27:43 +01:00
This commit is contained in:
MatteoPistorello 2023-02-27 17:56:16 +01:00
commit 65198af2d8
18 changed files with 347 additions and 320 deletions

View File

@ -4,7 +4,7 @@ Tutti i maggiori cambiamenti di questo progetto saranno documentati in questo fi
Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://keepachangelog.com/), e il progetto segue il [Semantic Versioning](http://semver.org/) per definire le versioni delle release. Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://keepachangelog.com/), e il progetto segue il [Semantic Versioning](http://semver.org/) per definire le versioni delle release.
- [2.4.41 (2023-02-24)](#2441-2023-02-24) - [2.4.41 (2023-02-27)](#2441-2023-02-27)
- [2.4.40 (2023-02-17)](#2440-2023-02-17) - [2.4.40 (2023-02-17)](#2440-2023-02-17)
- [2.4.39 (2023-01-13)](#2439-2023-01-13) - [2.4.39 (2023-01-13)](#2439-2023-01-13)
- [2.4.38 (2022-12-07)](#2438-2022-12-07) - [2.4.38 (2022-12-07)](#2438-2022-12-07)
@ -52,10 +52,11 @@ Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://k
- [2.2 (2016-11-10)](#22-2016-11-10) - [2.2 (2016-11-10)](#22-2016-11-10)
- [2.1 (2015-04-02)](#21-2015-04-02) - [2.1 (2015-04-02)](#21-2015-04-02)
## 2.4.41 (2023-02-24) ## 2.4.41 (2023-02-27)
### Aggiunto (Added) ### Aggiunto (Added)
- Aggiunta la modifica automatica del piano dei conti per clienti e fornitori - Aggiunta la modifica automatica del piano dei conti per clienti e fornitori
- Aggiunto l'inserimento di email multiple per notifica di interventi - Aggiunto l'inserimento di email multiple per notifica di interventi
- Aggiunta la possibilità di aggiornare l'ordine dei sottolivelli e di modificare la descrizione delle righe nelle checklist
### Modificato (Changed) ### Modificato (Changed)
- Aggiornata la versione di fullcalendar - Aggiornata la versione di fullcalendar
- Rimozione dei clienti eliminati dalla sincronizzazione dell'app - Rimozione dei clienti eliminati dalla sincronizzazione dell'app
@ -67,6 +68,11 @@ Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://k
- Corretta la creazione di eventi su calendario con vista del Giorno - Corretta la creazione di eventi su calendario con vista del Giorno
- Corretta la vista giornaliera in dashboard da impostazioni - Corretta la vista giornaliera in dashboard da impostazioni
- Correzione query vista scadenzario - Correzione query vista scadenzario
- Corretto l'editor nei moduli
- Corretta l'eliminazione di prima nota in riapertura di documenti
- Corretto l'inserimento di articoli in DDT e fatture di acquisto
- Corretta la visualizzazione del widget in Stato dei servizi
- Corretta la creazione evento con impostazione AllDay attiva
## 2.4.40 (2023-02-17) ## 2.4.40 (2023-02-17)
### Aggiunto (Added) ### Aggiunto (Added)
- Aggiunto box dettagli cliente in fase di creazione fattura - Aggiunto box dettagli cliente in fase di creazione fattura

View File

@ -1103,9 +1103,9 @@ div.tip {
} }
/* Stile Fullcalendar per weekend */ /* Stile Fullcalendar per weekend */
.fc-sat, .fc-day-sat,
.fc-sun { .fc-day-sun {
background-color: rgba(255, 99, 71, 0.6) !important; background-color: rgba(255,49,21,.3) !important;
} }
.login-box .img-responsive { .login-box .img-responsive {

203
bug.php
View File

@ -1,203 +0,0 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Modules\Emails\Account;
use Notifications\EmailNotification;
include_once __DIR__.'/core.php';
$account = Account::where('predefined', true)->first();
$bug_email = 'info@openstamanager.com';
$user = Auth::user();
if (filter('op') == 'send') {
// Preparazione email
$mail = new EmailNotification();
// Destinatario
$mail->AddAddress($bug_email);
// Oggetto
$mail->Subject = 'Segnalazione bug OSM '.$version;
// Aggiunta dei file di log (facoltativo)
if (!empty(post('log')) && file_exists(base_dir().'/logs/error.log')) {
$mail->AddAttachment(base_dir().'/logs/error.log');
}
// Aggiunta della copia del database (facoltativo)
if (!empty(post('sql'))) {
$backup_file = base_dir().'/Backup OSM '.date('Y-m-d').' '.date('H_i_s').'.sql';
Backup::database($backup_file);
$mail->AddAttachment($backup_file);
flash()->info(tr('Backup del database eseguito ed allegato correttamente!'));
}
// Aggiunta delle informazioni di base sull'installazione
$infos = [
'Utente' => $user['username'],
'IP' => get_client_ip(),
'Versione OSM' => $version.' ('.(!empty($revision) ? $revision : 'In sviluppo').')',
'PHP' => phpversion(),
];
// Aggiunta delle informazioni sul sistema (facoltativo)
if (!empty(post('info'))) {
$infos['Sistema'] = $_SERVER['HTTP_USER_AGENT'].' - '.getOS();
}
// Completamento del body
$body = post('body').'<hr>';
foreach ($infos as $key => $value) {
$body .= '<p>'.$key.': '.$value.'</p>';
}
$mail->Body = $body;
$mail->AltBody = 'Questa email arriva dal modulo bug di segnalazione bug di OSM';
// Invio mail
if (!$mail->send()) {
flash()->error(tr("Errore durante l'invio della segnalazione").': '.$mail->ErrorInfo);
} else {
flash()->info(tr('Email inviata correttamente!'));
}
// Rimozione del dump del database
if (!empty(post('sql'))) {
delete($backup_file);
}
redirect(base_path().'/bug.php');
exit();
}
$pageTitle = tr('Bug');
include_once App::filepath('include|custom|', 'top.php');
if (empty($account['from_address']) || empty($account['server'])) {
echo '
<div class="alert alert-warning">
<i class="fa fa-warning"></i>
<b>'.tr('Attenzione!').'</b> '.tr('Per utilizzare correttamente il modulo di segnalazione bug devi configurare alcuni parametri riguardanti le impostazione delle email').'.
'.Modules::link('Account email', $account['id'], tr('Correggi account'), null, 'class="btn btn-warning pull-right"').'
<div class="clearfix"></div>
</div>';
}
echo '
<div class="box">
<div class="box-header">
<h3 class="box-title"><i class="fa fa-bug"></i> '.tr('Segnalazione bug').'</h3>
</div>
<div class="box-body">
<form method="post" action="">
<input type="hidden" name="op" value="send">
<table class="table table-bordered table-condensed table-striped table-hover">
<tr>
<th width="150" class="text-right">'.tr('Da').':</th>
<td>'.$account['from_address'].'</td>
</tr>
<!-- A -->
<tr>
<th class="text-right">'.tr('A').':</th>
<td>'.$bug_email.'</td>
</tr>
<!-- Versione -->
<tr>
<th class="text-right">'.tr('Versione OSM').':</th>
<td>'.$version.' ('.(!empty($revision) ? $revision : tr('In sviluppo')).')</td>
</tr>
</table>
<div class="row">
<div class="col-md-4">
{[ "type": "checkbox", "placeholder": "'.tr('Allega file di log').'", "name": "log", "value": "1" ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "placeholder": "'.tr('Allega copia del database').'", "name": "sql" ]}
</div>
<div class="col-md-4">
{[ "type": "checkbox", "placeholder": "'.tr('Allega informazioni sul PC').'", "name": "info", "value": "1" ]}
</div>
</div>
<div class="clearfix"></div>
<br>
{[ "type": "ckeditor", "label": "'.tr('Descrizione del bug').'", "name": "body" ]}
<!-- PULSANTI -->
<div class="row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-primary" id="send" disabled>
<i class="fa fa-envelope"></i> '.tr('Invia segnalazione').'
</button>
</div>
</div>
</form>
</div>
</div>
<script>
$(document).ready(function() {
init();
var html = "<p>'.tr('Se hai riscontrato un bug ricordati di specificare').':</p>" +
"<ul>" +
"<li>'.tr('Modulo esatto (o pagina relativa) in cui questi si è verificato').';</li>" +
"<li>'.tr('Dopo quali specifiche operazioni hai notato il malfunzionamento').'.</li>" +
"</ul>" +
"<p>'.tr('Assicurati inoltre di controllare che il checkbox relativo ai file di log sia contrassegnato, oppure riporta qui l\'errore visualizzato').'.</p>" +
"<p>'.tr('Ti ringraziamo per il tuo contributo').',<br>" +
"'.tr('Lo staff di OSM').'</p>";
var firstFocus = true;
let editor = input("body");
editor.set(html);
editor.on("change", function() {
setTimeout(function() {
$("#send").prop("disabled", editor.get() === "");
}, 10);
});
editor.on("focus", function() {
if (firstFocus) {
editor.set("");
firstFocus = false;
}
});
});
</script>
<script type="text/javascript" charset="utf-8" src="'.App::getPaths()['js'].'/ckeditor/ckeditor.js'.'"></script>';
include_once App::filepath('include|custom|', 'bottom.php');

View File

@ -0,0 +1,78 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../core.php';
use Modules\Checklists\Check;
switch(post('op')){
case "delete_check":
$id = post('id');
$record = Check::find($id);
$record->delete();
break;
case "update_position":
$order = explode(',', post('order', true));
foreach($order as $i => $id){
$dbo->query("UPDATE zz_checks SET `order`=".prepare($i)." WHERE id=".prepare($id));
echo "UPDATE zz_checks SET `order`=".prepare($i)." WHERE id=".prepare($id);
}
break;
case "save_checkbox":
$id = post('id');
$record = Check::find($id);
$record->checked_by = $user->id;
$record->checked_at = date('Y-m-d H:i:s');
$record->save();
break;
case "remove_checkbox":
$id = post('id');
$record = Check::find($id);
$record->checked_by = NULL;
$record->checked_at = NULL;
$record->save();
break;
case "edit_check":
$id_record = post('id_record');
$record = Check::find($id_record);
$record->content = post('content');
$record->save();
flash()->info(tr('Informazioni salvate correttamente!'));
break;
}
?>

View File

@ -0,0 +1,53 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once __DIR__.'/../../../core.php';
use Modules\Checklists\Check;
$id_record = get("id_record");
$record = Check::find($id_record);
?>
<div class="row">
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "content", "required": 1, "value": "<?=$record->content?>" ]}
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<button type="button" class="btn btn-success" id="save-btn"><i class='fa fa-save'></i> <?php echo tr('Salva'); ?></button>
</div>
</div>
<script>
$('#save-btn').click(function() {
$('#save-btn').attr('disabled', true);
$('#save-btn').html('<i class="fa fa-spinner fa-spin"></i> <?php echo tr('Salvataggio in corso...'); ?>');
$.post('<?php echo $rootdir; ?>/modules/checklists/ajax.php', {
op: "edit_check",
id_record: "<?=$id_record?>",
content: $('#content').val()
}, function(){
location.reload();
});
});
</script>

92
modules/checklists/modutil.php Executable file → Normal file
View File

@ -17,55 +17,89 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
function renderChecklist($check, $level = 0) function renderChecklist($check, $level = 1, $parent = 0) {
{
global $structure;
$user = auth()->getUser(); $user = auth()->getUser();
$enabled = $check->assignedUsers ? $check->assignedUsers->pluck('id')->search($user->id) !== false : true; $enabled = $check->assignedUsers ? $check->assignedUsers->pluck('id')->search($user->id) !== false : true;
$result = ' $margin = ($level*20);
<li id="check_'.$check->id.'" class="check-item'.(!empty($check->checked_at) ? ' done' : '').'" '.(!$enabled ? 'style="opacity: 0.4"' : '').' data-id="'.$check->id.'">
<input type="checkbox" value="'.(!empty($check->checked_at) ? '1' : '0').'" '.(!empty($check->checked_at) ? 'checked' : '').'>
$result = '
<tr id="check_'.$check->id.'" data-id="'.$check->id.'" class="sortablerow sonof_'.$parent.'" >
<td style="padding-top:0px;padding-bottom:0px;border-top:0px;">
<table class="table" style="margin-bottom:0px;">
<tr>';
$result .= '
<td style="width:40px;text-align:center;border-top:0px;border-left:3px solid #eaeaea;">
<input type="checkbox" class="checkbox" data-id="'.$check->id.'" value="'.(!empty($check->checked_at) ? '1' : '0').'" '.(!empty($check->checked_at) ? 'checked' : '').' '.(!$enabled ? 'disabled' : '').'>
</td>';
$result .= '
<td style="border-top:0px;">
<span class="text">'.$check->content.' </span>'; <span class="text">'.$check->content.' </span>';
if (intval($check->assignedUsers->pluck('id')->toArray())>0){ if (intval($check->assignedUsers->pluck('id')->toArray())>0){
$result .= '<span class="label label-default">'. implode(',', $check->assignedUsers->pluck('username')->toArray()).'</span>'; $result .= ' <span class="label label-info pull-right" style="padding:6px 8px;" data-toggle="tooltip" title="Assegnato a '. implode(', ', $check->assignedUsers->pluck('username')->toArray()).'"><i class="fa fa-user"></i></span>';
}else{ }else{
$result .= '<span class="label label-danger">'. tr('Nessun utente assegnato').'</span>'; $result .= ' <span class="label label-danger pull-right" style="padding:6px 8px;">'. tr('Nessun utente assegnato').'</span>';
} }
if (empty($check->user) || $check->user->id == $user->id) { if(!empty($check->checked_at)){
$result .= ' $result .= '
<div class="tools"> <span class="label label-default pull-right" style="margin-right:5px;padding:6px 8px;">'.(!empty($check->checked_at) ? tr('Verificato da _NAME_ il _DATE_', [
<i class="fa fa-trash-o check-delete"></i> '_NAME_' => $check->checkUser->username,
</div>'; '_DATE_' => timestampFormat($check->checked_at),
} ]) : '').'
if ($level == 0) {
$result .= '
<span class="handle pull-right">
<i class="fa fa-ellipsis-v"></i>
<i class="fa fa-ellipsis-v"></i>
</span>'; </span>';
} }
$result .= ' $result .= '
<span class="badge pull-right" style="margin-right:5px">'.(!empty($check->checked_at) ? tr('Verificato da _NAME_ il _DATE_', [ </td>';
'_NAME_' => $check->checkUser->username,
'_DATE_' => timestampFormat($check->checked_at),
]) : '').'</span>';
$result .= ' $result .= '
<ul class="todo-list">'; <td style="width:40px;text-align:center;border-top:0px;">
<div class="input-group-btn">
<button class="btn btn-warning btn-xs '.(!$enabled ? 'disabled' : '').'" onclick="edit_check(\''.$check->id.'\')"><i class="fa fa-edit"></i></button>
<button class="btn btn-danger btn-xs '.(!$enabled ? 'disabled' : '').'" onclick="delete_check(\''.$check->id.'\')"><i class="fa fa-trash"></i></button>
</div>
</td>';
$children = $check->children;
$result .= '
</tr>';
if(sizeof($check->children)>0){
$result .= '
<tr>
<td colspan="4" style="padding-left:'.$margin.'px;padding-right:0px;padding-top:0px;padding-bottom:0px;border-top:0px;">
<table class="table" style="margin-bottom:0px;">
<tbody class="sort" data-sonof="'.$check->id.'">';
$children = $structure->checks()->where('id_parent', $check->id)->orderBy('order')->get();
foreach ($children as $child) { foreach ($children as $child) {
$result .= renderChecklist($child, $level + 1); $result .= renderChecklist($child, $level + 1, $check->id);
}
$result .= '
</tbody>
</table>
</td>
</tr>';
} }
$result .= ' $result .= '
</ul> </table>
</li>'; </td>
<td style="width:40px;text-align:center;border-top:0px;">
<button class="btn btn-xs btn-default handle '.(!$enabled ? 'disabled' : '').'" title="Modifica ordine delle righe" draggable="true">
<i class="fa fa-sort"></i>
</button>
</td>
</tr>';
return $result; return $result;
} }
@ -80,10 +114,10 @@ function renderChecklistHtml($check, $level = 0)
$result = ' $result = '
<tr> <tr>
<td class="text-center" style="width:30px;"> <td class="text-center" style="width:30px;">
'.(!empty($check->checked_at)?'<img src="'.ROOTDIR.'/templates/interventi/check.png" style="width:10px;">':'').' '.(!empty($check->checked_at)?'<img src="'.ROOTDIR.'/templates/interventi/custom/check.png" style="width:10px;">':'').'
</td> </td>
<td style="padding-left:'.$width.'px;"> <td style="padding-left:'.$width.'px;">
<span class="text">'.$check->content.'</span> <span class="text"><b>'.$check->content.'</b>'.(!empty($check->value)?': '.$check->value:'').'</span>
</td> </td>
</tr>'; </tr>';

View File

@ -545,7 +545,7 @@ function salvaArticolo() {
}); });
} }
$("form").bind("keypress", function(e) { $("#link_form").bind("keypress", function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
e.preventDefault(); e.preventDefault();
salvaArticolo(); salvaArticolo();

View File

@ -41,7 +41,15 @@ include_once __DIR__.'/../../core.php';
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Contenuto'); ?>", "name": "content", "required": 1, "value": "$content$" ]} <?php
echo input([
'type' => 'textarea',
'label' => tr('Contenuto'),
'name' => 'content',
'required' => 1,
'value' => $record['content'],
]);
?>
</div> </div>
</div> </div>

View File

@ -509,6 +509,9 @@ globals.dashboard = {
/* locales: allLocales, */ /* locales: allLocales, */
locale: globals.locale, locale: globals.locale,
slotEventOverlap: false, slotEventOverlap: false,
weekNumbers: true,
weekText: "W",
nowIndicator: true,
schedulerLicenseKey: "GPL-My-Project-Is-Open-Source", schedulerLicenseKey: "GPL-My-Project-Is-Open-Source",
hiddenDays: globals.dashboard.show_sunday ? [] : [0], hiddenDays: globals.dashboard.show_sunday ? [] : [0],
headerToolbar: { headerToolbar: {
@ -571,8 +574,7 @@ globals.dashboard = {
let start = info.start; let start = info.start;
let end = info.end; let end = info.end;
let intero_giorno = !start.hasTime && !end.hasTime; if (!info.allDay) {
if (intero_giorno !== true || globals.dashboard.informazioni_aggiuntive==0) {
let data = moment(start).format("YYYY-MM-DD"); let data = moment(start).format("YYYY-MM-DD");
let data_fine = moment(end).format("YYYY-MM-DD"); let data_fine = moment(end).format("YYYY-MM-DD");
let orario_inizio = moment(start).format("HH:mm"); let orario_inizio = moment(start).format("HH:mm");

View File

@ -366,10 +366,10 @@ if ($dir == 'entrata') {
if (!$block_edit) { if (!$block_edit) {
// Lettura ordini (cliente o fornitore) // Lettura ordini (cliente o fornitore)
$ordini_query = 'SELECT COUNT(*) AS tot FROM or_ordini WHERE idanagrafica='.prepare($record['idanagrafica']).' AND idstatoordine IN (SELECT id FROM or_statiordine WHERE descrizione IN(\'Accettato\', \'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\')) AND idtipoordine=(SELECT id FROM or_tipiordine WHERE dir='.prepare($dir).') AND or_ordini.id IN (SELECT idordine FROM or_righe_ordini WHERE or_righe_ordini.idordine = or_ordini.id AND (qta - qta_evasa) > 0)'; $ordini_query = 'SELECT COUNT(*) AS tot FROM or_ordini WHERE idanagrafica='.prepare($record['idanagrafica']).' AND idstatoordine IN (SELECT id FROM or_statiordine WHERE descrizione IN(\'Accettato\', \'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\')) AND idtipoordine=(SELECT id FROM or_tipiordine WHERE dir='.prepare($dir).') AND or_ordini.id IN (SELECT idordine FROM or_righe_ordini WHERE or_righe_ordini.idordine = or_ordini.id AND (qta - qta_evasa) > 0)';
$ordini = $dbo->fetchArray($ordini_query)[0]['tot']; $tot_ordini = $dbo->fetchArray($ordini_query)[0]['tot'];
$ddt_query = 'SELECT COUNT(*) AS tot FROM dt_ddt WHERE idstatoddt IN (SELECT id FROM dt_statiddt WHERE descrizione IN(\'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\')) AND idtipoddt=(SELECT id FROM or_tipiordine WHERE dir="'.($dir == 'entrata' ? 'uscita' : 'entrata').'") AND dt_ddt.id IN (SELECT idddt FROM dt_righe_ddt WHERE dt_righe_ddt.idddt = dt_ddt.id AND (qta - qta_evasa) > 0)'; $ddt_query = 'SELECT COUNT(*) AS tot FROM dt_ddt WHERE idstatoddt IN (SELECT id FROM dt_statiddt WHERE descrizione IN(\'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\')) AND idtipoddt=(SELECT id FROM or_tipiordine WHERE dir="'.($dir == 'entrata' ? 'uscita' : 'entrata').'") AND dt_ddt.id IN (SELECT idddt FROM dt_righe_ddt WHERE dt_righe_ddt.idddt = dt_ddt.id AND (qta - qta_evasa) > 0)';
$ddt = $dbo->fetchArray($ddt_query)[0]['tot']; $tot_ddt = $dbo->fetchArray($ddt_query)[0]['tot'];
// Form di inserimento riga documento // Form di inserimento riga documento
echo ' echo '
@ -383,7 +383,7 @@ if (!$block_edit) {
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]} {[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).', "idsede_partenza": '.intval($ddt->idsede_partenza).', "idsede_destinazione": '.intval($ddt->idsede_destinazione).', "idanagrafica": '.$ddt->idanagrafica.', "dir": "'.$dir.'", "idagente": '.$ddt->idagente.'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
</div> </div>
<div class="col-md-4" style="margin-top: 25px"> <div class="col-md-4" style="margin-top: 25px">
@ -414,13 +414,13 @@ if (!$block_edit) {
</li> </li>
<li> <li>
<a class="'.(!empty($ddt) ? '' : ' disabled').'" style="cursor:pointer" data-href="'.$structure->fileurl('add_ddt.php').'?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="modal" data-title="'.tr('Aggiungi Ddt').'"> <a class="'.(!empty($tot_ddt) ? '' : ' disabled').'" style="cursor:pointer" data-href="'.$structure->fileurl('add_ddt.php').'?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="modal" data-title="'.tr('Aggiungi Ddt').'">
<i class="fa fa-plus"></i> '.tr('Ddt').' <i class="fa fa-plus"></i> '.tr('Ddt').'
</a> </a>
</li> </li>
<li> <li>
<a class="'.(!empty($ordini) ? '' : ' disabled').'" style="cursor:pointer" data-href="'.$structure->fileurl('add_ordine.php').'?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="modal" data-title="'.tr('Aggiungi Ordine').'"> <a class="'.(!empty($tot_ordini) ? '' : ' disabled').'" style="cursor:pointer" data-href="'.$structure->fileurl('add_ordine.php').'?id_module='.$id_module.'&id_record='.$id_record.'" data-toggle="modal" data-title="'.tr('Aggiungi Ordine').'">
<i class="fa fa-plus"></i> '.tr('Ordine').' <i class="fa fa-plus"></i> '.tr('Ordine').'
</a> </a>
</li> </li>
@ -581,7 +581,7 @@ function salvaArticolo() {
}); });
} }
$("form").bind("keypress", function(e) { $("#link_form").bind("keypress", function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
e.preventDefault(); e.preventDefault();
salvaArticolo(); salvaArticolo();

View File

@ -965,7 +965,11 @@ switch (post('op')) {
} }
$articolo->idconto = $id_conto; $articolo->idconto = $id_conto;
$id_iva = $originale->idiva_vendita ?: setting('Iva predefinita'); if ($dir == 'entrata') {
if ($fattura->anagrafica['idiva_vendite'] ? $id_iva = $fattura->anagrafica['idiva_vendite'] : $id_iva = $originale->idiva_vendita ?: setting('Iva predefinita'));
} else {
if ($fattura->anagrafica['idiva_acquisti'] ? $id_iva = $fattura->anagrafica['idiva_acquisti'] : $id_iva = $originale->idiva_acquisti ?: setting('Iva predefinita'));
}
$id_anagrafica = $fattura->idanagrafica; $id_anagrafica = $fattura->idanagrafica;
$prezzi_ivati = setting('Utilizza prezzi di vendita comprensivi di IVA'); $prezzi_ivati = setting('Utilizza prezzi di vendita comprensivi di IVA');

View File

@ -817,7 +817,7 @@ if (!$block_edit) {
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]} {[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).', "idsede_partenza": '.intval($fattura->idsede_partenza).', "idsede_destinazione": '.intval($fattura->idsede_destinazione).', "idanagrafica": '.$fattura->idanagrafica.', "dir": "'.$dir.'", "idagente": '.$fattura->idagente.'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
</div> </div>
<div class="col-md-4" style="margin-top: 25px"> <div class="col-md-4" style="margin-top: 25px">
@ -1188,7 +1188,7 @@ function salvaArticolo() {
}); });
} }
$("form").bind("keypress", function(e) { $("#link_form").bind("keypress", function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
e.preventDefault(); e.preventDefault();
salvaArticolo(); salvaArticolo();

View File

@ -833,7 +833,7 @@ $(document).ready(function() {
}); });
} }
$("form").bind("keypress", function(e) { $("#link_form").bind("keypress", function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
e.preventDefault(); e.preventDefault();
salvaArticolo(); salvaArticolo();

View File

@ -439,7 +439,7 @@ function salvaArticolo() {
}); });
} }
$("form").bind("keypress", function(e) { $("#link_form").bind("keypress", function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
e.preventDefault(); e.preventDefault();
salvaArticolo(); salvaArticolo();

View File

@ -461,7 +461,7 @@ function salvaArticolo() {
}); });
} }
$("form").bind("keypress", function(e) { $("#link_form").bind("keypress", function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
e.preventDefault(); e.preventDefault();
salvaArticolo(); salvaArticolo();

View File

@ -82,7 +82,15 @@ use Models\PrintTemplate;
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Opzioni'); ?>", "name": "options", "value": "$options$", "help": "<?php echo tr('Impostazioni personalizzabili della stampa, in formato JSON'); ?>" ]} <?php
echo input([
'type' => 'textarea',
'label' => tr('Opzioni'),
'name' => 'options',
'value' => $record['options'],
'help' => tr('Impostazioni personalizzabili della stampa, in formato JSON'),
]);
?>
</div> </div>
</div> </div>
</div> </div>

123
plugins/checks.php Executable file → Normal file
View File

@ -57,15 +57,15 @@ if ($structure->permission == 'rw') {
$checks = $structure->mainChecks($id_record); $checks = $structure->mainChecks($id_record);
echo ' echo " <table class='table'>
<ul class="todo-list checklist">'; <tbody class='sort' data-sonof='0'>";
foreach ($checks as $check) { foreach ($checks as $check) {
echo renderChecklist($check); echo renderChecklist($check);
} }
echo " </tbody>
</table>";
echo ' echo '
</ul>
</div> </div>
</div> </div>
</div>'; </div>';
@ -73,62 +73,95 @@ echo '
echo ' echo '
<script>$(document).ready(init)</script> <script>$(document).ready(init)</script>
<script type="module"> <script>
import Checklist from "./modules/checklists/js/checklist.js";
var checklists = checklists ? checklists : {};
$(document).ready(function(){ $(document).ready(function(){
checklists["'.$checks_id.'"] = new Checklist({ $("[data-toggle=\'tooltip\']").tooltip();
id_module: "'.$id_module.'", });
id_plugin: "'.$id_plugin.'",
id_record: "'.$id_record.'",
}, "'.$checks_id.'");
sortable(".checklist", { sortable("#tab_checks .sort", {
placeholder: "sort-highlight", axis: "y",
handle: ".handle", handle: ".handle",
forcePlaceholderSize: true, cursor: "move",
zIndex: 999999, dropOnEmpty: true,
})[0].addEventListener("sortupdate", function(e) { scroll: true,
let order = $(".checklist > li[data-id]").toArray().map(a => $(a).data("id")) });
$.post(globals.rootdir + "/actions.php", { sortable_table = sortable("#tab_checks .sort").length;
id_module: globals.id_module,
id_plugin: "'.$id_plugin.'", for(i=0; i<sortable_table; i++){
id_record: globals.id_record, sortable("#tab_checks .sort")[i].addEventListener("sortupdate", function(e) {
op: "ordina-checks",
var sonof = $(this).data("sonof");
let order = $(this).find(".sonof_"+sonof+"[data-id]").toArray().map(a => $(a).data("id"))
$.post("'.$checklist_module->fileurl('ajax.php').'", {
op: "update_position",
order: order.join(","), order: order.join(","),
}); });
}); });
}
$(".checklist").todoList({ $("input[name^=\'value\']").keyup(function(){
onCheck: function () { $.post("'.$checklist_module->fileurl('ajax.php').'", {
var id = $(this).parent().data("id"); op: "save_value",
value: $(this).val(),
id: $(this).attr("data-id"),
});
});
checklists["'.$checks_id.'"].toggleCheck(id); $("textarea[name=\'note_checklist\']").keyup(function(){
}, $.post("'.$checklist_module->fileurl('ajax.php').'", {
onUnCheck: function () { op: "save_note",
var id = $(this).parent().data("id"); value: $(this).val(),
id: $(this).attr("data-id"),
});
});
checklists["'.$checks_id.'"].toggleCheck(id); $(".checkbox").click(function(){
if($(this).is(":checked")){
$.post("'.$checklist_module->fileurl('ajax.php').'", {
op: "save_checkbox",
id: $(this).attr("data-id"),
});
parent = $(this).attr("data-id");
$("tr.sonof_"+parent).find("input[type=checkbox]").each(function(){
if(!$(this).is(":checked")){
$(this).click();
} }
}); });
}else{
$(".check-delete").click(function(event){ $.post("'.$checklist_module->fileurl('ajax.php').'", {
var li = $(this).closest("li"); op: "remove_checkbox",
var id = li.data("id"); id: $(this).attr("data-id"),
swal({
title: "'.tr("Rimuovere l'elemento della checklist?").'",
html: "'.tr('Tutti gli elementi figli saranno rimossi di conseguenza. Continuare?').'",
showCancelButton: true,
confirmButtonText: "'.tr('Procedi').'",
type: "error",
}).then(function (result) {
checklists["'.$checks_id.'"].deleteCheck(id);
}); });
event.stopPropagation(); parent = $(this).attr("data-id");
$("tr.sonof_"+parent).find("input[type=checkbox]").each(function(){
if($(this).is(":checked")){
$(this).click();
}
}); });
}
})
function delete_check(id){
if(confirm("Eliminare questa checklist?")){
$.post("'.$checklist_module->fileurl('ajax.php').'", {
op: "delete_check",
id: id,
}, function(){
location.reload();
}); });
}
}
function edit_check(id){
launch_modal("Modifica checklist", "'.$checklist_module->fileurl('components/edit-check.php').'?id_record="+id, 1);
}
</script>'; </script>';
?>

View File

@ -214,7 +214,7 @@ class WidgetManager implements ManagerInterface
protected function group($options) protected function group($options)
{ {
$query = 'SELECT id FROM zz_widgets WHERE id_module = '.prepare($options['id_module']).' AND (|position|) AND enabled = 1 ORDER BY `order` ASC'; $query = 'SELECT id, id_module FROM zz_widgets WHERE id_module = '.prepare($options['id_module']).' AND (|position|) AND enabled = 1 ORDER BY `order` ASC';
// Mobile (tutti i widget a destra) // Mobile (tutti i widget a destra)
if (isMobile()) { if (isMobile()) {
@ -257,9 +257,13 @@ class WidgetManager implements ManagerInterface
// Aggiungo ad uno ad uno tutti i widget // Aggiungo ad uno ad uno tutti i widget
foreach ($widgets as $widget) { foreach ($widgets as $widget) {
if ($widgets[0]['id_module'] == $database->fetchOne('SELECT id FROM zz_modules WHERE title = "Stato dei servizi"')['id']) {
$result .= '
<li class="col-sm-6 col-md-4 col-lg-5 li-widget" id="widget_'.$widget['id'].'" style="height:100% !important;" data-id="'.$widget['id'].'">';
} else {
$result .= ' $result .= '
<li class="col-sm-6 col-md-4 col-lg-'.intval(12 / $row_max).' li-widget" id="widget_'.$widget['id'].'" data-id="'.$widget['id'].'">'; <li class="col-sm-6 col-md-4 col-lg-'.intval(12 / $row_max).' li-widget" id="widget_'.$widget['id'].'" data-id="'.$widget['id'].'">';
}
$info = array_merge($options, [ $info = array_merge($options, [
'id' => $widget['id'], 'id' => $widget['id'],
]); ]);