This commit is contained in:
David Bensel
2020-12-14 22:40:47 +03:00
parent 8320546641
commit bc9f7c83f4
3660 changed files with 183847 additions and 274871 deletions

View File

@@ -40,9 +40,9 @@ class modApi extends DolibarrModules
*/
public function __construct($db)
{
global $langs, $conf;
global $langs, $conf;
$this->db = $db;
$this->db = $db;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
@@ -81,7 +81,7 @@ class modApi extends DolibarrModules
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->requiredby = array('modZapier'); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
$this->phpmin = array(5, 4); // Minimum version of PHP required by module
$this->langfiles = array("other");
@@ -95,8 +95,8 @@ class modApi extends DolibarrModules
// Array to add new pages in new tabs
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@api:$user->rights->api->read:/api/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@api:$user->rights->othermodule->read:/api/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
// 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
// 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@api:$user->rights->othermodule->read:/api/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
// 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
// where objecttype can be
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
// 'contact' to add a tab in contact view
@@ -117,19 +117,19 @@ class modApi extends DolibarrModules
// 'stock' to add a tab in stock view
// 'thirdparty' to add a tab in third party view
// 'user' to add a tab in user view
$this->tabs = array();
$this->tabs = array();
// Dictionaries
if (!isset($conf->api->enabled))
{
$conf->api = new stdClass();
$conf->api->enabled = 0;
}
// Dictionaries
if (!isset($conf->api->enabled))
{
$conf->api = new stdClass();
$conf->api->enabled = 0;
}
$this->dictionaries = array();
// Boxes
// Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
$this->boxes = array(); // List of boxes
$this->boxes = array(); // List of boxes
// Example:
//$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>'')););
@@ -190,7 +190,7 @@ class modApi extends DolibarrModules
// Example:
// $this->export_code[$r]=$this->rights_class.'_'.$r;
// $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
// $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled.
// $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled.
// $this->export_permission[$r]=array(array("facture","facture","export"));
// $this->export_fields_array[$r]=array(
// 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
@@ -222,17 +222,17 @@ class modApi extends DolibarrModules
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')
{
$sql = array();
public function init($options = '')
{
$sql = array();
$result = $this->_load_tables('/api/sql/');
$result = $this->_load_tables('/api/sql/');
return $this->_init($sql, $options);
}
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.