Compare commits

...

7 Commits

Author SHA1 Message Date
Beppe 7ca8c70b26 Merge branch 'master' of https://github.com/devcode-it/openstamanager 2024-10-31 17:19:04 +01:00
Beppe c1fe61e464 Fix: correzione geolocalizzazione sede 2024-10-31 17:19:02 +01:00
valentina a02499cea8 fix: stampa fatture di vendita con note 2024-10-31 17:07:52 +01:00
MatteoPistorello 0b1e4d764e feat: gestione tel e mailto per le tabelle datatables 2024-10-31 15:11:40 +01:00
MatteoPistorello 438c10ab08 fix: query serial ddt 2024-10-31 14:49:49 +01:00
MatteoPistorello fe8e39a3e4 Merge branch 'master' of https://github.com/devcode-it/openstamanager 2024-10-31 14:49:17 +01:00
MatteoPistorello 709652eecd feat: gestione pulsanti precedente e successivo 2024-10-31 14:49:13 +01:00
9 changed files with 70 additions and 24 deletions

View File

@ -29,6 +29,7 @@ $draw_numer = intval(filter('draw'));
if (!empty(filter('order'))) {
$order['column'] = $order['column'] - 1;
}
$_SESSION['module_'.$id_module]['order'] = $order;
array_shift($columns);
$total = Query::readQuery($structure);
@ -176,8 +177,18 @@ if (!empty($query)) {
$column['data-color'] = isset($column['data-color']) ? $column['data-color'] : color_inverse(trim($column['data-background']));
}
elseif (preg_match('/^mailto_(.+?)$/', trim($field), $m)) {
$column['class'] = '';
$value = ($r[$field] ? '<a class="btn btn-default btn-sm btn-block" style="font-weight:normal;" href="mailto:'.$r[$field].'" target="_blank"><i class="fa fa-envelope text-primary"></i> '.$r[$field].'</a>' : '');
}
elseif (preg_match('/^tel_(.+?)$/', trim($field), $m)) {
$column['class'] = '';
$value = ($r[$field] ? '<a class="btn btn-default btn-sm btn-block" href="tel:'.$r[$field].'" target="_blank"><i class="fa fa-phone text-primary"></i> '.$r[$field].'</a>' : '');
}
// Link della colonna
if ($field != '_print_') {
if ($field != '_print_' && !preg_match('/^tel_(.+?)$/', trim($field), $m) && !preg_match('/^mailto_(.+?)$/', trim($field), $m)) {
$id_record = $r['id'];
$hash = '';

View File

@ -172,6 +172,41 @@ if (empty($record) || !$has_access) {
<i class="fa fa-chevron-left"></i> '.tr("Torna all'elenco").'
</a>';
// Pulsante Precedente e Successivo
// Aggiungo eventuali filtri applicati alla vista
if (count(getSearchValues($id_module)) > 0) {
foreach (getSearchValues($id_module) as $key => $value) {
$where[$key] = $value;
}
}
// Ricavo la posizione per questo id_record
$order = $_SESSION['module_'.$id_module]['order'] ?: [];
$module_query = Util\Query::getQuery($structure, $where, $order);
$posizioni = $dbo->fetchArray($module_query);
$key = array_search($id_record, array_column($posizioni, 'id'));
// Precedente
$prev = $posizioni[$key-1]['id'];
// Successivo
$next = $posizioni[$key+1]['id'];
if (isMobile()) {
echo '<div>';
} else {
echo '<div class="col-md-2 d-none d-sm-inline">';
}
echo '
<a class="btn btn-default'.($prev ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$prev.'">
<i class="fa fa-arrow-circle-left"></i>
</a>
<a class="btn btn-default'.($next ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$next.'">
<i class="fa fa-arrow-circle-right"></i>
</a>
</div>';
if (isMobile()) {
echo '<div>';
} else {

View File

@ -128,6 +128,10 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
$attr_td .= " width='30'";
$name = str_replace('icon_', 'icon_title_', $name);
$field = str_replace('icon_', '', $field);
} elseif (preg_match('/^mailto_/', (string) $field)) {
$field = str_replace('mailto_', '', $field);
} elseif (preg_match('/^tel_/', (string) $field)) {
$field = str_replace('tel_', '', $field);
}
if (isMobile()) {

View File

@ -120,17 +120,17 @@ class Sede extends Model
$this->lat = $data[0]->lat;
$this->lng = $data[0]->lon;
} elseif (setting('Gestore mappa') == 'Google Maps') {
$curl = new CurlHttpAdapter();
$geocoder = new GoogleMaps($curl, 'IT-it', null, true, $google);
$apiKey = setting('Google Maps API key per Tecnici');
$url = 'https://maps.googleapis.com/maps/api/geocode/json?address='.$indirizzo.'&key='.$apiKey;
// Ricerca indirizzo
$address = $geocoder->geocode($indirizzo)->first();
$coordinates = $address->getCoordinates();
$response = file_get_contents($url);
$data = json_decode($response, true);
// Salvataggio informazioni
$this->gaddress = $data[0]->display_name;
$this->lat = $coordinates->getLatitude();
$this->lng = $coordinates->getLongitude();
if ($data['status'] == 'OK') {
$this->lat = $data['results'][0]['geometry']['location']['lat'];
$this->lng = $data['results'][0]['geometry']['location']['lng'];
$this->gaddress = $data['results'][0]['formatted_address'];
}
}
}
}

View File

@ -277,7 +277,7 @@ if (empty(get('modal'))) {
$query = 'SELECT
*,
`dt_tipiddt_lang`.`title` AS tipo_documento,
`dt_ddt`.`dir`,
`dt_tipiddt`.`dir`,
`dt_ddt`.`numero`,
`dt_ddt`.`numero_esterno`,
`dt_ddt`.`data`

View File

@ -39,17 +39,8 @@ echo '
<button type="button" class="btn btn-primary '.(!empty($info_firma) ? 'tip' : '').'" title="'.$info_firma.'" onclick="anteprimaFirma()" '.($record['flag_completato'] ? 'disabled' : '').'>
<i class="fa fa-'.(!empty($info_firma) ? 'refresh' : 'desktop').'"></i> '.$frase.'...
</button>';
</button>
// TODO: da standardizzare in struttura per tutti i moduli di tipo table
/*<a class="btn btn-info'.($prev ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module=3&id_record='.$prev.'">
<i class="fa fa-arrow-circle-left"></i> '.tr('Precedente').'
</a>
<a class="btn btn-info'.($next ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module=3&id_record='.$next.'">
'.tr('Successivo').' <i class="fa fa-arrow-circle-right"></i>
</a>*/
echo '
<script>
function duplicaIntervento() {
openModal("'.tr('Duplica attività').'", "'.$module->fileurl('modals/duplicazione.php').'?id_module='.$id_module.'&id_record='.$id_record.'");

View File

@ -46,14 +46,18 @@ class Autofill
$this->max_rows_first_page = $first_page ?? $this->max_rows_first_page;
}
public function count($text, $small = false)
public function count($text, $small = null)
{
$count = ceil(strlen((string) $text) / $this->char_number);
// Ricerca dei caratteri a capo
preg_match_all("/(\r\n|\r|\n)/", (string) $text, $matches);
$count += count($matches[0]);
$count = ($count == 1 ? $count : $count / 1.538461538 );
if ($small) {
$count *= 1.5;
} elseif ($count != 1) {
$count /= 1.538461538;
}
$this->set($count);
}

View File

@ -478,7 +478,7 @@ class Query
$select = empty($select) ? '*' : implode(', ', $select);
$query = str_replace('|select|', $select.', @posizione := @posizione + 1 AS `posizione`', $query);
$query = str_replace('|select|', $select, $query);
return [
'query' => self::replacePlaceholder($query),

View File

@ -253,6 +253,7 @@ if (!empty($record['note'])) {
echo '
<p class="small-bold text-muted">'.tr('Note', [], ['upper' => true]).':</p>
<p>'.nl2br((string) $record['note']).'</p>';
$autofill->count($record['note'], true);
}
echo '