dolibarr 20.0.2
|
Class DolibarrModules. More...
Public Member Functions | |
__construct ($db) | |
Constructor. | |
getName () | |
Gives the translated module name if translation exists in admin.lang or into language files of module. | |
getDesc () | |
Gives the translated module description if translation exists in admin.lang or the default module description. | |
getDescLong () | |
Gives the long description of a module. | |
getDescLongReadmeFound () | |
Return path of file if a README file was found. | |
getChangeLog () | |
Gives the changelog. | |
getPublisher () | |
Gives the publisher name. | |
getPublisherUrl () | |
Gives the publisher url. | |
getVersion ($translated=1) | |
Gives module version (translated if param $translated is on) For 'experimental' modules, gives 'experimental' translation For 'dolibarr' modules, gives Dolibarr version. | |
getModulePosition () | |
Gives the module position. | |
isCoreOrExternalModule () | |
Tells if module is core or external. | |
getLangFilesArray () | |
Gives module related language files list. | |
getExportDatasetLabel ($r) | |
Gives translated label of an export dataset. | |
getImportDatasetLabel ($r) | |
Gives translated label of an import dataset. | |
getLastActivationDate () | |
Gives the last date of activation. | |
getLastActivationInfo () | |
Gives the last author of activation. | |
insert_boxes ($option='') | |
Adds boxes. | |
delete_boxes () | |
Removes boxes. | |
insert_cronjobs () | |
Adds cronjobs. | |
delete_cronjobs () | |
Removes boxes. | |
delete_tabs () | |
Removes tabs. | |
insert_tabs () | |
Adds tabs. | |
insert_const () | |
Adds constants. | |
delete_const () | |
Removes constants tagged 'deleteonunactive'. | |
insert_permissions ($reinitadminperms=0, $force_entity=null, $notrigger=0) | |
Adds access rights. | |
delete_permissions () | |
Removes access rights. | |
insert_menus () | |
Adds menu entries. | |
delete_menus () | |
Removes menu entries. | |
create_dirs () | |
Creates directories. | |
insert_dirs ($name, $dir) | |
Adds directories definitions. | |
delete_dirs () | |
Removes directories. | |
insert_module_parts () | |
Save configuration for generic features. | |
delete_module_parts () | |
Removes generic parts. | |
init ($options='') | |
Function called when module is enabled. | |
remove ($options='') | |
Function called when module is disabled. | |
getKanbanView ($codeenabledisable='', $codetoconfig='') | |
Return Kanban view of a module. | |
checkForUpdate () | |
Check for module update TODO : store results for $this->url_last_version and $this->needUpdate Add a cron task to monitor for updates. | |
checkForCompliance () | |
Check for module compliance with Dolibarr rules and law If a module is reported by this function,it is surely a malware. | |
Public Attributes | |
$lastVersion = '' | |
Module last version. | |
$needUpdate = false | |
true indicate this module need update | |
Protected Member Functions | |
_init ($array_sql, $options='') | |
Enables a module. | |
_remove ($array_sql, $options='') | |
Disable function. | |
_active () | |
Insert constants for module activation. | |
_unactive () | |
Module deactivation. | |
_load_tables ($reldir, $onlywithsuffix='') | |
Create tables and keys required by module: | |
declareNewDictionary ($dictionaryArray, $langs='') | |
Helper method to declare dictionaries one at a time (rather than declaring dictionaries property by property). | |
Class DolibarrModules.
Parent class for module descriptor class files
Definition at line 38 of file DolibarrModules.class.php.
DolibarrModules::__construct | ( | $db | ) |
Constructor.
Define names, constants, directories, boxes, permissions
Reimplemented in modAccounting, modAdherent, modAgenda, modAi, modApi, modAsset, modBanque, modBarcode, modBlockedLog, modBom, modBookCal, modBookmark, modCategorie, modClickToDial, modCollab, modCommande, modComptabilite, modContrat, modCron, modDataPolicy, modDav, modDebugBar, modDeplacement, modDocumentGeneration, modDon, modDynamicPrices, modECM, modEmailCollector, modEventOrganization, modExpedition, modExpenseReport, modExport, modExternalRss, modExternalSite, modFacture, modFckeditor, modFicheinter, modFournisseur, modFTP, modGeoIPMaxmind, modGravatar, modHoliday, modHRM, modImport, modIncoterm, modIntracommreport, modKnowledgeManagement, modLabel, modLdap, modLoan, modMailing, modMailmanSpip, modMargin, modModuleBuilder, modMrp, modMultiCurrency, modMyModule, modNotification, modOauth, modOpenSurvey, modPartnership, modPaybox, modPaymentByBankTransfer, modPaypal, modPrelevement, modPrinting, modProduct, modProductBatch, modProjet, modPropale, modReceiptPrinter, modReception, modRecruitment, modResource, modSalaries, modService, modSocialNetworks, modSociete, modStock, modStockTransfer, modStripe, modSupplierProposal, modSyslog, modTakePos, modTax, modTicket, modUser, modVariants, modWebhook, modWebPortal, modWebServices, modWebServicesClient, modWebsite, modWorkflow, modWorkstation, and modZapier.
Definition at line 417 of file DolibarrModules.class.php.
|
protected |
Insert constants for module activation.
Definition at line 1068 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _init().
|
protected |
Enables a module.
Inserts all information into database.
array | $array_sql | SQL requests to be executed when enabling module |
string | $options | String with options when disabling module:
|
Definition at line 438 of file DolibarrModules.class.php.
References _active(), create_dirs(), dol_syslog(), insert_boxes(), insert_const(), insert_cronjobs(), insert_menus(), insert_module_parts(), insert_permissions(), and insert_tabs().
Referenced by init(), modAdherent\init(), modAgenda\init(), modAi\init(), modApi\init(), modAsset\init(), modBanque\init(), modBarcode\init(), modBlockedLog\init(), modBom\init(), modBookCal\init(), modCategorie\init(), modCommande\init(), modComptabilite\init(), modContrat\init(), modDataPolicy\init(), modDav\init(), modDebugBar\init(), modDeplacement\init(), modDocumentGeneration\init(), modDon\init(), modDynamicPrices\init(), modEmailCollector\init(), modEventOrganization\init(), modExpedition\init(), modExpenseReport\init(), modExternalRss\init(), modFacture\init(), modFicheinter\init(), modFournisseur\init(), modHoliday\init(), modHRM\init(), modIntracommreport\init(), modKnowledgeManagement\init(), modLabel\init(), modLoan\init(), modMailing\init(), modMrp\init(), modMultiCurrency\init(), modMyModule\init(), modNotification\init(), modOauth\init(), modOpenSurvey\init(), modPartnership\init(), modPaymentByBankTransfer\init(), modPrelevement\init(), modProduct\init(), modProductBatch\init(), modProjet\init(), modPropale\init(), modReceiptPrinter\init(), modReception\init(), modRecruitment\init(), modResource\init(), modSalaries\init(), modService\init(), modSociete\init(), modStock\init(), modStockTransfer\init(), modSupplierProposal\init(), modTakePos\init(), modTax\init(), modTicket\init(), modUser\init(), modWebhook\init(), modWebPortal\init(), modWebsite\init(), modWorkflow\init(), modWorkstation\init(), and modZapier\init().
|
protected |
Create tables and keys required by module:
string | $reldir | Relative directory where to scan files. Example: '/install/mysql/' or '/module/sql/' |
string | $onlywithsuffix | Only with the defined suffix |
Definition at line 1155 of file DolibarrModules.class.php.
References dol_syslog(), getDolGlobalString(), and run_sql().
Referenced by modAsset\init(), modBom\init(), modBookCal\init(), modDeplacement\init(), modDon\init(), modDynamicPrices\init(), modExpenseReport\init(), modHRM\init(), modIntracommreport\init(), modKnowledgeManagement\init(), modLoan\init(), modMailing\init(), modMrp\init(), modMyModule\init(), modOpenSurvey\init(), modPartnership\init(), modReceiptPrinter\init(), modRecruitment\init(), modStock\init(), modStockTransfer\init(), modTakePos\init(), modTicket\init(), modWebhook\init(), modWebsite\init(), modWorkstation\init(), and modZapier\init().
|
protected |
Disable function.
Deletes the module constants and boxes from the database.
string[] | $array_sql | SQL requests to be executed when module is disabled |
string | $options | Options when disabling module: |
Definition at line 548 of file DolibarrModules.class.php.
References _unactive(), delete_boxes(), delete_const(), delete_cronjobs(), delete_dirs(), delete_menus(), delete_module_parts(), delete_permissions(), delete_tabs(), and dol_syslog().
Referenced by remove(), modAi\remove(), modApi\remove(), modBlockedLog\remove(), modBom\remove(), modBookCal\remove(), modDataPolicy\remove(), modDav\remove(), modEmailCollector\remove(), modEventOrganization\remove(), modExternalRss\remove(), modKnowledgeManagement\remove(), modMrp\remove(), modMultiCurrency\remove(), modMyModule\remove(), modPartnership\remove(), modRecruitment\remove(), modStockTransfer\remove(), modSupplierProposal\remove(), modTakePos\remove(), modWebhook\remove(), modWebPortal\remove(), modWorkstation\remove(), and modZapier\remove().
|
protected |
Module deactivation.
Definition at line 1118 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _remove().
DolibarrModules::checkForCompliance | ( | ) |
Check for module compliance with Dolibarr rules and law If a module is reported by this function,it is surely a malware.
Delete it as soon as possible.
Definition at line 2643 of file DolibarrModules.class.php.
DolibarrModules::checkForUpdate | ( | ) |
Check for module update TODO : store results for $this->url_last_version and $this->needUpdate Add a cron task to monitor for updates.
Definition at line 2615 of file DolibarrModules.class.php.
DolibarrModules::create_dirs | ( | ) |
Creates directories.
Definition at line 2206 of file DolibarrModules.class.php.
References dol_mkdir(), dol_syslog(), getDolGlobalString(), and insert_dirs().
Referenced by _init().
|
protected |
Helper method to declare dictionaries one at a time (rather than declaring dictionaries property by property).
array | $dictionaryArray | Array describing one dictionary. Keys are: 'name', table name (without prefix) 'lib', dictionary label 'sql', query for select 'sqlsort', sort order 'field', comma-separated list of fields to select 'fieldvalue', list of columns used for editing existing rows 'fieldinsert', list of columns used for inserting new rows 'rowid', name of the technical ID (primary key) column, usually 'rowid' 'cond', condition for the dictionary to be shown / active 'help', optional array of translation keys by column for tooltips 'fieldcheck' (appears to be unused) |
string | $langs | Optional translation file to include (appears to be unused) |
Definition at line 2711 of file DolibarrModules.class.php.
Referenced by modTicket\__construct().
DolibarrModules::delete_boxes | ( | ) |
Removes boxes.
Definition at line 1434 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _remove().
DolibarrModules::delete_const | ( | ) |
Removes constants tagged 'deleteonunactive'.
Definition at line 1835 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _remove().
DolibarrModules::delete_cronjobs | ( | ) |
Removes boxes.
Definition at line 1642 of file DolibarrModules.class.php.
References dol_syslog(), and name.
Referenced by _remove().
DolibarrModules::delete_dirs | ( | ) |
Removes directories.
Definition at line 2314 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _remove().
DolibarrModules::delete_menus | ( | ) |
Removes menu entries.
Definition at line 2175 of file DolibarrModules.class.php.
References dol_syslog(), and name.
Referenced by _remove().
DolibarrModules::delete_module_parts | ( | ) |
Removes generic parts.
Definition at line 2454 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _remove().
DolibarrModules::delete_permissions | ( | ) |
Removes access rights.
Definition at line 2041 of file DolibarrModules.class.php.
References dol_syslog(), and name.
Referenced by _remove().
DolibarrModules::delete_tabs | ( | ) |
Removes tabs.
Definition at line 1673 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _remove().
DolibarrModules::getChangeLog | ( | ) |
Gives the changelog.
First check ChangeLog-la_LA.md then ChangeLog.md
Definition at line 800 of file DolibarrModules.class.php.
References dol_buildpath(), dol_is_file(), dolMd2Html(), and name.
DolibarrModules::getDesc | ( | ) |
Gives the translated module description if translation exists in admin.lang or the default module description.
Definition at line 677 of file DolibarrModules.class.php.
References description, and name.
Referenced by getKanbanView().
DolibarrModules::getDescLong | ( | ) |
Gives the long description of a module.
First check README-la_LA.md then README.md If no markdown files found, it returns translated value of the key ->descriptionlong.
Definition at line 711 of file DolibarrModules.class.php.
References dol_buildpath(), dolMd2Html(), getDescLongReadmeFound(), and name.
DolibarrModules::getDescLongReadmeFound | ( | ) |
Return path of file if a README file was found.
Definition at line 765 of file DolibarrModules.class.php.
References dol_buildpath(), dol_is_file(), and name.
Referenced by getDescLong().
DolibarrModules::getExportDatasetLabel | ( | $r | ) |
Gives translated label of an export dataset.
int | $r | Dataset index |
Definition at line 955 of file DolibarrModules.class.php.
DolibarrModules::getImportDatasetLabel | ( | $r | ) |
Gives translated label of an import dataset.
int | $r | Dataset index |
Definition at line 977 of file DolibarrModules.class.php.
DolibarrModules::getKanbanView | ( | $codeenabledisable = '', | |
$codetoconfig = '' ) |
Return Kanban view of a module.
string | $codeenabledisable | HTML code for button to enable/disable module |
string | $codetoconfig | HTML code to go to config page |
Definition at line 2524 of file DolibarrModules.class.php.
References $lastVersion, dol_escape_htmltag(), dol_escape_js(), getDesc(), getDolGlobalString(), getName(), getVersion(), img_object(), img_picto(), and isCoreOrExternalModule().
DolibarrModules::getLangFilesArray | ( | ) |
Gives module related language files list.
Definition at line 943 of file DolibarrModules.class.php.
DolibarrModules::getLastActivationDate | ( | ) |
Gives the last date of activation.
Definition at line 998 of file DolibarrModules.class.php.
References dol_syslog().
DolibarrModules::getLastActivationInfo | ( | ) |
Gives the last author of activation.
Definition at line 1028 of file DolibarrModules.class.php.
References dol_syslog().
DolibarrModules::getModulePosition | ( | ) |
Gives the module position.
Definition at line 899 of file DolibarrModules.class.php.
DolibarrModules::getName | ( | ) |
Gives the translated module name if translation exists in admin.lang or into language files of module.
Otherwise return the module key name.
Definition at line 643 of file DolibarrModules.class.php.
References name.
Referenced by getKanbanView().
DolibarrModules::getPublisher | ( | ) |
Gives the publisher name.
Definition at line 845 of file DolibarrModules.class.php.
DolibarrModules::getPublisherUrl | ( | ) |
Gives the publisher url.
Definition at line 855 of file DolibarrModules.class.php.
DolibarrModules::getVersion | ( | $translated = 1 | ) |
Gives module version (translated if param $translated is on) For 'experimental' modules, gives 'experimental' translation For 'dolibarr' modules, gives Dolibarr version.
int | $translated | 1=Special version keys are translated, 0=Special version keys are not translated |
Definition at line 868 of file DolibarrModules.class.php.
Referenced by getKanbanView().
DolibarrModules::init | ( | $options = '' | ) |
Function called when module is enabled.
The init function adds tabs, constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. It also creates data directories
string | $options | Options when enabling module ('', 'newboxdefonly', 'noboxes', 'menuonly') 'noboxes' = Do not insert boxes 'newboxdefonly' = For boxes, insert def of boxes only and not boxes activation |
Reimplemented in modAdherent, modAgenda, modAi, modApi, modAsset, modBanque, modBarcode, modBlockedLog, modBom, modBookCal, modCategorie, modCommande, modComptabilite, modContrat, modDataPolicy, modDav, modDebugBar, modDeplacement, modDocumentGeneration, modDon, modDynamicPrices, modEmailCollector, modEventOrganization, modExpedition, modExpenseReport, modExternalRss, modFacture, modFicheinter, modFournisseur, modHoliday, modHRM, modIntracommreport, modKnowledgeManagement, modLabel, modLoan, modMailing, modMrp, modMultiCurrency, modMyModule, modNotification, modOauth, modOpenSurvey, modPartnership, modPaymentByBankTransfer, modPrelevement, modProduct, modProductBatch, modProjet, modPropale, modReceiptPrinter, modReception, modRecruitment, modResource, modSalaries, modService, modSociete, modStock, modStockTransfer, modSupplierProposal, modTakePos, modTax, modTicket, modUser, modWebhook, modWebPortal, modWebsite, modWorkflow, modWorkstation, and modZapier.
Definition at line 2498 of file DolibarrModules.class.php.
References _init().
DolibarrModules::insert_boxes | ( | $option = '' | ) |
Adds boxes.
string | $option | Options when disabling module ('newboxdefonly'=insert only boxes definition) |
Definition at line 1336 of file DolibarrModules.class.php.
References dol_syslog(), and InfoBox\getListOfPagesForBoxes().
Referenced by _init().
DolibarrModules::insert_const | ( | ) |
Adds constants.
Definition at line 1766 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _init().
DolibarrModules::insert_cronjobs | ( | ) |
Adds cronjobs.
Definition at line 1508 of file DolibarrModules.class.php.
References dol_now(), dol_syslog(), and name.
Referenced by _init().
DolibarrModules::insert_dirs | ( | $name, | |
$dir ) |
Adds directories definitions.
string | $name | Name |
string | $dir | Directory |
Definition at line 2275 of file DolibarrModules.class.php.
References dol_syslog(), and name.
Referenced by create_dirs().
DolibarrModules::insert_menus | ( | ) |
Adds menu entries.
Definition at line 2074 of file DolibarrModules.class.php.
References dol_syslog(), and name.
Referenced by _init().
DolibarrModules::insert_module_parts | ( | ) |
Save configuration for generic features.
This also generate website templates if the module provide some.
Definition at line 2341 of file DolibarrModules.class.php.
References dol_buildpath(), dol_copy(), dol_delete_file(), dol_dir_list(), dol_syslog(), and name.
Referenced by _init().
DolibarrModules::insert_permissions | ( | $reinitadminperms = 0, | |
$force_entity = null, | |||
$notrigger = 0 ) |
Adds access rights.
int | $reinitadminperms | If 1, we also grant them to all admin users |
int | $force_entity | Force current entity |
int | $notrigger | 1=Does not execute triggers, 0= execute triggers |
Definition at line 1874 of file DolibarrModules.class.php.
References dol_print_error(), dol_syslog(), and name.
Referenced by _init().
DolibarrModules::insert_tabs | ( | ) |
Adds tabs.
Definition at line 1699 of file DolibarrModules.class.php.
References dol_syslog().
Referenced by _init().
DolibarrModules::isCoreOrExternalModule | ( | ) |
Tells if module is core or external.
'dolibarr' and 'dolibarr_deprecated' is core 'experimental' and 'development' is core
Definition at line 920 of file DolibarrModules.class.php.
Referenced by getKanbanView().
DolibarrModules::remove | ( | $options = '' | ) |
Function called when module is disabled.
The remove function removes tabs, constants, boxes, permissions and menus from Dolibarr database. Data directories are not deleted
string | $options | Options when enabling module ('', 'noboxes') |
Reimplemented in modAi, modApi, modBlockedLog, modBom, modBookCal, modDataPolicy, modDav, modEmailCollector, modEventOrganization, modExternalRss, modKnowledgeManagement, modMrp, modMultiCurrency, modMyModule, modPartnership, modRecruitment, modStockTransfer, modSupplierProposal, modTakePos, modWebhook, modWebPortal, modWorkstation, and modZapier.
Definition at line 2511 of file DolibarrModules.class.php.
References _remove().