Changeset 2644114
- Timestamp:
- 12/14/2021 07:23:52 PM (4 years ago)
- Location:
- wc-yabi/trunk
- Files:
-
- 10 edited
-
content/settings.php (modified) (1 diff)
-
includes/ajax.php (modified) (1 diff)
-
includes/transaction.php (modified) (2 diffs)
-
languages/yabi-wc-es_CO.mo (modified) (previous)
-
languages/yabi-wc-es_CO.po (modified) (3 diffs)
-
languages/yabi-wc-es_ES.mo (modified) (previous)
-
languages/yabi-wc-es_ES.po (modified) (3 diffs)
-
languages/yabi-wc.pot (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
wc-yabi.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wc-yabi/trunk/content/settings.php
r2469031 r2644114 43 43 44 44 <tr> 45 <th width="14%"><label for="yabi_owner"><?php echo __('Type of Owner','yabi-wc'); ?>:</label></th> 46 <td> 47 <select id="yabi_owner" name="yabi_owner"> 48 <option value="company" <?php if( 'company' == get_option( 'yabi_owner' ) ) echo 'selected'; ?>><?php echo __('Company','yabi-wc'); ?></option> 49 <option value="person" <?php if( 'person' == get_option( 'yabi_owner' ) ) echo 'selected'; ?>><?php echo __('Person','yabi-wc'); ?></option> 50 </select> 51 </td> 52 </tr> 53 54 <tr> 45 55 <th width="14%"><label for="yabi_businessunituuid"><?php echo __('Business Unit Uuid','yabi-wc'); ?>:</label></th> 46 56 <td> 47 <input type="text" class="large-text" id="yabi_ invoice_name" name="yabi_businessunituuid" value="<?php echo esc_attr( get_option('yabi_businessunituuid') ); ?>" /><br/>57 <input type="text" class="large-text" id="yabi_businessunituuid" name="yabi_businessunituuid" value="<?php echo esc_attr( get_option('yabi_businessunituuid') ); ?>" /><br/> 48 58 <span class="description">xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</span> 49 59 </td> -
wc-yabi/trunk/includes/ajax.php
r2630794 r2644114 91 91 'dateTime' => $dateTime, 92 92 ); 93 94 $graphQL = yabi_create_invoice_person( $person, $products, $payment ); 93 94 if( 'person' == get_option( 'yabi_owner' ) ) 95 { 96 $graphQL = yabi_create_invoice_person( $person, $products, $payment ); 97 } 98 else 99 { 100 $graphQL = yabi_create_invoice_company( $person, $products, $payment ); 101 } 95 102 96 103 $response = yabi_send_data( $graphQL ); -
wc-yabi/trunk/includes/transaction.php
r2630794 r2644114 33 33 } 34 34 35 function yabi_create_invoice_ person( $person, $products, $payment )35 function yabi_create_invoice_company( $person, $products, $payment ) 36 36 { 37 37 $businessUnitUuid = get_option('yabi_businessunituuid'); … … 137 137 return $graphQL; 138 138 139 } 140 141 function yabi_create_invoice_person( $person, $products, $payment ) 142 { 143 $businessUnitUuid = get_option( 'yabi_businessunituuid' ); 144 $invoiceConsecutive = get_option( 'yabi_invoice_name' ) . get_option( 'yabi_invoice_number' ); 145 146 $data_products = yabi_create_products( $products ); 147 $tax_subtotal = yabi_create_tax( $data_products ); 148 149 $note = ''; 150 $observations = ''; 151 $commercial = yabi_create_commercial( $person ); 152 153 if( !empty( $person['note_name'] ) && !empty( $person['note_value'] ) ) 154 { 155 $note = 'note:{ 156 name:"'. $person['note_name'] .'" 157 value:"'. $person['note_value'] .'" 158 }'; 159 } 160 161 if( !empty( $person['observations'] ) ) 162 { 163 $observations = 'invoiceOptionalData:[{ 164 name:"Observations" 165 value:"'. $person['observations'] .'" 166 }]'; 167 } 168 169 $invoicetypecode = "SALES_INVOICE"; 170 if( $person['accountid'] == 'LEGAL' ) 171 { 172 $invoicetypecode = "SALES_INVOICE"; 173 } 174 175 $graphQL = 'mutation{ 176 createInvoice(input:{ 177 businessUnitUuid:"'. $businessUnitUuid .'" 178 invoiceConsecutive:"'. $invoiceConsecutive .'" 179 invoiceAcquirerId:{ 180 identifier:"'. $person['identifier'] .'" 181 type:'. $person['type'] .' 182 } 183 invoiceAcquirerData:{ 184 additionalAccountId:'. $person['accountid'] .' 185 address:{ 186 countryCode:"CO" 187 cityCode:"'. $person['citycode'] .'" 188 line:"'. $person['address'] .'" 189 } 190 contact:{ 191 email:"'. $person['email'] .'" 192 name:{ 193 firstName:"'. $person['name'] .'" 194 familyName:"'. $person['lastname'] .'" 195 } 196 telephone:"'. $person['telephone'] .'" 197 '. $note .' 198 } 199 '. $commercial .' 200 } 201 invoiceDetails:{ 202 acquirerEmail:"'. $person['email'] .'" 203 documentCurrencyId:"COP" 204 dueDate:"'. $payment['dueDate'] .'" 205 invoiceOperationCode:STANDARD 206 invoiceTypeCode:'. $invoicetypecode .' 207 issueDateTime:"'. $payment['dateTime'] .'" 208 } 209 invoiceData:{ 210 invoiceLines:[ 211 '. $data_products['graphQL'] .' 212 ] 213 paymentMeans:{ 214 id:CREDIT 215 paymentDueDate:"'. $payment['dueDate'] .'" 216 paymentId:"'. $payment['id'] .'" 217 paymentMeansCode:"ZZZ" 218 } 219 } 220 invoiceTaxDetails:[{ 221 id:1 222 taxAmount:'. $data_products['total_tax'] .' 223 taxSchemeId:IVA 224 taxSubtotal:['. $tax_subtotal .'] 225 }] 226 invoiceTotals:{ 227 allowanceTotalAmount:0 228 chargeTotalAmount:0 229 lineExtensionAmount:'. $data_products['total_value'] .' 230 payableAmount:'. ( $data_products['total_tax'] + $data_products['total_value'] ) .' 231 prepaidAmount:0 232 taxExclusiveAmount:'. $data_products['total_value'] .' 233 taxInclusiveAmount:'. ( $data_products['total_tax'] + $data_products['total_value'] ) .' 234 } 235 '. $observations .' 236 }){ 237 invoice{ 238 invoiceUuid 239 invoiceDianLog 240 invoiceDetails 241 } 242 } 243 } 244 '; 245 246 return $graphQL; 139 247 } 140 248 -
wc-yabi/trunk/languages/yabi-wc-es_CO.po
r2630794 r2644114 4 4 "Report-Msgid-Bugs-To: \n" 5 5 "POT-Creation-Date: 2020-12-02 23:02+0000\n" 6 "PO-Revision-Date: 2021-1 1-03 08:58-0500\n"6 "PO-Revision-Date: 2021-12-10 17:04-0500\n" 7 7 "Last-Translator: \n" 8 8 "Language-Team: \n" … … 12 12 "Content-Transfer-Encoding: 8bit\n" 13 13 "Plural-Forms: nplurals=2; plural=n != 1;\n" 14 "X-Generator: Poedit 3.0 \n"14 "X-Generator: Poedit 3.0.1\n" 15 15 "X-Loco-Version: 2.4.6; wp-5.5.3\n" 16 16 … … 348 348 msgid "You must select the type of person" 349 349 msgstr "Debe seleccionar el tipo de persona" 350 351 #: content/settings.php:45 352 msgid "Type of Owner" 353 msgstr "Tipo de dueño" 354 355 #: content/settings.php:48 356 msgid "Company" 357 msgstr "Empresa" 358 359 #: content/settings.php:49 360 msgid "Person" 361 msgstr "Persona natural" -
wc-yabi/trunk/languages/yabi-wc-es_ES.po
r2630794 r2644114 4 4 "Report-Msgid-Bugs-To: \n" 5 5 "POT-Creation-Date: 2020-12-02 23:02+0000\n" 6 "PO-Revision-Date: 2021-1 1-03 08:59-0500\n"6 "PO-Revision-Date: 2021-12-10 17:03-0500\n" 7 7 "Last-Translator: \n" 8 8 "Language-Team: Español\n" … … 12 12 "Content-Transfer-Encoding: 8bit\n" 13 13 "Plural-Forms: nplurals=2; plural=n != 1;\n" 14 "X-Generator: Poedit 3.0 \n"14 "X-Generator: Poedit 3.0.1\n" 15 15 "X-Loco-Version: 2.4.6; wp-5.5.3\n" 16 16 … … 345 345 msgid "You must select the type of person" 346 346 msgstr "Debe seleccionar el tipo de persona" 347 348 #: content/settings.php:45 349 msgid "Type of Owner" 350 msgstr "Tipo de dueño" 351 352 #: content/settings.php:48 353 msgid "Company" 354 msgstr "Empresa" 355 356 #: content/settings.php:49 357 msgid "Person" 358 msgstr "Persona natural" -
wc-yabi/trunk/languages/yabi-wc.pot
r2630794 r2644114 322 322 msgid "You must select the type of person" 323 323 msgstr "" 324 325 #: content/settings.php:45 326 msgid "Type of Owner" 327 msgstr "" 328 329 #: content/settings.php:48 330 msgid "Company" 331 msgstr "" 332 333 #: content/settings.php:49 334 msgid "Person" 335 msgstr "" -
wc-yabi/trunk/readme.txt
r2630794 r2644114 4 4 Donate link: https://www.paypal.me/datakun 5 5 Requires at least: 5.5 6 Tested up to: 5.8. 16 Tested up to: 5.8.2 7 7 Requires PHP: 7.4 8 8 Stable tag: trunk … … 96 96 = 1.5.1 = 97 97 * Fixed decimal problem on discount coupon 98 = 1.6.0 = 99 * In properties you can configure the account as a natural person or as a company, with the respective change the invoices will be generated depending on the type chosen -
wc-yabi/trunk/wc-yabi.php
r2630794 r2644114 9 9 * Plugin URI: https://mireunion.com/yabi 10 10 * Description: Create your electronic invoices of purchases made in woocommerce with Yabi 11 * Version: 1. 5.111 * Version: 1.6.0 12 12 * Author: Mex Avila 13 13 * Author URI: https://datakun.com/ … … 160 160 $yabi_invoice_name = sanitize_text_field( $_POST['yabi_invoice_name'] ); 161 161 $yabi_invoice_number = sanitize_text_field( $_POST['yabi_invoice_number'] ); 162 162 $yabi_owner = sanitize_key( $_POST['yabi_owner'] ); 163 163 $yabi_businessunituuid = sanitize_key( $_POST['yabi_businessunituuid'] ); 164 164 $yabi_token = sanitize_key( $_POST['yabi_token'] ); … … 167 167 update_option( 'yabi_invoice_name', $yabi_invoice_name ); 168 168 update_option( 'yabi_invoice_number', $yabi_invoice_number ); 169 169 update_option( 'yabi_owner', $yabi_owner ); 170 170 update_option( 'yabi_businessunituuid', $yabi_businessunituuid ); 171 171 update_option( 'yabi_token', $yabi_token );
Note: See TracChangeset
for help on using the changeset viewer.