Plugin Directory

Changeset 2591046


Ignore:
Timestamp:
08/30/2021 07:35:35 PM (5 years ago)
Author:
facturaone
Message:

v1.58

Location:
wp-facturaone/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-facturaone/trunk/FONE_index.php

    r2589148 r2591046  
    2121            $menutab='Avanzado';
    2222        }
    23        
    24         if(isset($_POST['FacturaONE_rate_standard'])){
    25             update_option('FacturaONE_rate_standard',sanitize_text_field($_POST['FacturaONE_rate_standard']));
    26             $mensaje='Cambio realizado correctamente';
    27             $menutab='Avanzado';
    28         }
    29 
    30         if(isset($_POST['FacturaONE_rate_reducedrate'])){
    31             update_option('FacturaONE_rate_reducedrate',sanitize_text_field($_POST['FacturaONE_rate_reducedrate']));
    32             $mensaje='Cambio realizado correctamente';
    33             $menutab='Avanzado';
    34         }
    35        
    36         if(isset($_POST['FacturaONE_rate_tasacero'])){
    37             update_option('FacturaONE_rate_tasacero',sanitize_text_field($_POST['FacturaONE_rate_tasacero']));
    38             $mensaje='Cambio realizado correctamente';
    39             $menutab='Avanzado';
    40         }
     23
     24        //asignar taxrate productos entre F1-WooCoomerce
     25        foreach ($_POST as $key => $value)
     26        {
     27          if (strpos($key, 'FacturaONE_taxrate_') !== false) 
     28          {
     29            $slug = $_POST[$key];
     30            update_option($key, sanitize_text_field($slug));
     31            $mensaje='Cambio realizado correctamente';
     32            $menutab='Impuestos';
     33          }
     34        }       
    4135
    4236        if(isset($_POST['FacturaONE_ivaincluido'])){
    4337            update_option('FacturaONE_ivaincluido',sanitize_text_field($_POST['FacturaONE_ivaincluido']));
    4438            $mensaje='Cambio realizado correctamente';
    45             $menutab='Avanzado';
     39            $menutab='Impuestos';
    4640        }
    4741
     
    10195        }else if ('<?php echo $menutab;?>'=='Ajustes'){
    10296            openCity(0, "Ajustes");
     97        }else if ('<?php echo $menutab;?>'=='Impuestos'){
     98            openCity(0, "Impuestos");
    10399        }else{
    104100            openCity(0, "Importar");
     
    200196          <button class="tablinks" style="width:150px;height:50px;" id="button_Ajustes" onclick="openCity(event, 'Ajustes')">Ajustes</button>
    201197          <button class="tablinks" style="width:150px;height:50px;" id="button_Avanzado" onclick="openCity(event, 'Avanzado')">Avanzado</button>
    202         </div>
    203         <div id="Importar" class="tabcontent" style="height:650px;">
     198          <button class="tablinks" style="width:150px;height:50px;" id="button_Impuestos" onclick="openCity(event, 'Impuestos')">Impuestos</button>
     199        </div>
     200        <div id="Importar" class="tabcontent" style="height:580px;">
    204201            <form method='post'>
    205202                <input type="hidden" name="fact_nonce_action" value="<?php echo wp_create_nonce('fact_nonce_action');?>"/>
     
    223220            </form>
    224221        </div>
    225         <div id="Ajustes" class="tabcontent" style="height:650px;">
     222        <div id="Ajustes" class="tabcontent" style="height:580px;">
    226223            <div style="padding: 25px;">
    227224                <form method='post'>
     
    263260            </div>
    264261        </div>
    265         <div id="Avanzado" class="tabcontent" style="height:650px;">
     262       
     263
     264        <div id="Avanzado" class="tabcontent" style="height:580px;">
    266265            <form method='post'>
    267266                <input type="hidden" name="fact_nonce_action" value="<?php echo wp_create_nonce('fact_nonce_action');?>"/>
     
    278277                        </td>
    279278                    </tr>
    280 
    281                     <?php   //carga taxrates
    282                             $taxrates = array();
    283                             $resultado = FONE_url_get_contents('impuestos');
    284                             $response = json_decode(gzuncompress(base64_decode($resultado)), true);
    285                             foreach ($response as $posicionA=>$jugadorA)
    286                             {
    287                             foreach ($jugadorA as $posicionB=>$jugadorB)
    288                             {
    289                             if ($posicionB=='q1'){
    290                             foreach ($jugadorB as $posicionC=>$jugadorC)
    291                             {
    292                             array_push($taxrates,array('tax_rate_id'=>$jugadorC['tax_rate_id'],'tax_rate_name'=>$jugadorC['tax_rate_name']));
    293                             }
    294                             }
    295                             }
    296                             }
    297                     ?>
    298                     <tr><th>*¹ Iva standard</th>
    299                         <td>
    300                             <select style="width:320px;" onchange="this.form.submit()" name="FacturaONE_rate_standard" id="FacturaONE_rate_standard">
    301                             <?php   echo '<option '.((get_option('FacturaONE_rate_standard')==-1) ? 'selected' : '').' value = "-1">No Usado</option>';
    302                                     foreach($taxrates as $taxrate){
    303                                         echo '<option '.((get_option('FacturaONE_rate_standard')==$taxrate['tax_rate_id']) ? 'selected' : '').' value = "'. $taxrate['tax_rate_id'] .'">'. $taxrate['tax_rate_name'] .'</option>';
    304                                     } ?>
    305                             </select>
    306                         </td>
    307                     </tr>
    308                     <tr><th>*¹ Iva reduced</th>
    309                         <td>
    310                             <select style="width:320px;" onchange="this.form.submit()" name="FacturaONE_rate_reducedrate" id="FacturaONE_rate_reducedrate">
    311                             <?php   echo '<option '.((get_option('FacturaONE_rate_reducedrate')==-1) ? 'selected' : '').' value = "-1">No Usado</option>';
    312                                     foreach($taxrates as $taxrate){
    313                                         echo '<option '.((get_option('FacturaONE_rate_reducedrate')==$taxrate['tax_rate_id']) ? 'selected' : '').' value = "'. $taxrate['tax_rate_id'] .'">'. $taxrate['tax_rate_name'] .'</option>';
    314                                     } ?>
    315                             </select>
    316                         </td>
    317                     </tr>
    318                     <tr><th>*¹ Iva tasa-cero</th>
    319                         <td>
    320                             <select style="width:320px;" onchange="this.form.submit()" name="FacturaONE_rate_tasacero" id="FacturaONE_rate_tasacero">
    321                             <?php   echo '<option '.((get_option('FacturaONE_rate_tasacero')==-1) ? 'selected' : '').' value = "-1">No Usado</option>';
    322                                     foreach($taxrates as $taxrate){
    323                                         echo '<option '.((get_option('FacturaONE_rate_tasacero')==$taxrate['tax_rate_id']) ? 'selected' : '').' value = "'. $taxrate['tax_rate_id'] .'">'. $taxrate['tax_rate_name'] .'</option>';
    324                                     } ?>
    325                             </select>
    326                         </td>
    327                     </tr>
    328                     <tr><th>*¹ Importar precio de articulos con impuestos incluidos</th>
    329                         <td>
    330                             <select style="width:320px;" onchange="this.form.submit()" name="FacturaONE_ivaincluido" id="FacturaONE_ivaincluido">
    331                                 <option <?php if(get_option('FacturaONE_ivaincluido')==1){echo 'selected';} ?> value="1">Sí, voy a introducir los precios con impuestos incluidos</option>
    332                                 <option <?php if(get_option('FacturaONE_ivaincluido')==0){echo 'selected';} ?> value="0">No, introduciré los precios sin impuestos.</option>
    333                             </select>
    334                         </td>
    335                     </tr>
    336279                    <tr><th>*¹ Oculta Productos Sin Imagen</th>
    337280                        <td>
     
    342285                        </td>
    343286                    </tr>               
    344                     <tr><th></th>
    345                         <td>
     287                    <tr>
     288                        <td colspan="2">
    346289                            <p>*¹ Para aplicar estas opciones, debe volver a <a href="#" onClick="execbackground('update_productos.php','start')">Importar Productos</a>
    347290                            </p>
     
    370313            </form>
    371314        </div>
     315   
     316        <div id="Impuestos" class="tabcontent" style="height:580px;">
     317            <form method='post'>
     318                <input type="hidden" name="fact_nonce_action" value="<?php echo wp_create_nonce('fact_nonce_action');?>"/>
     319                <table class="form-table">
     320                    <tr><th>*¹ Importar precio de articulos con impuestos incluidos</th>
     321                        <td>
     322                            <select style="width:320px;" onchange="this.form.submit()" name="FacturaONE_ivaincluido" id="FacturaONE_ivaincluido">
     323                                <option <?php if(get_option('FacturaONE_ivaincluido')==1){echo 'selected';} ?> value="1">Sí, voy a introducir los precios con impuestos incluidos</option>
     324                                <option <?php if(get_option('FacturaONE_ivaincluido')==0){echo 'selected';} ?> value="0">No, introduciré los precios sin impuestos.</option>
     325                            </select>
     326                        </td>
     327                    </tr>
     328                    <tr>
     329                        <td colspan="2">
     330                            Vinculo de Impuestos entre el ERP y WooCommerce
     331                        </td>
     332                    </tr>
     333                    <?php
     334                    //carga taxrates
     335                    $taxrates = array();
     336                    $resultado = FONE_url_get_contents('impuestos');
     337                    $response = json_decode(gzuncompress(base64_decode($resultado)), true);
     338                    foreach ($response as $posicionA=>$jugadorA)
     339                    {
     340                        foreach ($jugadorA as $posicionB=>$jugadorB)
     341                        {
     342                            if ($posicionB=='q1'){
     343                            foreach ($jugadorB as $posicionC=>$jugadorC)
     344                            {
     345                            array_push($taxrates,array('tax_rate_id'=>$jugadorC['tax_rate_id'],'tax_rate_name'=>$jugadorC['tax_rate_name']));
     346                            }
     347                            }
     348                        }
     349                    }
     350                    //carga tax_classe_names
     351                    $tax_classe_names = array('standard');
     352                    $tax_classes = WC_Tax::get_tax_rate_classes();
     353                    foreach ($tax_classes as $tax_classe){
     354                        array_push($tax_classe_names,$tax_classe->slug);
     355                    }
     356                    foreach($taxrates as $taxrate){
     357                    ?>
     358                        <tr><th>*¹ Impuesto <?php echo $taxrate['tax_rate_name'];?></th>
     359                            <td>
     360                                <select style="width:320px;" onchange="this.form.submit()" name="FacturaONE_taxrate_<?php echo $taxrate['tax_rate_id'];?>" id="FacturaONE_taxrate_<?php echo $taxrate['tax_rate_id'];?>">
     361                                <?php   echo '<option '.((get_option('FacturaONE_taxrate_'.$taxrate['tax_rate_id'])==-1) ? 'selected' : '').' value = "-1">No Usado</option>';
     362                                        foreach($tax_classe_names as $tax_classe_name){
     363                                            echo '<option '.((get_option('FacturaONE_taxrate_'.$taxrate['tax_rate_id'])==$tax_classe_name) ? 'selected' : '').' value = "'. $tax_classe_name .'">Tarifa '. $tax_classe_name .' WooCommerce</option>';
     364                                        } ?>
     365                                </select>
     366                            </td>
     367                        </tr>
     368                    <?php
     369                    }
     370                    ?>
     371                    <tr>
     372                        <td colspan="2">
     373                            <p>*¹ Para aplicar estas opciones, debe volver a <a href="#" onClick="execbackground('update_productos.php','start')">Importar Productos</a>
     374                            </p>
     375                        </td>
     376                    </tr>                   
     377                </table>
     378            </form>
     379        </div>
     380       
    372381        <div style="display:none;margin-top:-20px;margin-left:10px;" id="version_num">
    373382            <?php if (get_option('FacturaONE_version')){echo 'v'.get_option('FacturaONE_version');}?>
  • wp-facturaone/trunk/wp-facturaone.php

    r2589148 r2591046  
    44Plugin URI:
    55Description: La forma más fácil de trabajar con tu tienda online desde nuestro ERP FACTURAONE
    6 Version: 1.57
     6Version: 1.58
    77Author: FacturaOne
    88Author URI: https://www.FacturaOne.com
     
    246246
    247247        //$objProduct->set_tax_status(  isset($args['tax_status']) ? $args['tax_status'] : 'taxable' );
    248         if ($tax_rate_id==get_option('FacturaONE_rate_standard')){
    249             $objProduct->set_tax_class('standard');
    250         }else if ($tax_rate_id==get_option('FacturaONE_rate_reducedrate')){
    251             $objProduct->set_tax_class('reduced-rate');
    252         }else if ($tax_rate_id==get_option('FacturaONE_rate_tasacero')){
    253             $objProduct->set_tax_class('tasa-cero');
     248        $tax_class = get_option('FacturaONE_taxrate_'.$tax_rate_id);
     249        if ($tax_class!='' && $tax_class!=-1){
     250            $objProduct->set_tax_class($tax_class);
    254251        }else{
    255252            $objProduct->set_tax_class('tasa-cero');
    256253        }
    257        
     254//      if ($tax_rate_id==get_option('FacturaONE_rate_standard')){
     255//          $objProduct->set_tax_class('standard');
     256//      }else if ($tax_rate_id==get_option('FacturaONE_rate_reducedrate')){
     257//          $objProduct->set_tax_class('reduced-rate');
     258//      }else if ($tax_rate_id==get_option('FacturaONE_rate_tasacero')){
     259//          $objProduct->set_tax_class('tasa-cero');
     260//      }else{
     261//          $objProduct->set_tax_class('tasa-cero');
     262//      }
     263
    258264        //familia
    259265        $t_id = get_option("familia_id_$familia_id");
     
    342348           
    343349            //$objProduct->set_tax_status(  isset($args['tax_status']) ? $args['tax_status'] : 'taxable' );
    344             if ($tax_rate_id==get_option('FacturaONE_rate_standard')){
    345                 $objProduct->set_tax_class('standard');
    346             }else if ($tax_rate_id==get_option('FacturaONE_rate_reducedrate')){
    347                 $objProduct->set_tax_class('reduced-rate');
    348             }else if ($tax_rate_id==get_option('FacturaONE_rate_tasacero')){
    349                 $objProduct->set_tax_class('tasa-cero');
     350            $tax_class = get_option('FacturaONE_taxrate_'.$tax_rate_id);
     351            if ($tax_class!='' && $tax_class!=-1){
     352                $objProduct->set_tax_class($tax_class);
    350353            }else{
    351354                $objProduct->set_tax_class('tasa-cero');
    352355            }
     356//          if ($tax_rate_id==get_option('FacturaONE_rate_standard')){
     357//              $objProduct->set_tax_class('standard');
     358//          }else if ($tax_rate_id==get_option('FacturaONE_rate_reducedrate')){
     359//              $objProduct->set_tax_class('reduced-rate');
     360//          }else if ($tax_rate_id==get_option('FacturaONE_rate_tasacero')){
     361//              $objProduct->set_tax_class('tasa-cero');
     362//          }else{
     363//              $objProduct->set_tax_class('tasa-cero');
     364//          }
    353365   
    354366            //familia
     
    377389    }
    378390}
     391
     392
     393
     394//function FONE_get_rate_class_name($FONETarifa){
     395//  global $wpdb;
     396//  $product_ids = $wpdb->get_row("select * from $wpdb->options where option_name like '%FacturaONE_rateclassid%'" );
     397//      print_r($product_ids);
     398//}
     399//echo FONE_get_rate_class_name(1);die;
     400
    379401
    380402
Note: See TracChangeset for help on using the changeset viewer.