Skip to content

Commit

Permalink
v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
coax committed Feb 26, 2024
1 parent e3aaecf commit 928291f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
21 changes: 19 additions & 2 deletions solo-for-woocommerce/lib/solo-woocommerce-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Solo for WooCommerce
* Plugin URI: https://solo.com.hr/api-dokumentacija/dodaci
* Description: Narudžba u tvojoj WooCommerce trgovini će automatski kreirati račun ili ponudu u servisu Solo.
* Version: 1.2
* Version: 1.3
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Solo
Expand Down Expand Up @@ -55,7 +55,7 @@
$solo_woocommerce = new solo_woocommerce;

// Define default variables
$token = $tip_usluge = $jezik_ = $prikazi_porez = $tip_racuna = $rok_placanja = $iban = $akcija = $posalji = $naslov = $poruka = '';
$token = $tip_usluge = $jezik_ = $prikazi_porez = $tip_racuna = $rok_placanja = $napomene_racun = $napomene_ponuda = $iban = $akcija = $posalji = $naslov = $poruka = '';

// Create variables from settings
$settings = get_option('solo_woocommerce_postavke');
Expand Down Expand Up @@ -111,6 +111,7 @@

case 'postavke':
?>
<input type="hidden" name="solo_woocommerce_postavke[posalji]" value="<?php echo $posalji ?>">
<table class="form-table">
<tbody>
<tr>
Expand Down Expand Up @@ -173,6 +174,20 @@
<p class="description"><?php echo __('Nije obavezno upisati.', 'solo-for-woocommerce'); ?></p>
</td>
</tr>
<tr>
<th><label for="napomene_racun"><?php echo __('Napomene na računu', 'solo-for-woocommerce'); ?><sup class="tooltip" title="<?php echo __('Upiši napomene koje će se pojaviti na svakom računu.<br>Solo prihvaća do najviše 1000 znakova.', 'solo-for-woocommerce'); ?>"></sup></label></th>
<td>
<textarea name="solo_woocommerce_postavke[napomene_racun]" id="napomene_racun" rows="2" maxlength="1000" class="large-text"><?php echo $napomene_racun; ?></textarea>
<p class="description"><?php echo __('Nije obavezno upisati.', 'solo-for-woocommerce'); ?></p>
</td>
</tr>
<tr>
<th><label for="napomene_ponuda"><?php echo __('Napomene na ponudi', 'solo-for-woocommerce'); ?><sup class="tooltip" title="<?php echo __('Upiši napomene koje će se pojaviti na svakoj ponudi.<br>Solo prihvaća do najviše 1000 znakova.', 'solo-for-woocommerce'); ?>"></sup></label></th>
<td>
<textarea name="solo_woocommerce_postavke[napomene_ponuda]" id="napomene_ponuda" rows="2" maxlength="1000" class="large-text"><?php echo $napomene_ponuda; ?></textarea>
<p class="description"><?php echo __('Nije obavezno upisati.', 'solo-for-woocommerce'); ?></p>
</td>
</tr>
<tr>
<th><label for="iban"><?php echo __('IBAN za uplatu', 'solo-for-woocommerce'); ?><sup class="tooltip" title="<?php echo __('Odaberi IBAN (tvoj žiro račun) koji će se pojaviti na računu ili ponudi.<br>IBAN možeš mijenjati u web sučelju > Postavke > Moja tvrtka.', 'solo-for-woocommerce'); ?>"></sup></label></th>
<td>
Expand Down Expand Up @@ -282,6 +297,8 @@

case 'email':
?>
<input type="hidden" name="solo_woocommerce_postavke[prikazi_porez]" value="<?php echo $prikazi_porez ?>">
<input type="hidden" name="solo_woocommerce_postavke[tip_racuna]" value="<?php echo $tip_racuna ?>">
<br><div class="notice notice-info inline"><p><?php echo __('Za automatsko slanje mailova trebaš imati namještene SMTP postavke, bilo ručno ili putem jednog od besplatnih WordPress dodataka za slanje (npr. <a href="https://wordpress.org/plugins/wp-mail-smtp/" target="_blank">WP Mail SMTP</a>).', 'solo-for-woocommerce'); ?></p></div>
<table class="form-table">
<tbody>
Expand Down
17 changes: 10 additions & 7 deletions solo-for-woocommerce/solo-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Solo for WooCommerce
* Plugin URI: https://solo.com.hr/api-dokumentacija/dodaci
* Description: Narudžba u tvojoj WooCommerce trgovini će automatski kreirati račun ili ponudu u servisu Solo.
* Version: 1.2
* Version: 1.3
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Solo
Expand All @@ -21,7 +21,7 @@

//// Plugin version
if (!defined('SOLO_VERSION'))
define('SOLO_VERSION', '1.2');
define('SOLO_VERSION', '1.3');

//// Activate plugin
register_activation_hook(
Expand Down Expand Up @@ -468,10 +468,7 @@ function solo_woocommerce_form_validation($data) {
$type = 'error';
$settings_data = '';
} else {
$settings_data[$key] = sanitize_text_field($value);

// Textarea exception to allow line breaks
if (isset($data['poruka'])) $settings_data['poruka'] = sanitize_textarea_field($value);
$settings_data[$key] = sanitize_textarea_field($value);

// Checkboxes
if (!isset($data['prikazi_porez'])) $settings_data['prikazi_porez'] = 0;
Expand Down Expand Up @@ -798,14 +795,20 @@ function solo_woocommerce_process_order($order_id, $old_status, $new_status) {

$api_request .= '&valuta_' . $grammar . '=' . $currency_id . PHP_EOL;
$api_request .= '&tecaj=' . $currency_exchange . PHP_EOL;
$api_request .= '&napomene=' . urlencode(__('Preračunato po srednjem tečaju HNB-a', 'solo-for-woocommerce')) . ' (1 EUR = ' . $currency_exchange . ' ' . $currency . ')' . PHP_EOL;
$api_request .= '&napomene=' . urlencode(__('Preračunato po srednjem tečaju HNB-a', 'solo-for-woocommerce') . ' (1 EUR = ' . $currency_exchange . ' ' . $currency . ')') . PHP_EOL;
} else {
// Stop
return;
}
}

// Notes
if (isset(${'napomene_' . $document_type}) && !empty(${'napomene_' . $document_type})) $api_request .= '&napomene=' . urlencode(${'napomene_' . $document_type}) . PHP_EOL;

// Language
if (isset($jezik_) && !empty($jezik_)) $api_request .= '&jezik_' . $grammar . '=' . $jezik_ . PHP_EOL;

// Fiscalization
$api_request .= '&fiskalizacija=' . $fiskalizacija . PHP_EOL;

// Check for table in database
Expand Down

0 comments on commit 928291f

Please sign in to comment.