diff --git a/.github/stale.yml b/.github/stale.yml
new file mode 100644
index 000000000..48de326a9
--- /dev/null
+++ b/.github/stale.yml
@@ -0,0 +1,59 @@
+# Configuration for probot-stale - https://github.com/probot/stale
+
+# Number of days of inactivity before an Issue or Pull Request becomes stale
+daysUntilStale: 60
+
+# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
+# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
+daysUntilClose: 7
+
+# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
+onlyLabels: [bugfix]
+
+# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
+#exemptLabels:
+# - pinned
+# - security
+# - "[Status] Maybe Later"
+
+# Set to true to ignore issues in a project (defaults to false)
+exemptProjects: false
+
+# Set to true to ignore issues in a milestone (defaults to false)
+exemptMilestones: false
+
+# Set to true to ignore issues with an assignee (defaults to false)
+exemptAssignees: false
+
+# Label to use when marking as stale
+staleLabel: in chiusura
+
+# Comment to post when marking as stale. Set to `false` to disable
+markComment: >
+ Issue chiusa automaticamente in assenza di attività.
+
+# Comment to post when removing the stale label.
+# unmarkComment: >
+# Your comment here.
+
+# Comment to post when closing a stale Issue or Pull Request.
+# closeComment: >
+# Your comment here.
+
+# Limit the number of actions per hour, from 1-30. Default is 30
+limitPerRun: 30
+
+# Limit to only `issues` or `pulls`
+only: issues
+
+# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
+# pulls:
+# daysUntilStale: 30
+# markComment: >
+# This pull request has been automatically marked as stale because it has not had
+# recent activity. It will be closed if no further activity occurs. Thank you
+# for your contributions.
+
+# issues:
+# exemptLabels:
+# - confirmed
diff --git a/modules/contratti/add.php b/modules/contratti/add.php
index b42fde314..933d28dbf 100755
--- a/modules/contratti/add.php
+++ b/modules/contratti/add.php
@@ -37,7 +37,7 @@ echo '
- {[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Cliente&readonly_tipo=1" ]}
+ {[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "'.((empty($id_anagrafica)) ? 0 : 1).'" ]}
diff --git a/modules/interventi/edit.php b/modules/interventi/edit.php
index e57fe4f0a..baea68048 100755
--- a/modules/interventi/edit.php
+++ b/modules/interventi/edit.php
@@ -88,7 +88,7 @@ if (!empty($record['idpreventivo'])) {
'.Modules::link('Preventivi', $record['idpreventivo'], null, null, 'class="pull-right"');
}
echo '
- {[ "type": "select", "label": "'.tr('Preventivo').'", "name": "idpreventivo", "value": "'.$record['id_preventivo'].'", "ajax-source": "preventivi", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.$record['flag_completato'].'" ]}
+ {[ "type": "select", "label": "'.tr('Preventivo').'", "name": "idpreventivo", "value": "'.$record['id_preventivo'].'", "ajax-source": "preventivi", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.$record['flag_completato'].'", "icon-after": "add|'.Modules::get('Preventivi')['id'].'|pianificabile=1&idanagrafica='.$record['idanagrafica'].'" ]}
';
diff --git a/modules/iva/ajax/select.php b/modules/iva/ajax/select.php
index 9e0909398..100707daf 100755
--- a/modules/iva/ajax/select.php
+++ b/modules/iva/ajax/select.php
@@ -28,7 +28,7 @@ switch ($resource) {
$query = 'SELECT id, IF( codice_natura_fe IS NULL, IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)), CONCAT( IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)), " (", codice_natura_fe, ")" ) ) AS descrizione, percentuale FROM co_iva |where| ORDER BY descrizione ASC';
foreach ($elements as $element) {
- $filter[] = '(deleted_at IS NULL OR id='.prepare($element).')';
+ $filter[] = 'id='.prepare($element);
}
if (!empty($search)) {
diff --git a/modules/preventivi/actions.php b/modules/preventivi/actions.php
index a4f66757a..1f2061469 100755
--- a/modules/preventivi/actions.php
+++ b/modules/preventivi/actions.php
@@ -42,8 +42,16 @@ switch (post('op')) {
$tipo = TipoSessione::find($idtipointervento);
$preventivo = Preventivo::build($anagrafica, $tipo, $nome, $data_bozza, $id_sede);
+
+ $preventivo->idstato = post('idstato');
+ $preventivo->save();
+
$id_record = $preventivo->id;
+ if (isAjaxRequest()) {
+ echo json_encode(['id' => $id_record, 'text' => 'Contratto '.$preventivo->numero.' del '.dateFormat($preventivo->data_bozza).' - '.$preventivo->nome]);
+ }
+
flash()->info(tr('Aggiunto preventivo numero _NUM_!', [
'_NUM_' => $preventivo['numero'],
]));
diff --git a/modules/preventivi/add.php b/modules/preventivi/add.php
index 4d4d26dc9..62e4b0536 100755
--- a/modules/preventivi/add.php
+++ b/modules/preventivi/add.php
@@ -21,6 +21,8 @@ include_once __DIR__.'/../../core.php';
$id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idanagrafica'];
+$stati = get('pianificabile') ? 'SELECT id, descrizione FROM co_statipreventivi WHERE is_pianificabile=1' : 'SELECT id, descrizione FROM co_statipreventivi';
+
?>
-
- {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "value": "", "ajax-source": "clienti", "icon-after": "add||tipoanagrafica=Cliente&readonly_tipo=1" ]}
-
{[ "type": "select", "label": "", "name": "idsede", "ajax-source": "sedi", "placeholder": "Sede legale" ]}
+
+
+ {[ "type": "date", "label": "", "name": "data_bozza", "value": "", "required": 1 ]}
+
+
+
{[ "type": "select", "label": "", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento" ]}
+
+
+ {[ "type": "select", "label": "", "name": "idstato", "required": 1, "values": "query=" ]}
+
diff --git a/modules/preventivi/init.php b/modules/preventivi/init.php
index b0ab05c5e..109c2c087 100755
--- a/modules/preventivi/init.php
+++ b/modules/preventivi/init.php
@@ -25,6 +25,7 @@ if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT co_preventivi.*,
(SELECT tipo FROM an_anagrafiche WHERE idanagrafica = co_preventivi.idanagrafica) AS tipo_anagrafica,
co_statipreventivi.is_fatturabile,
+ co_statipreventivi.is_pianificabile,
co_statipreventivi.is_completato,
co_statipreventivi.is_revisionabile,
co_statipreventivi.descrizione AS stato
diff --git a/modules/preventivi/plugins/preventivi.consuntivo.php b/modules/preventivi/plugins/preventivi.consuntivo.php
index 574230765..2f3df6e06 100755
--- a/modules/preventivi/plugins/preventivi.consuntivo.php
+++ b/modules/preventivi/plugins/preventivi.consuntivo.php
@@ -411,25 +411,27 @@ echo '
';
// Aggiunta interventi se il preventivo é aperto o in attesa o pagato (non si possono inserire interventi collegati ad altri preventivi)
-if (in_array($record['stato'], ['Accettato', 'In lavorazione', 'Pagato'])) {
- echo '
-