File "test_wp_order.php"

Full path: /home/dora/public_html/wp-content/plugins/woocommerce-bsalev2/test/test_wp_order.php
File size: 1.47 KB
MIME-type: --
Charset: utf-8

<?php

/* * test de emitir dte dede Wp, sin em itirlo */
require_once dirname(__FILE__) . '/../lib/Autoload.php';

if( !current_user_can(BSALE_CAPABILITY_CONFIG_INTEGRAC) )
{
    echo('user not allowed!!');
    exit;
}

if( !isset($_REQUEST['param']) || $_REQUEST['param'] !== 'yes' )
{
    die("no allowed");
}
if( !isset($_REQUEST['test_dte']) || $_REQUEST['test_dte'] !== 'yes' )
{
    die("no allowed test_dte=yes");
}

error_reporting(E_ALL);
ini_set('display_errors', 1);


$order_id = isset($_GET['oid']) ? $_GET['oid'] : 0;

if( empty($order_id) )
{
    die("falta order id");
}

$order = wc_get_order($order_id);

if( empty($order) )
{
    die("order is null");
}

/* * ***************************************************** */

/*Funciones::print_r_html("cupones de la tienda:");
$args = array(
    'posts_per_page' => -1,
    'orderby' => 'title',
    'order' => 'asc',
    'post_type' => 'shop_coupon',
    'post_status' => 'publish',
);

$coupons = get_posts($args);

$coupon_names = array();
foreach( $coupons as $coupon )
{
    // Get the name for each coupon post
    $coupon_name = $coupon->post_title;
    array_push($coupon_names, $coupon_name);
}
Funciones::print_r_html($coupon_names, "cupones activos:");
*/
/* * **************************************************** */



$wp = new WpBsale();

Funciones::print_r_html("test dte para order = $order_id");
$arr_datos = $wp->crear_dte_bsale($order_id);
Funciones::print_r_html($arr_datos, "est dte para order = $order_id, respuesta");