';
/*
diff --git a/htdocs/index.php b/htdocs/index.php
index f1ce8248921..dd1e36d04f8 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -42,12 +42,17 @@ $hookmanager->initHooks(array('index'));
* Actions
*/
+$nbmodulesnotautoenabled = count($conf->modules);
+if (in_array('fckeditor', $conf->modules)) $nbmodulesnotautoenabled--;
+if (in_array('export', $conf->modules)) $nbmodulesnotautoenabled--;
+if (in_array('import', $conf->modules)) $nbmodulesnotautoenabled--;
+
// Check if company name is defined (first install)
if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) {
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
exit;
}
-if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled
+if ($nbmodulesnotautoenabled <= getDolGlobalString('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only user module enabled
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
exit;
}
diff --git a/htdocs/install/mysql/data/llx_c_availability.sql b/htdocs/install/mysql/data/llx_c_availability.sql
index b98db76b48e..7768477c5d1 100644
--- a/htdocs/install/mysql/data/llx_c_availability.sql
+++ b/htdocs/install/mysql/data/llx_c_availability.sql
@@ -33,6 +33,11 @@
--
INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_NOW', 'Immediate', null, 0, 1, 10);
+INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_1D', '1 day', 'd', 1, 1, 11);
+INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_2D', '2 days', 'd', 2, 1, 12);
+INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_3D', '3 days', 'd', 3, 1, 13);
+INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_4D', '4 days', 'd', 4, 1, 14);
+INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_5D', '5 days', 'd', 5, 1, 15);
INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_1W', '1 week', 'w', 1, 1, 20);
INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_2W', '2 weeks', 'w', 2, 1, 30);
INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_3W', '3 weeks', 'w', 3, 1, 40);
diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
index d5deec862d0..fd4368b78af 100644
--- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
+++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
@@ -688,7 +688,7 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext;
DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year'));
DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year');
-ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label);
+ALTER TABLE llx_takepos_floor_tables ADD UNIQUE uk_takepos_floor_tables (entity,label);
ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255);
ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128);
diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php
index fc0dcf37799..6598843b882 100644
--- a/htdocs/install/step5.php
+++ b/htdocs/install/step5.php
@@ -29,6 +29,7 @@
* For installation:
* It creates the login admin and set the MAIN_SECURITY_SALT to a random value.
* It set the value for MAIN_VERSION_LAST_INSTALL
+ * It activates some modules
* It creates the install.lock and shows the final message.
* For upgrade:
* It updates the value for MAIN_VERSION_LAST_UPGRADE.
@@ -42,6 +43,7 @@ if (file_exists($conffile)) {
}
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; // for dol_hash
+require_once $dolibarr_main_document_root.'/core/lib/functions2.lib.php';
global $langs;
@@ -287,6 +289,9 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
*/
}
+ // List of modules to enable
+ $tmparray = array();
+
// If we ask to force some modules to be enabled
if (!empty($force_install_module)) {
if (!defined('DOL_DOCUMENT_ROOT') && !empty($dolibarr_main_document_root)) {
@@ -294,9 +299,53 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
}
$tmparray = explode(',', $force_install_module);
+ }
+
+ $modNameLoaded = array();
+
+ // Search modules dirs
+ $modulesdir[] = $dolibarr_main_document_root.'/core/modules/';
+
+ foreach ($modulesdir as $dir) {
+ // Load modules attributes in arrays (name, numero, orders) from dir directory
+ //print $dir."\n
";
+ dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
+ $handle = @opendir($dir);
+ if (is_resource($handle)) {
+ while (($file = readdir($handle)) !== false) {
+ if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
+ $modName = substr($file, 0, dol_strlen($file) - 10);
+ if ($modName) {
+ if (!empty($modNameLoaded[$modName])) { // In cache of already loaded modules ?
+ $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.
";
+ setEventMessages($mesg, null, 'warnings');
+ dol_syslog($mesg, LOG_ERR);
+ continue;
+ }
+
+ try {
+ $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
+ if (class_exists($modName)) {
+ $objMod = new $modName($db);
+ $modNameLoaded[$modName] = $dir;
+ if (!empty($objMod->enabled_bydefault) && !in_array($file, $tmparray)) {
+ $tmparray[] = $file;
+ }
+ }
+ } catch (Exception $e) {
+ dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Loop on each modules to activate it
+ if (!empty($tmparray)) {
foreach ($tmparray as $modtoactivate) {
$modtoactivatenew = preg_replace('/\.class\.php$/i', '', $modtoactivate);
- print $langs->trans("ActivateModule", $modtoactivatenew).'
';
+ //print $langs->trans("ActivateModule", $modtoactivatenew).'
';
$file = $modtoactivatenew.'.class.php';
dolibarr_install_syslog('step5: activate module file='.$file);
@@ -307,8 +356,10 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
print 'ERROR: failed to activateModule() file='.$file;
}
}
+ //print '
';
}
+ // Now delete the flag to say install is complete
dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
$resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_NOT_INSTALLED'");
if (!$resql) {
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 9706ffedb76..90e520cea25 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1234,7 +1234,7 @@ SetupDescription4=
%s -> %sThis software is a suite of m
SetupDescription5=Other Setup menu entries manage optional parameters.
SetupDescriptionLink=
%s - %s
SetupDescription3b=Basic parameters used to customize the default behavior of your application (e.g for country-related features).
-SetupDescription4b=This software is a suite of many modules/applications. The modules related to your needs must be enabled and configured. Menu entries will appears with the activation of these modules.
+SetupDescription4b=This software is a suite of many modules/applications. The modules related to your needs must be activated. Menu entries will appears with the activation of these modules.
AuditedSecurityEvents=Security events that are audited
NoSecurityEventsAreAduited=No security events are audited. You can enable them from menu %s
Audit=Security events
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index 2016172c381..adc9c4177ad 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -177,5 +177,6 @@ ReminderType=Callback type
AddReminder=Create an automatic reminder notification for this event
ErrorReminderActionCommCreation=Error creating the reminder notification for this event
BrowserPush=Browser Popup Notification
+Reminders=Reminders
ActiveByDefault=Enabled by default
Until=until
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 600dfba7227..3c442fcc84a 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -169,4 +169,7 @@ GeneratePermissions=I want to add the rights for this object
GeneratePermissionsHelp=generate default rights for this object
PermissionDeletedSuccesfuly=Permission has been successfully removed
PermissionUpdatedSuccesfuly=Permission has been successfully updated
-PermissionAddedSuccesfuly=Permission has been successfully added
\ No newline at end of file
+PermissionAddedSuccesfuly=Permission has been successfully added
+MenuDeletedSuccessfuly=Menu has been successfully deleted
+MenuAddedSuccessfuly=Menu has been successfully added
+MenuUpdatedSuccessfuly=Menu has been successfully updated
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/modulebuilder.lang b/htdocs/langs/fr_FR/modulebuilder.lang
index 3c4161941e8..c9c0b9ef1bc 100644
--- a/htdocs/langs/fr_FR/modulebuilder.lang
+++ b/htdocs/langs/fr_FR/modulebuilder.lang
@@ -169,4 +169,7 @@ GeneratePermissions=Je souhaite ajouter les droits pour cet objet
GeneratePermissionsHelp=générer les droits par défault pour cet objet
PermissionDeletedSuccesfuly=La permission a été supprimée avec succès
PermissionUpdatedSuccesfuly=La permission a été mise à jour avec succès
-PermissionAddedSuccesfuly= La permission a été ajoutée avec succès
\ No newline at end of file
+PermissionAddedSuccesfuly= La permission a été ajoutée avec succès
+MenuDeletedSuccessfuly=Menu a été supprimé avec succès
+MenuAddedSuccessfuly=Menu a été ajouté avec succès
+MenuUpdatedSuccessfuly=Menu a été mise à jour avec succès
\ No newline at end of file
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 93f3e34bf2b..e52985e8c50 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -896,6 +896,17 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) {
// Init an object
if ($dirins && $action == 'initobject' && $module && $objectname) {
+ // check if module is enabled
+ if (isModEnabled(strtolower($module))) {
+ $result = unActivateModule(strtolower($module));
+ dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
+ if ($result) {
+ setEventMessages($result, null, 'errors');
+ }
+ header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
+ setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');
+ }
+
$objectname = ucfirst($objectname);
$dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
@@ -1341,43 +1352,31 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
// Regenerate left menu entry in descriptor for $objectname
$stringtoadd = "
\$this->menu[\$r++]=array(
- // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=mymodule',
- // This is a Left menu entry
'type'=>'left',
'titre'=>'List MyObject',
'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject',
'url'=>'/mymodule/myobject_list.php',
- // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'mymodule@mymodule',
'position'=>1100+\$r,
- // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'\$conf->mymodule->enabled',
- // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'target'=>'',
- // 0=Menu for internal users, 1=external users, 2=both
'user'=>2,
);
\$this->menu[\$r++]=array(
- // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject',
- // This is a Left menu entry
'type'=>'left',
'titre'=>'New MyObject',
'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject',
'url'=>'/mymodule/myobject_card.php?action=create',
- // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'mymodule@mymodule',
'position'=>1100+\$r,
- // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'\$conf->mymodule->enabled',
- // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'target'=>'',
- // 0=Menu for internal users, 1=external users, 2=both
'user'=>2
);\n";
$stringtoadd = preg_replace('/MyObject/', $objectname, $stringtoadd);
@@ -1389,8 +1388,28 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
// TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1
// TODO Avoid duplicate addition
- dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */"));
-
+ // load class and check if menu exist with same object name
+ $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
+ dol_include_once($pathtofile);
+ $class = 'mod'.$module;
+ if (class_exists($class)) {
+ try {
+ $moduleobj = new $class($db);
+ } catch (Exception $e) {
+ $error++;
+ dol_print_error($db, $e->getMessage());
+ }
+ }
+ $menus = $moduleobj->menu;
+ $counter = 0 ;
+ foreach ($menus as $menu) {
+ if ($menu['leftmenu'] == strtolower($module).'_'.strtolower($objectname)) {
+ $counter++;
+ }
+ }
+ if (!$counter) {
+ dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER LEFTMENU MYOBJECT */' => '/*LEFTMENU '.strtoupper($objectname).'*/'.$stringtoadd."\n\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER LEFTMENU MYOBJECT */'));
+ }
// Add module descriptor to list of files to replace "MyObject' string with real name of object.
$filetogenerate[] = 'core/modules/mod'.$module.'.class.php';
}
@@ -1728,6 +1747,16 @@ if ($dirins && $action == 'confirm_deletemodule') {
}
if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
+ // check if module is enabled (if it's disabled and send msg event)
+ if (isModEnabled(strtolower($module))) {
+ $result = unActivateModule(strtolower($module));
+ dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
+ if ($result) {
+ setEventMessages($result, null, 'errors');
+ }
+ header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
+ setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');
+ }
if (preg_match('/[^a-z0-9_]/i', $objectname)) {
$error++;
setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors');
@@ -1766,53 +1795,43 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
);
//menu for the object selected
- $stringtoedit = "\$this->menu[\$r++]=array(
- // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'fk_menu'=>'fk_mainmenu=".strtolower($module)."',
- // This is a Left menu entry
- 'type'=>'left',
- 'titre'=>'List ".ucfirst($objectname)."',
- 'mainmenu'=>'".strtolower($module)."',
- 'leftmenu'=>'".strtolower($module)."_".strtolower($objectname)."',
- 'url'=>'/".strtolower($module)."/".strtolower($objectname)."_list.php',
- // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
- 'langs'=>'".strtolower($module)."@".strtolower($module)."',
- 'position'=>1100+\$r,
- // Define condition to show or hide menu entry. Use '\$conf->".strtolower($module)."->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
- 'enabled'=>'\$conf->".strtolower($module)."->enabled',
- // Use 'perms'=>'\$user->rights->".strtolower($module)."->level1->level2' if you want your menu with a permission rules
- 'perms'=>'1',
- 'target'=>'',
- // 0=Menu for internal users, 1=external users, 2=both
- 'user'=>2,
- );
- \$this->menu[\$r++]=array(
- // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'fk_menu'=>'fk_mainmenu=".strtolower($module).",fk_leftmenu=".strtolower($module)."_".strtolower($objectname)."',
- // This is a Left menu entry
- 'type'=>'left',
- 'titre'=>'New ".ucfirst($objectname)."',
- 'mainmenu'=>'".strtolower($module)."',
- 'leftmenu'=>'".strtolower($module)."_".strtolower($objectname)."',
- 'url'=>'/".strtolower($module)."/".strtolower($objectname)."_card.php?action=create',
- // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
- 'langs'=>'".strtolower($module)."@".strtolower($module)."',
- 'position'=>1100+\$r,
- // Define condition to show or hide menu entry. Use '\$conf->".strtolower($module)."->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
- 'enabled'=>'\$conf->".strtolower($module)."->enabled',
- // Use 'perms'=>'\$user->rights->".strtolower($module)."->level1->level2' if you want your menu with a permission rules
- 'perms'=>'1',
- 'target'=>'',
- // 0=Menu for internal users, 1=external users, 2=both
- 'user'=>2
- );";
+ // load class and check if menu exist for this object
+ $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
+ dol_include_once($pathtofile);
+ $class = 'mod'.$module;
+ if (class_exists($class)) {
+ try {
+ $moduleobj = new $class($db);
+ } catch (Exception $e) {
+ $error++;
+ dol_print_error($db, $e->getMessage());
+ }
+ }
+ $menus = $moduleobj->menu;
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
- $check = dolReplaceInFile($moduledescriptorfile, array($stringtoedit => ''));
- if ($check > 0) {
- dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($objectname).'*/' => ''));
+ foreach ($menus as $menu) {
+ if ($menu['type'] == 'left' && $menu['leftmenu'] == strtolower($module).'_'.strtolower($objectname)) {
+ $left="\$this->menu[\$r++]=array(
+ 'fk_menu'=>'".$menu['fk_menu']."',
+ 'type'=>'".$menu['type']."',
+ 'titre'=>'".$menu['titre']."',
+ 'mainmenu'=>'".$menu['mainmenu']."',
+ 'leftmenu'=>'".$menu['leftmenu']."',
+ 'url'=>'".$menu['url']."',
+ 'langs'=>'".$menu['langs']."',
+ 'position'=>1100+\$r,
+ 'enabled'=>'".$menu['enabled']."',
+ 'perms'=>'".$menu['perms']."',
+ 'target'=>'".$menu['target']."',
+ 'user'=>".$menu['user'].",
+ );";
+ dolReplaceInFile($moduledescriptorfile, array($left => ''));
+ }
}
+ // Remarque : "\n" not handling yet
+ $check = dolReplaceInFile($moduledescriptorfile, array('/*LEFTMENU '.strtoupper($objectname).'*/'."\n" => '',"\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n" => ''));
// regenerate permissions and delete them
$rights = "
@@ -1994,8 +2013,9 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
$existRight = 0;
$allObject = array();
- $nbOfPermissions = count($permissions);
- for ($i =0; $i<$nbOfPermissions; $i++) {
+ $countPerms = count($permissions);
+
+ for ($i =0; $i<$countPerms; $i++) {
if ($permissions[$i][4] == $objectForPerms) {
$counter++;
if (count($permsForObject) < 3) {
@@ -2004,9 +2024,10 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
}
$allObject[] = $permissions[$i][4];
}
- $nbOfpermsInObj = count($permsForObject);
+
// check if label of object already exists
- for ($j = 0; $j<$nbOfpermsInObj; $j++) {
+ $countPermsObj = count($permsForObject);
+ for ($j = 0; $j<$countPermsObj; $j++) {
if (in_array($label, $permsForObject[$j])) {
$existRight++;
setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)), null, 'errors');
@@ -2037,6 +2058,7 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
";
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
if (!$existRight) {
+ //var_dump(1);exit;
dolReplaceInFile($moduledescriptorfile, array('/*END '.strtoupper($objectForPerms).'*/' => $rightToAdd.'/*END '.strtoupper($objectForPerms).'*/'));
setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null);
}
@@ -2099,13 +2121,18 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
$x1 = $permissions[$r-1][1];
$x2 = $permissions[$r-1][4];
$x3 = $permissions[$r-1][5];
- //check existing object permission
- $permsForObject =array();
+ //check existing object permission
+ $counter = 0;
+ $permsForObject =array();
+ $permissions = $moduleobj->rights;
+ $firstRight = 0;
+ $existRight = 0;
+ $allObject = array();
- $allObject = array();
- $nbOfPermissions = count($permissions);
- for ($i =0; $i<$nbOfPermissions; $i++) {
+ $countPerms = count($permissions);
+ for ($i =0; $i<$countPerms; $i++) {
if ($permissions[$i][4] == $objectForPerms) {
+ $counter++;
if (count($permsForObject) < 3) {
$permsForObject[] = $permissions[$i];
}
@@ -2114,8 +2141,8 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
}
if ($label != $x1 && $crud != $x3) {
- $x = count($permsForObject);
- for ($j = 0; $j<$x; $j++) {
+ $countPermsObj = count($permsForObject);
+ for ($j = 0; $j<$countPermsObj; $j++) {
if (in_array($label, $permsForObject[$j])) {
$error++;
setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)), null, 'errors');
@@ -2158,6 +2185,70 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
exit;
}
}
+// Delete permission
+if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('permskey', 'int')) {
+ $error = 0;
+ // load class and check if right exist
+ $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
+ dol_include_once($pathtofile);
+ $class = 'mod'.$module;
+ if (class_exists($class)) {
+ try {
+ $moduleobj = new $class($db);
+ } catch (Exception $e) {
+ $error++;
+ dol_print_error($db, $e->getMessage());
+ }
+ }
+
+ $permissions = $moduleobj->rights;
+ $key = (int) GETPOST('permskey', 'int')-1;
+ //get permission want to delete from permissions array
+ $x1 = $permissions[$key][1];
+ $x2 = $permissions[$key][4];
+ $x3 = $permissions[$key][5];
+ //prepare right want to delete
+ $rightTodelete = "
+ \$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
+ \$this->rights[\$r][1] = '$x1';
+ \$this->rights[\$r][4] = '$x2';
+ \$this->rights[\$r][5] = '$x3';
+ \$r++;
+ ";
+
+
+ $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
+ $check = dolReplaceInFile($moduledescriptorfile, array($rightTodelete => ''."\n\t\t"));
+ if ($check > 0) {
+ //check if all permissions of object was deleted
+ $permsForObj = array();
+ foreach ($permissions as $perms) {
+ $permsForObj[] = $perms[4];
+ }
+ $permsForObj = array_count_values($permsForObj);
+ if ($permsForObj[$permissions[$key][4]] == 1) {
+ $delObjStart = dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($permissions[$key][4].'*/') => '','/*END '.strtoupper($permissions[$key][4].'*/') => ''));
+ }
+ }
+ if (!$error) {
+ // check if module is enabled
+ if (isModEnabled(strtolower($module))) {
+ $result = unActivateModule(strtolower($module));
+ dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
+ if ($result) {
+ setEventMessages($result, null, 'errors');
+ }
+ header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
+ setEventMessages($langs->trans('PermissionDeletedSuccesfuly'), null);
+ setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');
+ exit;
+ } else {
+ header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
+ setEventMessages($langs->trans('PermissionDeletedSuccesfuly'), null);
+ exit;
+ }
+ }
+}
// Save file
if ($action == 'savefile' && empty($cancel)) {
$relofcustom = basename($dirins);
@@ -2269,6 +2360,91 @@ if ($action == 'reset' && $user->admin) {
exit;
}
+// delete menu
+if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) {
+ // check if module is enabled
+ if (isModEnabled(strtolower($module))) {
+ $result = unActivateModule(strtolower($module));
+ dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
+ if ($result) {
+ setEventMessages($result, null, 'errors');
+ }
+ header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
+ setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');
+ }
+ // load class and check if menu exist
+ $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
+ dol_include_once($pathtofile);
+ $class = 'mod'.$module;
+ if (class_exists($class)) {
+ try {
+ $moduleobj = new $class($db);
+ } catch (Exception $e) {
+ $error++;
+ dol_print_error($db, $e->getMessage());
+ }
+ }
+
+ $menus = $moduleobj->menu;
+
+ $key = (int) GETPOST('menukey', 'int');
+ $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
+
+
+ if ($menus[$key]['type'] == 'top') {
+ $menuTop = "
+ \$this->menu[\$r++] = array(
+ 'fk_menu'=>'".$menus[$key]['fk_menu']."',
+ 'type'=>'".$menus[$key]['type']."',
+ 'titre'=>'".$menus[$key]['titre']."',
+ 'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'),
+ 'mainmenu'=>'".$menus[$key]['mainmenu']."',
+ 'leftmenu'=> '',
+ 'url'=>'".$menus[$key]['url']."',
+ 'langs'=>'".$menus[$key]['langs']."',
+ 'position'=>1000 + \$r,
+ 'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
+ 'perms' =>'".$menus[$key]['perms']."',
+ 'target'=>'".$menus[$key]['target']."',
+ 'user'=>".$menus[$key]['user'].",
+ );";
+ $check = dolReplaceInFile($moduledescriptorfile, array($menuTop => '',"\t\t".'/*TOPMENU '.strtolower($menus[$key]['titre']).'*/'."\n" => '', '/*END TOPMENU '.strtolower($menus[$key]['titre']).'*/'."\n\t\t" => ''));
+ }
+ if ($menus[$key]['type'] == 'left') {
+ $left="\$this->menu[\$r++]=array(
+ 'fk_menu'=>'".$menus[$key]['fk_menu']."',
+ 'type'=>'".$menus[$key]['type']."',
+ 'titre'=>'".$menus[$key]['titre']."',
+ 'mainmenu'=>'".$menus[$key]['mainmenu']."',
+ 'leftmenu'=>'".$menus[$key]['leftmenu']."',
+ 'url'=>'".$menus[$key]['url']."',
+ 'langs'=>'".$menus[$key]['langs']."',
+ 'position'=>1100+\$r,
+ 'enabled'=>'".$menus[$key]['enabled']."',
+ 'perms'=>'".$menus[$key]['perms']."',
+ 'target'=>'".$menus[$key]['target']."',
+ 'user'=>".$menus[$key]['user'].",
+ );";
+ $check = dolReplaceInFile($moduledescriptorfile, array($left => ''));
+
+ // check if still had menu created when initial object
+ // if not we delete the comments from file
+ $menuForObj = 0;
+ foreach ($menus as $menu) {
+ if ($menu['leftmenu'] == $menus[$key]['leftmenu']) {
+ $menuForObj++;
+ }
+ }
+ if ($menuForObj == 1) {
+ $extractObjName = explode("_", $menus[$key]['leftmenu']);
+ dolReplaceInFile($moduledescriptorfile, array('/*LEFTMENU '.strtoupper($extractObjName[1]).'*/'."\n" => '','/*END LEFTMENU '.strtoupper($extractObjName[1]).'*/' => ''));
+ }
+ }
+
+ setEventMessages($langs->trans('MenuDeletedSuccessfuly'), null);
+ header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
+ exit;
+}
/*
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 60de90d819d..3d3d752fe11 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -14,7 +14,7 @@
* Copyright (C) 2014 Ion agorria
* Copyright (C) 2016-2018 Ferran Marcet
* Copyright (C) 2017 Gustavo Novaro
- * Copyright (C) 2019-2022 Frédéric France
+ * Copyright (C) 2019-2023 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1566,7 +1566,7 @@ class Product extends CommonObject
}
} elseif (isset($this->multilangs[$key])) {
if (empty($this->multilangs["$key"]["label"])) {
- $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
+ $this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
return -1;
}
@@ -4869,7 +4869,7 @@ class Product extends CommonObject
/**
* Return all parent products for current product (first level only)
*
- * @return array Array of product
+ * @return array|int Array of product
* @see hasFatherOrChild()
*/
public function getFather()
@@ -4911,7 +4911,7 @@ class Product extends CommonObject
* @param int $firstlevelonly Return only direct child
* @param int $level Level of recursing call (start to 1)
* @param array $parents Array of all parents of $id
- * @return array Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref)
+ * @return array|int Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref)
*/
public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array())
{
diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php
index 317bc7fb5fd..d43a2e3bf56 100644
--- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php
+++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php
@@ -367,7 +367,7 @@ class PriceGlobalVariableUpdater
/**
* List all price global variables
*
- * @return array Array of price global variable updaters
+ * @return array|int Array of price global variable updaters
*/
public function listUpdaters()
{
@@ -404,7 +404,7 @@ class PriceGlobalVariableUpdater
/**
* List all updaters which need to be processed
*
- * @return array Array of price global variable updaters
+ * @return array|int Array of price global variable updaters
*/
public function listPendingUpdaters()
{
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index 3ce244a4bb1..66cccc55489 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -577,7 +577,7 @@ class Entrepot extends CommonObject
/**
* Return number of unique different product into a warehouse
*
- * @return Array Array('nb'=>Nb, 'value'=>Value)
+ * @return array|int Array('nb'=>Nb, 'value'=>Value)
*/
public function nb_different_products()
{
@@ -608,7 +608,7 @@ class Entrepot extends CommonObject
/**
* Return stock and value of warehosue
*
- * @return Array Array('nb'=>Nb, 'value'=>Value)
+ * @return array|int Array('nb'=>Nb, 'value'=>Value)
*/
public function nb_products()
{
diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php
index acf2f526773..a39d92f93aa 100644
--- a/htdocs/product/stock/productlot_card.php
+++ b/htdocs/product/stock/productlot_card.php
@@ -469,7 +469,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '| ';
print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
print ' | ';
- print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
+ print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker', '', null, null, '', 1, '', 'id', 'auto', array(), $action);
print ' | ';
print '
';
}
@@ -479,7 +479,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '| ';
print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
print ' | ';
- print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
+ print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker', '', null, null, '', 1, '', 'id', 'auto', array(), $action);
print ' | ';
print '
';
}
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 6eb7384c11d..305cfdd570b 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -2313,4 +2313,29 @@ class Project extends CommonObject
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
}
+
+ /**
+ * Function sending an email to the current member with the text supplied in parameter.
+ *
+ * @param string $text Content of message (not html entities encoded)
+ * @param string $subject Subject of message
+ * @param array $filename_list Array of attached files
+ * @param array $mimetype_list Array of mime types of attached files
+ * @param array $mimefilename_list Array of public names of attached files
+ * @param string $addr_cc Email cc
+ * @param string $addr_bcc Email bcc
+ * @param int $deliveryreceipt Ask a delivery receipt
+ * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
+ * @param string $errors_to erros to
+ * @param string $moreinheader Add more html headers
+ * @since V18
+ * @return int <0 if KO, >0 if OK
+ */
+ public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
+ {
+ global $conf, $langs;
+ // TODO EMAIL
+
+ return 1;
+ }
}
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index 943280d6e2d..9ac60d8f823 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -372,7 +372,7 @@ if (empty($reshook) && $action == 'add') {
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
- $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
+ $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
}
/*if ($result < 0) {
$error++;
diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php
index af2583abece..d5d1dad1d81 100644
--- a/htdocs/public/partnership/new.php
+++ b/htdocs/public/partnership/new.php
@@ -360,7 +360,7 @@ if (empty($reshook) && $action == 'add') {
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
- $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
+ $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
}
}
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 4a13de1ef7f..40898f1ff6e 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -775,7 +775,7 @@ if ($ispaymentok) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/payment/paymentok.php'."\r\n";
- $result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, "", $moreinheader);
+ $result = $object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, "", $moreinheader);
if ($result < 0) {
$errmsg = $object->error;
diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php
index c44002340d6..6a36af77db2 100644
--- a/htdocs/public/project/new.php
+++ b/htdocs/public/project/new.php
@@ -222,6 +222,7 @@ if (empty($reshook) && $action == 'add') {
} else {
$thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
}
+ $thirdparty->email = GETPOST('email');
$thirdparty->address = GETPOST('address');
$thirdparty->zip = GETPOST('zip');
$thirdparty->town = GETPOST('town');
@@ -368,11 +369,10 @@ if (empty($reshook) && $action == 'add') {
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
-
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
- $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
+ $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
}
/*if ($result < 0) {
$error++;
diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php
index ca46cb8909c..5e4c68fe468 100644
--- a/htdocs/reception/class/api_receptions.class.php
+++ b/htdocs/reception/class/api_receptions.class.php
@@ -499,10 +499,10 @@ class Receptions extends DolibarrApi
*
* @param int $id Reception ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
- * @return Object Object with cleaned properties
*
* @url POST {id}/validate
*
+ * @return Object
* \todo An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported."
* Workaround: send this in the body
@@ -627,9 +627,10 @@ class Receptions extends DolibarrApi
*
* @param int $id Reception ID
* @param int $notrigger Disabled triggers
- * @return Object Object with cleaned properties
*
* @url POST {id}/close
+ *
+ * @return Object
*/
public function close($id, $notrigger = 0)
{
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index e9a89691c88..018d532a363 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -11,7 +11,7 @@
* Copyright (C) 2015 Claudio Aschieri
* Copyright (C) 2016-2022 Ferran Marcet
* Copyright (C) 2018 Quentin Vial-Gouteyron
- * Copyright (C) 2022 Frédéric France
+ * Copyright (C) 2022-2023 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -97,6 +97,12 @@ class Reception extends CommonObject
public $date_delivery; // Date delivery planed
+ /**
+ * @var integer|string Effective delivery date
+ * @deprecated
+ * @see $date_reception
+ */
+ public $date;
/**
* @var integer|string Effective delivery date
@@ -396,8 +402,7 @@ class Reception extends CommonObject
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->date_creation = $this->db->jdate($obj->date_creation);
- $this->date = $this->db->jdate($obj->date_reception); // TODO deprecated
- $this->date_reception = $this->db->jdate($obj->date_reception); // TODO deprecated
+ $this->date = $this->db->jdate($obj->date_reception); // TODO deprecated
$this->date_reception = $this->db->jdate($obj->date_reception); // Date real
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
$this->model_pdf = $obj->model_pdf;
diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php
index 9921167d00c..1a1b3818848 100644
--- a/htdocs/societe/class/api_thirdparties.class.php
+++ b/htdocs/societe/class/api_thirdparties.class.php
@@ -523,8 +523,8 @@ class Thirdparties extends DolibarrApi
/**
* Delete thirdparty
*
- * @param int $id Thirdparty ID
- * @return array
+ * @param int $id Thirdparty ID
+ * @return array
*/
public function delete($id)
{
@@ -1351,10 +1351,10 @@ class Thirdparties extends DolibarrApi
/**
* Generate a Document from a bank account record (like SEPA mandate)
*
- * @param int $id Thirdparty id
- * @param int $companybankid Companybank id
- * @param string $model Model of document to generate
- * @return array
+ * @param int $id Thirdparty id
+ * @param int $companybankid Companybank id
+ * @param string $model Model of document to generate
+ * @return array
*
* @url GET {id}/generateBankAccountDocument/{companybankid}/{model}
*/
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index f2e6d19afa8..55f2eab63d9 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -1944,7 +1944,7 @@ class SupplierProposal extends CommonObject
* @param int $offset For pagination
* @param string $sortfield Sort criteria
* @param string $sortorder Sort order
- * @return int -1 if KO, array with result if OK
+ * @return array|int -1 if KO, array with result if OK
*/
public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datec', $sortorder = 'DESC')
{
@@ -2225,7 +2225,7 @@ class SupplierProposal extends CommonObject
*
* @param User $user Object user
* @param int $mode "opened" for askprice to close, "signed" for proposal to invoice
- * @return int <0 if KO, >0 if OK
+ * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
public function load_board($user, $mode)
{
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 5faea34ad6c..ba8590dc8a5 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -1,7 +1,7 @@
* Copyright (C) 2016 Christophe Battarel
- * Copyright (C) 2019-2022 Frédéric France
+ * Copyright (C) 2019-2023 Frédéric France
* Copyright (C) 2020 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
@@ -198,6 +198,26 @@ class Ticket extends CommonObject
*/
public $cache_category_tickets;
+ /**
+ * @var array tickets severity
+ */
+ public $cache_severity_tickets;
+
+ /**
+ * @var array cache msgs ticket
+ */
+ public $cache_msgs_ticket;
+
+ /**
+ * @var array statuts labels
+ */
+ public $statuts;
+
+ /**
+ * @var array statuts short labels
+ */
+ public $statuts_short;
+
/**
* @var int Notify thirdparty at create
*/
@@ -219,7 +239,7 @@ class Ticket extends CommonObject
public $oldcopy;
/**
- * @var array array of TicketsLine
+ * @var TicketsLine[] array of TicketsLine
*/
public $lines;
@@ -1251,7 +1271,7 @@ class Ticket extends CommonObject
{
global $conf, $langs;
- if (!empty($this->cache_category_ticket) && count($this->cache_category_tickets)) {
+ if (!empty($this->cache_category_tickets) && count($this->cache_category_tickets)) {
// Cache already loaded
return 0;
}