FacturaScripts

ApiCreateDocument extends ApiController
in package
uses ApiBusinessDocumentTrait

Crea un documento de negocio (factura, albarán, pedido o presupuesto) en una sola llamada: alta de documento y líneas, recalculando totales y manteniendo el stock consistente.

Table of Contents

Constants

API_VERSION  : mixed = 3
INCIDENT_EXPIRATION_TIME  : mixed = 600
IP_LIST  : mixed = 'api-ip-list'
MAX_INCIDENT_COUNT  : mixed = 5

Properties

$apiKey  : ApiKey
$purchases_model  : string
$request  : Request
$response  : Response
$sales_model  : string
$url  : string

Methods

__construct()  : mixed
getPageData()  : array<string|int, mixed>
run()  : void
applyLineFields()  : void
Asigna a la línea los campos recibidos en el array de datos.
createPurchase()  : void
createSale()  : void
db()  : DataBase
getUriParam()  : string
loadModel()  : void
processInvoicePaid()  : void
runResource()  : void
saveLines()  : bool
toBool()  : bool
Convierte un valor a booleano.

Constants

INCIDENT_EXPIRATION_TIME

public mixed INCIDENT_EXPIRATION_TIME = 600

Properties

Methods

__construct()

public __construct(string $className[, string $url = '' ]) : mixed
Parameters
$className : string
$url : string = ''

getPageData()

public getPageData() : array<string|int, mixed>
Return values
array<string|int, mixed>

applyLineFields()

Asigna a la línea los campos recibidos en el array de datos.

protected applyLineFields(BusinessDocumentLine &$line, array<string|int, mixed> $data, bool $isNew) : void

Si un campo no viene en los datos se conserva el valor actual de la línea, salvo la cantidad, que en una línea nueva ($isNew) toma 1 por defecto.

Parameters
$line : BusinessDocumentLine
$data : array<string|int, mixed>
$isNew : bool

getUriParam()

protected getUriParam(string $num) : string
Parameters
$num : string
Return values
string

toBool()

Convierte un valor a booleano.

protected toBool(mixed $value) : bool

Acepta: true, false, 1, 0, "1", "0", "true", "false"

Parameters
$value : mixed
Return values
bool
On this page

Search results