update
This commit is contained in:
@@ -358,7 +358,7 @@ class Clients
|
||||
|
||||
$deleted_select = self::clients_has_deleted_column() ? 'COALESCE(deleted, 0) AS deleted' : '0 AS deleted';
|
||||
$client = $mdb -> query(
|
||||
"SELECT id, COALESCE(active, 0) AS active, " . $deleted_select . ", google_ads_customer_id, google_merchant_account_id, facebook_ads_account_id
|
||||
"SELECT id, COALESCE(active, 0) AS active, " . $deleted_select . ", google_ads_customer_id, google_merchant_account_id, facebook_ads_account_id, xml_feed_url
|
||||
FROM clients
|
||||
WHERE id = :id
|
||||
LIMIT 1",
|
||||
@@ -440,6 +440,33 @@ class Clients
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else if ( $pipeline === 'xml_feed' )
|
||||
{
|
||||
$xml_feed_url = trim( (string) ( $client['xml_feed_url'] ?? '' ) );
|
||||
if ( $xml_feed_url === '' )
|
||||
{
|
||||
echo json_encode( [ 'success' => false, 'message' => 'Klient nie ma ustawionego XML Feed URL.' ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$report = \services\XmlFeedImporter::import_for_client( $id );
|
||||
echo json_encode( [
|
||||
'success' => empty( $report['errors'] ),
|
||||
'pipeline' => 'xml_feed',
|
||||
'immediate' => true,
|
||||
'report' => $report,
|
||||
'message' => !empty( $report['errors'] ) ? implode( '; ', array_slice( (array) $report['errors'], 0, 3 ) ) : ''
|
||||
] );
|
||||
exit;
|
||||
}
|
||||
catch ( \Throwable $e )
|
||||
{
|
||||
echo json_encode( [ 'success' => false, 'message' => 'Blad importu XML feed: ' . $e -> getMessage() ] );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Domyslny reset (wszystkie pipeline oparte o cron_sync_status).
|
||||
|
||||
Reference in New Issue
Block a user