Skip to content
Snippets Groups Projects
Commit f4fe3de1 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Qual: Update skeleton of script

parent 4db66682
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/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---
*
* This program is free software; you can redistribute it and/or modify
......@@ -19,7 +19,7 @@
/**
* \file dev/skeletons/skeleton_script.php
* \ingroup mymodule othermodule1 othermodule2
* \ingroup mymodule
* \brief This file is an example for a command line script
* Put here some comments
*/
......@@ -34,19 +34,22 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit;
}
// Global variables
$version='1.29';
// Init global variables
$version='1.0';
$error=0;
// -------------------- 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");
// 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->load("main"); // To load language file for default language
@set_time_limit(0); // No timeout for this script
// Load user and its permissions
$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
......@@ -158,7 +161,7 @@ else
$db->rollback();
}
$db->close(); // Close database opened handler
$db->close(); // Close $db database opened handler
return $error;
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment