mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
Aggiornamento importazione FE
This commit is contained in:
@@ -17,32 +17,76 @@ if (!empty($list)) {
|
|||||||
<table class="table table-striped table-hover table-condensed table-bordered datatables">
|
<table class="table table-striped table-hover table-condensed table-bordered datatables">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>'.tr('Nome').'</th>
|
<th>'.tr('Descrizione').'</th>
|
||||||
|
<th>'.tr('Fornitore').'</th>
|
||||||
|
<th>'.tr('Totale imponibile').'</th>
|
||||||
<th width="20%" class="text-center">#</th>
|
<th width="20%" class="text-center">#</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>';
|
<tbody>';
|
||||||
|
|
||||||
foreach ($list as $element) {
|
foreach ($list as $element) {
|
||||||
echo '
|
$name = $element['name'];
|
||||||
<tr>
|
|
||||||
<td>'.$element.'</td>
|
|
||||||
<td class="text-center">';
|
|
||||||
|
|
||||||
if (file_exists($directory.'/'.$element)) {
|
echo '
|
||||||
|
<tr>';
|
||||||
|
if (file_exists($directory.'/'.$name)) {
|
||||||
echo '
|
echo '
|
||||||
<button type="button" class="btn btn-danger" onclick="delete_fe(this, \''.$element.'\')">
|
<td>
|
||||||
|
<p>'.$name.'</p>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>-</td>
|
||||||
|
<td>-</td>
|
||||||
|
|
||||||
|
<td class="text-center">
|
||||||
|
<button type="button" class="btn btn-danger" onclick="delete_fe(this, \''.$name.'\')">
|
||||||
<i class="fa fa-trash"></i>
|
<i class="fa fa-trash"></i>
|
||||||
</button>';
|
</button>';
|
||||||
} else {
|
} else {
|
||||||
|
$date = new DateTime($element['date']);
|
||||||
|
$date = $date->format('Y-m-d');
|
||||||
|
|
||||||
|
$descrizione = '';
|
||||||
|
if ($element['type'] == 'TD01') {
|
||||||
|
$descrizione = tr('Fattura num. _NUM_ del _DATE_', [
|
||||||
|
'_NUM_' => $element['number'],
|
||||||
|
'_DATE_' => dateFormat($date),
|
||||||
|
]);
|
||||||
|
} elseif ($element['type'] == 'TD04') {
|
||||||
|
$descrizione = tr('Nota di credito num. _NUM_ del _DATE_', [
|
||||||
|
'_NUM_' => $element['number'],
|
||||||
|
'_DATE_' => dateFormat($date),
|
||||||
|
]);
|
||||||
|
} elseif ($element['type'] == 'TD05') {
|
||||||
|
$descrizione = tr('Nota di debito num. _NUM_ del _DATE_', [
|
||||||
|
'_NUM_' => $element['number'],
|
||||||
|
'_DATE_' => dateFormat($date),
|
||||||
|
]);
|
||||||
|
} elseif ($element['type'] == 'TD06') {
|
||||||
|
$descrizione = tr('Parcella num. _NUM_ del _DATE_', [
|
||||||
|
'_NUM_' => $element['number'],
|
||||||
|
'_DATE_' => dateFormat($date),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<button type="button" class="btn btn-info" onclick="process_fe(this, \''.$element.'\')">
|
<td>
|
||||||
|
'.$descrizione.' <small>['.$name.']</small>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>'.$element['sender'].'</td>
|
||||||
|
<td>'.$element['amount'].'</td>
|
||||||
|
|
||||||
|
<td class="text-center">
|
||||||
|
<button type="button" class="btn btn-info" onclick="process_fe(this, \''.$name.'\')">
|
||||||
<i class="fa fa-upload"></i>
|
<i class="fa fa-upload"></i>
|
||||||
</button>';
|
</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<button type="button" class="btn btn-warning" '.((!extension_loaded('openssl') and substr(strtolower($element), -4) == '.p7m') ? 'disabled' : '').' onclick="download(this, \''.$element.'\')">
|
|
||||||
|
<button type="button" class="btn btn-warning" '.((!extension_loaded('openssl') && substr(strtolower($name), -4) == '.p7m') ? 'disabled' : '').' onclick="download(this, \''.$name.'\')">
|
||||||
<i class="fa fa-download"></i> '.tr('Importa').'
|
<i class="fa fa-download"></i> '.tr('Importa').'
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
@@ -16,11 +16,7 @@ class Interaction extends Services
|
|||||||
$directory = FatturaElettronica::getImportDirectory();
|
$directory = FatturaElettronica::getImportDirectory();
|
||||||
|
|
||||||
$list = [];
|
$list = [];
|
||||||
|
$names = [];
|
||||||
$files = glob($directory.'/*.xml*');
|
|
||||||
foreach ($files as $file) {
|
|
||||||
$list[] = basename($file);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ricerca da remoto
|
// Ricerca da remoto
|
||||||
if (self::isEnabled()) {
|
if (self::isEnabled()) {
|
||||||
@@ -28,15 +24,25 @@ class Interaction extends Services
|
|||||||
$body = static::responseBody($response);
|
$body = static::responseBody($response);
|
||||||
|
|
||||||
if ($body['status'] == '200') {
|
if ($body['status'] == '200') {
|
||||||
$files = $body['results'];
|
$list = $body['results'];
|
||||||
|
|
||||||
foreach ($files as $file) {
|
$names = array_column($list);
|
||||||
$list[] = basename($file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_clean($list);
|
// Ricerca fisica
|
||||||
|
$files = glob($directory.'/*.xml*');
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$name = basename($file);
|
||||||
|
|
||||||
|
if (!in_array($name, $names)) {
|
||||||
|
$list[] = [
|
||||||
|
'name' => $name,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getImportXML($name)
|
public static function getImportXML($name)
|
||||||
|
@@ -6,9 +6,9 @@ use Modules\Anagrafiche\Anagrafica;
|
|||||||
use Modules\Contratti\Contratto;
|
use Modules\Contratti\Contratto;
|
||||||
use Modules\DDT\DDT;
|
use Modules\DDT\DDT;
|
||||||
use Modules\Fatture\Fattura;
|
use Modules\Fatture\Fattura;
|
||||||
|
use Modules\Interventi\Intervento;
|
||||||
use Modules\Ordini\Ordine;
|
use Modules\Ordini\Ordine;
|
||||||
use Modules\Preventivi\Preventivo;
|
use Modules\Preventivi\Preventivo;
|
||||||
use Modules\Interventi\Intervento;
|
|
||||||
|
|
||||||
$calendar_id = filter('calendar_id');
|
$calendar_id = filter('calendar_id');
|
||||||
$start = filter('start');
|
$start = filter('start');
|
||||||
|
@@ -22,12 +22,16 @@ class Manager
|
|||||||
*/
|
*/
|
||||||
public function __construct($resource, $type, $version)
|
public function __construct($resource, $type, $version)
|
||||||
{
|
{
|
||||||
$resource = Resource::where('version', $version)
|
$object = Resource::where('version', $version)
|
||||||
->where('type', $type)
|
->where('type', $type)
|
||||||
->where('resource', $resource)
|
->where('resource', $resource)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$this->resource = $resource;
|
if (empty($object)) {
|
||||||
|
throw new ResourceNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->resource = $object;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ class Response
|
|||||||
}
|
}
|
||||||
|
|
||||||
$request = self::getRequest();
|
$request = self::getRequest();
|
||||||
$version = $request['version'] ?: 'v1';
|
$version = $request['version'];
|
||||||
|
|
||||||
// Controllo sull'accesso
|
// Controllo sull'accesso
|
||||||
if (!Auth::check() && $request['resource'] != 'login') {
|
if (!Auth::check() && $request['resource'] != 'login') {
|
||||||
@@ -220,6 +220,10 @@ class Response
|
|||||||
if (empty($request['token'])) {
|
if (empty($request['token'])) {
|
||||||
$request['token'] = '';
|
$request['token'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($request['version'])) {
|
||||||
|
$request['version'] = 'v1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user