+
+
+ get_tooltip_html( $data ) ); ?>
+ |
+
+ dolibarr_version ) ) {
+ esc_html_e( $not_configured );
+ } else {
+ if ( $version_ok ) {
+ esc_html_e( $configuration_ok );
+ } else {
+ esc_html_e( $not_compatible );
+ }
+ esc_html_e( ' ' . $detected );
+ }
+ ?>
+ |
+
+ plugin_id . $this->id . '_' . $key ];
+
+ // Make sure we use HTTPS
+ if ( 'https://' !== ( substr( $value, 0, 8 ) ) ) {
+ $this->errors[] = __( 'The protocol to use is https://', 'doliwoo' );
+ }
+
+ // Make sure we have the trailing slash
+ $value = trailingslashit( $value );
+
+ // Check that the server is available
+ try {
+ new SoapClient( $value . Doliwoo_Dolibarr::OTHER_ENDPOINT . Doliwoo_Dolibarr::WSDL_MODE );
+ } catch ( SoapFault $exc ) {
+ $this->errors[] = __( 'The webservice is not available. Please check the URL.', 'doliwoo' );
+ }
+
+ return $value;
+ }
+
+ /**
+ * Sanitize settings.
+ * Executed after validations.
+ * @see process_admin_options()
+ *
+ * @param array $settings Validated settings
+ *
+ * @return array Sanitized settings
+ */
+ public function sanitize_settings( $settings ) {
+ // Check Dolibarr version and compatibility
+
+ $endpoint = $settings['dolibarr_ws_endpoint'];
+ $ws_auth = array(
+ 'dolibarrkey' => $settings['dolibarr_key'],
+ 'sourceapplication' => $settings['sourceapplication'],
+ 'login' => $settings['dolibarr_login'],
+ 'password' => $settings['dolibarr_password'],
+ 'entity' => $settings['dolibarr_entity'],
+ );
+
+ $this->test_webservice( $endpoint, $ws_auth );
+
+ return $settings;
+ }
+
+ /**
+ * Display HTTPS is needed
+ * @see WC_Integration::display_errors()
+ *
+ * @return void
+ */
+ public function display_errors( ) {
+ if ( empty( $this->errors ) ) {
+ // Nothing to do
+ return;
+ }
+
+ foreach ( $this->errors as $key => $value ) {
+ ?>
+