'."\n";
// Filters lines
print '';
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index c325aae4854..bb4f41861ec 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -155,6 +155,9 @@ $permissiontoadd = $user->rights->expensereport->creer; // Used by the include o
/*
* Actions
*/
+$value_unit_ht = price2num(GETPOST('value_unit_ht', 'alpha'), 'MU');
+$value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU');
+$qty = price2num(GETPOST('qty', 'alpha'));
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -2370,14 +2373,14 @@ if ($action == 'create') {
print '';
// VAT
- $selectedvat = price2num($line->vatrate).($line->vat_src_code ? ' ('.$line->vat_src_code.')' : '');
+ $selectedvat = price2num($line->vatrate).(!empty($line->vat_src_code) ? ' ('.$line->vat_src_code.')' : '');
print '';
print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1);
print ' ';
// Unit price
print '';
- print ' ';
+ print ' ';
print ' ';
// Unit price with tax
@@ -2521,19 +2524,19 @@ if ($action == 'create') {
// Select date
print '';
- print $form->selectDate($date ? $date : -1, 'date', 0, 0, 0, '', 1, 1);
+ print $form->selectDate(!empty($date) ? $date : -1, 'date', 0, 0, 0, '', 1, 1);
print ' ';
// Select project
if (isModEnabled('project')) {
print '';
- $formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300');
+ $formproject->select_projects(-1, !empty($fk_project) ? $fk_project : 0, 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300');
print ' ';
}
// Select type
print '';
- print $formexpensereport->selectTypeExpenseReport($fk_c_type_fees, 'fk_c_type_fees', 1);
+ print $formexpensereport->selectTypeExpenseReport(!empty($fk_c_type_fees) ? $fk_c_type_fees : "", 'fk_c_type_fees', 1);
print ' ';
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
@@ -2545,7 +2548,7 @@ if ($action == 'create') {
// Add comments
print '';
// Select VAT
@@ -2554,22 +2557,22 @@ if ($action == 'create') {
if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) {
$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
}
- print $form->load_tva('vatrate', ($vatrate != '' ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1);
+ print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1);
print '';
// Unit price net
print '';
- print ' ';
+ print ' ';
print ' ';
// Unit price with tax
print '';
- print ' ';
+ print ' ';
print ' ';
// Quantity
print '';
- print ' '; // We must be able to enter decimal qty
+ print ' '; // We must be able to enter decimal qty
print ' ';
// Picture
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index e0799a46f73..a1afcef74a2 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -771,6 +771,7 @@ class ExpenseReport extends CommonObject
$sql .= " f.date_valid as datev,";
$sql .= " f.date_approve as datea,";
$sql .= " f.fk_user_creat as fk_user_creation,";
+ $sql .= " f.fk_user_author as fk_user_author,";
$sql .= " f.fk_user_modif as fk_user_modification,";
$sql .= " f.fk_user_valid,";
$sql .= " f.fk_user_approve";
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 38a9f051288..770276e96b8 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -836,7 +836,7 @@ class CommandeFournisseur extends CommonOrder
$label = '';
- if ($user->rights->fournisseur->commande->lire) {
+ if ($user->hasRight("fournisseur", "commande", "read")) {
$label = ''.$langs->trans("SupplierOrder").' ';
if (isset($this->statut)) {
$label .= ' '.$this->getLibStatut(5);
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 3db5ef13ef5..15e1ea41c2b 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -1857,7 +1857,7 @@ if ($step == 5 && $datatoimport) {
//dol_syslog("line ".$sourcelinenb.' - '.$nboflines.' - '.$excludefirstline.' - '.$endatlinenb);
$arrayrecord = $obj->import_read_record();
if ($arrayrecord === false) {
- $arrayofwarnings[$sourcelinenb][0] = array('lib'=>'File has '.$nboflines.' lines. However we reach end of file after record '.$sourcelinenb.'. This may occurs when some records are split onto several lines. Ensure the complete string is delimited correctly when there is a separator character in the text string.', 'type'=>'EOF_RECORD_ON_SEVERAL_LINES');
+ $arrayofwarnings[$sourcelinenb][0] = array('lib'=>'File has '.$nboflines.' lines. However we reach the end of file or an empty line at record '.$sourcelinenb.'. This may occurs when some records are split onto several lines and not correctly delimited by the "Char delimiter", or if there is line with no data on all fields.', 'type'=>'EOF_RECORD_ON_SEVERAL_LINES');
$endoffile++;
continue;
}
@@ -1910,8 +1910,8 @@ if ($step == 5 && $datatoimport) {
print ' ';
print '';
print '
'.$langs->trans("ResultOfSimulationNoError").'
';
- print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'
';
- print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'
';
+ print $langs->trans("NbInsertSim", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'
';
+ print $langs->trans("NbUpdateSim", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'
';
print '
';
print ' ';
} else {
@@ -2242,7 +2242,7 @@ if ($step == 6 && $datatoimport) {
$sourcelinenb++;
$arrayrecord = $obj->import_read_record();
if ($arrayrecord === false) {
- $arrayofwarnings[$sourcelinenb][0] = array('lib'=>'File has '.$nboflines.' lines. However we reach end of file after record '.$sourcelinenb.'. This may occurs when some records are split onto several lines.', 'type'=>'EOF_RECORD_ON_SEVERAL_LINES');
+ $arrayofwarnings[$sourcelinenb][0] = array('lib'=>'File has '.$nboflines.' lines. However we reach the end of file or an empty line at record '.$sourcelinenb.'. This may occurs when some records are split onto several lines and not correctly delimited by the "Char delimiter", or if there is line with no data on all fields.', 'type'=>'EOF_RECORD_ON_SEVERAL_LINES');
$endoffile++;
continue;
}
diff --git a/htdocs/install/doctemplates/websites/website_template-style02.zip b/htdocs/install/doctemplates/websites/website_template-style02.zip
new file mode 100644
index 00000000000..4a5a0a7eacb
Binary files /dev/null and b/htdocs/install/doctemplates/websites/website_template-style02.zip differ
diff --git a/htdocs/install/doctemplates/websites/website_template-style03.zip b/htdocs/install/doctemplates/websites/website_template-style03.zip
index f2a7684cc4e..18266bd18d9 100644
Binary files a/htdocs/install/doctemplates/websites/website_template-style03.zip and b/htdocs/install/doctemplates/websites/website_template-style03.zip differ
diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
index 84cd1b5665c..874dcb66f1b 100644
--- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
+++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
@@ -178,3 +178,8 @@ ALTER TABLE llx_element_categorie ADD UNIQUE INDEX idx_element_categorie_idx (fk
ALTER TABLE llx_element_categorie ADD CONSTRAINT fk_element_categorie_fk_categorie FOREIGN KEY (fk_categorie) REFERENCES llx_categorie(rowid);
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144);
+
+ALTER TABLE llx_socpeople ADD INDEX idx_socpeople_lastname (lastname);
+
+ALTER TABLE llx_societe ADD INDEX idx_societe_nom(nom);
+
diff --git a/htdocs/install/mysql/tables/llx_societe.key.sql b/htdocs/install/mysql/tables/llx_societe.key.sql
index 3a2c9540229..58701e4a7f9 100644
--- a/htdocs/install/mysql/tables/llx_societe.key.sql
+++ b/htdocs/install/mysql/tables/llx_societe.key.sql
@@ -23,6 +23,8 @@ ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_code_fournisseur(code_fourni
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_barcode (barcode, fk_barcode_type, entity);
+ALTER TABLE llx_societe ADD INDEX idx_societe_nom(nom);
+
ALTER TABLE llx_societe ADD INDEX idx_societe_user_creat(fk_user_creat);
ALTER TABLE llx_societe ADD INDEX idx_societe_user_modif(fk_user_modif);
diff --git a/htdocs/install/mysql/tables/llx_socpeople.key.sql b/htdocs/install/mysql/tables/llx_socpeople.key.sql
index 4d2a453e0fa..36e2b7b7d1c 100644
--- a/htdocs/install/mysql/tables/llx_socpeople.key.sql
+++ b/htdocs/install/mysql/tables/llx_socpeople.key.sql
@@ -20,5 +20,7 @@
ALTER TABLE llx_socpeople ADD INDEX idx_socpeople_fk_soc (fk_soc);
ALTER TABLE llx_socpeople ADD INDEX idx_socpeople_fk_user_creat (fk_user_creat);
+ALTER TABLE llx_socpeople ADD INDEX idx_socpeople_lastname (lastname);
+
ALTER TABLE llx_socpeople ADD CONSTRAINT fk_socpeople_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_socpeople ADD CONSTRAINT fk_socpeople_user_creat_user_rowid FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php
index daa0d7b148d..d9fc25fa1fe 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_list.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_list.php
@@ -246,9 +246,6 @@ $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
-if (!empty($searchCategoryKnowledgemanagementList) || !empty($catid)) {
- $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_knowledgemanagement as ck ON t.rowid = ck.fk_knowledgemanagement"; // We'll need this table joined to the select in order to filter by categ
-}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -287,29 +284,29 @@ foreach ($search as $key => $val) {
}
}
}
-//Search for tag/category
-$searchCategoryKnowledgemanagementSqlList = array();
-if ($searchCategoryKnowledgemanagementOperator == 1) {
+
+// Search for tag/category ($searchCategoryKnowledgemanagementList is an array of ID)
+if (!empty($searchCategoryKnowledgemanagementList)) {
+ $searchCategoryKnowledgemanagementSqlList = array();
+ $listofcategoryid = '';
foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
if (intval($searchCategoryKnowledgemanagement) == -2) {
- $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL";
+ $searchCategoryKnowledgemanagementSqlList[] = "NOT EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement)";
} elseif (intval($searchCategoryKnowledgemanagement) > 0) {
- $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie = ".$db->escape($searchCategoryKnowledgemanagement);
+ $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryKnowledgemanagement);
}
}
- if (!empty($searchCategoryKnowledgemanagementSqlList)) {
- $sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")";
+ if ($listofcategoryid) {
+ $searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
-} else {
- foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
- if (intval($searchCategoryKnowledgemanagement) == -2) {
- $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL";
- } elseif (intval($searchCategoryKnowledgemanagement) > 0) {
- $searchCategoryKnowledgemanagementSqlList[] = "t.rowid IN (SELECT fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement WHERE fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")";
+ if ($searchCategoryKnowledgemanagementOperator == 1) {
+ if (!empty($searchCategoryKnowledgemanagementSqlList)) {
+ $sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")";
+ }
+ } else {
+ if (!empty($searchCategoryKnowledgemanagementSqlList)) {
+ $sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")";
}
- }
- if (!empty($searchCategoryKnowledgemanagementSqlList)) {
- $sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")";
}
}
diff --git a/htdocs/langs/HOWTO-Translation.txt b/htdocs/langs/HOWTO-Translation.txt
index 0a05133fdb8..7e7d3c68af1 100644
--- a/htdocs/langs/HOWTO-Translation.txt
+++ b/htdocs/langs/HOWTO-Translation.txt
@@ -3,7 +3,8 @@
An instruction guide for translating Dolibarr in a new language is
available on Dolibarr wiki:
-English: https://wiki.dolibarr.org/index.php/Translator_documentation
-French: https://wiki.dolibarr.org/index.php/Documentation_traducteur
-Spanish: https://wiki.dolibarr.org/index.php/Documentaci%C3%B3n_traductores
-German: https://wiki.dolibarr.org/index.php/Dokumentation_Uebersetzung
+English: https://wiki.dolibarr.org/index.php/Translator_documentation
+French: https://wiki.dolibarr.org/index.php/Documentation_traducteur
+Spanish: https://wiki.dolibarr.org/index.php/Documentaci%C3%B3n_traductores
+German: https://wiki.dolibarr.org/index.php/Dokumentation_Uebersetzung
+Chinese: https://wiki.dolibarr.org/index.php/%E7%BF%BB%E8%AF%91%E6%96%87%E6%A1%A3
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index e53220e661d..d0e32e480d9 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -294,6 +294,7 @@ ErrorFailedToLoadThirdParty=Failed to find/load thirdparty from id=%s, email=%s,
ErrorThisPaymentModeIsNotSepa=This payment mode is not a bank account
ErrorStripeCustomerNotFoundCreateFirst=Stripe customer is not set for this thirdparty (or set to a value deleted on Stripe side). Create (or re-attach) it first.
ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into sender or recipient for a string containing the character +
+ErrorTableNotFound=Table %s not found
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang
index c4c629c9a87..668b5dd7c9d 100644
--- a/htdocs/langs/en_US/exports.lang
+++ b/htdocs/langs/en_US/exports.lang
@@ -134,7 +134,9 @@ FormatControlRule=Format control rule
## imports updates
KeysToUseForUpdates=Key (column) to use for updating existing data
NbInsert=Number of inserted lines: %s
+NbInsertSim=Number of lines that will be inserted: %s
NbUpdate=Number of updated lines: %s
+NbUpdateSim=Number of lines that will be updated : %s
MultipleRecordFoundWithTheseFilters=Multiple records have been found with these filters: %s
StocksWithBatch=Stocks and location (warehouse) of products with batch/serial number
WarningFirstImportedLine=The first line(s) will not be imported with the current selection
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index c7ca26ee149..0e11bef2bf1 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -133,11 +133,11 @@ UseSpecificEditorURL = Use a specific editor URL
UseSpecificFamily = Use a specific family
UseSpecificAuthor = Use a specific author
UseSpecificVersion = Use a specific initial version
-IncludeRefGeneration=The reference of object must be generated automatically by custom numbering rules
+IncludeRefGeneration=The reference of this object must be generated automatically by custom numbering rules
IncludeRefGenerationHelp=Check this if you want to include code to manage the generation of the reference automatically using custom numbering rules
-IncludeDocGeneration=I want to generate some documents from templates for the object
+IncludeDocGeneration=I want the feature to generate some documents (PDF, ODT) from templates for this object
IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record.
-ShowOnCombobox=Show value into combobox
+ShowOnCombobox=Show value into combo boxes
KeyForTooltip=Key for tooltip
CSSClass=CSS for edit/create form
CSSViewClass=CSS for read form
@@ -156,4 +156,7 @@ LinkToParentMenu=Parent menu (fk_xxxxmenu)
ListOfTabsEntries=List of tab entries
TabsDefDesc=Define here the tabs provided by your module
TabsDefDescTooltip=The tabs provided by your module/application are defined into the array $this->tabs into the module descriptor file. You can edit manually this file or use the embedded editor.
-BadValueForType=Bad value for type %s
\ No newline at end of file
+BadValueForType=Bad value for type %s
+DefinePropertiesFromExistingTable=Define properties from an existing table
+DefinePropertiesFromExistingTableDesc=If a table in the database (for the object to create) already exists, you can use it to define the properties of the object.
+DefinePropertiesFromExistingTableDesc2=Keep empty if the table does not exist yet. The code generator will use different kinds of fields to build an example of table that you can edit later.
diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang
index 9210ede360c..9f51df0bf56 100644
--- a/htdocs/langs/en_US/trips.lang
+++ b/htdocs/langs/en_US/trips.lang
@@ -38,39 +38,6 @@ TripSociete=Information company
TripNDF=Informations expense report
PDFStandardExpenseReports=Standard template to generate a PDF document for expense report
ExpenseReportLine=Expense report line
-TF_OTHER=Other
-TF_TRIP=Transportation
-TF_LUNCH=Lunch
-TF_METRO=Metro
-TF_TRAIN=Train
-TF_BUS=Bus
-TF_CAR=Car
-TF_PEAGE=Toll
-TF_ESSENCE=Fuel
-TF_HOTEL=Hotel
-TF_TAXI=Taxi
-EX_KME=Mileage costs
-EX_FUE=Fuel CV
-EX_HOT=Hotel
-EX_PAR=Parking CV
-EX_TOL=Toll CV
-EX_TAX=Various Taxes
-EX_IND=Indemnity transportation subscription
-EX_SUM=Maintenance supply
-EX_SUO=Office supplies
-EX_CAR=Car rental
-EX_DOC=Documentation
-EX_CUR=Customers receiving
-EX_OTR=Other receiving
-EX_POS=Postage
-EX_CAM=CV maintenance and repair
-EX_EMM=Employees meal
-EX_GUM=Guests meal
-EX_BRE=Breakfast
-EX_FUE_VP=Fuel PV
-EX_TOL_VP=Toll PV
-EX_PAR_VP=Parking PV
-EX_CAM_VP=PV maintenance and repair
DefaultCategoryCar=Default transportation mode
DefaultRangeNumber=Default range number
UploadANewFileNow=Upload a new document now
@@ -148,3 +115,38 @@ CarCategory=Vehicle category
ExpenseRangeOffset=Offset amount: %s
RangeIk=Mileage range
AttachTheNewLineToTheDocument=Attach the line to an uploaded document
+
+## Dictionary
+EX_BRE=Breakfast
+EX_CAM=CV maintenance and repair
+EX_CAM_VP=PV maintenance and repair
+EX_CAR=Car rental
+EX_CUR=Customers receiving
+EX_DOC=Documentation
+EX_EMM=Employees meal
+EX_FUE=Fuel CV
+EX_FUE_VP=Fuel PV
+EX_GUM=Guests meal
+EX_HOT=Hotel
+EX_IND=Indemnity transportation subscription
+EX_KME=Mileage costs
+EX_OTR=Other receiving
+EX_PAR=Parking CV
+EX_PAR_VP=Parking PV
+EX_POS=Postage
+EX_SUM=Maintenance supply
+EX_SUO=Office supplies
+EX_TAX=Various Taxes
+EX_TOL=Toll CV
+EX_TOL_VP=Toll PV
+TF_BUS=Bus
+TF_CAR=Car
+TF_ESSENCE=Fuel
+TF_HOTEL=Hotel
+TF_LUNCH=Lunch
+TF_METRO=Metro
+TF_OTHER=Other
+TF_PEAGE=Toll
+TF_TAXI=Taxi
+TF_TRAIN=Train
+TF_TRIP=Transportation
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 6865e4b8bf4..6f010215df3 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -850,7 +850,7 @@ if (!defined('NOLOGIN')) {
// End test login / passwords
if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
// No data to test login, so we show the login page.
- dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." - action=".GETPOST('action', 'aZ09')." - actionlogin=".GETPOST('actionlogin', 'aZ09')." - showing the login form and exit", LOG_INFO);
+ dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." - action=".GETPOST('action', 'aZ09')." - actionlogin=".GETPOST('actionlogin', 'aZ09')." - showing the login form and exit", LOG_NOTICE);
if (defined('NOREDIRECTBYMAINTOLOGIN')) {
// When used with NOREDIRECTBYMAINTOLOGIN set, the http header must already be set when including the main.
// See example with selectsearchbox.php. This case is reserverd for the selectesearchbox.php so we can
diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php
index 2a4b1072e87..107189e5181 100644
--- a/htdocs/margin/tabs/productMargins.php
+++ b/htdocs/margin/tabs/productMargins.php
@@ -74,7 +74,9 @@ if (empty($user->rights->margins->liretous)) {
$invoicestatic = new Facture($db);
$form = new Form($db);
-
+$totalMargin = 0;
+$marginRate = 0;
+$markRate = 0;
if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
@@ -136,7 +138,7 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_end();
- if ($user->rights->facture->lire) {
+ if ($user->hasRight("facture", "read")) {
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client,";
$sql .= " f.rowid as facid, f.ref, f.total_ht,";
$sql .= " f.datef, f.paye, f.fk_statut as statut, f.type,";
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 8441dd530ee..1c30d709576 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -202,10 +202,10 @@ foreach ($dirsrootforscan as $dirread) {
}
$textforlistofdirs .= ''.$dirread.' ';
if ($dirread == DOL_DOCUMENT_ROOT) {
- if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$textforlistofdirs .= $form->textwithpicto('', $langs->trans("ConstantIsOn", "MAIN_FEATURES_LEVEL"));
}
- if (!empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT)) {
+ if (getDolGlobalString('MODULEBUILDER_ADD_DOCUMENT_ROOT')) {
$textforlistofdirs .= $form->textwithpicto('', $langs->trans("ConstantIsOn", "MODULEBUILDER_ADD_DOCUMENT_ROOT"));
}
}
@@ -317,7 +317,6 @@ if ($dirins && $action == 'initmodule' && $modulename) {
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql');
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql');
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.key.sql');
- dol_delete_file($destdir.'/img/object_myobject.png');
dol_delete_file($destdir.'/class/myobject.class.php');
dol_delete_dir($destdir.'/class', 1);
@@ -895,237 +894,7 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) {
}
}
-
-// Build the $fields array from SQL table (initfromtablename)
-if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', 'alpha')) {
- $tablename = GETPOST('initfromtablename', 'alpha');
- $_results = $db->DDLDescTable($tablename);
- if (empty($_results)) {
- setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors');
- } else {
- /**
- * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
- * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
- * 'label' the translation key.
- * 'picto' is code of a picto to show before value in forms
- * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...)
- * 'position' is the sort order of field.
- * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
- * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
- * 'noteditable' says if field is not editable (1 or 0)
- * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
- * 'index' if we want an index in database.
- * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
- * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
- * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage)
- * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
- * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
- * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
- * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
- * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar'
- * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
- * 'comment' is not used. You can store here any text of your choice. It is not used by application.
- * 'validate' is 1 if need to validate with $this->validateField()
- * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value)
- */
-
- /*public $fields=array(
- 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
- 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
- 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
- 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text'),
- 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>'LinkToThirdparty'),
- 'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
- 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
- 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
- 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
- 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
- //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
- 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510),
- 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
- //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
- 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
- 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
- );*/
-
- $string = 'public $fields=array('."\n";
- $string .= " ";
- $i = 10;
- while ($obj = $db->fetch_object($_results)) {
- // fieldname
- $fieldname = $obj->Field;
- // type
- $type = $obj->Type;
- if ($type == 'int(11)') {
- $type = 'integer';
- }
- if ($type == 'float') {
- $type = 'real';
- }
- if (strstr($type, 'tinyint')) {
- $type = 'integer';
- }
- if ($obj->Field == 'fk_soc') {
- $type = 'integer:Societe:societe/class/societe.class.php';
- }
- if (preg_match('/^fk_proj/', $obj->Field)) {
- $type = 'integer:Project:projet/class/project.class.php:1:fk_statut=1';
- }
- if (preg_match('/^fk_prod/', $obj->Field)) {
- $type = 'integer:Product:product/class/product.class.php:1';
- }
- if ($obj->Field == 'fk_warehouse') {
- $type = 'integer:Entrepot:product/stock/class/entrepot.class.php';
- }
- if (preg_match('/^(fk_user|fk_commercial)/', $obj->Field)) {
- $type = 'integer:User:user/class/user.class.php';
- }
-
- // notnull
- $notnull = ($obj->Null == 'YES' ? 0 : 1);
- if ($fieldname == 'fk_user_modif') {
- $notnull = -1;
- }
- // label
- $label = preg_replace('/_/', '', ucfirst($fieldname));
- if ($fieldname == 'rowid') {
- $label = 'TechnicalID';
- }
- if ($fieldname == 'import_key') {
- $label = 'ImportId';
- }
- if ($fieldname == 'fk_soc') {
- $label = 'ThirdParty';
- }
- if ($fieldname == 'tms') {
- $label = 'DateModification';
- }
- if ($fieldname == 'datec') {
- $label = 'DateCreation';
- }
- if ($fieldname == 'date_valid') {
- $label = 'DateValidation';
- }
- if ($fieldname == 'datev') {
- $label = 'DateValidation';
- }
- if ($fieldname == 'note_private') {
- $label = 'NotePublic';
- }
- if ($fieldname == 'note_public') {
- $label = 'NotePrivate';
- }
- if ($fieldname == 'fk_user_creat') {
- $label = 'UserAuthor';
- }
- if ($fieldname == 'fk_user_modif') {
- $label = 'UserModif';
- }
- if ($fieldname == 'fk_user_valid') {
- $label = 'UserValidation';
- }
- // visible
- $visible = -1;
- if ($fieldname == 'entity') {
- $visible = -2;
- }
- if ($fieldname == 'import_key') {
- $visible = -2;
- }
- if ($fieldname == 'fk_user_creat') {
- $visible = -2;
- }
- if ($fieldname == 'fk_user_modif') {
- $visible = -2;
- }
- if (in_array($fieldname, array('ref_ext', 'model_pdf', 'note_public', 'note_private'))) {
- $visible = 0;
- }
- // enabled
- $enabled = 1;
- // default
- $default = '';
- if ($fieldname == 'entity') {
- $default = 1;
- }
- // position
- $position = $i;
- if (in_array($fieldname, array('status', 'statut', 'fk_status', 'fk_statut'))) {
- $position = 500;
- }
- if ($fieldname == 'import_key') {
- $position = 900;
- }
- // index
- $index = 0;
- if ($fieldname == 'entity') {
- $index = 1;
- }
- // css, cssview, csslist
- $css = '';
- $cssview = '';
- $csslist = '';
- if (preg_match('/^fk_/', $fieldname)) {
- $css = 'maxwidth500 widthcentpercentminusxx';
- }
- if ($fieldname == 'label') {
- $css = 'minwidth300';
- $cssview = 'wordbreak';
- }
- if (in_array($fieldname, array('note_public', 'note_private'))) {
- $cssview = 'wordbreak';
- }
-
- // type
- $picto = $obj->Picto;
- if ($obj->Field == 'fk_soc') {
- $picto = 'company';
- }
- if (preg_match('/^fk_proj/', $obj->Field)) {
- $picto = 'project';
- }
-
- // Build the property string
- $string .= "'".$obj->Field."'=>array('type'=>'".$type."', 'label'=>'".$label."',";
- if ($default != '') {
- $string .= " 'default'=>".$default.",";
- }
- $string .= " 'enabled'=>".$enabled.",";
- $string .= " 'visible'=>".$visible;
- if ($notnull) {
- $string .= ", 'notnull'=>".$notnull;
- }
- if ($fieldname == 'ref' || $fieldname == 'code') {
- $string .= ", 'showoncombobox'=>1";
- }
- $string .= ", 'position'=>".$position;
- if ($index) {
- $string .= ", 'index'=>".$index;
- }
- if ($picto) {
- $string .= ", 'picto'=>'".$picto."'";
- }
- if ($css) {
- $string .= ", 'css'=>".$css;
- }
- if ($cssview) {
- $string .= ", 'cssview'=>".$cssview;
- }
- if ($csslist) {
- $string .= ", 'csslist'=>".$csslist;
- }
- $string .= "),\n";
- $string .= " ";
- $i += 5;
- }
- $string .= ');'."\n";
- $string .= " ";
- print $string;
- exit;
- }
-}
-
+// Init an object
if ($dirins && $action == 'initobject' && $module && $objectname) {
$objectname = ucfirst($objectname);
@@ -1169,6 +938,247 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
}
}
+ // If we must reuse a table for properties, define $stringforproperties
+ $stringforproperties = '';
+ $tablename = GETPOST('initfromtablename', 'alpha');
+ if ($tablename) {
+ $_results = $db->DDLDescTable($tablename);
+ if (empty($_results)) {
+ $error++;
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors');
+ } else {
+ /**
+ * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
+ * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
+ * 'label' the translation key.
+ * 'picto' is code of a picto to show before value in forms
+ * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...)
+ * 'position' is the sort order of field.
+ * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
+ * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
+ * 'noteditable' says if field is not editable (1 or 0)
+ * 'alwayseditable' says if field can be modified also when status is not draft ('1' or '0')
+ * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
+ * 'index' if we want an index in database.
+ * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
+ * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
+ * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage)
+ * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
+ * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
+ * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
+ * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
+ * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar'
+ * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
+ * 'comment' is not used. You can store here any text of your choice. It is not used by application.
+ * 'validate' is 1 if need to validate with $this->validateField()
+ * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value)
+ */
+
+ /*public $fields=array(
+ 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
+ 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
+ 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
+ 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'alwayseditable'=>'1'),
+ 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>'LinkToThirdparty'),
+ 'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
+ 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
+ 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
+ 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
+ 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
+ //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
+ 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510),
+ 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
+ //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
+ 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
+ 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
+ );*/
+
+ $stringforproperties = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
+ $stringforproperties .= 'public $fields=array('."\n";
+ $i = 10;
+ while ($obj = $db->fetch_object($_results)) {
+ // fieldname
+ $fieldname = $obj->Field;
+ // type
+ $type = $obj->Type;
+ if ($type == 'int(11)') {
+ $type = 'integer';
+ }
+ if ($type == 'float') {
+ $type = 'real';
+ }
+ if (strstr($type, 'tinyint')) {
+ $type = 'integer';
+ }
+ if ($obj->Field == 'fk_soc') {
+ $type = 'integer:Societe:societe/class/societe.class.php';
+ }
+ if (preg_match('/^fk_proj/', $obj->Field)) {
+ $type = 'integer:Project:projet/class/project.class.php:1:fk_statut=1';
+ }
+ if (preg_match('/^fk_prod/', $obj->Field)) {
+ $type = 'integer:Product:product/class/product.class.php:1';
+ }
+ if ($obj->Field == 'fk_warehouse') {
+ $type = 'integer:Entrepot:product/stock/class/entrepot.class.php';
+ }
+ if (preg_match('/^(fk_user|fk_commercial)/', $obj->Field)) {
+ $type = 'integer:User:user/class/user.class.php';
+ }
+
+ // notnull
+ $notnull = ($obj->Null == 'YES' ? 0 : 1);
+ if ($fieldname == 'fk_user_modif') {
+ $notnull = -1;
+ }
+ // label
+ $label = preg_replace('/_/', '', ucfirst($fieldname));
+ if ($fieldname == 'rowid') {
+ $label = 'TechnicalID';
+ }
+ if ($fieldname == 'import_key') {
+ $label = 'ImportId';
+ }
+ if ($fieldname == 'fk_soc') {
+ $label = 'ThirdParty';
+ }
+ if ($fieldname == 'tms') {
+ $label = 'DateModification';
+ }
+ if ($fieldname == 'datec') {
+ $label = 'DateCreation';
+ }
+ if ($fieldname == 'date_valid') {
+ $label = 'DateValidation';
+ }
+ if ($fieldname == 'datev') {
+ $label = 'DateValidation';
+ }
+ if ($fieldname == 'note_private') {
+ $label = 'NotePublic';
+ }
+ if ($fieldname == 'note_public') {
+ $label = 'NotePrivate';
+ }
+ if ($fieldname == 'fk_user_creat') {
+ $label = 'UserAuthor';
+ }
+ if ($fieldname == 'fk_user_modif') {
+ $label = 'UserModif';
+ }
+ if ($fieldname == 'fk_user_valid') {
+ $label = 'UserValidation';
+ }
+ // visible
+ $visible = -1;
+ if ($fieldname == 'entity') {
+ $visible = -2;
+ }
+ if ($fieldname == 'import_key') {
+ $visible = -2;
+ }
+ if ($fieldname == 'fk_user_creat') {
+ $visible = -2;
+ }
+ if ($fieldname == 'fk_user_modif') {
+ $visible = -2;
+ }
+ if (in_array($fieldname, array('ref_ext', 'model_pdf', 'note_public', 'note_private'))) {
+ $visible = 0;
+ }
+ // enabled
+ $enabled = 1;
+ // default
+ $default = '';
+ if ($fieldname == 'entity') {
+ $default = 1;
+ }
+ // position
+ $position = $i;
+ if (in_array($fieldname, array('status', 'statut', 'fk_status', 'fk_statut'))) {
+ $position = 500;
+ }
+ if ($fieldname == 'import_key') {
+ $position = 900;
+ }
+ // $alwayseditable
+ if ($fieldname == 'label') {
+ $alwayseditable = 1;
+ }
+ // index
+ $index = 0;
+ if ($fieldname == 'entity') {
+ $index = 1;
+ }
+ // css, cssview, csslist
+ $css = '';
+ $cssview = '';
+ $csslist = '';
+ if (preg_match('/^fk_/', $fieldname)) {
+ $css = 'maxwidth500 widthcentpercentminusxx';
+ }
+ if ($fieldname == 'label') {
+ $css = 'minwidth300';
+ $cssview = 'wordbreak';
+ }
+ if (in_array($fieldname, array('note_public', 'note_private'))) {
+ $cssview = 'wordbreak';
+ }
+ if (in_array($fieldname, array('ref', 'label')) || preg_match('/integer:/', $type)) {
+ $csslist = 'tdoverflowmax150';
+ }
+
+ // type
+ $picto = $obj->Picto;
+ if ($obj->Field == 'fk_soc') {
+ $picto = 'company';
+ }
+ if (preg_match('/^fk_proj/', $obj->Field)) {
+ $picto = 'project';
+ }
+
+ // Build the property string
+ $stringforproperties .= "'".$obj->Field."'=>array('type'=>'".$type."', 'label'=>'".$label."',";
+ if ($default != '') {
+ $stringforproperties .= " 'default'=>".$default.",";
+ }
+ $stringforproperties .= " 'enabled'=>".$enabled.",";
+ $stringforproperties .= " 'visible'=>".$visible;
+ if ($notnull) {
+ $stringforproperties .= ", 'notnull'=>".$notnull;
+ }
+ if ($alwayseditable) {
+ $stringforproperties .= ", 'alwayseditable'=>1";
+ }
+ if ($fieldname == 'ref' || $fieldname == 'code') {
+ $stringforproperties .= ", 'showoncombobox'=>1";
+ }
+ $stringforproperties .= ", 'position'=>".$position;
+ if ($index) {
+ $stringforproperties .= ", 'index'=>".$index;
+ }
+ if ($picto) {
+ $stringforproperties .= ", 'picto'=>'".$picto."'";
+ }
+ if ($css) {
+ $stringforproperties .= ", 'css'=>'".$css."'";
+ }
+ if ($cssview) {
+ $stringforproperties .= ", 'cssview'=>'".$cssview."'";
+ }
+ if ($csslist) {
+ $stringforproperties .= ", 'csslist'=>'".$csslist."'";
+ }
+ $stringforproperties .= "),\n";
+ $i += 5;
+ }
+ $stringforproperties .= ');'."\n";
+ $stringforproperties .= '// END MODULEBUILDER PROPERTIES'."\n";
+ }
+ }
+
if (!$error) {
// Copy some files
$filetogenerate = array(
@@ -1186,7 +1196,6 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql',
//'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',
);
@@ -1210,20 +1219,33 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
);
}
- foreach ($filetogenerate as $srcfile => $destfile) {
- $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0);
- if ($result <= 0) {
- if ($result < 0) {
- $error++;
- $langs->load("errors");
- setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors');
- } else {
- // $result == 0
- setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings');
+
+ if (!$error) {
+ foreach ($filetogenerate as $srcfile => $destfile) {
+ $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0);
+ if ($result <= 0) {
+ if ($result < 0) {
+ $error++;
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors');
+ } else {
+ // $result == 0
+ setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings');
+ }
}
}
}
+ // Replace property section with $stringforproperties
+ if (!$error && $stringforproperties) {
+ //var_dump($stringforproperties);exit;
+ $arrayreplacement = array(
+ '/\/\/ BEGIN MODULEBUILDER PROPERTIES.*\/\/ END MODULEBUILDER PROPERTIES/ims' => $stringforproperties
+ );
+
+ dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1);
+ }
+
// Edit the class 'class/'.strtolower($objectname).'.class.php'
if (GETPOST('includerefgeneration', 'aZ09')) {
// Replace 'visible'=>1, 'noteditable'=>0, 'default'=>''
@@ -1386,14 +1408,19 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
if (!$error) {
// Edit the class file to write properties
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask);
- if (is_numeric($object) && $object < 0) {
+
+ if (is_numeric($object) && $object <= 0) {
+ $pathoffiletoeditsrc = $destdir.'/class/'.strtolower($objectname).'.class.php';
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $pathoffiletoeditsrc), null, 'errors');
$error++;
}
}
if (!$error) {
// Edit sql with new properties
$result = rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object);
- if ($result < 0) {
+
+ if ($result <= 0) {
+ setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null);
$error++;
}
}
@@ -1401,6 +1428,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
if (!$error) {
setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null);
$tabobj = $objectname;
+ } else {
+ $tabobj = 'newobject';
}
}
@@ -1485,25 +1514,26 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
if (!$error && !GETPOST('regenerateclasssql')&& !GETPOST('regeneratemissing')) {
$addfieldentry = array(
- 'name'=>GETPOST('propname', 'aZ09'),
- 'label'=>GETPOST('proplabel', 'alpha'),
- 'type'=>GETPOST('proptype', 'alpha'),
- 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
- 'visible'=>GETPOST('propvisible', 'int'),
- 'enabled'=>GETPOST('propenabled', 'int'),
- 'position'=>GETPOST('propposition', 'int'),
- 'notnull'=>GETPOST('propnotnull', 'int'),
- 'index'=>GETPOST('propindex', 'int'),
- 'searchall'=>GETPOST('propsearchall', 'int'),
- 'isameasure'=>GETPOST('propisameasure', 'int'),
- 'comment'=>GETPOST('propcomment', 'alpha'),
- 'help'=>GETPOST('prophelp', 'alpha'),
- 'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
- 'cssview'=>GETPOST('propcssview', 'alpha'),
- 'csslist'=>GETPOST('propcsslist', 'alpha'),
- 'default'=>GETPOST('propdefault', 'restricthtml'),
- 'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
- 'validate' => GETPOST('propvalidate', 'int')
+ 'name'=>GETPOST('propname', 'aZ09'),
+ 'label'=>GETPOST('proplabel', 'alpha'),
+ 'type'=>GETPOST('proptype', 'alpha'),
+ 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
+ 'visible'=>GETPOST('propvisible', 'int'),
+ 'enabled'=>GETPOST('propenabled', 'int'),
+ 'position'=>GETPOST('propposition', 'int'),
+ 'notnull'=>GETPOST('propnotnull', 'int'),
+ 'index'=>GETPOST('propindex', 'int'),
+ 'searchall'=>GETPOST('propsearchall', 'int'),
+ 'isameasure'=>GETPOST('propisameasure', 'int'),
+ 'comment'=>GETPOST('propcomment', 'alpha'),
+ 'help'=>GETPOST('prophelp', 'alpha'),
+ 'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
+ 'cssview'=>GETPOST('propcssview', 'alpha'),
+ 'csslist'=>GETPOST('propcsslist', 'alpha'),
+ 'default'=>GETPOST('propdefault', 'restricthtml'),
+ 'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
+ 'alwayseditable'=>intval(GETPOST('propalwayseditable', 'int')),
+ 'validate' => GETPOST('propvalidate', 'int')
);
@@ -1528,6 +1558,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype);
if (is_numeric($object) && $object <= 0) {
+ $pathoffiletoeditsrc = $destdir.'/class/'.strtolower($objectname).'.class.php';
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $pathoffiletoeditsrc), null, 'errors');
$error++;
}
}
@@ -1537,6 +1569,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype);
if ($result <= 0) {
+ setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null, 'errors');
$error++;
}
}
@@ -1568,7 +1601,10 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) {
// Edit the class file to write properties
if (!$error) {
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey);
+
if (is_numeric($object) && $object <= 0) {
+ $pathoffiletoeditsrc = $destdir.'/class/'.strtolower($objectname).'.class.php';
+ setEventMessages($langs->trans('ErrorFailToCreateFile', $pathoffiletoeditsrc), null, 'errors');
$error++;
}
}
@@ -1576,7 +1612,9 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) {
// Edit sql with new properties
if (!$error) {
$result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
+
if ($result <= 0) {
+ setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null, 'errors');
$error++;
}
}
@@ -1655,7 +1693,6 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql',
'scripts/myobject.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_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php',
'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php',
@@ -1934,7 +1971,7 @@ if ($message) {
}
//print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).' ';
-$infomodulesfound = ''.$form->textwithpicto(''.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).' ', $langs->trans("ModuleBuilderDesc4", $FILEFLAG).' '.$textforlistofdirs).'
';
+$infomodulesfound = ''.$form->textwithpicto('', $langs->trans("ModuleBuilderDesc3", count($listofmodules)).' '.$langs->trans("ModuleBuilderDesc4", $FILEFLAG).' '.$textforlistofdirs).'
';
// Load module descriptor
@@ -2013,8 +2050,10 @@ if (is_array($listofmodules) && count($listofmodules) > 0) {
}
$urltomodulesetup = ''.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").' ';
- if (!empty($conf->global->$const_name)) { // If module is already activated
- $linktoenabledisable .= 'numero.'&action=reset&value=mod'.$module.$param.'">';
+
+ // Define $linktoenabledisable to show after module title
+ if (isModEnabled($modulelowercase)) { // If module is already activated
+ $linktoenabledisable .= ' numero.'&action=reset&token='.newToken().'&value=mod'.$module.$param.'">';
$linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1);
$linktoenabledisable .= ' ';
@@ -2074,7 +2113,7 @@ if (is_array($listofmodules) && count($listofmodules) > 0) {
}
$head[$h][0] = $_SERVER["PHP_SELF"].'?module=deletemodule';
-$head[$h][1] = $langs->trans("DangerZone");
+$head[$h][1] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("DangerZone");
$head[$h][2] = 'deletemodule';
$h++;
@@ -2271,6 +2310,8 @@ if ($module == 'initmodule') {
$head2[$h][2] = 'buildpackage';
$h++;
+ $MAXTABFOROBJECT = 15;
+
print '';
// Note module is inside $dirread
@@ -2282,7 +2323,7 @@ if ($module == 'initmodule') {
$pathtochangelog = $modulelowercase.'/ChangeLog.md';
if ($action != 'editfile' || empty($file)) {
- print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', 0, 'formodulesuffix'); // Description - level 2
+ print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', $MAXTABFOROBJECT, 'formodulesuffix'); // Description - level 2
print ''.$langs->trans("ModuleBuilderDesc".$tab).' ';
$infoonmodulepath = '';
@@ -2442,7 +2483,7 @@ if ($module == 'initmodule') {
print '';
}
} else {
- print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', 0, 'formodulesuffix'); // Level 2
+ print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', $MAXTABFOROBJECT, 'formodulesuffix'); // Level 2
}
if ($tab == 'languages') {
@@ -2563,7 +2604,7 @@ if ($module == 'initmodule') {
if ($h > 1) {
$head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=deleteobject';
- $head3[$h][1] = $langs->trans("DangerZone");
+ $head3[$h][1] =img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("DangerZone");
$head3[$h][2] = 'deleteobject';
$h++;
}
@@ -2589,12 +2630,38 @@ if ($module == 'initmodule') {
print ''.$langs->trans("EnterNameOfObjectDesc").' ';
- print ' ';
- print ' '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).' ';
+ print '';
+
+ print '
';
+
+ print '
';
+
+ print '
';
+
+ print '
';
+
+ print ' ';
+ print ' '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).' ';
print ' '.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).' ';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
print ' ';
+ /*
print ' ';
print ''.$langs->trans("or").' ';
print ' ';
@@ -2604,6 +2671,7 @@ if ($module == 'initmodule') {
print ' ';
print ' ';
print ' ';
+ */
print '';
} elseif ($tabobj == 'deleteobject') {
@@ -2665,7 +2733,7 @@ if ($module == 'initmodule') {
}
if (class_exists($tabobj)) {
try {
- $tmpobjet = @new $tabobj($db);
+ $tmpobject = @new $tabobj($db);
} catch (Exception $e) {
dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING);
}
@@ -2738,13 +2806,22 @@ if ($module == 'initmodule') {
$urlofcard = dol_buildpath('/'.$pathtocard, 1);
-
-
-
+ print '';
print '';
// Main DAO class file
print '
'.$langs->trans("ClassFile").' :
'.(dol_is_file($realpathtoclass) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).(dol_is_file($realpathtoclass) ? '' : ' ').' ';
print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
';
+ // Image
+ if (dol_is_file($realpathtopicto)) {
+ print '
'.$langs->trans("Image").' :
'.(dol_is_file($realpathtopicto) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : ' ').' ';
+ //print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
+ print '
';
+ } elseif (!empty($tmpobject)) {
+ print '
'.$langs->trans("Image").' : '.img_picto('', $tmpobject->picto, 'class="pictofixedwidth"');
+ print '
';
+ }
+
// API file
print '
';
print '
'.$langs->trans("ApiClassFile").' :
'.(dol_is_file($realpathtoapi) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':' ').' ';
@@ -2781,9 +2858,6 @@ if ($module == 'initmodule') {
print '
'.$langs->trans("PageForObjLib").' :
'.(dol_is_file($realpathtoobjlib) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).(dol_is_file($realpathtoobjlib) ? '' : ' ').' ';
print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
print '
';
- print '
'.$langs->trans("Image").' :
'.(dol_is_file($realpathtopicto) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : ' ').' ';
- //print '
'.img_picto($langs->trans("Edit"), 'edit').' ';
- print '
';
print '
';
print '
'.$langs->trans("SqlFile").' :
'.(dol_is_file($realpathtosql) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).(dol_is_file($realpathtosql) ? '' : ' ').' ';
@@ -2871,7 +2945,7 @@ if ($module == 'initmodule') {
print '
';
- if (!empty($tmpobjet)) {
+ if (!empty($tmpobject)) {
$reflector = new ReflectionClass($tabobj);
$reflectorproperties = $reflector->getProperties(); // Can also use get_object_vars
$reflectorpropdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars
@@ -2911,6 +2985,7 @@ if ($module == 'initmodule') {
print '
'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).' ';
print '
'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).' ';
print '
'.$langs->trans("NotEditable").' ';
+ print '
'.$langs->trans("AlwaysEditable").' ';
print '
'.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).' ';
print '
'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).' ';
print '
'.$langs->trans("CSSClass").' ';
@@ -2924,9 +2999,9 @@ if ($module == 'initmodule') {
print '
';
print '
';
- // We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobjet->fields may have been
+ // We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobject->fields may have been
// modified during the constructor and we want value into head of class before constructor is called.
- //$properties = dol_sort_array($tmpobjet->fields, 'position');
+ //$properties = dol_sort_array($tmpobject->fields, 'position');
$properties = dol_sort_array($reflectorpropdefault['fields'], 'position');
if (!empty($properties)) {
@@ -2944,6 +3019,7 @@ if ($module == 'initmodule') {
print ' ';
print ' ';
print ' ';
+ print ' ';
print ' ';
print ' ';
print ' ';
@@ -2965,7 +3041,7 @@ if ($module == 'initmodule') {
{
$propname=$propval->getName();
$comment=$propval->getDocComment();
- $type=gettype($tmpobjet->$propname);
+ $type=gettype($tmpobject->$propname);
$default=$propdefault[$propname];
// Discard generic properties
if (in_array($propname, array('element', 'childtables', 'table_element', 'table_element_line', 'class_element_line', 'ismultientitymanaged'))) continue;
@@ -2986,6 +3062,7 @@ if ($module == 'initmodule') {
$propenabled = $propval['enabled'];
$propvisible = $propval['visible'];
$propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0;
+ $propalwayseditable = !empty($propval['alwayseditable'])?$propval['alwayseditable']:0;
$propsearchall = !empty($propval['searchall'])?$propval['searchall']:0;
$propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0;
$propcss = !empty($propval['css'])?$propval['css']:'';
@@ -3044,6 +3121,9 @@ if ($module == 'initmodule') {
print ' ';
print '';
print '';
+ print ' ';
+ print ' ';
+ print '';
print ' ';
print ' ';
print '';
@@ -3110,6 +3190,9 @@ if ($module == 'initmodule') {
print $propnoteditable ? dol_escape_htmltag($propnoteditable) : '';
print ' ';
print '';
+ print $propalwayseditable ? dol_escape_htmltag($propalwayseditable) : '';
+ print ' ';
+ print '';
print $propsearchall ? '1' : '';
print ' ';
print '';
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 8265bbadaf8..b30391becc7 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -89,6 +89,7 @@ class MyObject extends CommonObject
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
+ * 'alwayseditable' says if field can be modified also when status is not draft ('1' or '0')
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
@@ -115,19 +116,19 @@ class MyObject extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>10),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object', 'validate'=>1),
- 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1),
+ 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1, 'alwayseditable'=>1),
'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1),
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1),
- 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
- 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'),
+ 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1, 'cssview'=>'wordbreak'),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501),
//'date_validation ' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
- 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid'),
- 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
+ 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150'),
+ 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511, 'csslist'=>'tdoverflowmax150'),
//'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 169d764b80b..212f02aa4b3 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -144,7 +144,7 @@ class modMyModule extends DolibarrModules
$this->langfiles = array("mymodule@mymodule");
// Prerequisites
- $this->phpmin = array(5, 6); // Minimum version of PHP required by module
+ $this->phpmin = array(7, 0); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module
// Messages at activation
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
index 3011c932171..46967d6e4fa 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
@@ -48,9 +48,9 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
/**
* @var array Minimum version of PHP required by module.
- * e.g.: PHP ≥ 5.6 = array(5, 6)
+ * e.g.: PHP ≥ 7.0 = array(7, 0)
*/
- public $phpmin = array(5, 6);
+ public $phpmin = array(7, 0);
/**
* @var string Dolibarr version of the loaded document
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
index 382b5a0f0ab..312f1215406 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
@@ -70,9 +70,9 @@ class pdf_standard_myobject extends ModelePDFMyObject
/**
* @var array Minimum version of PHP required by module.
- * e.g.: PHP ≥ 5.6 = array(5, 6)
+ * e.g.: PHP ≥ 7.0 = array(7, 0)
*/
- public $phpmin = array(5, 6);
+ public $phpmin = array(7, 0);
/**
* Dolibarr version of the loaded document
diff --git a/htdocs/modulebuilder/template/img/README.md b/htdocs/modulebuilder/template/img/README.md
new file mode 100644
index 00000000000..2fcb4afc087
--- /dev/null
+++ b/htdocs/modulebuilder/template/img/README.md
@@ -0,0 +1,14 @@
+
+Directory for module image files
+--------------------------------
+
+You can put here the .png files of your module:
+
+
+If the picto of your module is an image (property $picto has been set to 'mymodule.png@mymodule', you can put into this
+directory a .png file called *object_mymodule.png* (16x16 or 32x32 pixels)
+
+
+If the picto of an object is an image (property $picto of the object.class.php has been set to 'myobject.png@mymodule', then you can put into this
+directory a .png file called *object_myobject.png* (16x16 or 32x32 pixels)
+
diff --git a/htdocs/modulebuilder/template/img/object_mymodule.png b/htdocs/modulebuilder/template/img/object_mymodule.png
deleted file mode 100644
index b421fe3c9e0..00000000000
Binary files a/htdocs/modulebuilder/template/img/object_mymodule.png and /dev/null differ
diff --git a/htdocs/modulebuilder/template/img/object_mymodule_over.png b/htdocs/modulebuilder/template/img/object_mymodule_over.png
deleted file mode 100644
index 7831c3025d7..00000000000
Binary files a/htdocs/modulebuilder/template/img/object_mymodule_over.png and /dev/null differ
diff --git a/htdocs/modulebuilder/template/img/object_myobject.png b/htdocs/modulebuilder/template/img/object_myobject.png
deleted file mode 100644
index b421fe3c9e0..00000000000
Binary files a/htdocs/modulebuilder/template/img/object_myobject.png and /dev/null differ
diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index b58c7169f25..8624713c689 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -105,7 +105,7 @@ class Mo extends CommonObject
'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'),
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1),
- 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'),
+ 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200', 'alwayseditable'=>1),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'),
@@ -116,8 +116,8 @@ class Mo extends CommonObject
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
- 'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
- 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
+ 'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap', 'alwayseditable'=>1),
+ 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1, 'alwayseditable'=>1),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')),
@@ -613,11 +613,9 @@ class Mo extends CommonObject
}
if (!$error) {
- setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
$this->db->commit();
return 1;
} else {
- setEventMessages($this->error, $this->errors, 'errors');
$this->db->rollback();
return -1;
}
@@ -636,8 +634,9 @@ class Mo extends CommonObject
$role = "";
if ($this->status != self::STATUS_DRAFT) {
- $this->error = 'BadStatus';
- return -1;
+ //$this->error = 'BadStatusForUpdateProduction';
+ //return -1;
+ return 1;
}
$this->db->begin();
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
index 373dd7b6410..fde5811547a 100644
--- a/htdocs/mrp/mo_card.php
+++ b/htdocs/mrp/mo_card.php
@@ -136,7 +136,7 @@ if (empty($reshook)) {
}
$triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record
- //Create MO with Childs
+ // Create MO with Childs
if ($action == 'add' && empty($id) && !empty($TBomLineId)) {
$noback = 1;
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
@@ -165,7 +165,7 @@ if (empty($reshook)) {
$res = $object->add_object_linked('mo', $mo_parent->id);
}
- header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.$moline->fk_mo, 1));
+ header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.((int) $moline->fk_mo), 1));
exit;
}
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 53414a0a608..034fa97f86f 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -76,7 +76,7 @@ if ($user->socid) {
$socid = $user->socid;
}
-if (empty($user->rights->fournisseur->lire)) {
+if (empty($user->rights->fournisseur->lire) && (empty($conf->margin->enabled) && !$user->hasRight("margin", "liretous"))) {
accessforbidden();
}
@@ -919,7 +919,7 @@ END;
print "\n";
- if ($user->rights->fournisseur->lire) { // Duplicate ? this check is already in the head of this file
+ if ($user->hasRight("fournisseur", "read")) { // Duplicate ? this check is already in the head of this file
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
index ba35cb0ba3f..c86713ffb93 100644
--- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
+++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
@@ -48,9 +48,9 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
/**
* @var array Minimum version of PHP required by module.
- * e.g.: PHP ≥ 5.6 = array(5, 6)
+ * e.g.: PHP ≥ 7.0 = array(7, 0)
*/
- public $phpmin = array(5, 6);
+ public $phpmin = array(7, 0);
/**
* @var string Dolibarr version of the loaded document
diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
index bf267a475c6..007333dfd5d 100644
--- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
+++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
@@ -70,9 +70,9 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
/**
* @var array Minimum version of PHP required by module.
- * e.g.: PHP ≥ 5.6 = array(5, 6)
+ * e.g.: PHP ≥ 7.0 = array(7, 0)
*/
- public $phpmin = array(5, 6);
+ public $phpmin = array(7, 0);
/**
* Dolibarr version of the loaded document
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index a0299ef3fec..5cb7cf69ef8 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -1016,7 +1016,7 @@ if ($resql) {
// Type ent
if (!empty($arrayfields['typent.code']['checked'])) {
print ' ';
- if (count($typenArray) == 0) {
+ if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
$typenArray = $formcompany->typent_array(1);
}
print $typenArray[$obj->typent_code];
diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php
index bfde88726e9..b3f91901575 100644
--- a/htdocs/theme/eldy/dropdown.inc.php
+++ b/htdocs/theme/eldy/dropdown.inc.php
@@ -183,7 +183,7 @@ div#topmenu-quickadd-dropdown a::after, div#topmenu-bookmark-dropdown a::after {
border-top-left-radius: 0;
padding: 1px 0 0 0;
border-top-width: 0;
- width: 300px;
+ width: 360px;
}
.topnav .user-menu .dropdown-menu {
top: 50px;
@@ -522,6 +522,9 @@ div.quickaddblock:focus {
max-width: 360px;
}
+ .side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu {
+ width: 300px;
+ }
.dropdown-menu {
border: none;
-webkit-box-shadow: none;
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index cf30cc2bb99..9ba58cd069b 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -1000,18 +1000,18 @@ if ($action == 'create' || $action == 'adduserldap') {
print ' ';
$valuetoshow = '';
if (preg_match('/ldap/', $dolibarr_main_authentication)) {
- $valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("PasswordOfUserInLDAP");
+ $valuetoshow .= ($valuetoshow ? ' + ' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)';
}
if (preg_match('/http/', $dolibarr_main_authentication)) {
- $valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("HTTPBasicPassword");
+ $valuetoshow .= ($valuetoshow ? ' + ' : '').$langs->trans("HTTPBasicPassword");
}
if (preg_match('/dolibarr/', $dolibarr_main_authentication)) {
if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
- $valuetoshow .= ($valuetoshow ? ', ' : '').' '; // Dolibarr password is preffiled with LDAP known password
+ $valuetoshow .= ($valuetoshow ? ' + ' : '').' '; // Dolibarr password is preffiled with LDAP known password
$valuetoshow .= preg_replace('/./i', '*', $ldap_pass);
} else {
// We do not use a field password but a field text to show new password to use.
- $valuetoshow .= ($valuetoshow ? ', ' : '').' ';
+ $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').' ';
}
}
diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php
index 2302b6e7681..562ab081ab8 100644
--- a/htdocs/user/clicktodial.php
+++ b/htdocs/user/clicktodial.php
@@ -127,7 +127,7 @@ if ($id > 0) {
$langs->load("errors");
print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).' ';
} else {
- print ' '.$form->textwithpicto($langs->trans("KeepEmptyToUseDefault").': '.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc"));
+ print ' '.$form->textwithpicto(''.$langs->trans("KeepEmptyToUseDefault").' : '.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc"));
}
print ' ';
print '';
@@ -154,7 +154,7 @@ if ($id > 0) {
print '';
if (!empty($user->admin)) {
- print 'ClickToDial URL ';
+ print 'ClickToDial URL ';
print '';
if (!empty($conf->global->CLICKTODIAL_URL)) {
$url = $conf->global->CLICKTODIAL_URL;
@@ -172,7 +172,7 @@ if ($id > 0) {
print ' ';
}
- print 'ClickToDial '.$langs->trans("IdPhoneCaller").' ';
+ print 'ClickToDial '.$langs->trans("IdPhoneCaller").' ';
print ''.(!empty($object->clicktodial_poste) ? $object->clicktodial_poste : '').' ';
print " ";
diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php
index dd12669980a..d93ec7851e4 100644
--- a/htdocs/user/group/ldap.php
+++ b/htdocs/user/group/ldap.php
@@ -108,7 +108,7 @@ dol_banner_tab($object, 'id', $linkback, (!empty($user->rights->user->user->lire
print '';
print '
';
-print '
';
+print '';
// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
if (!empty($conf->mutlicompany->enabled)) {
diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php
index f065a165a54..56ab923435d 100644
--- a/htdocs/zapier/class/api_zapier.class.php
+++ b/htdocs/zapier/class/api_zapier.class.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/zapier/class/hook.class.php';
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
-class ZapierApi extends DolibarrApi
+class Zapier extends DolibarrApi
{
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
diff --git a/phpstan.neon b/phpstan.neon
index 02e47e753d7..129ca462921 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -103,6 +103,7 @@ parameters:
- %currentWorkingDirectory%/htdocs/core/lib/donation.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/ecm.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/emailing.lib.php
+ #- %currentWorkingDirectory%/htdocs/core/lib/eventorganization.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/expedition.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/expensereport.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/fichinter.lib.php
@@ -110,13 +111,17 @@ parameters:
- %currentWorkingDirectory%/htdocs/core/lib/fiscalyear.lib.php
#- %currentWorkingDirectory%/htdocs/core/lib/format_cards.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/fourn.lib.php
+ #- %currentWorkingDirectory%/htdocs/core/lib/ftp.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/functions.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/functions2.lib.php
+ #- %currentWorkingDirectory%/htdocs/core/lib/functions_ch.lib.php
+ #- %currentWorkingDirectory%/htdocs/core/lib/functionsnumtoword.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/geturl.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/holiday.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/hrm.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/images.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/import.lib.php
+ #- %currentWorkingDirectory%/htdocs/core/lib/intracommreport.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/invoice.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/invoice2.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/json.lib.php
@@ -132,11 +137,13 @@ parameters:
- %currentWorkingDirectory%/htdocs/core/lib/parsemd.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/payments.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/pdf.lib.php
+ #- %currentWorkingDirectory%/htdocs/core/lib/phpsessionindb.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/prelevement.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/price.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/product.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/project.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/propal.lib.php
+ #- %currentWorkingDirectory%/htdocs/core/lib/receiptprinter.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/reception.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/report.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/resource.lib.php
@@ -155,6 +162,7 @@ parameters:
- %currentWorkingDirectory%/htdocs/core/lib/usergroups.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/vat.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/website.lib.php
+ #- %currentWorkingDirectory%/htdocs/core/lib/website2.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/ws.lib.php
- %currentWorkingDirectory%/htdocs/core/lib/xcal.lib.php
featureToggles: