";
$_REQUEST['SCREEN']="noticias";
return(FALSE);
}
/*
** Remove all shipping, fees, etc from invoice
** This should prevent the effects of page reloads.
*/
if(!cleanInvoice($UserInfo['Invoice'], $error))
{
$ActionResults[] = $error;
return(FALSE);
}
if(!clearInvoiceFees($UserInfo['Invoice'], $error))
{
$ActionResults[] = $error;
return(FALSE);
}
/*
** Insert the address into the address table.
*/
$AddressID = insertAddress($inputAddress);
if($AddressID <= 0)
{
$ActionResults[] = localize('An error occurred while processing your invoice.') .
"\n";
$_REQUEST['SCREEN']="order_info";
return(FALSE);
}
$n=0;
$datos = array();
foreach($inputAddress as $c){
$datos[$n] = $c;
$n++;
}
$addUser = createUser($datos[0],$datos[9],$AddressID);
/*
** Create shipping row.
*/
$ship_GiftMessage = isset($_REQUEST['ship_GiftMessage']) ? $_REQUEST['ship_GiftMessage'] : "";
$shipping = createShipping($UserInfo['Invoice'], $AddressID,
$_REQUEST['ship_Method'], $_REQUEST['ship_GiftMessage']);
if ($shipping <= 0)
{
$ActionResults[] = localize('An error occurred while processing your invoice.') .
"\n";
$_REQUEST['SCREEN']="order_info";
return(FALSE);
}
// update all SKUs
if(!setInvoiceSKUShipping($UserInfo['Invoice'], FALSE, $shipping, $gastos_envio, $error))
{
$ActionResults[] = localize('An error occurred while processing your invoice.');
$_REQUEST['SCREEN'] = "order_info";
return(FALSE);
}
/*
** Create fees for this shipping address
*/
//get item total for this shipping address
$SubTotal = getInvoiceSubTotals($UserInfo['Invoice'], FALSE, $error);
/*
** Calculate shipping by total. Probably needs to be passed shipping method,
** too.
*/
$TotalShipping = getShipping($UserInfo['Invoice'], FALSE, $error);
//update the shipping fees
if(!insertInvoiceFee($UserInfo['Invoice'], getFeeID('Shipping'),
$TotalShipping, $error))
{
$ActionResults = $error;
$_REQUEST['SCREEN']="order_info";
return(FALSE);
}
//calculate tax by total
$TotalTax = calculateTax($SubTotal["Taxable"], $TotalShipping,
$shipAddress["CountryCode"], $shipAddress["StateProv"], $error);
// Add tax fee
if(!insertInvoiceFee($UserInfo['Invoice'], getFeeID('Tax'),
$TotalTax, $error))
{
$ActionResults = $error;
$_REQUEST['SCREEN']="order_info";
return(FALSE);
}
$billingAddress = $UserInfo["Address"]["ID"];
if(!createInvoiceBilling($UserInfo['Invoice'], '', $billingAddress, '', '', '', '', $envio, $ship_Method))
{
//$ActionResults[] = localize('An error occured while saving your billing info!');
$_REQUEST['SCREEN'] = "order_billing";
return(FALSE);
}
if(!(hasShipping($UserInfo['Invoice'], $error)))
{
$ActionResults[] .= "Su factura no tiene la información de envio.
";
$SCREEN = "order_info";
return(FALSE);
}
if(!activateInvoice($UserInfo['Invoice'], $error))
{
$ActionResults[] = '1';
return(FALSE);
}
if(!insertInvoiceStatus($UserInfo['Invoice'], getStatusID("Creada"), time(), "", $error))
{
$ActionResults[] = '2';
return(FALSE);
}
$invoice = $UserInfo['Invoice'];
//set session as having no active invoice
if(!detachInvoiceFromSession($sid))
{
$ActionResults[] = '3';
return(FALSE);
}
$invoiceInfo = getInvoiceInfo($UserInfo['Invoice'], $error);
/*
foreach($invoiceInfo as $a){
if($a->idimg != ''){
$idimg = $a->idimg;
}
}
*/
$Portes = addPortes($UserInfo['Invoice'], $_REQUEST['envios']);
$Contenido = "