Files
torebki-fabiola.pl/wp-content/plugins/woocommerce-dhl/classes/settings-dhl.php
2026-03-05 13:07:40 +01:00

410 lines
14 KiB
PHP

<?php
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Settings for flexible shipping
*/
$options_hours = array(
);
for ( $h = 9; $h < 20; $h++ ) {
$options_hours[$h . ':00'] = $h . ':00';
if ( $h < 19 ) {
$options_hours[$h . ':30'] = $h . ':30';
}
}
$order_statuses = wc_get_order_statuses();
$flexible_printing = apply_filters( 'flexible_printing', false );
$auto_print_description = '';
$auto_print_custom_attributes = array();
if ( $flexible_printing ) {
if ( $this->get_option( 'auto_print', '' ) == 'yes' ) {
$flexible_printing_integration_url = apply_filters( 'flexible_printing_integration_url', 'dhl' );
$auto_print_description = sprintf( __( 'Aby przejść do ustawień wydruku kliknij %stutaj%s.', 'woocommerce-dhl' ), '<a target="_blank" href="' . $flexible_printing_integration_url . '">', '</a>' );
}
else {
$auto_print_description = __( 'Konfiguracja wydruku dostępna po włączeniu opcji i zapisaniu ustawień.', 'woocommerce-dhl' );
}
}
else {
$this->settings['auto_print'] = 'no';
$flexible_printing_buy_url = 'https://www.wpdesk.pl/sklep/flexible-printing/';
$auto_print_description = sprintf(
__( 'Drukuj etykiety bezpośrnio na drukarce (bez pobierania pliku) lub zapisuj automatycznie na dysku. %sKup Flexible Printing &rarr;%s.', 'woocommerce-dhl' ),
'<a href="' . $flexible_printing_buy_url . '" target="_blank">',
'</a>'
);
$auto_print_custom_attributes = array( 'disabled' => 'disabled' );
}
$settings = array(
array(
'title' => __( 'Logowanie DHL 24 API', 'woocommerce-dhl' ),
'type' => 'title',
'description' => '',
),
'login' => array(
'title' => __( 'Login', 'woocommerce-dhl' ),
'type' => 'text',
'description' => __( 'Login do DHL24 API.', 'woocommerce-dhl' ),
'default' => '',
'desc_tip' => true,
'custom_attributes' => array(
'required' => 'required'
)
),
'password' => array(
'title' => __( 'Hasło', 'woocommerce-dhl' ),
'type' => 'password',
'description' => __( 'Hasło do DHL24 API.', 'woocommerce-dhl' ),
'default' => '',
'desc_tip' => true,
'custom_attributes' => array(
'required' => 'required',
'autocomplete' => 'new-password'
)
),
'api_status' => array(
'title' => __( 'Status połączenia', 'woocommerce-dhl' ),
'type' => \VendorDHL\WPDesk\WooCommerceShippingMethod\Field\ApiConnectionStatus\ApiConnectionStatus::FIELD_TYPE,
'description' => __( 'Hasło do DHL24 API.', 'woocommerce-dhl' ),
'default' => '',
'desc_tip' => true,
'custom_attributes' => array(
'required' => 'required',
'autocomplete' => 'new-password'
)
),
array(
'title' => __( 'Logowanie DHL Parcel Shop API', 'woocommerce-dhl' ),
'type' => 'title',
'description' => '',
),
'login_parcelshop' => array(
'title' => __( 'Login', 'woocommerce-dhl' ),
'type' => 'text',
'default' => '',
'desc_tip' => true,
),
'password_parcelshop' => array(
'title' => __( 'Hasło', 'woocommerce-dhl' ),
'type' => 'password',
'description' => __( 'Hasło do DHL Parcelshop API.', 'woocommerce-dhl' ),
'default' => '',
'desc_tip' => true,
),
'api_parcelshop_status' => array(
'title' => __( 'Status połączenia', 'woocommerce-dhl' ),
'type' => \VendorDHL\WPDesk\WooCommerceShippingMethod\Field\ApiConnectionStatus\ApiConnectionStatus::FIELD_TYPE,
'description' => __( 'Hasło do DHL24 API.', 'woocommerce-dhl' ),
'default' => '',
'desc_tip' => true,
'custom_attributes' => array(
'required' => 'required',
'autocomplete' => 'new-password'
)
),
array(
'title' => __( 'Tryb testowy', 'woocommerce-dhl' ),
'type' => 'title',
'description' => '',
),
'test_mode' => array(
'title' => __( 'Tryb testowy', 'woocommerce-dhl' ),
'label' => __( 'Włącz tryb testowy', 'woocommerce-dhl' ),
'type' => 'checkbox',
'description' => __( 'Jeśli włączasz tryb testowy - wpisz Login i Hasło API do serwisu testowego, a nie do produkcyjnego. Serwis testowy dostępny jest pod adresem: <a target="_blank" href="https://sandbox.dhl24.com.pl/">https://sandbox.dhl24.com.pl/</a>', 'woocommerce-dhl' ),
'default' => 'no',
'desc_tip' => false
),
array(
'title' => __( 'Deklaracja stałego zbioru', 'woocommerce-dhl' ),
'type' => 'title',
'description' => '',
),
'permanent_collection' => array(
'title' => __( 'Stały zbiór', 'woocommerce-dhl' ),
'label' => __( 'Włącz', 'woocommerce-dhl' ),
'type' => 'checkbox',
'description' => __( 'Włącz tylko w przypadku, gdy masz podpisaną deklarację stałego zbioru.', 'woocommerce-dhl' ),
'default' => 'no',
'desc_tip' => false
),
'date_change_hour' => array(
'title' => __( 'Godzina, po której nastąpi zmiana daty nadania na następny dzień roboczy', 'woocommerce-dhl' ),
'type' => 'select',
'default' => '14',
'options' => array(
'0' => __( '0', 'woocommerce-dhl' ),
'1' => __( '1', 'woocommerce-dhl' ),
'2' => __( '2', 'woocommerce-dhl' ),
'3' => __( '3', 'woocommerce-dhl' ),
'4' => __( '4', 'woocommerce-dhl' ),
'5' => __( '5', 'woocommerce-dhl' ),
'6' => __( '6', 'woocommerce-dhl' ),
'7' => __( '7', 'woocommerce-dhl' ),
'8' => __( '8', 'woocommerce-dhl' ),
'9' => __( '9', 'woocommerce-dhl' ),
'10' => __( '10', 'woocommerce-dhl' ),
'11' => __( '11', 'woocommerce-dhl' ),
'12' => __( '12', 'woocommerce-dhl' ),
'13' => __( '13', 'woocommerce-dhl' ),
'14' => __( '14', 'woocommerce-dhl' ),
'15' => __( '15', 'woocommerce-dhl' ),
'16' => __( '16', 'woocommerce-dhl' ),
'17' => __( '17', 'woocommerce-dhl' ),
'18' => __( '18', 'woocommerce-dhl' ),
'19' => __( '19', 'woocommerce-dhl' ),
'20' => __( '20', 'woocommerce-dhl' ),
'21' => __( '21', 'woocommerce-dhl' ),
'22' => __( '22', 'woocommerce-dhl' ),
'23' => __( '23', 'woocommerce-dhl' ),
),
),
array(
'title' => __( 'Tworzenie przesyłek', 'woocommerce-dhl' ),
'type' => 'title',
'description' => '',
),
'auto_create' => array(
'title' => __( 'Tworzenie przesyłek', 'woocommerce-dhl' ),
'type' => 'select',
'default' => 'manual',
'options' => array(
'manual' => __( 'Ręczne', 'woocommerce-dhl' ),
'auto' => __( 'Automatyczne', 'woocommerce-dhl' ),
),
),
'order_status' => array(
'title' => __( 'Status zamówienia', 'woocommerce-dhl' ),
'type' => 'select',
'default' => 'wc-completed',
'options' => $order_statuses,
'description' => __( 'Status zamówienia, przy którym do zamówienia zostanie automatycznie utworzona przesyłka.', 'woocommerce-dhl' ),
),
'complete_order' => array(
'title' => __('Zrealizuj zamówienie', 'woocommerce-dhl'),
'type' => 'checkbox',
'label' => __('Włącz zmianę statusu zamówienia na Zrealizowane', 'woocommerce-dhl'),
'default' => 'no',
'description' => __('Po nadaniu przesyłek status zamówienia zostanie automatycznie zmieniony na Zrealizowane.', 'woocommerce-dhl'),
),
array(
'title' => __( 'Domyślne ustawienia przesyłki', 'woocommerce-dhl' ),
'type' => 'title',
'description' => '',
),
'package_width' => array(
'title' => __( 'Długość paczki [cm]', 'woocommerce-dhl' ),
'type' => 'number',
'default' => '',
'custom_attributes' => array(
'min' => 0,
'max' => 10000,
'step' => 1,
'required' => 'required'
)
),
'package_length' => array(
'title' => __( 'Szerokość paczki [cm]', 'woocommerce-dhl' ),
'type' => 'number',
'default' => '',
'custom_attributes' => array(
'min' => 0,
'max' => 10000,
'step' => 1,
'required' => 'required'
)
),
'package_height' => array(
'title' => __( 'Wysokość paczki [cm]', 'woocommerce-dhl' ),
'type' => 'number',
'default' => '',
'custom_attributes' => array(
'min' => 0,
'max' => 10000,
'step' => 1,
'required' => 'required'
)
),
'package_weight' => array(
'title' => __( 'Waga paczki', 'woocommerce-dhl' ),
'type' => 'number',
'default' => '',
'custom_attributes' => array(
'min' => 0,
'max' => 10000,
'step' => 'any',
'required' => 'required'
)
),
'package_contents' => array(
'title' => __( 'Zawartość paczki', 'woocommerce-dhl' ),
'type' => 'text',
'default' => ''
),
'package_comment' => array(
'title' => __( 'Komentarz', 'woocommerce-dhl' ),
'type' => 'text',
'description' => __( 'Komentarz widoczny na etykiecie. Dostępne shortcody [order_number], [shop_name], [shop_url]', 'woocommerce-dhl' ),
'default' => __( 'Zamówienie [order_number], [shop_name], [shop_url]' , 'woocommerce-dhl' ),
'desc_tip' => false,
),
array(
'title' => __( 'Etykiety', 'woocommerce-dhl' ),
'type' => 'title',
'description' => ''
),
'label_format' => array(
'title' => __( 'Format etykiet', 'woocommerce-dhl' ),
'type' => 'select',
'options' => array(
'BLP' => __( 'Etykieta BLP' , 'woocommerce-dhl' ),
'LBLP' => __( 'Etykieta BLP w formacie PDF A4', 'woocommerce-dhl' ),
'ZBLP' => __( 'Etykieta BLP w formacie dla drukarek Zebra', 'woocommerce-dhl' ),
),
'default' => 'LBLP',
),
'auto_print' => array(
'title' => __( 'Drukowanie', 'woocommerce-dhl' ),
'label' => __( 'Włącz automatyczne drukowanie', 'woocommerce-dhl' ),
'type' => 'checkbox',
'description' => $auto_print_description,
'custom_attributes' => $auto_print_custom_attributes,
'default' => 'no',
'desc_tip' => false
),
array(
'title' => __( 'Dane nadawcy', 'woocommerce-dhl' ),
'type' => 'title',
'description' => '',
),
'account_number' => array(
'title' => __( 'Numer klienta (SAP)', 'woocommerce-dhl' ),
'type' => 'text',
'default' => ''
),
'sender_name' => array(
'title' => __( 'Nazwa', 'woocommerce-dhl' ),
'type' => 'text',
'default' => '',
'custom_attributes' => array(
'required' => 'required'
)
),
'sender_street' => array(
'title' => __( 'Adres', 'woocommerce-dhl' ),
'type' => 'text',
'default' => '',
'custom_attributes' => array(
'required' => 'required'
)
),
'sender_house_number' => array(
'title' => __( 'Nr budynku', 'woocommerce-dhl' ),
'type' => 'text',
'default' => ''
),
'sender_apartment_number' => array(
'title' => __( 'Nr lokalu', 'woocommerce-dhl' ),
'type' => 'text',
'default' => ''
),
'sender_postal_code' => array(
'title' => __( 'Kod pocztowy', 'woocommerce-dhl' ),
'type' => 'text',
'default' => '',
'custom_attributes' => array(
'required' => 'required'
)
),
'sender_city' => array(
'title' => __( 'Miasto', 'woocommerce-dhl' ),
'type' => 'text',
'default' => ''
),
'sender_contact_person' => array(
'title' => __( 'Osoba kontaktowa', 'woocommerce-dhl' ),
'type' => 'text',
'default' => '',
'custom_attributes' => array(
'required' => 'required'
)
),
'sender_contact_phone' => array(
'title' => __( 'Telefon', 'woocommerce-dhl' ),
'type' => 'text',
'default' => '',
'custom_attributes' => array(
'required' => 'required'
)
),
'sender_contact_email' => array(
'title' => __( 'E-mail', 'woocommerce-dhl' ),
'type' => 'text',
'default' => get_option( 'admin_email' ),
'custom_attributes' => array(
'required' => 'required'
)
),
array(
'title' => __( 'Zaawansowane', 'woocommerce-dhl' ),
'type' => 'title',
'description' => ''
),
self::OPTION_LOGGING => [
'title' => __( 'Zapis zdarzeń', 'woocommerce-dpd' ),
'label' => __( 'Włącz zapis zdarzeń do logów', 'woocommerce-dpd' ),
'type' => 'checkbox',
// Translators: WC logger URL.
'description' => sprintf( __( 'Zapis zdarzeń należy włączać tylko podczas diagnozowania problemów. Zdarzenia zapisywane są w %1$sdzienniku WooCommerce%2$s.', 'woocommerce-dpd' ), '<a href="' . admin_url( 'admin.php?page=wc-status&tab=logs' ) . '" target="_blank">', '</a>' ),
'custom_attributes' => [],
'default' => 'no',
'desc_tip' => false,
],
'select_type' => array(
'title' => __( 'Wybór DHL Parcel', 'woocommerce-dhl' ),
'type' => 'select',
'default' => 'select2',
'description' => sprintf(__( 'Sprawdź opis listy punktów odbioru w naszej %sdokumentacji%s.', 'woocommerce-dhl' ), '<a href="https://www.wpdesk.pl/docs/woocommerce-dhl-docs/#Opcje_zaawansowane" target="_blank">', '</a>' ),
'options' => array(
'select2' => __( 'Select2', 'woocommerce-dhl' ),
'select2_ajax' => __( 'Select2 (AJAX)', 'woocommerce-dhl' ),
),
),
);
/*
if ( apply_filters( 'flexible_printing', false ) ) {
$settings[] = array(
'title' => __( 'Drukowanie', 'woocommerce-dhl' ),
'type' => 'title',
'description' => '',
);
$settings['auto_print'] = array(
'title' => __( 'Etykiety', 'woocommerce-dhl' ),
'label' => __( 'Włącz automatyczne drukowanie', 'woocommerce-dhl' ),
'type' => 'checkbox',
'description' => __( 'Etykieta zostanie automatycznie wydrukowana na wybranej drukarce', 'woocommerce-dhl' ),
'default' => 'no',
'desc_tip' => false
);
$settings['printer'] = array(
'title' => __( 'Drukarka', 'woocommerce-dhl' ),
'type' => 'select',
'options' => apply_filters( 'flexible_printing_printers', array() ),
'description' => __( 'Drukarka, na której zostanie wydrukowana etykieta', 'woocommerce-dhl' ),
'default' => 'no',
'desc_tip' => false
);
}
*/
return $settings;