mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-18 12:30:35 +01:00
Aggiunti esempio csv anagrafiche per modulo import
This commit is contained in:
parent
eb65c39fa8
commit
dc5ea2dfe9
@ -3,7 +3,28 @@
|
|||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
switch (post('op')) {
|
switch (post('op')) {
|
||||||
case 'import':
|
|
||||||
|
case 'example':
|
||||||
|
|
||||||
|
$module = filter('module');
|
||||||
|
|
||||||
|
$list = array (
|
||||||
|
array('Codice','Ragione sociale','Partita IVA','Nazione','Indirizzo','CAP','Città','Provincia','Telefono','Fax','Cellulare','Email','IBAN','Note','Tipologia'),
|
||||||
|
array('00001','Cliente','12345678910','ITALIA','Via Giuseppe Mazzini, 123','12345','Este','PD','786 543 21','123 456 78','321 123 456 78','email@cliente.it','IT60 X054 2811 1010 0000 0123 456','Anagrafica di esempio','Cliente'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$fp = fopen('../../files/'.$module.'/'.$module.'.csv', 'w');
|
||||||
|
|
||||||
|
foreach ($list as $fields) {
|
||||||
|
fputcsv($fp, $fields, ';');
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fp);
|
||||||
|
exit;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'import':
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
if (!empty($value)) {
|
if (!empty($value)) {
|
||||||
|
@ -28,7 +28,36 @@ foreach ($imports as $key => $value) {
|
|||||||
<!-- PULSANTI -->
|
<!-- PULSANTI -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
|
<button id="example" type="button" class="btn btn-info hide" ><i class="fa fa-file"></i> <?php echo tr('Scarica esempio CSV'); ?></button>
|
||||||
<button type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?></button>
|
<button type="submit" class="btn btn-primary"><i class="fa fa-plus"></i> <?php echo tr('Aggiungi'); ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#id_record').change( function(){
|
||||||
|
if ($(this).val()>0){
|
||||||
|
$( "#example" ).removeClass('hide');
|
||||||
|
}else{
|
||||||
|
$( "#example" ).addClass('hide');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$( "#example" ).click(function(event) {
|
||||||
|
|
||||||
|
var module = $('#id_record').find(':selected').data('text').toLowerCase();
|
||||||
|
var dir = "<?php echo ROOTDIR; ?>/modules/"+module+"/import.php";
|
||||||
|
var file = "<?php echo ROOTDIR; ?>/files/"+module+"/"+module+".csv";
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: dir,
|
||||||
|
type: 'post',
|
||||||
|
data: {op: 'example', module: module},
|
||||||
|
success: function(data){
|
||||||
|
window.location = file;
|
||||||
|
$('#main_loading').hide();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user