Objetos de negociado: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
{{TemplateDocDesarrollo}}
{{TemplateDocDesarrollo}}
= Business objects =
= Objetos de negociado =
All business objects are defined by a PHP class that herits of class CommonObject (defined in file commonobject.class.php).
Todos los objetos de negociado se definen mediante clases PHP que hereda de la clase CommonObject (definida en el archivo commonobject.class.php).
Every business object has the 4 CRUD methods:
Todos los objetos de negociado tienen los 4 métodos CRUD:
* Create: create()
* Creación: create()
* Read: fetch()
* Lectura: fetch()
* Update: update()
* Actualización: update()
* Delete: delete()
* Borrado: delete()


= Linked business objects =
= Objetos de negociado vinculados =
Some business objects are linked to other. This is done into Dolibarr using the [[Table llx_element_element]]. But you don't have to read this table to get objects linked to another.
Algunos objetos de negociado se encuentran vinculados con otros. En Dolibarr esto se hace usando la [[Table llx_element_element]]. Pero no tiene que leer esta tabla para obtener objetos vinculados a otro.
This is a portion of code that show you how ou can do this:
Este es un trozo de código que le muestra como hacerlo:
<source lang="php">
<source lang="php">
// This load the array linked_object with objects that link to this one
// Cargamos el array linked_object con objetos que se vinculan con uno
$object->load_object_linked($object->id, $object->element);
// To load array linked_object with objects that are linked by this one
$object->load_object_linked($object->id, $object->element);
$object->load_object_linked($object->id, $object->element);


// Then choose id with objects type you need
// Elegimos id con los objetos del tipo que necesitamos
$org_order_array = $object->linked_object["commande"];
$org_order_array = $object->linked_object["commande"];


// Now use them
// Lo usamos
$thelinkedobjectid = $org_order_array[0];
$thelinkedobjectid = $org_order_array[0];
// new order instance
// creamos una instancia de pedido
$thelinkedobject = new Commande($object->db);
$thelinkedobject = new Commande($object->db);
// load the object
// Cargamos el objeto
$thelinkedobject->fetch($thelinkedobjectid);
$thelinkedobject->fetch($thelinkedobjectid);
</source>
</source>
Line 32: Line 30:
He aquí un ejemplo para la creación de un tercero (empresa cliente, por ejemplo):
He aquí un ejemplo para la creación de un tercero (empresa cliente, por ejemplo):


Si se encuentra en el caso de un script externo a Dolibarr, es necesario realizar un inicio, antes de cualquier cosa
Si se encuentra en el caso de un script externo a Dolibarr, antes de nada es necesario realizar un inicio.


<source lang="php">
<source lang="php">

Navigation menu