Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 455b6f19bf | |||
| 16e00f8573 | |||
| baf3f6da32 | |||
| 040708a2db | |||
| 6e465e3010 | |||
| 8b08969c69 | |||
| 34d4dc8660 | |||
| 1510ef03f1 | |||
| ce8c95921f | |||
| 095a6ae879 | |||
| 296143016a | |||
| 3aa2504f3c | |||
| c1a396f246 | |||
| a45ba1c8b3 | |||
| 7a944a73f7 | |||
| 71595cc8de | |||
| f89dbd0c23 | |||
| 9ba859e15b | |||
| 672e448e9a | |||
| 0749032fbc | |||
| d692614f70 | |||
| 1303cff9fd | |||
| 6b2bd0964b | |||
| 0d2cf13524 | |||
| f6ef9c39d2 | |||
| 7e4ed56f28 | |||
| 06dd7883c2 | |||
| 4d0644f46c | |||
| 712042b8d8 | |||
| efee12740d | |||
| 14395810d0 | |||
| 03002a8938 | |||
| 21fcee8ff5 | |||
| 1361340928 | |||
| 1bda30e957 | |||
| a87423d879 | |||
| 24cda34681 | |||
| 22e4e652b5 | |||
| 2c514a8ab6 | |||
| b1ea728c15 | |||
| caf5568779 | |||
| 0728fd8f01 | |||
| 9d5c20113f | |||
| 47762a8557 | |||
| 434bb0d993 | |||
| 939a4fe03e | |||
| 493de65892 | |||
| d8eca66747 | |||
| 23ae8e1b1d | |||
| a14aa6eb98 | |||
| 99a30e4d9f | |||
| 7ad20993d9 | |||
| 8978980901 | |||
| 6d66c5cf97 | |||
| b3f19be47d | |||
| 13e73abc5d | |||
| 14d91b6d6e | |||
| c004636b6c | |||
| 4c4c6e3153 | |||
| 7d0824d01f | |||
| 32c0966801 | |||
| 57ab20ed1f | |||
| c533973420 | |||
| b092abf8c7 | |||
| 78089cadc1 | |||
| 3816bf5a20 | |||
| e8b15d8096 | |||
| d925726ecd | |||
| aaad0a6bda |
@@ -1,40 +0,0 @@
|
|||||||
APP_ENV=production
|
|
||||||
APP_DEBUG=true
|
|
||||||
APP_KEY=base64:C+sutHm6xP5sE4QXhoZFhYjArlVN11s2mDU1F8beUkM=
|
|
||||||
APP_URL=http://vanguard.test
|
|
||||||
|
|
||||||
LOG_CHANNEL=stack
|
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
|
||||||
DB_HOST="localhost"
|
|
||||||
DB_DATABASE="trfcertest"
|
|
||||||
DB_USERNAME="solocla"
|
|
||||||
DB_PASSWORD="!Massarosa2"
|
|
||||||
DB_PREFIX="auth_"
|
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
|
||||||
CACHE_DRIVER=file
|
|
||||||
QUEUE_DRIVER=sync
|
|
||||||
SESSION_DRIVER=database
|
|
||||||
SESSION_LIFETIME=120
|
|
||||||
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PASSWORD=null
|
|
||||||
REDIS_PORT=6379
|
|
||||||
|
|
||||||
MAIL_MAILER=mail
|
|
||||||
MAIL_FROM_NAME=Vanguard
|
|
||||||
MAIL_FROM_ADDRESS=vanguard@test.dev
|
|
||||||
MAIL_HOST=smtp.mailtrap.io
|
|
||||||
MAIL_PORT=2525
|
|
||||||
MAIL_USERNAME=null
|
|
||||||
MAIL_PASSWORD=null
|
|
||||||
MAIL_ENCRYPTION=null
|
|
||||||
|
|
||||||
PUSHER_APP_ID=
|
|
||||||
PUSHER_APP_KEY=
|
|
||||||
PUSHER_APP_SECRET=
|
|
||||||
PUSHER_APP_CLUSTER=mt1
|
|
||||||
|
|
||||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
|
||||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
||||||
@@ -21,3 +21,34 @@ yarn-error.log
|
|||||||
.env.backup
|
.env.backup
|
||||||
.env.production
|
.env.production
|
||||||
auth.json
|
auth.json
|
||||||
|
# File di debug e temporanei JSON e log
|
||||||
|
/public/userarea/*.json
|
||||||
|
/public/userarea/*.log
|
||||||
|
/public/userarea/*.txt
|
||||||
|
|
||||||
|
# File di log nella sottocartella class
|
||||||
|
/public/userarea/class/*.log
|
||||||
|
|
||||||
|
# File XLSX temporanei importati
|
||||||
|
/public/userarea/imported_trf/*.xlsx
|
||||||
|
/public/userarea/xlstemplates/*.xlsx
|
||||||
|
|
||||||
|
# Ignora cartelle di foto generate
|
||||||
|
/public/photostrf/
|
||||||
|
/public/photostrf/qrcodes/
|
||||||
|
public/userarea/import_debug.log
|
||||||
|
public/userarea/last_url.txt
|
||||||
|
public/userarea/class/curl_auth_debug.log
|
||||||
|
public/userarea/class/curl_request_debug.log
|
||||||
|
public/userarea/last_url.txt
|
||||||
|
public/userarea/class/curl_auth_debug.log
|
||||||
|
public/userarea/class/curl_request_debug.log
|
||||||
|
|
||||||
|
# Ignora tutti i log
|
||||||
|
*.log
|
||||||
|
|
||||||
|
|
||||||
|
# Ignora cartella photostrf in public/userarea
|
||||||
|
/public/userarea/photostrf/
|
||||||
|
public/userarea/customfield_values_response.json
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Userarea;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class UploadPhotosMobileController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$iddatadb = $request->query('iddatadb');
|
||||||
|
|
||||||
|
if (empty($iddatadb)) {
|
||||||
|
return response('ID riga non fornito', 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the upload form
|
||||||
|
return view('userarea.upload_photos_mobile', [
|
||||||
|
'iddatadb' => $iddatadb
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function upload(Request $request)
|
||||||
|
{
|
||||||
|
// Validation
|
||||||
|
$request->validate([
|
||||||
|
'photo' => 'required|file|mimes:jpeg,png,gif,heic,heif|max:5120', // 5MB
|
||||||
|
'iddatadb' => 'required|integer'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$iddatadb = $request->input('iddatadb');
|
||||||
|
$photo = $request->file('photo');
|
||||||
|
$iduserlogin = auth()->id(); // assuming Laravel authentication
|
||||||
|
|
||||||
|
// Check if user exists
|
||||||
|
$userExists = DB::table('auth_users')->where('id', $iduserlogin)->exists();
|
||||||
|
if (!$userExists) {
|
||||||
|
return response()->json(['success' => false, 'message' => 'Utente non valido']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload folder
|
||||||
|
$uploadDir = public_path('photostrf');
|
||||||
|
if (!is_dir($uploadDir)) {
|
||||||
|
mkdir($uploadDir, 0755, true);
|
||||||
|
}
|
||||||
|
if (!is_writable($uploadDir)) {
|
||||||
|
return response()->json(['success' => false, 'message' => 'La cartella photostrf non è scrivibile']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// New filename
|
||||||
|
$timestamp = now()->format('YmdHis');
|
||||||
|
$originalName = pathinfo($photo->getClientOriginalName(), PATHINFO_FILENAME);
|
||||||
|
$extension = strtolower($photo->getClientOriginalExtension());
|
||||||
|
|
||||||
|
$newFileName = "{$iddatadb}-{$timestamp}-{$originalName}.{$extension}";
|
||||||
|
$destination = $uploadDir . '/' . $newFileName;
|
||||||
|
|
||||||
|
// Move uploaded file
|
||||||
|
$photo->move($uploadDir, $newFileName);
|
||||||
|
|
||||||
|
// Save DB record
|
||||||
|
DB::table('datadb_photos')->insert([
|
||||||
|
'iddatadb' => $iddatadb,
|
||||||
|
'file_path' => $newFileName,
|
||||||
|
'file_name' => $newFileName,
|
||||||
|
'uploaded_by' => $iduserlogin
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json(['success' => true, 'message' => 'Foto caricata con successo']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -110,7 +110,7 @@ class LoginController extends Controller
|
|||||||
if ($user->hasRole('Admin')) {
|
if ($user->hasRole('Admin')) {
|
||||||
return redirect()->to('userarea/import_dashboard.php');
|
return redirect()->to('userarea/import_dashboard.php');
|
||||||
} elseif ($user->hasRole('User')) {
|
} elseif ($user->hasRole('User')) {
|
||||||
return redirect()->to('userarea/index.php');
|
return redirect()->to('userarea/import_dashboard.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se il ruolo non è specificato, reindirizza alla home predefinita
|
// Se il ruolo non è specificato, reindirizza alla home predefinita
|
||||||
|
|||||||
@@ -28,10 +28,21 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
\Illuminate\Database\Schema\Builder::defaultStringLength(191);
|
\Illuminate\Database\Schema\Builder::defaultStringLength(191);
|
||||||
|
|
||||||
Factory::guessFactoryNamesUsing(function (string $modelName) {
|
Factory::guessFactoryNamesUsing(function (string $modelName) {
|
||||||
return 'Database\Factories\\'.class_basename($modelName).'Factory';
|
return 'Database\Factories\\' . class_basename($modelName) . 'Factory';
|
||||||
});
|
});
|
||||||
|
|
||||||
\Illuminate\Pagination\Paginator::useBootstrap();
|
\Illuminate\Pagination\Paginator::useBootstrap();
|
||||||
|
|
||||||
|
// Register Microsoft Socialite driver
|
||||||
|
$this->app->make('Laravel\Socialite\Contracts\Factory')->extend('microsoft', function ($app) {
|
||||||
|
$config = $app['config']['services.microsoft'];
|
||||||
|
return new \SocialiteProviders\Microsoft\Provider(
|
||||||
|
$app['request'],
|
||||||
|
$config['client_id'],
|
||||||
|
$config['client_secret'],
|
||||||
|
$config['redirect']
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,6 +34,14 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
Verified::class => [
|
Verified::class => [
|
||||||
ActivateUser::class,
|
ActivateUser::class,
|
||||||
],
|
],
|
||||||
|
<<<<<<< HEAD
|
||||||
|
\SocialiteProviders\Manager\SocialiteWasMapped::class => [
|
||||||
|
\SocialiteProviders\Microsoft\MicrosoftExtendSocialite::class,
|
||||||
|
=======
|
||||||
|
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
|
||||||
|
'SocialiteProviders\\Azure\\AzureExtendSocialite@handle',
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,7 +51,7 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
parent::boot(); // Aggiungi questa linea per sicurezza
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$app = new Illuminate\Foundation\Application(
|
$app = new Illuminate\Foundation\Application(
|
||||||
realpath(__DIR__.'/../')
|
realpath(__DIR__ . '/../')
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -38,12 +38,17 @@
|
|||||||
"laravel/fortify": "^1.21",
|
"laravel/fortify": "^1.21",
|
||||||
"laravel/framework": "^11.0",
|
"laravel/framework": "^11.0",
|
||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/socialite": "^5.0",
|
"laravel/socialite": "^5.16",
|
||||||
"laravel/tinker": "^2.7",
|
"laravel/tinker": "^2.7",
|
||||||
"laravel/ui": "^4.0",
|
"laravel/ui": "^4.0",
|
||||||
"phpmailer/phpmailer": "^6.9",
|
"phpmailer/phpmailer": "^6.9",
|
||||||
"phpoffice/phpspreadsheet": "^4.1",
|
"phpoffice/phpspreadsheet": "^4.1",
|
||||||
"proengsoft/laravel-jsvalidation": "^4.0.0",
|
"proengsoft/laravel-jsvalidation": "^4.0.0",
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"socialiteproviders/microsoft": "^4.7",
|
||||||
|
=======
|
||||||
|
"socialiteproviders/microsoft-azure": "^5.2",
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
"spatie/laravel-query-builder": "^5.0",
|
"spatie/laravel-query-builder": "^5.0",
|
||||||
"vanguardapp/activity-log": "^6.0",
|
"vanguardapp/activity-log": "^6.0",
|
||||||
"vanguardapp/announcements": "^6.0",
|
"vanguardapp/announcements": "^6.0",
|
||||||
|
|||||||
@@ -4,7 +4,11 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "ef3e05e7260284f5b7c7b4b6f93b252b",
|
<<<<<<< HEAD
|
||||||
|
"content-hash": "9c4f1e3bc3ee2180211c055e70635aef",
|
||||||
|
=======
|
||||||
|
"content-hash": "583c865e5b67680202a816953a662b03",
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "akaunting/laravel-setting",
|
"name": "akaunting/laravel-setting",
|
||||||
@@ -2240,16 +2244,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/socialite",
|
"name": "laravel/socialite",
|
||||||
"version": "v5.15.1",
|
"version": "v5.16.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/socialite.git",
|
"url": "https://github.com/laravel/socialite.git",
|
||||||
"reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029"
|
"reference": "40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/socialite/zipball/cc02625f0bd1f95dc3688eb041cce0f1e709d029",
|
"url": "https://api.github.com/repos/laravel/socialite/zipball/40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf",
|
||||||
"reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029",
|
"reference": "40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2271,16 +2275,16 @@
|
|||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "5.x-dev"
|
|
||||||
},
|
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
|
||||||
"Laravel\\Socialite\\SocialiteServiceProvider"
|
|
||||||
],
|
|
||||||
"aliases": {
|
"aliases": {
|
||||||
"Socialite": "Laravel\\Socialite\\Facades\\Socialite"
|
"Socialite": "Laravel\\Socialite\\Facades\\Socialite"
|
||||||
}
|
},
|
||||||
|
"providers": [
|
||||||
|
"Laravel\\Socialite\\SocialiteServiceProvider"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "5.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -2308,7 +2312,7 @@
|
|||||||
"issues": "https://github.com/laravel/socialite/issues",
|
"issues": "https://github.com/laravel/socialite/issues",
|
||||||
"source": "https://github.com/laravel/socialite"
|
"source": "https://github.com/laravel/socialite"
|
||||||
},
|
},
|
||||||
"time": "2024-06-28T20:09:34+00:00"
|
"time": "2024-09-03T09:46:57+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/tinker",
|
"name": "laravel/tinker",
|
||||||
@@ -4980,6 +4984,170 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-04-27T21:32:50+00:00"
|
"time": "2024-04-27T21:32:50+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "socialiteproviders/manager",
|
||||||
|
"version": "v4.8.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/SocialiteProviders/Manager.git",
|
||||||
|
"reference": "8180ec14bef230ec2351cff993d5d2d7ca470ef4"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/SocialiteProviders/Manager/zipball/8180ec14bef230ec2351cff993d5d2d7ca470ef4",
|
||||||
|
"reference": "8180ec14bef230ec2351cff993d5d2d7ca470ef4",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
|
||||||
|
"laravel/socialite": "^5.5",
|
||||||
|
"php": "^8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^1.2",
|
||||||
|
"phpunit/phpunit": "^9.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"SocialiteProviders\\Manager\\ServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"SocialiteProviders\\Manager\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Andy Wendt",
|
||||||
|
"email": "andy@awendt.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Anton Komarev",
|
||||||
|
"email": "a.komarev@cybercog.su"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Miguel Piedrafita",
|
||||||
|
"email": "soy@miguelpiedrafita.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "atymic",
|
||||||
|
"email": "atymicq@gmail.com",
|
||||||
|
"homepage": "https://atymic.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Easily add new or override built-in providers in Laravel Socialite.",
|
||||||
|
"homepage": "https://socialiteproviders.com",
|
||||||
|
"keywords": [
|
||||||
|
"laravel",
|
||||||
|
"manager",
|
||||||
|
"oauth",
|
||||||
|
"providers",
|
||||||
|
"socialite"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/socialiteproviders/manager/issues",
|
||||||
|
"source": "https://github.com/socialiteproviders/manager"
|
||||||
|
},
|
||||||
|
"time": "2025-02-24T19:33:30+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"name": "socialiteproviders/microsoft",
|
||||||
|
"version": "4.7.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/SocialiteProviders/Microsoft.git",
|
||||||
|
"reference": "824ef97a4f6e3f363c21702b76676d54e8265573"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/SocialiteProviders/Microsoft/zipball/824ef97a4f6e3f363c21702b76676d54e8265573",
|
||||||
|
"reference": "824ef97a4f6e3f363c21702b76676d54e8265573",
|
||||||
|
=======
|
||||||
|
"name": "socialiteproviders/microsoft-azure",
|
||||||
|
"version": "5.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/SocialiteProviders/Microsoft-Azure.git",
|
||||||
|
"reference": "453d62c9d7e3b3b76e94c913fb46e68a33347b16"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/SocialiteProviders/Microsoft-Azure/zipball/453d62c9d7e3b3b76e94c913fb46e68a33347b16",
|
||||||
|
"reference": "453d62c9d7e3b3b76e94c913fb46e68a33347b16",
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"firebase/php-jwt": "^6.8",
|
||||||
|
=======
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
|
"php": "^8.0",
|
||||||
|
"socialiteproviders/manager": "^4.4"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"SocialiteProviders\\Microsoft\\": ""
|
||||||
|
=======
|
||||||
|
"SocialiteProviders\\Azure\\": ""
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"name": "Brian Faust",
|
||||||
|
"email": "hello@brianfaust.de"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Microsoft OAuth2 Provider for Laravel Socialite",
|
||||||
|
"keywords": [
|
||||||
|
=======
|
||||||
|
"name": "Chris Hemmings",
|
||||||
|
"email": "chris@hemmin.gs"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Microsoft Azure OAuth2 Provider for Laravel Socialite",
|
||||||
|
"keywords": [
|
||||||
|
"azure",
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
|
"laravel",
|
||||||
|
"microsoft",
|
||||||
|
"oauth",
|
||||||
|
"provider",
|
||||||
|
"socialite"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"docs": "https://socialiteproviders.com/microsoft",
|
||||||
|
"issues": "https://github.com/socialiteproviders/providers/issues",
|
||||||
|
"source": "https://github.com/socialiteproviders/providers"
|
||||||
|
},
|
||||||
|
"time": "2025-07-06T00:25:25+00:00"
|
||||||
|
=======
|
||||||
|
"docs": "https://socialiteproviders.com/microsoft-azure",
|
||||||
|
"issues": "https://github.com/socialiteproviders/providers/issues",
|
||||||
|
"source": "https://github.com/socialiteproviders/providers"
|
||||||
|
},
|
||||||
|
"time": "2024-03-15T03:02:10+00:00"
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "spatie/laravel-package-tools",
|
"name": "spatie/laravel-package-tools",
|
||||||
"version": "1.16.4",
|
"version": "1.16.4",
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ return [
|
|||||||
Proengsoft\JsValidation\JsValidationServiceProvider::class,
|
Proengsoft\JsValidation\JsValidationServiceProvider::class,
|
||||||
Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::class,
|
Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::class,
|
||||||
Laravel\Socialite\SocialiteServiceProvider::class,
|
Laravel\Socialite\SocialiteServiceProvider::class,
|
||||||
|
\SocialiteProviders\Manager\ServiceProvider::class,
|
||||||
Webpatser\Countries\CountriesServiceProvider::class,
|
Webpatser\Countries\CountriesServiceProvider::class,
|
||||||
Intervention\Image\ImageServiceProvider::class,
|
Intervention\Image\ImageServiceProvider::class,
|
||||||
Jenssegers\Agent\AgentServiceProvider::class,
|
Jenssegers\Agent\AgentServiceProvider::class,
|
||||||
|
|||||||
@@ -11,9 +11,13 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 'social' => [
|
'social' => [
|
||||||
// 'providers' => ['facebook', 'twitter', 'google'],
|
<<<<<<< HEAD
|
||||||
// ],
|
'providers' => ['facebook', 'twitter', 'google', 'microsoft'],
|
||||||
|
=======
|
||||||
|
'providers' => ['azure'],
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -64,9 +64,18 @@ return [
|
|||||||
'redirect' => env('GOOGLE_CALLBACK_URI'),
|
'redirect' => env('GOOGLE_CALLBACK_URI'),
|
||||||
],
|
],
|
||||||
|
|
||||||
// 'authy' => [
|
<<<<<<< HEAD
|
||||||
// 'key' => env('AUTHY_KEY'),
|
'microsoft' => [
|
||||||
// ],
|
'client_id' => env('MICROSOFT_CLIENT_ID'),
|
||||||
|
'client_secret' => env('MICROSOFT_CLIENT_SECRET'),
|
||||||
|
'redirect' => env('MICROSOFT_REDIRECT_URI'),
|
||||||
|
],
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> 040708a2dbf9850937d72bcdb4aba264fe9b9f4c
|
||||||
|
// 'authy' => [
|
||||||
|
// 'key' => env('AUTHY_KEY'),
|
||||||
|
// ],
|
||||||
|
|
||||||
'resend' => [
|
'resend' => [
|
||||||
'key' => env('RESEND_KEY'),
|
'key' => env('RESEND_KEY'),
|
||||||
@@ -78,4 +87,11 @@ return [
|
|||||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'azure' => [
|
||||||
|
'client_id' => env('AZURE_CLIENT_ID'),
|
||||||
|
'client_secret' => env('AZURE_CLIENT_SECRET'),
|
||||||
|
'redirect' => env('AZURE_REDIRECT_URI'),
|
||||||
|
'tenant' => env('AZURE_TENANT_ID'),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 510 B |
|
Before Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 508 B |
|
Before Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 510 B |
|
Before Width: | Height: | Size: 516 B |
|
Before Width: | Height: | Size: 512 B |
|
Before Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 517 B |
|
After Width: | Height: | Size: 451 B |
|
After Width: | Height: | Size: 510 B |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 460 B |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 456 B |
|
After Width: | Height: | Size: 460 B |
|
After Width: | Height: | Size: 457 B |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 455 B |
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// URL dell'API e credenziali
|
||||||
|
$api_url = 'https://93.43.5.102/limsapi/api/authentication/authenticate';
|
||||||
|
$credentials = [
|
||||||
|
'Username' => 'WebApiUser',
|
||||||
|
'Password' => 'webapiuser01'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Inizializza cURL
|
||||||
|
$ch = curl_init($api_url);
|
||||||
|
|
||||||
|
// Configura le opzioni di cURL
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($credentials));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json'
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Solo per test
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Solo per test
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen('curl_auth_debug.log', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
// Esegui la richiesta
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
|
||||||
|
// Verifica errori
|
||||||
|
if ($response === false || $http_code != 200) {
|
||||||
|
http_response_code($http_code ? $http_code : 500);
|
||||||
|
echo json_encode([
|
||||||
|
'error' => 'Errore nella richiesta API',
|
||||||
|
'http_code' => $http_code,
|
||||||
|
'curl_error' => $curl_error,
|
||||||
|
'response' => substr($response, 0, 1000)
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$decoded = json_decode($response);
|
||||||
|
if (json_last_error() === JSON_ERROR_NONE) {
|
||||||
|
http_response_code($http_code);
|
||||||
|
echo $response;
|
||||||
|
} else {
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode([
|
||||||
|
'error' => 'Risposta non JSON valida',
|
||||||
|
'http_code' => $http_code,
|
||||||
|
'response' => substr($response, 0, 1000)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 3) . '/vendor/autoload.php'; // Torna al livello di public
|
||||||
|
|
||||||
|
use Dotenv\Dotenv;
|
||||||
|
|
||||||
|
class VisualLimsApiClient
|
||||||
|
{
|
||||||
|
private static $instance = null;
|
||||||
|
private $baseUrl;
|
||||||
|
private $username;
|
||||||
|
private $password;
|
||||||
|
private $token = null;
|
||||||
|
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
$dotenv = Dotenv::createImmutable(dirname(__DIR__, 3)); // Torna al livello di public
|
||||||
|
$dotenv->load();
|
||||||
|
|
||||||
|
$this->baseUrl = $_ENV['API_BASE_URL'];
|
||||||
|
$this->username = $_ENV['API_USERNAME'];
|
||||||
|
$this->password = $_ENV['API_PASSWORD'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if (self::$instance === null) {
|
||||||
|
self::$instance = new VisualLimsApiClient();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function authenticate()
|
||||||
|
{
|
||||||
|
$ch = curl_init("{$this->baseUrl}/api/authentication/authenticate");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||||
|
'Username' => $this->username,
|
||||||
|
'Password' => $this->password
|
||||||
|
]));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json'
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_auth_debug.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false || $http_code != 200) {
|
||||||
|
throw new Exception("Autenticazione fallita: HTTP {$http_code}, Errore cURL: {$curl_error}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_data = json_decode($response, true);
|
||||||
|
$this->token = null;
|
||||||
|
|
||||||
|
if (is_array($token_data) && isset($token_data['token'])) {
|
||||||
|
$this->token = $token_data['token'];
|
||||||
|
} elseif (is_string($token_data) && !empty($token_data)) {
|
||||||
|
$this->token = trim($token_data, '"');
|
||||||
|
} elseif (is_string($response) && !empty($response)) {
|
||||||
|
$this->token = trim($response, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->token)) {
|
||||||
|
throw new Exception("Token non ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getToken()
|
||||||
|
{
|
||||||
|
if ($this->token === null) {
|
||||||
|
$this->authenticate();
|
||||||
|
}
|
||||||
|
return $this->token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($endpoint)
|
||||||
|
{
|
||||||
|
$token = $this->getToken();
|
||||||
|
$url = "{$this->baseUrl}/api/odata/{$endpoint}";
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: Bearer {$token}",
|
||||||
|
"Accept: application/json"
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_request_debug.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
throw new Exception("Errore nella richiesta: {$curl_error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($http_code !== 200) {
|
||||||
|
throw new Exception("Errore nel recupero dati: HTTP {$http_code}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = json_decode($response, true);
|
||||||
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
|
throw new Exception("Risposta non JSON valida: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 3) . '/vendor/autoload.php'; // Torna al livello di public
|
||||||
|
|
||||||
|
use Dotenv\Dotenv;
|
||||||
|
|
||||||
|
class VisualLimsApiClient
|
||||||
|
{
|
||||||
|
private static $instance = null;
|
||||||
|
private $baseUrl;
|
||||||
|
private $username;
|
||||||
|
private $password;
|
||||||
|
private $token = null;
|
||||||
|
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
$dotenv = Dotenv::createImmutable(dirname(__DIR__, 3)); // Torna al livello di public
|
||||||
|
$dotenv->load();
|
||||||
|
|
||||||
|
$this->baseUrl = $_ENV['API_BASE_URL'];
|
||||||
|
$this->username = $_ENV['API_USERNAME'];
|
||||||
|
$this->password = $_ENV['API_PASSWORD'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if (self::$instance === null) {
|
||||||
|
self::$instance = new VisualLimsApiClient();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function authenticate()
|
||||||
|
{
|
||||||
|
$ch = curl_init("{$this->baseUrl}/api/authentication/authenticate");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||||
|
'Username' => $this->username,
|
||||||
|
'Password' => $this->password
|
||||||
|
]));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json'
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_auth_debug.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false || $http_code != 200) {
|
||||||
|
throw new Exception("Autenticazione fallita: HTTP {$http_code}, Errore cURL: {$curl_error}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_data = json_decode($response, true);
|
||||||
|
$this->token = null;
|
||||||
|
|
||||||
|
if (is_array($token_data) && isset($token_data['token'])) {
|
||||||
|
$this->token = $token_data['token'];
|
||||||
|
} elseif (is_string($token_data) && !empty($token_data)) {
|
||||||
|
$this->token = trim($token_data, '"');
|
||||||
|
} elseif (is_string($response) && !empty($response)) {
|
||||||
|
$this->token = trim($response, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->token)) {
|
||||||
|
throw new Exception("Token non ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getToken()
|
||||||
|
{
|
||||||
|
if ($this->token === null) {
|
||||||
|
$this->authenticate();
|
||||||
|
}
|
||||||
|
return $this->token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($endpoint)
|
||||||
|
{
|
||||||
|
$token = $this->getToken();
|
||||||
|
$url = "{$this->baseUrl}/api/odata/{$endpoint}";
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: Bearer {$token}",
|
||||||
|
"Accept: application/json"
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_request_debug.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
throw new Exception("Errore nella richiesta: {$curl_error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($http_code !== 200) {
|
||||||
|
throw new Exception("Errore nel recupero dati: HTTP {$http_code}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = json_decode($response, true);
|
||||||
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
|
throw new Exception("Risposta non JSON valida: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 3) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
use Dotenv\Dotenv;
|
||||||
|
|
||||||
|
class VisualLimsApiClientXml
|
||||||
|
{
|
||||||
|
private static $instance = null;
|
||||||
|
private $baseUrl;
|
||||||
|
private $username;
|
||||||
|
private $password;
|
||||||
|
private $token = null;
|
||||||
|
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
$dotenv = Dotenv::createImmutable(dirname(__DIR__, 3));
|
||||||
|
$dotenv->load();
|
||||||
|
|
||||||
|
$this->baseUrl = $_ENV['API_BASE_URL'];
|
||||||
|
$this->username = $_ENV['API_USERNAME'];
|
||||||
|
$this->password = $_ENV['API_PASSWORD'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if (self::$instance === null) {
|
||||||
|
self::$instance = new VisualLimsApiClientXml();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function authenticate()
|
||||||
|
{
|
||||||
|
$ch = curl_init("{$this->baseUrl}/api/authentication/authenticate");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||||
|
'Username' => $this->username,
|
||||||
|
'Password' => $this->password
|
||||||
|
]));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json'
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_auth_debug_xml.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false || $http_code != 200) {
|
||||||
|
throw new Exception("Autenticazione fallita: HTTP {$http_code}, Errore cURL: {$curl_error}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_data = json_decode($response, true);
|
||||||
|
$this->token = null;
|
||||||
|
|
||||||
|
if (is_array($token_data) && isset($token_data['token'])) {
|
||||||
|
$this->token = $token_data['token'];
|
||||||
|
} elseif (is_string($token_data) && !empty($token_data)) {
|
||||||
|
$this->token = trim($token_data, '"');
|
||||||
|
} elseif (is_string($response) && !empty($response)) {
|
||||||
|
$this->token = trim($response, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->token)) {
|
||||||
|
throw new Exception("Token non ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getToken()
|
||||||
|
{
|
||||||
|
if ($this->token === null) {
|
||||||
|
$this->authenticate();
|
||||||
|
}
|
||||||
|
return $this->token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($endpoint, $options = [])
|
||||||
|
{
|
||||||
|
$token = $this->getToken();
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$url = "{$this->baseUrl}/api/odata/{$endpoint}" . ($query ? '?' . $query : '');
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: Bearer {$token}",
|
||||||
|
"Accept: application/xml"
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_request_debug_xml.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
throw new Exception("Errore nella richiesta: {$curl_error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($http_code !== 200) {
|
||||||
|
throw new Exception("Errore nel recupero dati: HTTP {$http_code}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica che la risposta sia XML
|
||||||
|
if (strpos($response, '<?xml') !== 0) {
|
||||||
|
throw new Exception("Risposta non valida: atteso formato XML, ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 3) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
use Dotenv\Dotenv;
|
||||||
|
|
||||||
|
class VisualLimsApiClientXml
|
||||||
|
{
|
||||||
|
private static $instance = null;
|
||||||
|
private $baseUrl;
|
||||||
|
private $username;
|
||||||
|
private $password;
|
||||||
|
private $token = null;
|
||||||
|
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
$dotenv = Dotenv::createImmutable(dirname(__DIR__, 3));
|
||||||
|
$dotenv->load();
|
||||||
|
|
||||||
|
$this->baseUrl = $_ENV['API_BASE_URL'];
|
||||||
|
$this->username = $_ENV['API_USERNAME'];
|
||||||
|
$this->password = $_ENV['API_PASSWORD'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if (self::$instance === null) {
|
||||||
|
self::$instance = new VisualLimsApiClientXml();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function authenticate()
|
||||||
|
{
|
||||||
|
$ch = curl_init("{$this->baseUrl}/api/authentication/authenticate");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||||
|
'Username' => $this->username,
|
||||||
|
'Password' => $this->password
|
||||||
|
]));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json'
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_auth_debug_xml.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false || $http_code != 200) {
|
||||||
|
throw new Exception("Autenticazione fallita: HTTP {$http_code}, Errore cURL: {$curl_error}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_data = json_decode($response, true);
|
||||||
|
$this->token = null;
|
||||||
|
|
||||||
|
if (is_array($token_data) && isset($token_data['token'])) {
|
||||||
|
$this->token = $token_data['token'];
|
||||||
|
} elseif (is_string($token_data) && !empty($token_data)) {
|
||||||
|
$this->token = trim($token_data, '"');
|
||||||
|
} elseif (is_string($response) && !empty($response)) {
|
||||||
|
$this->token = trim($response, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->token)) {
|
||||||
|
throw new Exception("Token non ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getToken()
|
||||||
|
{
|
||||||
|
if ($this->token === null) {
|
||||||
|
$this->authenticate();
|
||||||
|
}
|
||||||
|
return $this->token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($endpoint, $options = [])
|
||||||
|
{
|
||||||
|
$token = $this->getToken();
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$url = "{$this->baseUrl}/api/odata/{$endpoint}" . ($query ? '?' . $query : '');
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: Bearer {$token}",
|
||||||
|
"Accept: application/xml"
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_request_debug_xml.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
throw new Exception("Errore nella richiesta: {$curl_error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($http_code !== 200) {
|
||||||
|
throw new Exception("Errore nel recupero dati: HTTP {$http_code}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica che la risposta sia XML
|
||||||
|
if (strpos($response, '<?xml') !== 0) {
|
||||||
|
throw new Exception("Risposta non valida: atteso formato XML, ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>VisualLims Authentication</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 20px auto;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#authButton {
|
||||||
|
padding: 10px 20px;
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#authButton:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
#result {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>VisualLims Authentication</h1>
|
||||||
|
<button id="authButton">Authenticate</button>
|
||||||
|
<div id="result"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('authButton').addEventListener('click', async () => {
|
||||||
|
const resultDiv = document.getElementById('result');
|
||||||
|
resultDiv.textContent = 'Authenticating...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('https://93.43.5.102/limsapi/api/authentication/authenticate', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
Username: 'WebApiUserTest',
|
||||||
|
Password: 'WebApiUserClienteTest'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
if (data && data.token) {
|
||||||
|
resultDiv.textContent = `Token: ${data.token}`;
|
||||||
|
} else {
|
||||||
|
resultDiv.textContent = 'Authentication failed: No token received';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
resultDiv.textContent = `Error: ${error.message}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
<?php
|
||||||
|
// Questo file può essere vuoto o contenere logica PHP aggiuntiva se necessario
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Autenticazione VisualLims</title>
|
||||||
|
<!-- Includi Select2 CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 20px auto;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#authButton {
|
||||||
|
padding: 10px 20px;
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#authButton:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
#result {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
#schemiResult {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Autenticazione VisualLims</h1>
|
||||||
|
<button id="authButton">Autentica</button>
|
||||||
|
<div id="result"></div>
|
||||||
|
|
||||||
|
<!-- Tendina per i clienti -->
|
||||||
|
<h3>Seleziona un cliente:</h3>
|
||||||
|
<select id="clientiSelect" style="width: 100%;">
|
||||||
|
<option value="">Seleziona un cliente...</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- Area per mostrare gli schemi -->
|
||||||
|
<div id="schemiResult"></div>
|
||||||
|
|
||||||
|
<!-- Includi jQuery (necessario per Select2) -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<!-- Includi Select2 JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Inizializza Select2 sulla tendina
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#clientiSelect').select2({
|
||||||
|
placeholder: "Cerca un cliente...",
|
||||||
|
allowClear: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Carica i clienti al caricamento della pagina
|
||||||
|
loadClienti();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Autenticazione
|
||||||
|
document.getElementById('authButton').addEventListener('click', async () => {
|
||||||
|
const resultDiv = document.getElementById('result');
|
||||||
|
resultDiv.textContent = 'Autenticazione in corso...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('auth_proxy.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Errore HTTP! Stato: ${response.status}, Dettagli: ${data.error || 'Nessun dettaglio disponibile'}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof data === 'string' && data.length > 0) {
|
||||||
|
resultDiv.textContent = `Token: ${data}`;
|
||||||
|
} else if (data && data.token) {
|
||||||
|
resultDiv.textContent = `Token: ${data.token}`;
|
||||||
|
} else {
|
||||||
|
resultDiv.textContent = `Autenticazione fallita: Nessun token ricevuto. Dettagli: ${JSON.stringify(data)}`;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
resultDiv.textContent = `Errore: ${error.message}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Funzione per caricare i clienti nella tendina
|
||||||
|
async function loadClienti() {
|
||||||
|
const resultDiv = document.getElementById('result');
|
||||||
|
resultDiv.textContent = 'Caricamento clienti...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('get_clienti.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({})
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(data.error || `Errore HTTP: ${response.status}, Dettagli: ${JSON.stringify(data)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.value && Array.isArray(data.value)) {
|
||||||
|
const select = document.getElementById('clientiSelect');
|
||||||
|
data.value.forEach(c => {
|
||||||
|
const nome = c.Nominativo || 'Nome non disponibile';
|
||||||
|
const id = c.IdCliente || 'ID non disponibile';
|
||||||
|
const option = new Option(`${nome.trim()} (ID: ${id})`, id);
|
||||||
|
select.add(option);
|
||||||
|
});
|
||||||
|
resultDiv.textContent = 'Clienti caricati con successo.';
|
||||||
|
} else {
|
||||||
|
resultDiv.textContent = 'Nessun cliente trovato o formato dati non valido.';
|
||||||
|
console.log('Risposta API:', data);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
resultDiv.textContent = 'Errore: ' + err.message;
|
||||||
|
console.error('Dettagli errore:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Evento per gestire la selezione di un cliente e recuperare gli schemi
|
||||||
|
$('#clientiSelect').on('select2:select', async function(e) {
|
||||||
|
const clienteId = e.target.value; // Oppure: $(this).val()
|
||||||
|
const schemiDiv = document.getElementById('schemiResult'); // Correzione del nome variabile
|
||||||
|
|
||||||
|
// Log per debug
|
||||||
|
console.log('Cliente selezionato:', clienteId);
|
||||||
|
|
||||||
|
if (!clienteId) {
|
||||||
|
schemiDiv.textContent = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
schemiDiv.textContent = 'Caricamento schemi...';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('get_schemi.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
clienteId
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(data.error || `Errore HTTP: ${response.status}, Dettagli: ${JSON.stringify(data)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.SchemiAbilitati && Array.isArray(data.SchemiAbilitati)) {
|
||||||
|
let html = '<h3>Schemi Abilitati:</h3><ul>';
|
||||||
|
data.SchemiAbilitati.forEach(s => {
|
||||||
|
const nomeSchema = s.NomeSchema || s.Descrizione || 'Schema non specificato';
|
||||||
|
html += `<li>${nomeSchema}</li>`;
|
||||||
|
});
|
||||||
|
html += '</ul>';
|
||||||
|
schemiDiv.innerHTML = html;
|
||||||
|
} else {
|
||||||
|
schemiDiv.textContent = 'Nessuno schema trovato per questo cliente.';
|
||||||
|
console.log('Risposta Schemi:', data);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
schemiDiv.textContent = 'Errore: ' + err.message;
|
||||||
|
console.error('Dettagli errore:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Gestisci la deselezione (opzionale)
|
||||||
|
$('#clientiSelect').on('select2:unselect', function(e) {
|
||||||
|
const schemiDiv = document.getElementById('schemiResult'); // Correzione del nome variabile
|
||||||
|
schemiDiv.textContent = '';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"}}
|
|
||||||
HTTP Code: 400
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"},"success":false,"http_code":400}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings?tracking_numbers=750000810057432004040056&courier_code=tnt-it
|
|
||||||
Request Data: []
|
|
||||||
Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[]}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Get Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[],"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"}}
|
|
||||||
HTTP Code: 400
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"},"success":false,"http_code":400}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/get?tracking_numbers=750000810057432004040056&courier_code=tnt-it
|
|
||||||
Request Data: []
|
|
||||||
Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[]}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Get Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[],"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"}}
|
|
||||||
HTTP Code: 400
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"},"success":false,"http_code":400}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/get?tracking_numbers=750000810057432004040056
|
|
||||||
Request Data: []
|
|
||||||
Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[]}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Get Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[],"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e85f77564ba2d1b2d35c7b28c72e62b","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-26T09:43:15+00:00","update_at":"2025-03-26T09:01:02+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e85f77564ba2d1b2d35c7b28c72e62b","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-26T09:43:15+00:00","update_at":"2025-03-26T09:01:02+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e8601d0116ffa9f4abe6fa609f27214","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-26T10:12:12+00:00","update_at":"2025-03-26T09:43:15+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e8601d0116ffa9f4abe6fa609f27214","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-26T10:12:12+00:00","update_at":"2025-03-26T09:43:15+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "75000",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"75000","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e88676cc0b94ee0270add7c597d0cb0","tracking_number":"75000","courier_code":"tnt-it","order_number":"75000","order_date":null,"created_at":"2025-03-27T14:47:59+00:00","update_at":null,"delivery_status":"pending","archived":"tracking","updating":true,"source":"API","destination_country":null,"destination_state":null,"destination_city":null,"origin_country":null,"origin_state":null,"origin_city":null,"tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":null,"service_code":null,"weight":null,"weight_kg":null,"product_type":null,"pieces":null,"dimension":null,"previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"pending002","status_info":null,"latest_event":null,"latest_checkpoint_time":null,"transit_time":0,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e88676cc0b94ee0270add7c597d0cb0","tracking_number":"75000","courier_code":"tnt-it","order_number":"75000","order_date":null,"created_at":"2025-03-27T14:47:59+00:00","update_at":null,"delivery_status":"pending","archived":"tracking","updating":true,"source":"API","destination_country":null,"destination_state":null,"destination_city":null,"origin_country":null,"origin_state":null,"origin_city":null,"tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":null,"service_code":null,"weight":null,"weight_kg":null,"product_type":null,"pieces":null,"dimension":null,"previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"pending002","status_info":null,"latest_event":null,"latest_checkpoint_time":null,"transit_time":0,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e8867d062b0ddfac8655e3d81b289af","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-27T14:49:04+00:00","update_at":"2025-03-26T10:12:12+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e8867d062b0ddfac8655e3d81b289af","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-27T14:49:04+00:00","update_at":"2025-03-26T10:12:12+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "123",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"123","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":4110,"message":"The value of tracking_number is invalid."},"data":null}
|
|
||||||
HTTP Code: 400
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":4110,"message":"The value of tracking_number is invalid."},"data":null,"success":false,"http_code":400}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e9652c58e37fc7c8c9b08e9f2eb8f8e","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-04-03T12:51:49+00:00","update_at":"2025-04-01T09:02:08+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e9652c58e37fc7c8c9b08e9f2eb8f8e","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-04-03T12:51:49+00:00","update_at":"2025-04-01T09:02:08+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
// Enable errors for debugging
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('log_errors', 1);
|
||||||
|
ini_set('error_log', __DIR__ . '/delete_record_debug.log');
|
||||||
|
|
||||||
|
// Log iniziale
|
||||||
|
error_log("Inizio cancellazione record alle " . date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
|
// Includi il file di configurazione del database
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
// Ricevi l'ID dalla richiesta POST
|
||||||
|
$input = json_decode(file_get_contents('php://input'), true);
|
||||||
|
$iddatadb = isset($input['id']) ? intval($input['id']) : 0;
|
||||||
|
|
||||||
|
if ($iddatadb <= 0) {
|
||||||
|
http_response_code(400);
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID non valido']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connessione al database
|
||||||
|
try {
|
||||||
|
$db = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $db->getConnection();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Errore di connessione al database: ' . $e->getMessage()]);
|
||||||
|
error_log("Errore di connessione al database: " . $e->getMessage());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inizia una transazione
|
||||||
|
$pdo->beginTransaction();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Elimina i dettagli associati dal tavolo import_data_details
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM import_data_details WHERE id = ?");
|
||||||
|
$stmt->execute([$iddatadb]);
|
||||||
|
|
||||||
|
// Elimina il record principale dal tavolo datadb
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM datadb WHERE iddatadb = ?");
|
||||||
|
$stmt->execute([$iddatadb]);
|
||||||
|
|
||||||
|
// Verifica se il record è stato eliminato
|
||||||
|
if ($stmt->rowCount() > 0) {
|
||||||
|
$pdo->commit();
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Record eliminato con successo']);
|
||||||
|
error_log("Record con iddatadb=$iddatadb eliminato con successo");
|
||||||
|
} else {
|
||||||
|
$pdo->rollBack();
|
||||||
|
http_response_code(404);
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Record non trovato']);
|
||||||
|
error_log("Record con iddatadb=$iddatadb non trovato");
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$pdo->rollBack();
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Errore durante la cancellazione: ' . $e->getMessage()]);
|
||||||
|
error_log("Errore durante la cancellazione del record con iddatadb=$iddatadb: " . $e->getMessage());
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Swagger Codegen Ignore
|
||||||
|
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
3.0.34
|
||||||
@@ -39,6 +39,7 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||||
<?php include('cssinclude.php'); ?>
|
<?php include('cssinclude.php'); ?>
|
||||||
<style>
|
<style>
|
||||||
.client-field-row .row {
|
.client-field-row .row {
|
||||||
@@ -81,7 +82,7 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
<ul class="mb-0">
|
<ul class="mb-0">
|
||||||
<li>Template Name</li>
|
<li>Template Name</li>
|
||||||
<li>Row Header and Column Header: where the title of the excel starts</li>
|
<li>Row Header and Column Header: where the title of the excel starts</li>
|
||||||
<li>Destination Table: already prefilled</li>
|
<li>Cheme</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -123,7 +124,24 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
<label class="form-label"><?= htmlspecialchars($desttable, ENT_QUOTES, 'UTF-8'); ?>*</label>
|
<label class="form-label"><?= htmlspecialchars($desttable, ENT_QUOTES, 'UTF-8'); ?>*</label>
|
||||||
<input type="text" name="target_table" class="form-control" value="<?php echo htmlspecialchars($template['target_table']); ?>" readonly required>
|
<input type="text" name="target_table" class="form-control" value="<?php echo htmlspecialchars($template['target_table']); ?>" readonly required>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Aggiungi il campo per selezionare il cliente -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Select Client *</label>
|
||||||
|
<select name="client_id" id="clientSelect" class="form-control" required>
|
||||||
|
<option value="">Select a client...</option>
|
||||||
|
<!-- Le opzioni verranno popolate tramite JavaScript -->
|
||||||
|
</select>
|
||||||
|
<span id="clientLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Recupero clienti in corso...</span>
|
||||||
|
</div>
|
||||||
|
<!-- Aggiungi il campo per selezionare lo schema -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Select Schema *</label>
|
||||||
|
<select name="schema_id" id="schemaSelect" class="form-control" required>
|
||||||
|
<option value="">Select a schema...</option>
|
||||||
|
<!-- Le opzioni verranno popolate tramite JavaScript -->
|
||||||
|
</select>
|
||||||
|
<span id="schemaLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Caricamento schemi in corso...</span>
|
||||||
|
</div>
|
||||||
<!-- Sezione per i campi specifici del cliente -->
|
<!-- Sezione per i campi specifici del cliente -->
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Client-Specific Fields</label>
|
<label class="form-label">Client-Specific Fields</label>
|
||||||
@@ -227,23 +245,188 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
<!--end switcher-->
|
<!--end switcher-->
|
||||||
<!-- Temporaneamente disabilitato jsinclude.php per test -->
|
<!-- Temporaneamente disabilitato jsinclude.php per test -->
|
||||||
<!-- <?php include('jsinclude.php'); ?> -->
|
<!-- <?php include('jsinclude.php'); ?> -->
|
||||||
|
<!-- Includi jQuery e Select2 -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Dati del cliente e dello schema associati al template
|
||||||
|
const templateClientId = <?php echo json_encode($template['idclient'] ?? 0); ?>;
|
||||||
|
const templateSchemaId = <?php echo json_encode($template['idschema'] ?? 0); ?>;
|
||||||
|
const templateSchemaName = "<?php echo htmlspecialchars($template['schemaname'] ?? ''); ?>";
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
const form = document.getElementById("editTemplateForm");
|
const form = document.getElementById("editTemplateForm");
|
||||||
const addFieldButton = document.getElementById("addField");
|
const addFieldButton = document.getElementById("addField");
|
||||||
const container = document.getElementById("clientSpecificFields");
|
const container = document.getElementById("clientSpecificFields");
|
||||||
|
const clientLoadingStatus = document.getElementById("clientLoadingStatus");
|
||||||
|
const schemaLoadingStatus = document.getElementById("schemaLoadingStatus");
|
||||||
|
|
||||||
if (!form || !addFieldButton || !container) {
|
if (!form || !addFieldButton || !container || !clientLoadingStatus || !schemaLoadingStatus) {
|
||||||
console.error("One or more DOM elements not found:", {
|
console.error("One or more DOM elements not found:", {
|
||||||
form,
|
form,
|
||||||
addFieldButton,
|
addFieldButton,
|
||||||
container
|
container,
|
||||||
|
clientLoadingStatus,
|
||||||
|
schemaLoadingStatus
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("All DOM elements found");
|
console.log("All DOM elements found");
|
||||||
|
|
||||||
|
// Controllo che jQuery sia caricato
|
||||||
|
if (typeof jQuery === 'undefined') {
|
||||||
|
console.error("jQuery non è caricato!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inizializza Select2 sulla tendina dei clienti
|
||||||
|
$('#clientSelect').select2({
|
||||||
|
placeholder: "Search for a client...",
|
||||||
|
allowClear: true
|
||||||
|
}).on('select2:open', function() {
|
||||||
|
console.log("Select2 initialized successfully for clientSelect");
|
||||||
|
}).on('select2:select', function(e) {
|
||||||
|
console.log("Client selected:", e.params.data.id, e.params.data.text);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Inizializza Select2 sulla tendina degli schemi
|
||||||
|
$('#schemaSelect').select2({
|
||||||
|
placeholder: "Search for a schema...",
|
||||||
|
allowClear: true
|
||||||
|
}).on('select2:open', function() {
|
||||||
|
console.log("Select2 initialized successfully for schemaSelect");
|
||||||
|
}).on('select2:select', function(e) {
|
||||||
|
console.log("Schema selected:", e.params.data.id, e.params.data.text);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Carica i clienti al caricamento della pagina
|
||||||
|
async function loadClients() {
|
||||||
|
try {
|
||||||
|
clientLoadingStatus.style.display = 'inline';
|
||||||
|
clientLoadingStatus.textContent = 'Recupero clienti in corso...';
|
||||||
|
|
||||||
|
const response = await fetch("get_clienti.php", {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const text = await response.text();
|
||||||
|
console.log("Risposta raw (clienti):", text);
|
||||||
|
const data = JSON.parse(text);
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(data.error || `Errore HTTP: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.value && Array.isArray(data.value)) {
|
||||||
|
const select = document.getElementById("clientSelect");
|
||||||
|
select.innerHTML = '<option value="">Select a client...</option>';
|
||||||
|
data.value.forEach(client => {
|
||||||
|
const nome = client.Nominativo || "Nome non disponibile";
|
||||||
|
const id = client.IdCliente || "ID non disponibile";
|
||||||
|
const option = new Option(`${nome.trim()} (ID: ${id})`, id);
|
||||||
|
if (parseInt(id) === parseInt(templateClientId)) {
|
||||||
|
option.selected = true;
|
||||||
|
}
|
||||||
|
select.add(option);
|
||||||
|
});
|
||||||
|
$(select).trigger('change');
|
||||||
|
console.log("Clienti caricati con successo.");
|
||||||
|
clientLoadingStatus.textContent = "Clienti caricati.";
|
||||||
|
} else {
|
||||||
|
console.error("Nessun cliente trovato o formato dati non valido.", data);
|
||||||
|
clientLoadingStatus.textContent = "Nessun cliente trovato.";
|
||||||
|
Swal.fire({
|
||||||
|
title: "Errore!",
|
||||||
|
text: "Nessun cliente trovato o formato dati non valido.",
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonText: "OK"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Errore nel caricamento dei clienti:", error);
|
||||||
|
clientLoadingStatus.textContent = "Errore nel caricamento.";
|
||||||
|
Swal.fire({
|
||||||
|
title: "Errore!",
|
||||||
|
text: "Impossibile caricare i clienti: " + error.message,
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonText: "OK"
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setTimeout(() => {
|
||||||
|
clientLoadingStatus.style.display = 'none';
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Carica gli schemi al caricamento della pagina
|
||||||
|
async function loadSchemas() {
|
||||||
|
try {
|
||||||
|
schemaLoadingStatus.style.display = 'inline';
|
||||||
|
schemaLoadingStatus.textContent = 'Caricamento schemi in corso...';
|
||||||
|
|
||||||
|
const response = await fetch("get_schemi.php", {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const text = await response.text();
|
||||||
|
console.log("Risposta raw (schemi):", text);
|
||||||
|
const data = JSON.parse(text);
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(data.error || `Errore HTTP: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const select = document.getElementById("schemaSelect");
|
||||||
|
select.innerHTML = '<option value="">Select a schema...</option>';
|
||||||
|
data.value.forEach(schema => {
|
||||||
|
const nome = schema.Nome || "Nome non disponibile";
|
||||||
|
const id = schema.IdSchemaCustomFields || "ID non disponibile";
|
||||||
|
const optionText = `${nome.trim()} (ID: ${id})`;
|
||||||
|
const option = new Option(optionText, id);
|
||||||
|
if (parseInt(id) === parseInt(templateSchemaId)) {
|
||||||
|
option.selected = true;
|
||||||
|
}
|
||||||
|
select.add(option);
|
||||||
|
});
|
||||||
|
$(select).trigger('change');
|
||||||
|
console.log("Schemi caricati con successo.");
|
||||||
|
schemaLoadingStatus.textContent = "Schemi caricati.";
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Errore nel caricamento degli schemi:", error);
|
||||||
|
schemaLoadingStatus.textContent = "Errore nel caricamento.";
|
||||||
|
Swal.fire({
|
||||||
|
title: "Errore!",
|
||||||
|
text: "Impossibile caricare gli schemi: " + error.message,
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonText: "OK"
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setTimeout(() => {
|
||||||
|
schemaLoadingStatus.style.display = 'none';
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Carica i dati in sequenza
|
||||||
|
async function loadData() {
|
||||||
|
try {
|
||||||
|
await loadClients();
|
||||||
|
await loadSchemas();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Errore nel caricamento dei dati:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadData();
|
||||||
|
|
||||||
// Debug iniziale del DOM
|
// Debug iniziale del DOM
|
||||||
const debugDom = () => {
|
const debugDom = () => {
|
||||||
const initialRows = container.getElementsByClassName("client-field-row");
|
const initialRows = container.getElementsByClassName("client-field-row");
|
||||||
@@ -300,38 +483,38 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
const newField = document.createElement("div");
|
const newField = document.createElement("div");
|
||||||
newField.className = "client-field-row mb-2";
|
newField.className = "client-field-row mb-2";
|
||||||
newField.innerHTML = `
|
newField.innerHTML = `
|
||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<input type="text" name="specific_fields[${fieldCount}][name]" class="form-control" placeholder="Field Name (e.g., SKU)">
|
<input type="text" name="specific_fields[${fieldCount}][name]" class="form-control" placeholder="Field Name (e.g., SKU)">
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<select name="specific_fields[${fieldCount}][type]" class="form-control" onchange="toggleDropdownValues(this)">
|
|
||||||
<option value="text">Text</option>
|
|
||||||
<option value="dropdown">Dropdown</option>
|
|
||||||
<option value="date">Date</option>
|
|
||||||
<option value="boolean">Yes/No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2 dropdown-values" style="visibility: hidden;">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][possible_values]" class="form-control" placeholder="Values (e.g., Red, Blue, Green)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<select name="specific_fields[${fieldCount}][required]" class="form-control">
|
|
||||||
<option value="1">Yes</option>
|
|
||||||
<option value="0">No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][export_column_name]" class="form-control" placeholder="Export Column Name (e.g., MONCLER_SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][default_value]" class="form-control" placeholder="Default Value (optional)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<button type="button" class="btn btn-danger remove-field">-</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
`;
|
<div class="col-md-2">
|
||||||
|
<select name="specific_fields[${fieldCount}][type]" class="form-control" onchange="toggleDropdownValues(this)">
|
||||||
|
<option value="text">Text</option>
|
||||||
|
<option value="dropdown">Dropdown</option>
|
||||||
|
<option value="date">Date</option>
|
||||||
|
<option value="boolean">Yes/No</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 dropdown-values" style="visibility: hidden;">
|
||||||
|
<input type="text" name="specific_fields[${fieldCount}][possible_values]" class="form-control" placeholder="Values (e.g., Red, Blue, Green)">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<select name="specific_fields[${fieldCount}][required]" class="form-control">
|
||||||
|
<option value="1">Yes</option>
|
||||||
|
<option value="0">No</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<input type="text" name="specific_fields[${fieldCount}][export_column_name]" class="form-control" placeholder="Export Column Name (e.g., MONCLER_SKU)">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<input type="text" name="specific_fields[${fieldCount}][default_value]" class="form-control" placeholder="Default Value (optional)">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<button type="button" class="btn btn-danger remove-field">-</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
container.appendChild(newField);
|
container.appendChild(newField);
|
||||||
|
|
||||||
newField.querySelector(".remove-field").addEventListener("click", function() {
|
newField.querySelector(".remove-field").addEventListener("click", function() {
|
||||||
@@ -383,6 +566,65 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
|
|
||||||
let formData = new FormData(this);
|
let formData = new FormData(this);
|
||||||
|
|
||||||
|
// Aggiungi il nome del cliente selezionato a FormData
|
||||||
|
const clientSelect = document.getElementById("clientSelect");
|
||||||
|
const clientId = clientSelect.value;
|
||||||
|
const selectedClientOption = clientSelect.options[clientSelect.selectedIndex];
|
||||||
|
|
||||||
|
// Validazione: assicurati che un cliente sia selezionato
|
||||||
|
if (!clientId) {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Errore!",
|
||||||
|
text: "Per favore seleziona un cliente.",
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonText: "OK"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Estrai il nome del cliente in modo più robusto
|
||||||
|
let clientName = "";
|
||||||
|
if (selectedClientOption) {
|
||||||
|
const optionText = selectedClientOption.text.trim();
|
||||||
|
const nameMatch = optionText.match(/^(.+?)(?:\s*\(ID:\s*\d+\))?$/);
|
||||||
|
clientName = nameMatch ? nameMatch[1].trim() : optionText;
|
||||||
|
}
|
||||||
|
|
||||||
|
formData.append("client_name", clientName);
|
||||||
|
|
||||||
|
// Aggiungi l'ID e il nome dello schema selezionato a FormData
|
||||||
|
const schemaSelect = document.getElementById("schemaSelect");
|
||||||
|
const schemaId = schemaSelect.value;
|
||||||
|
const selectedSchemaOption = schemaSelect.options[schemaSelect.selectedIndex];
|
||||||
|
|
||||||
|
// Validazione: assicurati che uno schema sia selezionato
|
||||||
|
if (!schemaId) {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Errore!",
|
||||||
|
text: "Per favore seleziona uno schema.",
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonText: "OK"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Estrai il nome dello schema in modo più robusto
|
||||||
|
let schemaName = "";
|
||||||
|
if (selectedSchemaOption) {
|
||||||
|
const optionText = selectedSchemaOption.text.trim();
|
||||||
|
const nameMatch = optionText.match(/^(.+?)(?:\s*\(ID:\s*\d+\))?$/);
|
||||||
|
schemaName = nameMatch ? nameMatch[1].trim() : optionText;
|
||||||
|
}
|
||||||
|
|
||||||
|
formData.append("idschema", schemaId);
|
||||||
|
formData.append("schemamaname", schemaName);
|
||||||
|
|
||||||
|
// Log per debug
|
||||||
|
console.log("Client ID:", clientId);
|
||||||
|
console.log("Client Name:", clientName);
|
||||||
|
console.log("Schema ID:", schemaId);
|
||||||
|
console.log("Schema Name:", schemaName);
|
||||||
|
|
||||||
// Genera il JSON per client_specific_fields
|
// Genera il JSON per client_specific_fields
|
||||||
let finalSpecificFields = {};
|
let finalSpecificFields = {};
|
||||||
|
|
||||||
@@ -433,8 +675,8 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
console.log("Fetch response:", data);
|
console.log("Fetch response:", data);
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Success!",
|
title: "Successo!",
|
||||||
text: "Template updated successfully!",
|
text: "Template aggiornato con successo!",
|
||||||
icon: "success",
|
icon: "success",
|
||||||
confirmButtonText: "OK"
|
confirmButtonText: "OK"
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
@@ -442,7 +684,7 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Error!",
|
title: "Errore!",
|
||||||
text: data.message,
|
text: data.message,
|
||||||
icon: "error",
|
icon: "error",
|
||||||
confirmButtonText: "OK"
|
confirmButtonText: "OK"
|
||||||
@@ -450,10 +692,10 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("Fetch error:", error);
|
console.error("Errore Fetch:", error);
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Error!",
|
title: "Errore!",
|
||||||
text: "An unexpected error occurred.",
|
text: "Si è verificato un errore imprevisto.",
|
||||||
icon: "error",
|
icon: "error",
|
||||||
confirmButtonText: "OK"
|
confirmButtonText: "OK"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
2025-06-10 12:21:44 - Errore nel recupero dati: HTTP 404, Risposta:
|
||||||
|
2025-06-16 11:15:30 - Errore nel recupero dati: HTTP 404, Risposta: {"title":"Not Found","status":404,"detail":"Not Found","instance":"GET /api/odata/Rapporto(2523026)","errorCode":"d25cbd678"}
|
||||||
|
2025-06-16 11:34:59 - Autenticazione fallita: HTTP 0, Errore cURL: Failed to connect to 93.43.5.102 port 443 after 21033 ms: Couldn't connect to server, Risposta:
|
||||||
|
2025-06-16 11:42:03 - Errore nella richiesta: Recv failure: Connection was reset
|
||||||
|
2025-07-04 10:42:49 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||||
|
2025-07-04 10:44:13 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||||
|
2025-07-04 10:48:07 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||||
|
2025-08-19 16:29:25 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||||
|
2025-08-26 16:47:19 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-08-26 16:48:15 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-08-26 16:48:44 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-08-26 16:49:24 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-08-26 16:50:23 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-09-08 08:39:17 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('log_errors', 1);
|
||||||
|
ini_set('error_log', __DIR__ . '/import_debug.log');
|
||||||
|
|
||||||
|
|
||||||
|
error_log("TEST: errore manuale");
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php'; // Torna al livello di public per trovare vendor/
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Disabilita la visualizzazione degli errori PHP per evitare output HTML
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
$data = $api->get("Cliente"); // Recupera i clienti
|
||||||
|
|
||||||
|
// Salva la risposta in un file per debug
|
||||||
|
file_put_contents(__DIR__ . '/clienti_response.json', json_encode($data));
|
||||||
|
|
||||||
|
echo json_encode($data);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode([
|
||||||
|
'error' => $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
|
||||||
|
// ID della CommessaWeb specifica (cambialo di volta in volta)
|
||||||
|
$id = 529435; // TODO: Cambia questo valore con l'ID desiderato
|
||||||
|
|
||||||
|
// Endpoint per recuperare la CommessaWeb specifica con espansione dello schema custom
|
||||||
|
$endpoint = "CommessaWeb({$id})";
|
||||||
|
|
||||||
|
// Opzioni per l'espansione: includi OrderCustomFields per ottenere i campi custom dello schema assegnato all'ordine
|
||||||
|
$options = ['$expand' => 'OrderCustomFields'];
|
||||||
|
|
||||||
|
// Debug: salva URL usato
|
||||||
|
$base_url = 'https://93.43.5.102/limsapi/api/odata/';
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$full_url = $base_url . $endpoint . ($query ? '?' . $query : '');
|
||||||
|
file_put_contents(__DIR__ . '/last_url.txt', $full_url . PHP_EOL, FILE_APPEND);
|
||||||
|
|
||||||
|
// Chiamata API
|
||||||
|
$data = $api->get($endpoint, $options);
|
||||||
|
|
||||||
|
// Salva il JSON in locale
|
||||||
|
file_put_contents(__DIR__ . '/commessaweb_schema_response.json', json_encode($data, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
echo json_encode($data);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
|
||||||
|
// მივიღოთ მრავლობითი field_ids
|
||||||
|
$fieldIds = [];
|
||||||
|
if (isset($_GET['field_ids'])) {
|
||||||
|
$fieldIds = array_filter(array_map('intval', explode(',', $_GET['field_ids'])));
|
||||||
|
}
|
||||||
|
|
||||||
|
// თუ არ გადმოგვცეს -> ერთი default
|
||||||
|
if (empty($fieldIds)) {
|
||||||
|
$fieldIds = [156];
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = [];
|
||||||
|
|
||||||
|
foreach ($fieldIds as $customFieldId) {
|
||||||
|
$endpoint = "CustomField($customFieldId)?\$expand=CustomFieldsValues";
|
||||||
|
$data = $api->get($endpoint);
|
||||||
|
|
||||||
|
$results[$customFieldId] = $data['CustomFieldsValues'] ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debug ფაილი
|
||||||
|
file_put_contents(__DIR__ . '/customfield_values_response.json', json_encode($results));
|
||||||
|
|
||||||
|
echo json_encode($results);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode([
|
||||||
|
'error' => $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
|
||||||
|
// Endpoint per recuperare le Matrici
|
||||||
|
$endpoint = 'Matrice';
|
||||||
|
|
||||||
|
// (Opzionale) aggiungi parametri, ad esempio $top per limitare i risultati
|
||||||
|
$options = []; // oppure ad esempio: ['$top' => 100]
|
||||||
|
|
||||||
|
// Debug: salva URL usato
|
||||||
|
$base_url = 'https://93.43.5.102/limsapi/api/odata/';
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$full_url = $base_url . $endpoint . ($query ? '?' . $query : '');
|
||||||
|
file_put_contents(__DIR__ . '/last_url.txt', $full_url . PHP_EOL, FILE_APPEND);
|
||||||
|
|
||||||
|
// Chiamata API
|
||||||
|
$data = $api->get($endpoint, $options);
|
||||||
|
|
||||||
|
// Salva il JSON in locale
|
||||||
|
file_put_contents(__DIR__ . '/matrici_response.json', json_encode($data, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
echo json_encode($data);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClientXml.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/xml; charset=utf-8');
|
||||||
|
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClientXml::getInstance();
|
||||||
|
|
||||||
|
// Endpoint per i metadata
|
||||||
|
$endpoint = '$metadata';
|
||||||
|
|
||||||
|
// Nessun parametro aggiuntivo necessario
|
||||||
|
$options = [];
|
||||||
|
|
||||||
|
// Debug: salva URL usato
|
||||||
|
$base_url = 'https://93.43.5.102/limsapi/api/odata/';
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$full_url = $base_url . $endpoint . ($query ? '?' . $query : '');
|
||||||
|
file_put_contents(__DIR__ . '/last_url.txt', $full_url . PHP_EOL, FILE_APPEND);
|
||||||
|
|
||||||
|
// Chiamata API
|
||||||
|
$data = $api->get($endpoint, $options);
|
||||||
|
|
||||||
|
// Salva il file XML in locale
|
||||||
|
file_put_contents(__DIR__ . '/metadata_response.xml', $data);
|
||||||
|
|
||||||
|
// Restituisci il contenuto XML
|
||||||
|
echo $data;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||||
|
http_response_code(500);
|
||||||
|
echo '<?xml version="1.0" encoding="utf-8"?><error>' . htmlspecialchars($e->getMessage()) . '</error>';
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
$rapporto_id = 515081;
|
||||||
|
|
||||||
|
// Costruzione manuale dell'endpoint con espansione annidata
|
||||||
|
$endpoint = "Rapporto($rapporto_id)?\$expand=CampioniDatiRapporto(\$expand=AnalisiDatiRapporto,CustomFieldsDatiRapporto)";
|
||||||
|
|
||||||
|
// Non passiamo options, già incluso nell'endpoint
|
||||||
|
$data = $api->get($endpoint);
|
||||||
|
|
||||||
|
file_put_contents(__DIR__ . '/rapporto_expanded.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||||
|
echo json_encode($data);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||