first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce NIP\n"
"POT-Creation-Date: 2016-03-02 10:04+0100\n"
"PO-Revision-Date: 2016-03-02 10:09+0100\n"
"Last-Translator: Krzysztof Busłowicz <elkurczako1@gmail.com>\n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
"_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
#: woocommerce-nip.php:33 woocommerce-nip.php:90
msgid "Polish NIP ID"
msgstr "Polnische NIP-ID"
#: woocommerce-nip.php:34
msgctxt "placeholder"
msgid "Enter NIP"
msgstr "Geben Sie NIP"
#: woocommerce-nip.php:58
msgid "First name"
msgstr "Vorname"
#: woocommerce-nip.php:63
msgid "Last name"
msgstr "Nachname"
#: woocommerce-nip.php:70
msgid "Company Name"
msgstr "Firmenname"
#: woocommerce-nip.php:75
msgid "Address"
msgstr "Adresse"
#: woocommerce-nip.php:80
msgid "Postcode / Zip"
msgstr "Postleitzahl"
#: woocommerce-nip.php:85
msgid "Town / City"
msgstr "Ort"
#: woocommerce-nip.php:112
msgid "First name is required!"
msgstr "Geben Sie Vorname!"
#: woocommerce-nip.php:116
msgid "Last name is required!."
msgstr "Geben Sie Nachname!"
#: woocommerce-nip.php:120
msgid "Address is required!"
msgstr "Geben Sie Adresse!"
#: woocommerce-nip.php:124
msgid "Post code / Zip is required!."
msgstr "Geben Sie Postleitzahl!"
#: woocommerce-nip.php:129
msgid "Town / City is required!."
msgstr "Geben Sie Ort!"

View File

@@ -0,0 +1,74 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce NIP\n"
"POT-Creation-Date: 2016-03-02 10:01+0100\n"
"PO-Revision-Date: 2016-03-02 10:03+0100\n"
"Last-Translator: Krzysztof Busłowicz <elkurczako1@gmail.com>\n"
"Language-Team: \n"
"Language: pl_PL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2);\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
#: woocommerce-nip.php:33 woocommerce-nip.php:90
msgid "Polish NIP ID"
msgstr "Numer NIP"
#: woocommerce-nip.php:34
msgctxt "placeholder"
msgid "Enter NIP"
msgstr "Podaj NIP"
#: woocommerce-nip.php:58
msgid "First name"
msgstr "Imię"
#: woocommerce-nip.php:63
msgid "Last name"
msgstr "Nazwisko"
#: woocommerce-nip.php:70
msgid "Company Name"
msgstr "Nazwa firmy"
#: woocommerce-nip.php:75
msgid "Address"
msgstr "Adres"
#: woocommerce-nip.php:80
msgid "Postcode / Zip"
msgstr "Kod pocztowy"
#: woocommerce-nip.php:85
msgid "Town / City"
msgstr "Miasto"
#: woocommerce-nip.php:112
msgid "First name is required!"
msgstr "Imię jest wymagane!"
#: woocommerce-nip.php:116
msgid "Last name is required!."
msgstr "Nazwisko jest wymagane!"
#: woocommerce-nip.php:120
msgid "Address is required!"
msgstr "Adres jest wymagany!"
#: woocommerce-nip.php:124
msgid "Post code / Zip is required!."
msgstr "Kod pocztowy jest wymagany!"
#: woocommerce-nip.php:129
msgid "Town / City is required!."
msgstr "Miasto jest wymagane!"

View File

