31,029
edits
mNo edit summary |
|||
| Line 26: | Line 26: | ||
Here is an example for the creation of a third party (eg customer company): | Here is an example for the creation of a third party (eg customer company): | ||
< | <source lang="php"> | ||
// We declare the class we want to use | // We declare the class we want to use | ||
include_once('/pathofdolibarrhtdocs/societe.class.php'); | include_once('/pathofdolibarrhtdocs/societe.class.php'); | ||
| Line 50: | Line 50: | ||
// To update object | // To update object | ||
$mycompany->update($user); | $mycompany->update($user); | ||
</ | </source> | ||
Note: If we are inside an external script, you must add at the beginning of script, before the include of class we want to use: | Note: If we are inside an external script, you must add at the beginning of script, before the include of class we want to use: | ||
< | <source lang="php"> | ||
include('/pathofdolibarrhtdocs/master.inc.php'); | |||
</pre> | |||
This will create objects $db, $lang and $user. | This will create objects $db, $lang and $user. | ||
If we want that actions (create, update), are tagged with a particular user as the create/update user, | If we want that actions (create, update), are tagged with a particular user as the create/update user, you must do after the include of master.inc.php and before callong the create or update methode | ||
<source lang="php"> | |||
$user->fetch('loginuser'); | |||
</source> | |||