Possibilità di interrogazione db da API per resource anagrafiche

This commit is contained in:
Luca 2020-11-12 10:58:37 +01:00
parent 9fba3330ec
commit 4ee3d228b6
3 changed files with 23 additions and 3 deletions

View File

@ -196,7 +196,7 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
</div>
<div class="col-md-5 text-right">
<i class="fa fa-question-circle tip" title="'.tr('Le operazioni di esportazione, copia e stampa sono limitate alle righe selezionate e visibili della tabella').'. '.tr('Per azioni su tutti i contenuti selezionati, utilizzare le Azioni di gruppo').'."></i>
<i class="fa fa-question-circle-o tip" title="'.tr('Le operazioni di esportazione, copia e stampa sono limitate alle righe selezionate e visibili della tabella').'. '.tr('Per azioni su tutti i contenuti selezionati, utilizzare le Azioni di gruppo').'."></i>
<div class="btn-group" role="group">';
if (setting('Abilita esportazione Excel e PDF')) {

View File

@ -63,8 +63,28 @@ class Anagrafiche extends Resource implements RetrieveInterface, CreateInterface
$filters[] = 'an_anagrafiche.idanagrafica IN (SELECT idanagrafica FROM an_tipianagrafiche_anagrafiche WHERE idtipoanagrafica = (SELECT idtipoanagrafica FROM an_tipianagrafiche WHERE descrizione = '.prepare($type).'))';
}
$query .= !empty($filters) ? ' AND ('.implode('OR ', $filters).')' : '';
//Aggiunta possibilità di interrogazione db da API per resource anagrafiche
$filter = (array) $request['filter'];
foreach ($filter as $key => $value) {
$value = substr($value, 1, -1);
$result = [];
if (str_contains($value, ',')) {
$temp = explode(',', $value);
foreach ($temp as $value) {
$result = $key.'='.prepare($value);
}
} else {
$result = $key.'='.prepare($value);
}
$filters[] = $result;
}
$query .= !empty($filters) ? ' AND ('.implode(' OR ', $filters).')' : '';
$query .= '
HAVING 2=2
ORDER BY an_anagrafiche.ragione_sociale';

View File

@ -240,7 +240,7 @@ return [
'crea_fattura' => [
'text' => '<span><i class="fa fa-file-code-o"></i> '.tr('Fattura _TYPE_', [ '_TYPE_' => strtolower($module['name'])]),
'data' => [
'title' => tr('Fatturare gli _TYPE_ selezionati?', [ '_TYPE_' => strtolower($module['name'])]).' <small class="tip" title="'.tr("Verranno fatturati solo gli interventi completati non collegati a contratti o preventivi").'."><i class="fa fa-question-circle-o"></i></small>',
'title' => tr('Fatturare gli _TYPE_ selezionati?', [ '_TYPE_' => strtolower($module['name'])]).' <small><i class="fa fa-question-circle-o tip" title="'.tr("Verranno fatturati solo gli interventi completati non collegati a contratti o preventivi").'."></i></small>',
'msg' =>'{[ "type": "checkbox", "label": "<small>'.tr('Aggiungere alle fatture di vendita non ancora emesse?').'</small>", "placeholder": "'.tr('Aggiungere alle fatture di vendita nello stato bozza?').'", "name": "accodare" ]}<br>
{[ "type": "select", "label": "'.tr('Sezionale').'", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module=\''.$id_fatture.'\' AND is_fiscale = 1 ORDER BY name", "value": "'.$id_segment.'" ]}',
'button' => tr('Procedi'),