@@ -0,0 +1,33 @@
=== WooCommerce NIP ===
Contributors: Elkurczako
Requires at least: 4.0
Tested up to: 4.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Plugin for WordPress and WooCommerce e-commerce. Adds NIP (polish VAT number) to WooCommerce customer profile and orders.
== Description ==
WooCommerce NIP adds custom \"NIP\" field to customer profile.
Users can set and modify this field on WordPress front and back end. Field \"NIP\" is visible in order details and added to customer e-mails.
Plugin modifies standard My Account > edit Billing Address page
Plugin modifies standatd Create Account form on sites front end.
Plugin adds \“Dane Firmy\” section with \“NIP\” field to edit User Profile page on WordPress back end.
Tested with WooCommerce 2.3 to 2.4
Tested with WordPress 4.3 to 4.4.2
Tested with WPML 3.3
== Installation ==
Download woocommerce-nip.zip and install it via Plugins > AddNew >Upload.
Or you can unzip the archive and upload it\'s content to yoursite/wp-content/plugins directory using an FTP client.
== Changelog ==
1.0.0 First release (Polish) - checkout and order field only
1.0.1 Added multilingual support for WPML. Rewriting in English. Added Polish and German translations.
1.1.0 Added support for viewing and editing on WordPress Users Page on back end,
Added support for viewing and editing on My Account Page on front end.
Tweak - adding and saving customer billing data on Create Account front end page

View File

@@ -0,0 +1,51 @@
=== WooCommerce NIP ===
Contributors: Elkurczako
Requires at least: 4.0
Tested up to: 4.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Wtyczka WordPress rozszerzająca funkcjonalność WooCommerce wtyczki e-commerce. Dodaje pole NIP do profilu klienta i jego zamówień.
== OPIS ==
Ta wtyczka dodaje własne pole \”NIP\” do profilu użytkownika „Customer” WooCommerce.
Wtyczka rozszerza formularz na ekranie zakładania konta dla klientów o niezbędne do kontaktu pola:
* Imię - wymagane
* Nazwisko wymagane
* Nazwa firmy opcja
* Adres - Wymagane
* Kod pocztowy Wymagane
* Miasto - Wymagane
* Numer NIP - opcja
Wtyczka dodaje Sekcję „Dane Firmy” z polem „Numer NIP” na stronie edycji profilu użytkownika na zapleczu WordPress
Klienci mogą dopisać NIP przy zakładaniu konta.
Klienci mogą dopisać / edytować NIP na ekranie Moje Konto edycja adresu Płatności.
Klienci mogą dopisać / edytować NIP na ekranie płatności.
Administrator może dopisać / edytować NIP w profilu użytkownika.
Pole NIP jest dopisywane do danych zamówienia i załączane do emaili dla klienta.
Wtyczka jest wielojęzyczna. Językiem podstawowym jest angielski i zawiera wbudowane tłumaczenia na języki: polski, niemiecki
Wtyczka testowana z WordPress 4.0 4.4.2
Wtyczka testowana z WooCommerce 2.3 i 2.4
Wtyczka testowana z WPML 3.3
== Instalacja ==
Pobierz woocommerce-nip.zip i zainstaluj na stronie Wtyczki > Dodaj Nową >Wyślij na serwer.
Instalacja ręczna / update wypakuj zawartość woocommerce-nip.zip i skopiuj ją do katalogu „twój-adres-wordpressa/wp-content/plugins za pomocą klienta FTP.
== Changelog ==
1.0.0 First release (Polish) - checkout and order field only
1.0.1 Added multilingual support. Rewriting in English. Added Polish and German translations.
1.1.0 Added support for viewing and editing on WordPress Users Page on back end,
Added support for viewing and editing on My Account Page on front end.
Tweak - adding and saving customer billing data on Create Account front end page

View File

@@ -0,0 +1,244 @@
<?php
/*
* Plugin Name: WooCommerce NIP
Plugin URI:
Description: Dodatkowe pole - mumer NIP - dla WooCommerce
Version: 1.1.0
Author: Krzysztof Busłowicz
Author URI: http://www.sirta.pl
Text Domain: woocommerce-nip
Domain Path: /languages/
License: GPL
License URI: https://www.gnu.org/licenses/gpl.html
*/
defined( 'ABSPATH' ) or die( 'Cheating? No script kiddies please!' );
/***
*Multilanguage support
***/
add_action('plugins_loaded', 'wnip_load_textdomain');
function wnip_load_textdomain() {
load_plugin_textdomain( 'woocommerce-nip', false, dirname( plugin_basename(__FILE__) ) . '/languages/' );
}
/**
*Adding field to user profiles
// Hook in */
add_filter( 'woocommerce_billing_fields', 'my_custom_billing_fields' );
// Function Hook
Function my_custom_billing_fields( $fields ) {
$fields['billing_nip'] = array(
'label' => __('NIP','woocommerce-nip'),
'placeholder' => _x('Podaj NIP jeśli będziesz potrzebować faktury', 'placeholder', 'woocommerce-nip'),
'required' => false,
'class' => array('my-field-class form-row-wide'),
'clear' => true
);
// just copy same format if youd like to add more fields
return $fields;
}
/**
* Adding address fields to user registration form
**/
/**
* Add new register fields for WooCommerce registration.
*
* @return string Register fields HTML.
*/
function wooc_extra_register_fields() {
?>
<p class="form-row form-row-first">
<label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" />
</p>
<p class="form-row form-row-last">
<label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" />
</p>
<div class="clear"></div>
<p class="form-row form-row-wide">
<label for="reg_billing_company"><?php _e( 'Company Name', 'woocommerce' ); ?> </label>
<input type="text" class="input-text" name="billing_company" id="reg_billing_company" value="<?php if ( ! empty( $_POST['billing_company'] ) ) esc_attr_e( $_POST['billing_company'] ); ?>" />
</p>
<p class="form-row form-row-wide">
<label for="reg_billing_address_1"><?php _e( 'Address', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_address_1" id="reg_billing_address_1" value="<?php if ( ! empty( $_POST['billing_address_1'] ) ) esc_attr_e( $_POST['billing_address_1'] ); ?>" />
</p>
<p class="form-row form-row-first">
<label for="reg_billing_postcode"><?php _e( 'Postcode / Zip', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_postcode" id="reg_billing_postcode" value="<?php if ( ! empty( $_POST['billing_postcode'] ) ) esc_attr_e( $_POST['billing_postcode'] ); ?>" />
</p>
<p class="form-row form-row-last">
<label for="reg_billing_city"><?php _e( 'Town / City', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_city" id="billing_city" value="<?php if ( ! empty( $_POST['billing_city'] ) ) esc_attr_e( $_POST['billing_city'] ); ?>" />
</p>
<p class="form-row form-row-wide">
<label for="reg_billing_nip"><?php _e( 'Polish NIP ID','woocommerce-nip' ); ?> </label>
<input type="text" class="input-text" name="billing_nip" id="reg_billing_nip" value="<?php if ( ! empty( $_POST['billing_nip'] ) ) esc_attr_e( $_POST['billing_nip'] ); ?>" />
</p>
<div class="clear"></div>
<?php
}
add_action( 'woocommerce_register_form', 'wooc_extra_register_fields' );
/**
* Validate the extra register fields.
*
* @param string $username Current username.
* @param string $email Current email.
* @param object $validation_errors WP_Error object.
*
* @return void
*/
function wooc_validate_extra_register_fields( $username, $email, $validation_errors ) {
if ( isset( $_POST['billing_first_name'] ) && empty( $_POST['billing_first_name'] ) ) {
$validation_errors->add( 'billing_first_name_error', __( 'First name is required!', 'woocommerce-nip' ) );
}
if ( isset( $_POST['billing_last_name'] ) && empty( $_POST['billing_last_name'] ) ) {
$validation_errors->add( 'billing_last_name_error', __( 'Last name is required!.', 'woocommerce-nip' ) );
}
if ( isset( $_POST['billing_address_1'] ) && empty( $_POST['billing_address_1'] ) ) {
$validation_errors->add( 'billing_address_1_error', __( 'Address is required!', 'woocommerce-nip' ) );
}
if ( isset( $_POST['billing_postcode'] ) && empty( $_POST['billing_postcode'] ) ) {
$validation_errors->add( 'billing_postcode_error', __( 'Post code / Zip is required!.', 'woocommerce-nip' ) );
}
if ( isset( $_POST['billing_city'] ) && empty( $_POST['billing_city'] ) ) {
$validation_errors->add( 'billing_city_error', __( 'Town / City is required!.', 'woocommerce-nip' ) );
}
}
add_action( 'woocommerce_register_post', 'wooc_validate_extra_register_fields', 10, 3 );
/**
* Save the extra register fields.
*
* @param int $customer_id Current customer ID.
*
* @return void
*/
function wooc_save_extra_register_fields( $customer_id ) {
if ( isset( $_POST['billing_first_name'] ) ) {
// WordPress default first name field.
update_user_meta( $customer_id, 'first_name', sanitize_text_field( $_POST['billing_first_name'] ) );
// WooCommerce billing first name.
update_user_meta( $customer_id, 'billing_first_name', sanitize_text_field( $_POST['billing_first_name'] ) );
}
if ( isset( $_POST['billing_last_name'] ) ) {
// WordPress default last name field.
update_user_meta( $customer_id, 'last_name', sanitize_text_field( $_POST['billing_last_name'] ) );
// WooCommerce billing last name.
update_user_meta( $customer_id, 'billing_last_name', sanitize_text_field( $_POST['billing_last_name'] ) );
}
if ( isset( $_POST['billing_company'] ) ) {
// WooCommerce billing_company
update_user_meta( $customer_id, 'billing_company', sanitize_text_field( $_POST['billing_company'] ) );
}
if ( isset( $_POST['billing_address_1'] ) ) {
// WooCommerce billing address
update_user_meta( $customer_id, 'billing_address_1', sanitize_text_field( $_POST['billing_address_1'] ) );
}
if ( isset( $_POST['billing_postcode'] ) ) {
// WooCommerce billing phone
update_user_meta( $customer_id, 'billing_postcode', sanitize_text_field( $_POST['billing_postcode'] ) );
}
if ( isset( $_POST['billing_city'] ) ) {
// WooCommerce billing city
update_user_meta( $customer_id, 'billing_city', sanitize_text_field( $_POST['billing_city'] ) );
}
if ( isset( $_POST['billing_nip'] ) ) {
// WooCommerce billing nip
update_user_meta( $customer_id, 'billing_nip', sanitize_text_field( $_POST['billing_nip'] ) );
}
}
add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' );
/**
*Displaying new nip field in the backend
**
*/
add_action( 'show_user_profile', 'ws_update_user_profile' );
add_action( 'edit_user_profile', 'ws_update_user_profile' );
function ws_update_user_profile( $user ){ ?>
<h3>Dane Firmy</h3>
<table class="form-table">
<tr>
<th><label for="billing_nip">Numer NIP</label></th>
<td><input type="text" name="billing_nip" value="<?php echo esc_attr(get_the_author_meta( 'billing_nip', $user->ID )); ?>" class="regular-text" /></td>
</tr>
</table>
<?php
}
add_action( 'personal_options_update', 'save_extra_fields' );
add_action( 'edit_user_profile_update', 'save_extra_fields' );
function save_extra_fields( $user_id ){
update_user_meta( $user_id,'billing_nip', sanitize_text_field( $_POST['billing_nip'] ) );
}
/**
* Update the order meta with field value
**/
add_action('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta');
function my_custom_checkout_field_update_order_meta( $order_id ) {
if ($_POST['billing_nip']) update_post_meta( $order_id, 'Nip', esc_attr($_POST['billing_nip']));
}
/**
* Display field value on the order edition page
**/
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta');
function my_custom_checkout_field_display_admin_order_meta($post){
$key_1_values = get_post_meta( $post->id, 'Nip' );
echo '<strong>NIP</strong>: '.$key_1_values[0];
}
/**
* Add the field to order emails
**/
add_filter('woocommerce_email_order_meta_keys', 'my_custom_checkout_field_order_meta_keys');
function my_custom_checkout_field_order_meta_keys( $keys ) {
$keys[] = 'Nip';
return $keys;
}