Plugin Directory

Changeset 3454681


Ignore:
Timestamp:
02/05/2026 01:55:25 PM (8 weeks ago)
Author:
wntcloud
Message:

Bugs fix

Location:
wintouch-cloud
Files:
11 edited
14 copied

Legend:

Unmodified
Added
Removed
  • wintouch-cloud/tags/0.0.8/README.md

    r3450548 r3454681  
    88**Requires at least:** 5.0 
    99**Tested up to:** 6.9 
    10 **Stable tag:** 0.0.7 
     10**Stable tag:** 0.0.8 
    1111**Requires PHP:** 7.2 
    1212**License:** GPLv2 or later 
  • wintouch-cloud/tags/0.0.8/readme.txt

    r3450548 r3454681  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 0.0.7
     6Stable tag: 0.0.8
    77Requires PHP: 7.2
    88License: GPLv2 or later
  • wintouch-cloud/tags/0.0.8/src/Api.php

    r3447688 r3454681  
    4040        $data = json_encode([
    4141            "store" => $storeurl,
    42             "type" => "woocommerce"
     42            "type" => "woocommerce",
     43            "vatroundatdocument" => get_option("woocommerce_tax_round_at_subtotal") === 'yes'
    4344        ]);
    4445
     
    4748        $body = wp_remote_retrieve_body($response);
    4849
    49         return json_decode($body, true);
     50        $parsed = json_decode($body, true);
     51
     52        if (!isset($parsed['errors'])) {
     53            return $parsed;
     54        }
     55
     56        throw new ApiException(esc_html($parsed['errors'][0]['message']));
    5057    }
    5158
     
    7582
    7683    public function GetEnterprises() {
    77         $response = $this->Get('enterprises');
     84        $response = $this->Get('enterprises?IsActive=eq=true');
    7885        $body = wp_remote_retrieve_body($response);
    7986        $parsed = json_decode($body, true);
  • wintouch-cloud/tags/0.0.8/src/Authentication.php

    r3448855 r3454681  
    5656                $url = wp_parse_url(get_site_url(), PHP_URL_HOST);
    5757                $storeurl = preg_replace('/^www\./', '', $url);
    58                 (new Api())->CreateIntegration($storeurl);
    5958
    60                 update_option('wintouch_shopurl', $storeurl, false);
    61                 update_option('wintouch_setting_orderstate', null, false);
    62                 delete_option('wintouch_setting_syncstock');
    63                 delete_option('wintouch_lastsync');
     59                try {
     60                    $response = (new Api())->CreateIntegration($storeurl);
    6461
    65                 return true;
     62                    update_option('wintouch_shopurl', $storeurl, false);
     63                    update_option('wintouch_setting_orderstate', null, false);
     64
     65                    delete_option('wintouch_setting_syncstock');
     66                    delete_option('wintouch_lastsync');
     67
     68                    return true;
     69                } catch (ApiException $ex) {
     70                    delete_option('wintouch_enterpriseid');
     71                    delete_option('wintouch_apikey');
     72                    add_settings_error('wintouch', 'wt', $ex->getMessage(), 'error');
     73                }
    6674            }
    6775
  • wintouch-cloud/tags/0.0.8/views/Account.php

    r3450548 r3454681  
    1818<div class="card">
    1919
    20     <div class="wt-account-description">
     20    <div>
    2121        <h2 class="title">Utilizador</h2>
    2222
    2323        <br>
    2424
    25         <?php
    26             if (isset($wintouch_user['Name'])) {
    27                 echo '<p>Nome: '.esc_html($wintouch_user['Name']).'</p>';
    28             } else {
    29                 echo '<p>Nome: Não definido</p>';
    30             }
     25        <div class="wt-account-description">
     26            <?php
     27                if (isset($wintouch_user['Name'])) {
     28                    echo '<p>Nome: '.esc_html($wintouch_user['Name']).'</p>';
     29                } else {
     30                    echo '<p>Nome: Não definido</p>';
     31                }
    3132
    32             if (isset($wintouch_user['Email'])) {
    33                 echo '<p>Email: '.esc_html($wintouch_user['Email']).'</p>';
    34             } else {
    35                 echo '<p>Email: Não definido</p>';
    36             }
     33                if (isset($wintouch_user['Email'])) {
     34                    echo '<p>Email: '.esc_html($wintouch_user['Email']).'</p>';
     35                } else {
     36                    echo '<p>Email: Não definido</p>';
     37                }
    3738
    38             if (isset($wintouch_user['PhoneNumber'])) {
    39                 echo '<p>Telemóvel: '.esc_html($wintouch_user['PhoneNumber']).'</p>';
    40             } else {
    41                 echo '<p>Telemóvel: Não definido</p>';
    42             }
    43         ?>
     39                if (isset($wintouch_user['PhoneNumber'])) {
     40                    echo '<p>Telemóvel: '.esc_html($wintouch_user['PhoneNumber']).'</p>';
     41                } else {
     42                    echo '<p>Telemóvel: Não definido</p>';
     43                }
     44            ?>
     45        </div>
    4446
    4547        <br>
     
    5658
    5759    <div class="wt-account-enterprise">
    58         <div class="wt-account-description">
     60        <div>
    5961            <h2 class="title">Empresa associada</h2>
    6062
    6163            <br>
    6264
    63             <?php
    64                 if (isset($wintouch_enterprise['Name'])) {
    65                     echo '<p>Nome: '.esc_html($wintouch_enterprise['Name']).'</p>';
    66                 } else {
    67                     echo '<p>Nome: Não definido</p>';
    68                 }
     65            <div class="wt-account-description">
     66                <?php
     67                    if (isset($wintouch_enterprise['Name'])) {
     68                        echo '<p>Nome: '.esc_html($wintouch_enterprise['Name']).'</p>';
     69                    } else {
     70                        echo '<p>Nome: Não definido</p>';
     71                    }
    6972
    70                 if (isset($wintouch_enterprise['Email'])) {
    71                     echo '<p>Email: '.esc_html($wintouch_enterprise['Email']).'</p>';
    72                 } else {
    73                     echo '<p>Email: Não definido</p>';
    74                 }
     73                    if (isset($wintouch_enterprise['Email'])) {
     74                        echo '<p>Email: '.esc_html($wintouch_enterprise['Email']).'</p>';
     75                    } else {
     76                        echo '<p>Email: Não definido</p>';
     77                    }
    7578
    76                 if (isset($wintouch_enterprise['PhoneNumber1'])) {
    77                     echo '<p>Telemóvel: '.esc_html($wintouch_enterprise['PhoneNumber1']).'</p>';
    78                 } else {
    79                     echo '<p>Telemóvel: Não definido</p>';
    80                 }
    81             ?>
     79                    if (isset($wintouch_enterprise['PhoneNumber1'])) {
     80                        echo '<p>Telemóvel: '.esc_html($wintouch_enterprise['PhoneNumber1']).'</p>';
     81                    } else {
     82                        echo '<p>Telemóvel: Não definido</p>';
     83                    }
     84                ?>
     85            </div>
    8286
    8387            <br>
  • wintouch-cloud/tags/0.0.8/views/Enterprises.php

    r3443376 r3454681  
    11<?php
    22    defined( "ABSPATH" ) || exit;
     3
     4    settings_errors('wintouch');
    35?>
    46
  • wintouch-cloud/tags/0.0.8/views/General.php

    r3447026 r3454681  
    3030            switch ($this->activeTab) {
    3131                case 'settings':
    32                     include(__DIR__ . '/../views/Settings.php');;
     32                    include(__DIR__ . '/../views/Settings.php');
    3333                    break;
    3434                case 'account':
    35                     include(__DIR__ . '/../views/Account.php');;
     35                    include(__DIR__ . '/../views/Account.php');
    3636                    break;
    3737                default:
    38                     include(__DIR__ . '/../views/Orders.php');;
     38                    include(__DIR__ . '/../views/Orders.php');
    3939                    break;
    4040            }
  • wintouch-cloud/tags/0.0.8/views/Orders.php

    r3443376 r3454681  
    9797            ];
    9898
    99             return sprintf('%1$s %2$s', $item['docnumber'] , $this->row_actions($actions));;
     99            return sprintf('%1$s %2$s', $item['docnumber'] , $this->row_actions($actions));
    100100        }
    101101    }
  • wintouch-cloud/tags/0.0.8/wintouch-cloud.php

    r3450548 r3454681  
    33 * Plugin Name: WINTOUCH Cloud
    44 * Description: Uma ferramenta de faturação para o seu negócio.
    5  * Version: 0.0.7
     5 * Version: 0.0.8
    66 * Author: WINTOUCH
    77 * Author URI: https://wintouchcloud.com
  • wintouch-cloud/trunk/README.md

    r3450548 r3454681  
    88**Requires at least:** 5.0 
    99**Tested up to:** 6.9 
    10 **Stable tag:** 0.0.7 
     10**Stable tag:** 0.0.8 
    1111**Requires PHP:** 7.2 
    1212**License:** GPLv2 or later 
  • wintouch-cloud/trunk/readme.txt

    r3450548 r3454681  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 0.0.7
     6Stable tag: 0.0.8
    77Requires PHP: 7.2
    88License: GPLv2 or later
  • wintouch-cloud/trunk/src/Api.php

    r3447688 r3454681  
    4040        $data = json_encode([
    4141            "store" => $storeurl,
    42             "type" => "woocommerce"
     42            "type" => "woocommerce",
     43            "vatroundatdocument" => get_option("woocommerce_tax_round_at_subtotal") === 'yes'
    4344        ]);
    4445
     
    4748        $body = wp_remote_retrieve_body($response);
    4849
    49         return json_decode($body, true);
     50        $parsed = json_decode($body, true);
     51
     52        if (!isset($parsed['errors'])) {
     53            return $parsed;
     54        }
     55
     56        throw new ApiException(esc_html($parsed['errors'][0]['message']));
    5057    }
    5158
     
    7582
    7683    public function GetEnterprises() {
    77         $response = $this->Get('enterprises');
     84        $response = $this->Get('enterprises?IsActive=eq=true');
    7885        $body = wp_remote_retrieve_body($response);
    7986        $parsed = json_decode($body, true);
  • wintouch-cloud/trunk/src/Authentication.php

    r3448855 r3454681  
    5656                $url = wp_parse_url(get_site_url(), PHP_URL_HOST);
    5757                $storeurl = preg_replace('/^www\./', '', $url);
    58                 (new Api())->CreateIntegration($storeurl);
    5958
    60                 update_option('wintouch_shopurl', $storeurl, false);
    61                 update_option('wintouch_setting_orderstate', null, false);
    62                 delete_option('wintouch_setting_syncstock');
    63                 delete_option('wintouch_lastsync');
     59                try {
     60                    $response = (new Api())->CreateIntegration($storeurl);
    6461
    65                 return true;
     62                    update_option('wintouch_shopurl', $storeurl, false);
     63                    update_option('wintouch_setting_orderstate', null, false);
     64
     65                    delete_option('wintouch_setting_syncstock');
     66                    delete_option('wintouch_lastsync');
     67
     68                    return true;
     69                } catch (ApiException $ex) {
     70                    delete_option('wintouch_enterpriseid');
     71                    delete_option('wintouch_apikey');
     72                    add_settings_error('wintouch', 'wt', $ex->getMessage(), 'error');
     73                }
    6674            }
    6775
  • wintouch-cloud/trunk/views/Account.php

    r3450548 r3454681  
    1818<div class="card">
    1919
    20     <div class="wt-account-description">
     20    <div>
    2121        <h2 class="title">Utilizador</h2>
    2222
    2323        <br>
    2424
    25         <?php
    26             if (isset($wintouch_user['Name'])) {
    27                 echo '<p>Nome: '.esc_html($wintouch_user['Name']).'</p>';
    28             } else {
    29                 echo '<p>Nome: Não definido</p>';
    30             }
     25        <div class="wt-account-description">
     26            <?php
     27                if (isset($wintouch_user['Name'])) {
     28                    echo '<p>Nome: '.esc_html($wintouch_user['Name']).'</p>';
     29                } else {
     30                    echo '<p>Nome: Não definido</p>';
     31                }
    3132
    32             if (isset($wintouch_user['Email'])) {
    33                 echo '<p>Email: '.esc_html($wintouch_user['Email']).'</p>';
    34             } else {
    35                 echo '<p>Email: Não definido</p>';
    36             }
     33                if (isset($wintouch_user['Email'])) {
     34                    echo '<p>Email: '.esc_html($wintouch_user['Email']).'</p>';
     35                } else {
     36                    echo '<p>Email: Não definido</p>';
     37                }
    3738
    38             if (isset($wintouch_user['PhoneNumber'])) {
    39                 echo '<p>Telemóvel: '.esc_html($wintouch_user['PhoneNumber']).'</p>';
    40             } else {
    41                 echo '<p>Telemóvel: Não definido</p>';
    42             }
    43         ?>
     39                if (isset($wintouch_user['PhoneNumber'])) {
     40                    echo '<p>Telemóvel: '.esc_html($wintouch_user['PhoneNumber']).'</p>';
     41                } else {
     42                    echo '<p>Telemóvel: Não definido</p>';
     43                }
     44            ?>
     45        </div>
    4446
    4547        <br>
     
    5658
    5759    <div class="wt-account-enterprise">
    58         <div class="wt-account-description">
     60        <div>
    5961            <h2 class="title">Empresa associada</h2>
    6062
    6163            <br>
    6264
    63             <?php
    64                 if (isset($wintouch_enterprise['Name'])) {
    65                     echo '<p>Nome: '.esc_html($wintouch_enterprise['Name']).'</p>';
    66                 } else {
    67                     echo '<p>Nome: Não definido</p>';
    68                 }
     65            <div class="wt-account-description">
     66                <?php
     67                    if (isset($wintouch_enterprise['Name'])) {
     68                        echo '<p>Nome: '.esc_html($wintouch_enterprise['Name']).'</p>';
     69                    } else {
     70                        echo '<p>Nome: Não definido</p>';
     71                    }
    6972
    70                 if (isset($wintouch_enterprise['Email'])) {
    71                     echo '<p>Email: '.esc_html($wintouch_enterprise['Email']).'</p>';
    72                 } else {
    73                     echo '<p>Email: Não definido</p>';
    74                 }
     73                    if (isset($wintouch_enterprise['Email'])) {
     74                        echo '<p>Email: '.esc_html($wintouch_enterprise['Email']).'</p>';
     75                    } else {
     76                        echo '<p>Email: Não definido</p>';
     77                    }
    7578
    76                 if (isset($wintouch_enterprise['PhoneNumber1'])) {
    77                     echo '<p>Telemóvel: '.esc_html($wintouch_enterprise['PhoneNumber1']).'</p>';
    78                 } else {
    79                     echo '<p>Telemóvel: Não definido</p>';
    80                 }
    81             ?>
     79                    if (isset($wintouch_enterprise['PhoneNumber1'])) {
     80                        echo '<p>Telemóvel: '.esc_html($wintouch_enterprise['PhoneNumber1']).'</p>';
     81                    } else {
     82                        echo '<p>Telemóvel: Não definido</p>';
     83                    }
     84                ?>
     85            </div>
    8286
    8387            <br>
  • wintouch-cloud/trunk/views/Enterprises.php

    r3443376 r3454681  
    11<?php
    22    defined( "ABSPATH" ) || exit;
     3
     4    settings_errors('wintouch');
    35?>
    46
  • wintouch-cloud/trunk/views/General.php

    r3447026 r3454681  
    3030            switch ($this->activeTab) {
    3131                case 'settings':
    32                     include(__DIR__ . '/../views/Settings.php');;
     32                    include(__DIR__ . '/../views/Settings.php');
    3333                    break;
    3434                case 'account':
    35                     include(__DIR__ . '/../views/Account.php');;
     35                    include(__DIR__ . '/../views/Account.php');
    3636                    break;
    3737                default:
    38                     include(__DIR__ . '/../views/Orders.php');;
     38                    include(__DIR__ . '/../views/Orders.php');
    3939                    break;
    4040            }
  • wintouch-cloud/trunk/views/Orders.php

    r3443376 r3454681  
    9797            ];
    9898
    99             return sprintf('%1$s %2$s', $item['docnumber'] , $this->row_actions($actions));;
     99            return sprintf('%1$s %2$s', $item['docnumber'] , $this->row_actions($actions));
    100100        }
    101101    }
  • wintouch-cloud/trunk/wintouch-cloud.php

    r3450548 r3454681  
    33 * Plugin Name: WINTOUCH Cloud
    44 * Description: Uma ferramenta de faturação para o seu negócio.
    5  * Version: 0.0.7
     5 * Version: 0.0.8
    66 * Author: WINTOUCH
    77 * Author URI: https://wintouchcloud.com
Note: See TracChangeset for help on using the changeset viewer.