mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-18 12:30:35 +01:00
Aggiunta possibilità di aggiungere sedi al volo per le fatture
This commit is contained in:
parent
6736190797
commit
e537c752df
@ -200,7 +200,7 @@ switch ($resource) {
|
|||||||
|
|
||||||
case 'sedi':
|
case 'sedi':
|
||||||
if (isset($superselect['idanagrafica'])) {
|
if (isset($superselect['idanagrafica'])) {
|
||||||
$query = "SELECT * FROM (SELECT '0' AS id, 'Sede legale' AS descrizione UNION SELECT id, CONCAT_WS(' - ', nomesede, citta) FROM an_sedi |where|) AS tab |filter| ORDER BY descrizione";
|
$query = "SELECT * FROM (SELECT '0' AS id, CONCAT('Sede legale', ' (' , (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = ".$superselect['idanagrafica']." ), ')') AS descrizione UNION SELECT id, CONCAT_WS(' - ', nomesede, citta) FROM an_sedi |where|) AS tab |filter| ORDER BY descrizione";
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$filter[] = 'id='.prepare($element);
|
$filter[] = 'id='.prepare($element);
|
||||||
@ -219,7 +219,7 @@ switch ($resource) {
|
|||||||
if (isset($superselect['idanagrafica'])) {
|
if (isset($superselect['idanagrafica'])) {
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
$query = "SELECT * FROM (SELECT '0' AS id, 'Sede legale' AS descrizione UNION SELECT id, CONCAT_WS(' - ', nomesede, citta) FROM an_sedi |where|) AS tab |filter| ORDER BY descrizione";
|
$query = "SELECT * FROM (SELECT '0' AS id, CONCAT('Sede legale', ' (' , (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = ".$user->idanagrafica." ), ')') AS descrizione UNION SELECT id, CONCAT_WS(' - ', nomesede, citta) FROM an_sedi |where|) AS tab |filter| ORDER BY descrizione";
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$filter[] = 'id='.prepare($element);
|
$filter[] = 'id='.prepare($element);
|
||||||
|
@ -157,7 +157,7 @@ if (empty($record['is_fiscale'])) {
|
|||||||
if ($dir == 'uscita') {
|
if ($dir == 'uscita') {
|
||||||
?>
|
?>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{[ "type": "select", "label": "<?php echo tr('Partenza merce'); ?>", "name": "idsede_partenza", "ajax-source": "sedi", "placeholder": "Sede legale", "value": "$idsede_partenza$"]}
|
{[ "type": "select", "label": "<?php echo tr('Partenza merce'); ?>", "name": "idsede_partenza", "ajax-source": "sedi", "placeholder": "Sede legale", "value": "$idsede_partenza$", "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|id_plugin=<?php echo Plugins::get('Sedi')['id']; ?>&id_parent=<?php echo $record['idanagrafica']; ?>||<?php echo (intval($block_edit)) ? 'disabled' : ''; ?>" ]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
@ -171,7 +171,7 @@ if (empty($record['is_fiscale'])) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{[ "type": "select", "label": "<?php echo tr('Destinazione merce'); ?>", "name": "idsede_destinazione", "ajax-source": "sedi", "value": "$idsede_destinazione$", "readonly": "" ]}
|
{[ "type": "select", "label": "<?php echo tr('Destinazione merce'); ?>", "name": "idsede_destinazione", "ajax-source": "sedi", "value": "$idsede_destinazione$", "readonly": "", "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|id_plugin=<?php echo Plugins::get('Sedi')['id']; ?>&id_parent=<?php echo $record['idanagrafica']; ?>||<?php echo (intval($block_edit)) ? 'disabled' : ''; ?>" ]}
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,29 @@ $operazione = filter('op');
|
|||||||
|
|
||||||
switch ($operazione) {
|
switch ($operazione) {
|
||||||
case 'addreferente':
|
case 'addreferente':
|
||||||
$dbo->insert('an_referenti', [
|
if (!empty(post('nome'))){
|
||||||
'idanagrafica' => $id_parent,
|
|
||||||
'nome' => post('nome'),
|
|
||||||
'mansione' => post('mansione'),
|
|
||||||
'telefono' => post('telefono'),
|
|
||||||
'email' => post('email'),
|
|
||||||
'idsede' => post('idsede'),
|
|
||||||
]);
|
|
||||||
$id_record = $dbo->lastInsertedID();
|
|
||||||
|
|
||||||
flash()->info(tr('Aggiunto nuovo referente!'));
|
$dbo->insert('an_referenti', [
|
||||||
|
'idanagrafica' => $id_parent,
|
||||||
|
'nome' => post('nome'),
|
||||||
|
'mansione' => post('mansione'),
|
||||||
|
'telefono' => post('telefono'),
|
||||||
|
'email' => post('email'),
|
||||||
|
'idsede' => post('idsede'),
|
||||||
|
]);
|
||||||
|
$id_record = $dbo->lastInsertedID();
|
||||||
|
|
||||||
|
if (isAjaxRequest() && !empty($id_record)) {
|
||||||
|
echo json_encode(['id' => $id_record, 'text' => post('nome')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
flash()->info(tr('Aggiunto nuovo referente!'));
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
flash()->warning(tr('Errore durante aggiunta del referente'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -6,23 +6,35 @@ $operazione = filter('op');
|
|||||||
|
|
||||||
switch ($operazione) {
|
switch ($operazione) {
|
||||||
case 'addsede':
|
case 'addsede':
|
||||||
$dbo->insert('an_sedi', [
|
|
||||||
'idanagrafica' => $id_parent,
|
|
||||||
'nomesede' => post('nomesede'),
|
|
||||||
'indirizzo' => post('indirizzo'),
|
|
||||||
'citta' => post('citta'),
|
|
||||||
'cap' => post('cap'),
|
|
||||||
'provincia' => strtoupper(post('provincia')),
|
|
||||||
'km' => post('km'),
|
|
||||||
'cellulare' => post('cellulare'),
|
|
||||||
'telefono' => post('telefono'),
|
|
||||||
'email' => post('email'),
|
|
||||||
'id_nazione' => !empty(post('id_nazione')) ? post('id_nazione') : null,
|
|
||||||
'idzona' => post('idzona'),
|
|
||||||
]);
|
|
||||||
$id_record = $dbo->lastInsertedID();
|
|
||||||
|
|
||||||
flash()->info(tr('Aggiunta una nuova sede!'));
|
if (!empty(post('nomesede'))){
|
||||||
|
$dbo->insert('an_sedi', [
|
||||||
|
'idanagrafica' => $id_parent,
|
||||||
|
'nomesede' => post('nomesede'),
|
||||||
|
'indirizzo' => post('indirizzo'),
|
||||||
|
'citta' => post('citta'),
|
||||||
|
'cap' => post('cap'),
|
||||||
|
'provincia' => strtoupper(post('provincia')),
|
||||||
|
'km' => post('km'),
|
||||||
|
'cellulare' => post('cellulare'),
|
||||||
|
'telefono' => post('telefono'),
|
||||||
|
'email' => post('email'),
|
||||||
|
'id_nazione' => !empty(post('id_nazione')) ? post('id_nazione') : null,
|
||||||
|
'idzona' => post('idzona'),
|
||||||
|
]);
|
||||||
|
$id_record = $dbo->lastInsertedID();
|
||||||
|
|
||||||
|
if (isAjaxRequest() && !empty($id_record)) {
|
||||||
|
echo json_encode(['id' => $id_record, 'text' => post('nomesede').' - '.post('citta')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
flash()->info(tr('Aggiunta una nuova sede!'));
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
flash()->warning(tr('Errore durante aggiunta della sede'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user