forked from Wavyzz/dolibarr
Qual: Update skeleton of script
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/php
|
#!/usr/bin/php
|
||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) ---Put here your own copyright and developer email---
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file dev/skeletons/skeleton_script.php
|
* \file dev/skeletons/skeleton_script.php
|
||||||
* \ingroup mymodule othermodule1 othermodule2
|
* \ingroup mymodule
|
||||||
* \brief This file is an example for a command line script
|
* \brief This file is an example for a command line script
|
||||||
* Put here some comments
|
* Put here some comments
|
||||||
*/
|
*/
|
||||||
@@ -34,19 +34,22 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global variables
|
// Init global variables
|
||||||
$version='1.29';
|
$version='1.0';
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
// -------------------- START OF YOUR CODE HERE --------------------
|
// -------------------- START OF YOUR CODE HERE --------------------
|
||||||
// Include Dolibarr environment
|
@set_time_limit(0); // No timeout for this script
|
||||||
|
define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only".
|
||||||
|
|
||||||
|
// Include and load Dolibarr environment variables
|
||||||
require_once($path."../../htdocs/master.inc.php");
|
require_once($path."../../htdocs/master.inc.php");
|
||||||
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
|
// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file).
|
||||||
|
// $user is created but empty.
|
||||||
|
|
||||||
//$langs->setDefaultLang('en_US'); // To change default language of $langs
|
//$langs->setDefaultLang('en_US'); // To change default language of $langs
|
||||||
$langs->load("main"); // To load language file for default language
|
$langs->load("main"); // To load language file for default language
|
||||||
@set_time_limit(0); // No timeout for this script
|
|
||||||
|
|
||||||
// Load user and its permissions
|
// Load user and its permissions
|
||||||
$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||||
@@ -158,7 +161,7 @@ else
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close(); // Close database opened handler
|
$db->close(); // Close $db database opened handler
|
||||||
|
|
||||||
return $error;
|
return $error;
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user