Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4056296dab | |||
| 7158f4d369 | |||
| 1d613d8226 | |||
| 174a85a707 | |||
| 835386a887 |
45
api.php
45
api.php
@@ -47,6 +47,43 @@ if ( !$isApiRequest )
|
||||
}
|
||||
}
|
||||
|
||||
// --- API routing (ordersPRO) ---
|
||||
if ( $isApiRequest )
|
||||
{
|
||||
if ( !headers_sent() )
|
||||
header( 'Content-Type: application/json; charset=utf-8' );
|
||||
|
||||
try
|
||||
{
|
||||
$mdb = new medoo( [
|
||||
'database_type' => 'mysql',
|
||||
'database_name' => $database[ 'name' ],
|
||||
'server' => $database[ 'host' ],
|
||||
'username' => $database[ 'user' ],
|
||||
'password' => $database[ 'password' ],
|
||||
'charset' => 'utf8'
|
||||
] );
|
||||
|
||||
$settingsRepo = new \Domain\Settings\SettingsRepository( $mdb );
|
||||
$router = new \api\ApiRouter( $mdb, $settingsRepo );
|
||||
$router->handle();
|
||||
}
|
||||
catch ( \Throwable $e )
|
||||
{
|
||||
if ( !headers_sent() )
|
||||
header( 'Content-Type: application/json; charset=utf-8' );
|
||||
|
||||
http_response_code( 500 );
|
||||
echo json_encode( [
|
||||
'status' => 'error',
|
||||
'code' => 'INTERNAL_ERROR',
|
||||
'message' => 'Internal server error'
|
||||
], JSON_UNESCAPED_UNICODE );
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$mdb = new medoo( [
|
||||
'database_type' => 'mysql',
|
||||
'database_name' => $database[ 'name' ],
|
||||
@@ -59,14 +96,6 @@ $mdb = new medoo( [
|
||||
$settingsRepo = new \Domain\Settings\SettingsRepository( $mdb );
|
||||
$settings = $settingsRepo->allSettings();
|
||||
|
||||
// --- API routing (ordersPRO) ---
|
||||
if ( $isApiRequest )
|
||||
{
|
||||
$router = new \api\ApiRouter( $mdb, $settingsRepo );
|
||||
$router->handle();
|
||||
exit;
|
||||
}
|
||||
|
||||
// --- Ekomi CSV export ---
|
||||
if ( \Shared\Helpers\Helpers::get( 'ekomi_csv' ) )
|
||||
{
|
||||
|
||||
@@ -71,6 +71,7 @@ class SettingsRepository
|
||||
'infinitescroll' => $this->isEnabled($values['infinitescroll'] ?? null) ? 1 : 0,
|
||||
'own_gtm_js' => $values['own_gtm_js'] ?? '',
|
||||
'own_gtm_html' => $values['own_gtm_html'] ?? '',
|
||||
'api_key' => $values['api_key'] ?? '',
|
||||
];
|
||||
|
||||
$warehouseMessageZero = $values['warehouse_message_zero'] ?? [];
|
||||
|
||||
@@ -471,8 +471,7 @@ class SettingsController
|
||||
'label' => 'Htaccess cache',
|
||||
'tab' => 'system',
|
||||
]),
|
||||
FormField::text('api_key', [
|
||||
'label' => 'Klucz API (ordersPRO)',
|
||||
FormField::custom('api_key', $this->renderApiKeyField($data['api_key'] ?? ''), [
|
||||
'tab' => 'system',
|
||||
]),
|
||||
|
||||
@@ -560,4 +559,23 @@ class SettingsController
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function renderApiKeyField(string $value): string
|
||||
{
|
||||
$escaped = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$js = "var c='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',"
|
||||
. "k='';for(var i=0;i<32;i++){k+=c.charAt(Math.floor(Math.random()*c.length));}"
|
||||
. "document.getElementById('api_key').value=k;";
|
||||
|
||||
return '<div class="form-group row">'
|
||||
. '<label class="col-lg-4 control-label">Klucz API:</label>'
|
||||
. '<div class="col-lg-8">'
|
||||
. '<div class="input-group">'
|
||||
. '<input type="text" id="api_key" class="form-control" name="api_key" value="' . $escaped . '" />'
|
||||
. '<span class="input-group-addon btn btn-info" onclick="' . htmlspecialchars($js, ENT_QUOTES, 'UTF-8') . '">Generuj</span>'
|
||||
. '</div>'
|
||||
. '</div>'
|
||||
. '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class ApiRouter
|
||||
}
|
||||
|
||||
$controller->$action();
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
self::sendError('INTERNAL_ERROR', 'Internal server error', 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,6 +262,10 @@ if (Test-Path $tempDir) {
|
||||
Remove-Item -Recurse -Force $tempDir
|
||||
}
|
||||
|
||||
if (-not (Test-Path $tempDir)) {
|
||||
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
||||
}
|
||||
|
||||
foreach ($f in $filesToPack) {
|
||||
$destPath = Join-Path $tempDir $f
|
||||
$destDir = Split-Path $destPath -Parent
|
||||
@@ -295,7 +299,16 @@ if (Test-Path $zipPath) {
|
||||
# Pakuj zawartosc temp dir (bez folderu temp/)
|
||||
$originalLocation = Get-Location
|
||||
Set-Location $tempDir
|
||||
Compress-Archive -Path '*' -DestinationPath "../../$zipPath" -Force
|
||||
$tempItems = Get-ChildItem -Force
|
||||
if ($tempItems) {
|
||||
Compress-Archive -Path '*' -DestinationPath "../../$zipPath" -Force
|
||||
} else {
|
||||
# SQL-only update: create minimal ZIP with empty placeholder
|
||||
$placeholderPath = "_sql_only_update.txt"
|
||||
Set-Content -Path $placeholderPath -Value "SQL-only update $versionNumber"
|
||||
Compress-Archive -Path $placeholderPath -DestinationPath "../../$zipPath" -Force
|
||||
Remove-Item $placeholderPath -Force
|
||||
}
|
||||
Set-Location $originalLocation
|
||||
|
||||
Write-Ok "Utworzono ZIP: $zipPath"
|
||||
|
||||
@@ -4,6 +4,21 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.317 (2026-02-23) - Klucz API: przycisk generowania + fix zapisu
|
||||
|
||||
- **FIX**: `SettingsRepository::saveSettings()` — pole `api_key` brakowało w whiteliście zapisywanych pól, przez co wartość była tracona przy każdym zapisie (TRUNCATE + insert)
|
||||
- **NEW**: Pole "Klucz API" w ustawieniach — przycisk "Generuj" do losowego 32-znakowego klucza alfanumerycznego, usunięto "(ordersPRO)" z nazwy
|
||||
- **FIX**: `api.php` — routing API przeniesiony przed ładowanie globalnych settings (wczesne wyjście), obsługa błędów przez `\Throwable`
|
||||
- **FIX**: `ApiRouter` — catch `\Throwable` zamiast `\Exception` dla pełniejszego łapania błędów
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.316 (2026-02-23) - Migracja brakującej kolumny type w custom fields
|
||||
|
||||
- **FIX**: Dodanie brakującej kolumny `type` w tabeli `pp_shop_products_custom_fields` — kolumna była używana w kodzie od v0.277 ale nigdy nie miała migracji ALTER TABLE, przez co instancje ze starszą bazą dostawały `PDOException: Column not found: 1054 Unknown column 'type'` przy zapisie produktu
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.315 (2026-02-23) - Fix listowania atrybutów w admin
|
||||
|
||||
- **FIX**: `AttributeRepository::listForAdmin()` — zapytanie COUNT dostawało parametr `:default_lang_id` którego nie miało w SQL, powodując `PDOException: SQLSTATE[HY093]: Invalid parameter number`. Parametr potrzebny tylko w głównym SELECT, nie w COUNT
|
||||
|
||||
1
migrations/0.316.sql
Normal file
1
migrations/0.316.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE `pp_shop_products_custom_fields` ADD COLUMN `type` VARCHAR(30) NOT NULL DEFAULT '' AFTER `name`;
|
||||
BIN
updates/0.30/ver_0.315.zip
Normal file
BIN
updates/0.30/ver_0.315.zip
Normal file
Binary file not shown.
23
updates/0.30/ver_0.315_manifest.json
Normal file
23
updates/0.30/ver_0.315_manifest.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"changelog": "FIX - PDOException w listowaniu atrybutow admin (SQLSTATE HY093)",
|
||||
"version": "0.315",
|
||||
"files": {
|
||||
"added": [
|
||||
|
||||
],
|
||||
"deleted": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
"autoload/Domain/Attribute/AttributeRepository.php"
|
||||
]
|
||||
},
|
||||
"checksum_zip": "sha256:cfe6eb7dfad896c4ea885c2f9a52c6a389d4e38379a0bf64f5d429910d87e55f",
|
||||
"sql": [
|
||||
|
||||
],
|
||||
"date": "2026-02-23",
|
||||
"directories_deleted": [
|
||||
|
||||
]
|
||||
}
|
||||
BIN
updates/0.30/ver_0.316.zip
Normal file
BIN
updates/0.30/ver_0.316.zip
Normal file
Binary file not shown.
23
updates/0.30/ver_0.316_manifest.json
Normal file
23
updates/0.30/ver_0.316_manifest.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"changelog": "FIX - migracja brakujacej kolumny type w pp_shop_products_custom_fields",
|
||||
"version": "0.316",
|
||||
"files": {
|
||||
"added": [
|
||||
|
||||
],
|
||||
"deleted": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
|
||||
]
|
||||
},
|
||||
"checksum_zip": "sha256:654a3683c0add19d0cb2f87db6f6a45cd4ce08799dd3692c6adacc07666f13b1",
|
||||
"sql": [
|
||||
"ALTER TABLE `pp_shop_products_custom_fields` ADD COLUMN `type` VARCHAR(30) NOT NULL DEFAULT \u0027\u0027 AFTER `name`;"
|
||||
],
|
||||
"date": "2026-02-23",
|
||||
"directories_deleted": [
|
||||
|
||||
]
|
||||
}
|
||||
@@ -1,14 +1,20 @@
|
||||
<b>ver. 0.316 - 23.02.2026</b><br />
|
||||
FIX - migracja brakujacej kolumny type w pp_shop_products_custom_fields
|
||||
<hr>
|
||||
<b>ver. 0.315 - 23.02.2026</b><br />
|
||||
FIX - PDOException w listowaniu atrybutow admin (SQLSTATE HY093)
|
||||
<hr>
|
||||
<b>ver. 0.314 - 23.02.2026</b><br />
|
||||
FIX - naprawa globalnej wyszukiwarki admin (Content-Type, Cache-Control, POST, try/catch), NEW - title strony z numerem zamówienia
|
||||
FIX - naprawa globalnej wyszukiwarki admin (Content-Type, Cache-Control, POST, try/catch), NEW - title strony z numerem zamĂłwienia
|
||||
<hr>
|
||||
<b>ver. 0.313 - 23.02.2026</b><br />
|
||||
FIX - sync płatności Apilo (int cast na apilo_order_id PPxxxxxx dawał 0) + logowanie decyzji sync do pp_log
|
||||
FIX - sync płatności Apilo (int cast na apilo_order_id PPxxxxxx dawał 0) + logowanie decyzji sync do pp_log
|
||||
<hr>
|
||||
<b>ver. 0.312 - 23.02.2026</b><br />
|
||||
FIX - krytyczne bugi integracji Apilo: curl_getinfo po curl_close, nieskończona pętla wysyłki, ceny 0.00 PLN, walidacja cen
|
||||
FIX - krytyczne bugi integracji Apilo: curl_getinfo po curl_close, nieskoÄąĂË€žczona pĂ„ĂË„ËÂtla wysyÄąĂË€ški, ceny 0.00 PLN, walidacja cen
|
||||
<hr>
|
||||
<b>ver. 0.311 - 23.02.2026</b><br />
|
||||
FIX - race condition callback płatności Apilo, persistence filtrów tabel admin, poprawki cen zamówień
|
||||
FIX - race condition callback pÄąĂËÂĂ˂¬ĹˇatnoÄąĂËÂĂ˂¬Ĺźci Apilo, persistence filtrĂ„ĂË€šÄąĂË€šw tabel admin, poprawki cen zamĂ„ĂË€šÄąĂË€šwieÄąĂËÂĂ˂¬Ĺľ
|
||||
<hr>
|
||||
<b>ver. 0.310 - 23.02.2026</b><br />
|
||||
NEW - Zakladka Logi w sekcji Integracje (podglad pp_log z paginacja, sortowaniem, filtrami)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?
|
||||
$current_ver = 315;
|
||||
$current_ver = 317;
|
||||
|
||||
for ($i = 1; $i <= $current_ver; $i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user