2019-03-08 15:18:52 +01:00
< ? php
2020-09-07 15:04:06 +02:00
/*
* 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 />.
*/
2020-03-09 14:24:59 +01:00
2018-10-17 18:28:15 +02:00
include_once __DIR__ . '/../../../core.php' ;
2020-03-09 14:24:59 +01:00
$revisione_principale = $dbo -> fetchOne ( 'SELECT master_revision FROM co_preventivi WHERE id = ' . prepare ( $id_record ));
2018-10-17 18:28:15 +02:00
2020-03-09 14:24:59 +01:00
$revisioni = $dbo -> fetchArray ( 'SELECT * FROM co_preventivi WHERE master_revision = ' . prepare ( $revisione_principale [ 'master_revision' ]) . ' OR id = ' . prepare ( $revisione_principale [ 'master_revision' ]) . ' ORDER BY created_at' );
2018-10-17 18:28:15 +02:00
2020-03-09 14:24:59 +01:00
echo "
< form action = '".$rootdir.' / editor . php ? id_module = '.$id_module.' & id_record = '.$id_record."' method = 'post' >
< input type = 'hidden' name = 'backto' value = 'record-edit' >
< input type = 'hidden' name = 'op' value = 'edit_revision' >
< input type = 'hidden' name = 'id_plugin' value = '".$id_plugin."' >
< input type = 'hidden' name = 'id_record' value = '".$id_record."' >
< input type = 'hidden' name = 'master_revision' value = '".$revisione_principale[' master_revision ']."' >
2018-10-17 18:28:15 +02:00
2020-03-09 14:24:59 +01:00
< div class = 'alert alert-info' >
< i class = 'fa fa-info-circle' ></ i > " .tr('Seleziona la spunta e clicca salva per cambiare la revisione del preventivo'). "
</ div >
2018-10-17 18:28:15 +02:00
2020-03-09 14:24:59 +01:00
< table class = 'table table-condensed table-bordered' >
< tr >
< th style = 'width:50px;' class = 'text-center' > #</th>
< th > Descrizione </ th >
< th style = 'width:50px;' ></ th >
</ tr > " ;
2018-10-17 18:28:15 +02:00
2020-03-09 14:24:59 +01:00
foreach ( $revisioni as $i => $revisione ) {
if ( $revisione [ 'master_revision' ] == $revisione [ 'id' ] || $revisione [ 'default_revision' ] == 1 ) {
2018-10-25 16:57:39 +02:00
$disabled = 'disabled' ;
} else {
$disabled = '' ;
}
2020-03-09 14:24:59 +01:00
if ( $revisione [ 'default_revision' ]) {
2018-10-25 16:57:39 +02:00
$cheched = 'checked' ;
} else {
$cheched = '' ;
}
2020-03-09 14:24:59 +01:00
echo "
< tr >
< td class = 'text-center' >
< input type = 'radio' class = 'revision_changer' name = 'idrevisione' value = '".$revisione[' id ']."' " . $cheched .'>
</ td >
< td >
'.tr(' Revisione _NUM_ creata il _DATE_ alle _TIME_ ' , [
2020-04-01 17:17:26 +02:00
'_NUM_' => ( $revisione [ 'numero_revision' ]),
2020-03-09 14:24:59 +01:00
'_DATE_' => dateFormat ( $revisione [ 'created_at' ]),
'_TIME_' => timeFormat ( $revisione [ 'created_at' ]),
]) . "
</ td >
< td class = 'text-center' >
< button type = 'button' class = 'btn btn-danger ".$disabled."' onclick = 'delete_revision(".$revisione[' id '].")' " . $disabled . " >
< i class = 'fa fa-trash' ></ i >
</ button >
</ td >
</ tr > " ;
2018-10-17 18:28:15 +02:00
}
2020-03-09 14:24:59 +01:00
echo '
</ table > ' ;
echo "
< div class = 'row' >
< div class = 'col-md-12 text-center' >
< button " .((count( $revisioni ) < 2) ? 'disabled' : ''). " type = 'submit' class = 'btn btn-primary' >
< i class = 'fa fa-refresh' ></ i > " .tr('Cambia revisione').'
</ button >
</ div >
</ div >
</ form > ' ;
2018-10-17 18:28:15 +02:00
2020-03-09 14:24:59 +01:00
echo "
< form action = '".$rootdir.' / editor . php ? id_module = '.$id_module.' & id_record = '.$id_record."' method = 'post' id = 'form_deleterevision' >
< input type = 'hidden' name = 'backto' value = 'record-edit' >
< input type = 'hidden' name = 'op' value = 'delete_revision' >
< input type = 'hidden' name = 'id_plugin' value = '".$id_plugin."' >
< input type = 'hidden' name = 'id_record' value = '".$id_record."' >
< input type = 'hidden' name = 'idrevisione' id = 'idrevisione' value = '' >
</ form > " ;
echo '
< script >
function delete_revision ( id ) {
if ( confirm ( " '.tr('Vuoi cancellare questa revisione?').' " )){
$ ( " #idrevisione " ) . val ( id );
$ ( " #form_deleterevision " ) . submit ();
}
}
</ script > ' ;