Changeset 2561842
- Timestamp:
- 07/10/2021 12:26:01 PM (5 years ago)
- Location:
- smartaccounts/trunk
- Files:
-
- 4 edited
-
SmartAccountsArticleAsync.php (modified) (1 diff)
-
SmartAccountsClient.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
-
smartaccounts.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
smartaccounts/trunk/SmartAccountsArticleAsync.php
r2465911 r2561842 180 180 // Sale price is set. Update only regular price and keep actual sale price what it is. 181 181 update_post_meta($post_id, '_regular_price', $data['price']); 182 } elseif (!$salePrice && ($data['price'] != $finalPrice && $regularPrice === $finalPrice)) { 183 // if no sale price and price in SmartAccounts has changed then change also in the WooCommerce 184 update_post_meta($post_id, '_regular_price', $data['price']); 185 update_post_meta($post_id, '_price', $data['price']); 182 186 } 183 187 -
smartaccounts/trunk/SmartAccountsClient.php
r2328274 r2561842 80 80 } 81 81 82 $clients = $this->api->sendRequest(null, $apiUrl, 83 "fetchAddresses=true&fetchContacts=true&nameOrRegCode=" . $client); 82 $clients = $this->api->sendRequest(null, $apiUrl, "fetchAddresses=true&fetchContacts=true&nameOrRegCode=" . $client); 83 $hasMoreEntries = isset($clients['hasMoreEntries']) && $clients['hasMoreEntries'] ? "YES" : "NO"; 84 error_log("Found " . count($clients['clients']) . " SA clients. hasMoreEntries: $hasMoreEntries"); 84 85 85 86 if ($this->isAnonymous) { … … 101 102 } 102 103 104 error_log("Create anonymous customer for country $country to SmartAccounts"); 103 105 return $this->addNewSaClient(null, $name, $country); 104 106 } … … 189 191 { 190 192 if (!is_array($clients) || count($clients) == 0) { 193 error_log("No SA customers found, creating new with name $name"); 191 194 return $this->addNewSaClient($email, $name, $country); 192 195 } 193 196 197 $clientNames = []; 194 198 foreach ($clients as $client) { 195 //match client if name matches and is company or email also matches196 if (($this->isCompany || $this->hasEmail($client, 197 $email)) && strtolower($this->name) == strtolower($client["name"])) {199 //match client if name matches and (is company or email also matches) 200 if (($this->isCompany || $this->hasEmail($client, $email)) && 201 strtolower(trim($this->name)) === strtolower(trim($client["name"]))) { 198 202 return $client; 199 203 } 200 } 201 204 $clientNames[] = $client['name']; 205 } 206 207 error_log("No good match found for $name, creating new company. Found names " . json_encode($clientNames)); 202 208 return $this->addNewSaClient($email, $name, $country); 203 209 } -
smartaccounts/trunk/readme.txt
r2540725 r2561842 59 59 == Changelog == 60 60 61 = 3.6 = 62 Price update improvements and more detailed logging for existing customer matching. 63 61 64 = 3.5 = 62 65 Filter for editing SmartAccounts body data -
smartaccounts/trunk/smartaccounts.php
r2540725 r2561842 4 4 * Plugin URI: https://github.com/smartman/woocommerce_smartaccounts 5 5 * Description: This plugin creates sales invoices in the smartaccounts.ee Online Accounting Software after Woocommerce order creation 6 * Version: 3. 56 * Version: 3.6 7 7 * Author: Margus Pala 8 8 * Author URI: https://marguspala.com
Note: See TracChangeset
for help on using the changeset viewer.