Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated compat of PHP modules #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions core/modules/modListInCSV.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function __construct($db)
// 'js' => array('/listincsv/js/listincsv.js'), // Set this to relative path of js file if module must load a js on all pages
// 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
// 'dir' => array('output' => 'othermodulename'), // To force the default directories names
// 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@listincsv')) // Set here all workflow context managed by module
// 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'isModEnabled('module1') && isModEnabled('module2')', 'picto'=>'yourpicto@listincsv')) // Set here all workflow context managed by module
// );
$this->module_parts = array(
'hooks'=>array(
Expand Down Expand Up @@ -124,8 +124,8 @@ function __construct($db)
$this->const = array();

// Array to add new pages in new tabs
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@listincsv:$user->rights->listincsv->read:/listincsv/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:Title2:mylangfile@listincsv:$user->rights->othermodule->read:/listincsv/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@listincsv:$user->hasRight('listincsv', 'read'):/listincsv/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:Title2:mylangfile@listincsv:$user->hasRight('othermodule', 'read'):/listincsv/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
// '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)
Expand All @@ -150,14 +150,14 @@ function __construct($db)
$this->tabs = array();

// Dictionaries
if (! isset($conf->listincsv->enabled))
if (! isModEnabled('listincsv'))
{
$conf->listincsv=new stdClass();
$conf->listincsv->enabled=0;
}
$this->dictionaries=array();
/* Example:
if (! isset($conf->listincsv->enabled)) $conf->listincsv->enabled=0; // This is to avoid warnings
if (! isModEnabled('listincsv')) $conf->listincsv->enabled=0; // This is to avoid warnings
$this->dictionaries=array(
'langs'=>'mylangfile@listincsv',
'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor
Expand All @@ -168,7 +168,7 @@ function __construct($db)
'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record)
'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert)
'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid')
'tabcond'=>array($conf->listincsv->enabled,$conf->listincsv->enabled,$conf->listincsv->enabled) // Condition to show each dictionary
'tabcond'=>array(isModEnabled('listincsv'),isModEnabled('listincsv'),isModEnabled('listincsv')) // Condition to show each dictionary
);
*/

Expand All @@ -187,13 +187,13 @@ function __construct($db)
// $this->rights[$r][0] = $this->numero . $r; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->hasRight('permkey', 'level1', 'level2'))
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->hasRight('permkey', 'level1', 'level2'))
// $r++;
$this->rights[$r][0] = $this->numero . $r; // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('LISTINCSVExport'); // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'export'; // In php code, permission will be checked by test if ($user->rights->permkey->level1)
$this->rights[$r][4] = 'export'; // In php code, permission will be checked by test if ($user->hasRight('permkey', 'level1'))
$r++;


Expand All @@ -212,8 +212,8 @@ function __construct($db)
// 'url'=>'/listincsv/pagetop.php',
// 'langs'=>'mylangfile@listincsv', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'enabled'=>'$conf->listincsv->enabled', // Define condition to show or hide menu entry. Use '$conf->listincsv->enabled' if entry must be visible if module is enabled.
// 'perms'=>'1', // Use 'perms'=>'$user->rights->listincsv->level1->level2' if you want your menu with a permission rules
// 'enabled'=>'isModEnabled('listincsv')', // Define condition to show or hide menu entry. Use 'isModEnabled('listincsv')' if entry must be visible if module is enabled.
// 'perms'=>'1', // Use 'perms'=>'$user->hasRight('listincsv', 'level1', 'level2')' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
Expand All @@ -227,8 +227,8 @@ function __construct($db)
// 'url'=>'/listincsv/pagelevel2.php',
// 'langs'=>'mylangfile@listincsv', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'enabled'=>'$conf->listincsv->enabled', // Define condition to show or hide menu entry. Use '$conf->listincsv->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
// 'perms'=>'1', // Use 'perms'=>'$user->rights->listincsv->level1->level2' if you want your menu with a permission rules
// 'enabled'=>'isModEnabled('listincsv')', // Define condition to show or hide menu entry. Use 'isModEnabled('listincsv')' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
// 'perms'=>'1', // Use 'perms'=>'$user->hasRight('listincsv', 'level1', 'level2')' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
Expand Down