' . esc_html( self::mention() ) . '

'; } public static function pageMention(): void { if ( self::mentionEnabled() ) { echo '

' . esc_html( self::mention() ) . '

'; } } public static function productField(): void { echo '
'; woocommerce_wp_select( array( 'id' => OrderMapper::PRODUCT_CATEGORY_META, 'label' => __( 'E-reporting', 'totalio-ereporting' ), 'description' => __( 'Bien ou service, pour la déclaration. « Automatique » : service si le produit est virtuel ou téléchargeable.', 'totalio-ereporting' ), 'desc_tip' => true, 'options' => array( '' => __( 'Automatique', 'totalio-ereporting' ), 'goods' => __( 'Livraison de biens', 'totalio-ereporting' ), 'services' => __( 'Prestation de services', 'totalio-ereporting' ), ), ) ); echo '
'; } /** * Appelé par WooCommerce après sa propre vérification du jeton de sécurité de la fiche produit. * * @param \WC_Product $product Produit en cours d'enregistrement. */ public static function saveProductField( $product ): void { if ( ! current_user_can( 'edit_product', $product->get_id() ) ) { return; } // phpcs:ignore WordPress.Security.NonceVerification.Missing -- jeton vérifié par WooCommerce avant ce crochet. $value = isset( $_POST[ OrderMapper::PRODUCT_CATEGORY_META ] ) ? sanitize_key( wp_unslash( $_POST[ OrderMapper::PRODUCT_CATEGORY_META ] ) ) : ''; if ( in_array( $value, array( 'goods', 'services' ), true ) ) { $product->update_meta_data( OrderMapper::PRODUCT_CATEGORY_META, $value ); } else { $product->delete_meta_data( OrderMapper::PRODUCT_CATEGORY_META ); } } }