'.$langs->trans("AlsoDefaultValuesAreEffectiveForActionCreate");
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
print_liste_field_titre($texturl, $_SERVER["PHP_SELF"], 'page,param', '', $param, '', $sortfield, $sortorder);
// Field
diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php
index df7054ca162..de5a1e75d0a 100644
--- a/htdocs/api/class/api.class.php
+++ b/htdocs/api/class/api.class.php
@@ -216,7 +216,7 @@ class DolibarrApi
*
* @param string $resource element to check
* @param int $resource_id Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
- * @param type $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
+ * @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
diff --git a/htdocs/api/index.php b/htdocs/api/index.php
index 4207618d125..3f47731316c 100644
--- a/htdocs/api/index.php
+++ b/htdocs/api/index.php
@@ -234,12 +234,13 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
$classname = ucwords($module);
- dol_syslog('Search /' . $moduledirforclass . '/class/api_' . $classfile . '.class.php => dir_part_file=' . $dir_part_file . ' classname=' . $classname);
+ dol_syslog('Search api file /' . $moduledirforclass . '/class/api_' . $classfile . '.class.php => dir_part_file=' . $dir_part_file . ' classname=' . $classname);
$res = false;
if ($dir_part_file)
$res = include_once $dir_part_file;
if (! $res) {
+ dol_syslog('Failed to make include_once '.$dir_part_file, LOG_WARNING);
print 'API not found (failed to include API file)';
header('HTTP/1.1 501 API not found (failed to include API file)');
exit(0);
diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php
index 47e22a3bf62..54f289a5b23 100644
--- a/htdocs/bom/class/api_boms.class.php
+++ b/htdocs/bom/class/api_boms.class.php
@@ -28,21 +28,13 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
*/
/**
- * API class for bom bom
+ * API class for bom
*
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
-class BOMs extends DolibarrApi
+class Boms extends DolibarrApi
{
- /**
- * @var array $FIELDS Mandatory fields, checked when create and update object
- */
- static $FIELDS = array(
- 'label'
- );
-
-
/**
* @var BOM $bom {@type BOM}
*/
@@ -71,16 +63,16 @@ class BOMs extends DolibarrApi
*/
public function get($id)
{
- if(! DolibarrApiAccess::$user->rights->bom->read) {
+ if (! DolibarrApiAccess::$user->rights->bom->read) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
- if( ! $result ) {
+ if (! $result) {
throw new RestException(404, 'BOM not found');
}
- if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
+ if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -107,33 +99,33 @@ class BOMs extends DolibarrApi
global $db, $conf;
$obj_ret = array();
-
+ $tmpobject = new BOM($db);
+
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
- $restictonsocid = 0; // Set to 1 if there is a field socid in table of object
+ $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
- if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
+ if ($restrictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT t.rowid";
- if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
- $sql.= " FROM ".MAIN_DB_PREFIX."bom_mytable as t";
+ if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
+ $sql.= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t";
- if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
+ if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= " WHERE 1 = 1";
// Example of use $mode
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
- $tmpobject = new BOM($db);
if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')';
- if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
- if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
- if ($restictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
+ if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
+ if ($restrictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
+ if ($restrictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter
- if ($restictonsocid && $search_sale > 0)
+ if ($restrictonsocid && $search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
@@ -190,7 +182,7 @@ class BOMs extends DolibarrApi
*/
public function post($request_data = null)
{
- if(! DolibarrApiAccess::$user->rights->bom->create) {
+ if(! DolibarrApiAccess::$user->rights->bom->write) {
throw new RestException(401);
}
// Check mandatory fields
@@ -215,7 +207,7 @@ class BOMs extends DolibarrApi
*/
public function put($id, $request_data = null)
{
- if(! DolibarrApiAccess::$user->rights->bom->create) {
+ if(! DolibarrApiAccess::$user->rights->bom->write) {
throw new RestException(401);
}
@@ -224,7 +216,7 @@ class BOMs extends DolibarrApi
throw new RestException(404, 'BOM not found');
}
- if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
+ if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -239,7 +231,7 @@ class BOMs extends DolibarrApi
}
else
{
- throw new RestException(500, $this->commande->error);
+ throw new RestException(500, $this->bom->error);
}
}
@@ -259,7 +251,7 @@ class BOMs extends DolibarrApi
throw new RestException(404, 'BOM not found');
}
- if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
+ if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -309,12 +301,13 @@ class BOMs extends DolibarrApi
*/
private function _validate($data)
{
- $bom = array();
- foreach (BOMs::$FIELDS as $field) {
+ $myobject = array();
+ foreach ($this->myobject->fields as $field => $propfield) {
+ if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) continue; // Not a mandatory field
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
- $bom[$field] = $data[$field];
+ $myobject[$field] = $data[$field];
}
- return $bom;
+ return $myobject;
}
}
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index b543d6790c6..ebe4e48f264 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -281,6 +281,7 @@ class ActionComm extends CommonObject
if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep;
//if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date;
if (! isset($this->fk_project) || $this->fk_project < 0) $this->fk_project = 0;
+ // For backward compatibility
if ($this->elementtype=='facture') $this->elementtype='invoice';
if ($this->elementtype=='commande') $this->elementtype='order';
if ($this->elementtype=='contrat') $this->elementtype='contract';
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 454936d2998..fae9ab49cc8 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6525,7 +6525,7 @@ abstract class CommonObject
$out .= $extrafields->showOutputField($key, $value);
break;
case "edit":
- $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id);
+ $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
break;
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 26acdf50fcc..caea57280b9 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1567,6 +1567,9 @@ class ExtraFields
if ($type == 'date') $out.=' (YYYY-MM-DD)';
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
*/
+ if (! empty($help)) {
+ $out .= $form->textwithpicto("", $help);
+ }
return $out;
}
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 59996942cd3..1d681d2672b 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -834,7 +834,7 @@ class FormTicket
if ($user->rights->ticket->write && !$user->socid)
{
print '
';
-}
+ // Adds a line numbering column
+ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
+ $coldisplay++;
+ echo '
';
+ }
$coldisplay++;
?>
diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
index 9aa395c22d6..e5b925b0d83 100644
--- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
+++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
@@ -94,6 +94,9 @@ ALTER TABLE llx_bank_url DROP INDEX uk_bank_url;
ALTER TABLE llx_bank_url ADD UNIQUE INDEX uk_bank_url (fk_bank, url_id, type);
ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer;
+ALTER TABLE llx_actioncomm ADD COLUMN visibility varchar(12) DEFAULT 'default';
+
+DROP TABLE llx_ticket_msg;
ALTER TABLE llx_don ADD COLUMN fk_soc integer NULL;
diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql
index 046b8c155bd..ad6ea20115c 100644
--- a/htdocs/install/mysql/tables/llx_actioncomm.sql
+++ b/htdocs/install/mysql/tables/llx_actioncomm.sql
@@ -46,7 +46,8 @@ create table llx_actioncomm
transparency integer, -- transparency (ical standard). used to say if user assigned to event are busy or not by event. This field may be deprecated if we want to store transparency for each assigned user, moved into table llx_actioncomm_resources.
priority smallint, -- priority (ical standard)
- fulldayevent smallint NOT NULL default 0, -- priority (ical standard)
+ visibility varchar(12) DEFAULT 'default', -- visibility (ical standard) - 'default', 'public', 'private', 'confidential'
+ fulldayevent smallint NOT NULL default 0, -- full day (ical standard)
punctual smallint NOT NULL default 1, -- deprecated. milestone is event with date start (datep) = date end (datep2)
percent smallint NOT NULL default 0,
location varchar(128),
diff --git a/htdocs/install/mysql/tables/llx_ticket_msg.key.sql b/htdocs/install/mysql/tables/llx_ticket_msg.key.sql
deleted file mode 100755
index f6ff6fc5e88..00000000000
--- a/htdocs/install/mysql/tables/llx_ticket_msg.key.sql
+++ /dev/null
@@ -1,17 +0,0 @@
--- SQL definition for module ticket
--- Copyright (C) 2013 Jean-François FERRY
---
--- 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
--- the Free Software Foundation, either version 3 of the License, or
--- (at your option) any later version.
---
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program. If not, see .
-
---ALTER TABLE llx_ticket_msg ADD CONSTRAINT fk_ticket_msg_fk_track_id FOREIGN KEY (fk_track_id) REFERENCES llx_ticket (track_id);
diff --git a/htdocs/install/mysql/tables/llx_ticket_msg.sql b/htdocs/install/mysql/tables/llx_ticket_msg.sql
deleted file mode 100755
index 7ff3297b0cc..00000000000
--- a/htdocs/install/mysql/tables/llx_ticket_msg.sql
+++ /dev/null
@@ -1,26 +0,0 @@
--- SQL definition for module ticket
--- Copyright (C) 2013 Jean-François FERRY
---
--- 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
--- the Free Software Foundation, either version 3 of the License, or
--- (at your option) any later version.
---
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program. If not, see .
-
-CREATE TABLE llx_ticket_msg
-(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- entity integer DEFAULT 1,
- fk_track_id varchar(128),
- fk_user_action integer,
- datec datetime,
- message text,
- private integer DEFAULT 0
-)ENGINE=innodb;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 90abbe90fc6..daba22fe660 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -470,6 +470,7 @@ TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. Technical knowled
PageUrlForDefaultValues=You must enter the relative path of the page URL. If you include parameters in URL, the default values will be effective if all parameters are set to same value.
PageUrlForDefaultValuesCreate= Example: For the form to create a new third party, it is %s. For URL of external modules installed into custom directory, do not include the "custom/", so use path like mymodule/mypage.php and not custom/mymodule/mypage.php. If you want default value only if url has some parameter, you can use %s
PageUrlForDefaultValuesList= Example: For the page that lists third parties, it is %s. For URL of external modules installed into custom directory, do not include the "custom/" so use a path like mymodule/mypagelist.php and not custom/mymodule/mypagelist.php. If you want default value only if url has some parameter, you can use %s
+AlsoDefaultValuesAreEffectiveForActionCreate=Also note that overwritting default values for form creation works only for pages that were correctly designed (so with parameter action=create...)
EnableDefaultValues=Enable customization of default values
EnableOverwriteTranslation=Enable usage of overwritten translation
GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code. To change this value, you must edit it from Home-Setup-translation.
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 3aec931714b..463cf828b29 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -855,7 +855,7 @@ Download=Download
DownloadDocument=Download document
ActualizeCurrency=Update currency rate
Fiscalyear=Fiscal year
-ModuleBuilder=Module Builder
+ModuleBuilder=Module and Application Builder
SetMultiCurrencyCode=Set currency
BulkActions=Bulk actions
ClickToShowHelp=Click to show tooltip help
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 8e2d57a03fc..5cb927dc8b7 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -1,5 +1,5 @@
# Dolibarr language file - Source file is en_US - loan
-ModuleBuilderDesc=This tool must be used only by experienced users or developers. It provides utilities to build or edit your own module. Documentation for alternative manual development is here.
+ModuleBuilderDesc=This tool must be used only by experienced users or developers. It provides utilities to build or edit your own module. Documentation for alternative manual development is here.
EnterNameOfModuleDesc=Enter name of the module/application to create with no spaces. Use uppercase to separate words (For example: MyModule, EcommerceForShop, SyncWithMySystem...)
EnterNameOfObjectDesc=Enter name of the object to create with no spaces. Use uppercase to separate words (For example: MyObject, Student, Teacher...). The CRUD class file, but also API file, pages to list/add/edit/delete object and SQL files will be generated.
ModuleBuilderDesc2=Path where modules are generated/edited (first directory for external modules defined into %s): %s
@@ -21,13 +21,14 @@ ModuleBuilderDesctriggers=This is the view of triggers provided by your module.
ModuleBuilderDeschooks=This tab is dedicated to hooks.
ModuleBuilderDescwidgets=This tab is dedicated to manage/build widgets.
ModuleBuilderDescbuildpackage=You can generate here a "ready to distribute" package file (a normalized .zip file) of your module and a "ready to distribute" documentation file. Just click on button to build the package or documentation file.
-EnterNameOfModuleToDeleteDesc=You can delete your module. WARNING: ALL files of module AND structured data and documentation will be deleted!
-EnterNameOfObjectToDeleteDesc=You can delete an object. WARNING: All files related to object will be deleted!
+EnterNameOfModuleToDeleteDesc=You can delete your module. WARNING: All coding files of module (generated or created manually) AND structured data and documentation will be deleted!
+EnterNameOfObjectToDeleteDesc=You can delete an object. WARNING: All coding files (generated or created manually) related to object will be deleted!
DangerZone=Danger zone
BuildPackage=Build package
+BuildPackageDesc=You can generate a zip package or your application so your are ready to distribute it on any Dolibarr. You can also distribute it or sell it on marketplace like DoliStore.com.
BuildDocumentation=Build documentation
ModuleIsNotActive=This module is not activated yet. Go to %s to make it live or click here:
-ModuleIsLive=This module has been activated. Any change on it may break a current active feature.
+ModuleIsLive=This module has been activated. Any change may break a current live feature.
DescriptionLong=Long description
EditorName=Name of editor
EditorUrl=URL of editor
@@ -43,10 +44,11 @@ PathToModulePackage=Path to zip of module/application package
PathToModuleDocumentation=Path to file of module/application documentation (%s)
SpaceOrSpecialCharAreNotAllowed=Spaces or special characters are not allowed.
FileNotYetGenerated=File not yet generated
-RegenerateClassAndSql=Erase and regenerate class and sql files
+RegenerateClassAndSql=Force update of .class and .sql files
RegenerateMissingFiles=Generate missing files
SpecificationFile=File of documentation
LanguageFile=File for language
+ObjectProperties=Object Properties
ConfirmDeleteProperty=Are you sure you want to delete the property %s? This will change code in PHP class but also remove column from table definition of object.
NotNull=Not NULL
NotNullDesc=1=Set database to NOT NULL. -1=Allow null values and force value to NULL if empty ('' or 0).
@@ -62,7 +64,8 @@ ReadmeFile=Readme file
ChangeLog=ChangeLog file
TestClassFile=File for PHP Unit Test class
SqlFile=Sql file
-PageForLib=File for PHP libraries
+PageForLib=File for PHP library
+PageForObjLib=File for PHP library dedicated to object
SqlFileExtraFields=Sql file for complementary attributes
SqlFileKey=Sql file for keys
AnObjectAlreadyExistWithThisNameAndDiffCase=An object already exists with this name and a different case
@@ -81,8 +84,10 @@ IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Ex
SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0)
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.
LanguageDefDesc=Enter in this files, all the key and the translation for each language file.
-MenusDefDesc=Define here the menus provided by your module (once defined, they are visible into the menu editor %s)
-PermissionsDefDesc=Define here the new permissions provided by your module (once defined, they are visible into the default permissions setup %s)
+MenusDefDesc=Define here the menus provided by your module
+PermissionsDefDesc=Define here the new permissions provided by your module
+MenusDefDescTooltip=The menus provided by your module/application are defined into the array $this->menus into the module descriptor file. You can edit manually this file or use the embedded editor.
Note: Once defined (and module re-activated), menus are also visible into the menu editor available to administrator users on %s.
+PermissionsDefDescTooltip=The permissions provided by your module/application are defined into the array $this->rights into the module descriptor file. You can edit manually this file or use the embedded editor.
Note: Once defined (and module re-activated), permissions are visible into the default permissions setup %s.
HooksDefDesc=Define in the module_parts['hooks'] property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on 'initHooks(' in core code). Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on 'executeHooks' in core code).
TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed.
SeeIDsInUse=See IDs in use in your installation
@@ -109,4 +114,5 @@ UseSpecificEditorName = Use a specific editor name
UseSpecificEditorURL = Use a specific editor URL
UseSpecificFamily = Use a specific family
UseSpecificAuthor = Use a specific author
-UseSpecificVersion = Use a specific initial version
\ No newline at end of file
+UseSpecificVersion = Use a specific initial version
+ModuleMustBeEnabled=The module/application must be enabled first
\ No newline at end of file
diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang
index 8265df1b370..c84dc17f087 100644
--- a/htdocs/langs/en_US/ticket.lang
+++ b/htdocs/langs/en_US/ticket.lang
@@ -58,9 +58,10 @@ Notify_TICKET_SENTBYMAIL=Send ticket message by email
# Status
NotRead=Not read
Read=Read
-Answered=Answered
Assigned=Assigned
InProgress=In progress
+NeedMoreInformation=Waiting more information
+Answered=Answered
Waiting=Waiting
Closed=Closed
Deleted=Deleted
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 0e80c0ba4ac..0ad297221be 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -156,8 +156,7 @@ if ($dirins && $action == 'initmodule' && $modulename)
dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php');
dol_delete_dir($destdir.'/scripts');
-
- // Delete some files related to Object (because the dolCopyDir has copied everything)
+ // Delete some files related to Object (because the previous dolCopyDir has copied everything)
dol_delete_file($destdir.'/myobject_card.php');
dol_delete_file($destdir.'/myobject_note.php');
dol_delete_file($destdir.'/myobject_document.php');
@@ -222,6 +221,39 @@ if ($dirins && $action == 'initmodule' && $modulename)
}
}
+if ($dirins && $action == 'initapi' && !empty($module))
+{
+ dol_mkdir($dirins.'/'.strtolower($module).'/class');
+ $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
+ $srcfile = $srcdir.'/class/api_mymodule.class.php';
+ $destfile = $dirins.'/'.strtolower($module).'/class/api_'.strtolower($module).'.class.php';
+ //var_dump($srcfile);var_dump($destfile);
+ $result = dol_copy($srcfile, $destfile, 0, 0);
+
+ if ($result > 0)
+ {
+ $modulename = ucfirst($module); // Force first letter in uppercase
+ $objectname = $tabobj;
+
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement=array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ 'myobject'=>strtolower($objectname),
+ 'MyObject'=>$objectname,
+ 'MYOBJECT'=>strtoupper($objectname),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
+ );
+
+ dolReplaceInFile($destfile, $arrayreplacement);
+ }
+}
if ($dirins && $action == 'inithook' && !empty($module))
{
dol_mkdir($dirins.'/'.strtolower($module).'/class');
@@ -230,6 +262,26 @@ if ($dirins && $action == 'inithook' && !empty($module))
$destfile = $dirins.'/'.strtolower($module).'/class/actions_'.strtolower($module).'.class.php';
//var_dump($srcfile);var_dump($destfile);
$result = dol_copy($srcfile, $destfile, 0, 0);
+
+ if ($result > 0)
+ {
+ $modulename = ucfirst($module); // Force first letter in uppercase
+
+ //var_dump($phpfileval['fullname']);
+ $arrayreplacement=array(
+ 'mymodule'=>strtolower($modulename),
+ 'MyModule'=>$modulename,
+ 'MYMODULE'=>strtoupper($modulename),
+ 'My module'=>$modulename,
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template'=>strtolower($modulename),
+ '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
+ );
+
+ dolReplaceInFile($destfile, $arrayreplacement);
+ }
}
if ($dirins && $action == 'inittrigger' && !empty($module))
{
@@ -500,10 +552,10 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
- 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
+ //'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php',
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
- 'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php'
+ //'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php'
);
foreach($filetogenerate as $srcfile => $destfile)
@@ -524,8 +576,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
}
}
- if (! $error)
- {
+ //if (! $error) // If there is error copying 1 file, we still have to make the replacement
+ //{
// Scan for object class files
$listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$');
@@ -536,6 +588,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
if (preg_match('/^actions_/', $fileobj['name'])) continue;
$tmpcontent=file_get_contents($fileobj['fullname']);
+ $reg=array();
if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg))
{
$objectnameloop = $reg[1];
@@ -587,7 +640,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
// TODO
}
- }
+ //}
}
if (! $error)
@@ -730,11 +783,11 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj))
}
}
- if (GETPOST('regeneratemissing'))
+ /*if (GETPOST('regeneratemissing'))
{
setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'warnings');
$error++;
- }
+ }*/
// Edit the class file to write properties
if (! $error)
@@ -760,7 +813,7 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj))
clearstatcache(true);
// Make a redirect to reload all data
- header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname.'&nocache='.time());
+ header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname.'&nocache='.time());
exit;
}
@@ -795,7 +848,7 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey)
clearstatcache(true);
// Make a redirect to reload all data
- header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname);
+ header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname);
exit;
}
@@ -1030,9 +1083,9 @@ if ($action == 'savefile' && empty($cancel))
if ($action == 'set' && $user->admin)
{
$param='';
- if ($module) $param.='&module='.$module;
- if ($tab) $param.='&tab='.$tab;
- if ($tabobj) $param.='&tabobj='.$tabobj;
+ if ($module) $param.='&module='.urlencode($module);
+ if ($tab) $param.='&tab='.urlencode($tab);
+ if ($tabobj) $param.='&tabobj='.urlencode($tabobj);
$value = GETPOST('value', 'alpha');
$resarray = activateModule($value);
@@ -1065,9 +1118,9 @@ if ($action == 'set' && $user->admin)
if ($action == 'reset' && $user->admin)
{
$param='';
- if ($module) $param.='&module='.$module;
- if ($tab) $param.='&tab='.$tab;
- if ($tabobj) $param.='&tabobj='.$tabobj;
+ if ($module) $param.='&module='.urlencode($module);
+ if ($tab) $param.='&tab='.urlencode($tab);
+ if ($tabobj) $param.='&tabobj='.urlencode($tabobj);
$value = GETPOST('value', 'alpha');
$result=unActivateModule($value);
@@ -1105,7 +1158,7 @@ $text=$langs->trans("ModuleBuilder");
print load_fiche_titre($text, '', 'title_setup');
-print $langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').' ';
+print ''.$langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').' ';
$dirsrootforscan=array($dirread);
if ($dirread != DOL_DOCUMENT_ROOT && $conf->global->MAIN_FEATURES_LEVEL >=2) { $dirsrootforscan[]=DOL_DOCUMENT_ROOT; }
@@ -1310,9 +1363,9 @@ elseif (! empty($module))
$const_name = 'MAIN_MODULE_'.strtoupper($module);
$param='';
- if ($tab) $param.= '&tab='.$tab;
- if ($module) $param.='&module='.$module;
- if ($tabobj) $param.='&tabobj='.$tabobj;
+ if ($tab) $param.='&tab='.urlencode($tab);
+ if ($module) $param.='&module='.urlencode($module);
+ if ($tabobj) $param.='&tabobj='.urlencode($tabobj);
$urltomodulesetup=''.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'';
$linktoenabledisable='';
@@ -1595,8 +1648,8 @@ elseif (! empty($module))
{
$pathtofile = $modulelowercase.'/langs/'.$langfile['relativename'];
print '