From a5893db10679e0cb0c73a3a021d6352f15ac73e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Jun 2020 22:05:55 +0200 Subject: [PATCH 1/9] FIX upload documents into manual ECM was reported a permission error --- htdocs/core/lib/security.lib.php | 39 +++++++++++----------------- htdocs/core/modules/modECM.class.php | 8 +++--- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index a4f1a30bd4d..1aec703de4a 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -233,28 +233,22 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f continue; } - if ($feature == 'societe') - { + if ($feature == 'societe') { if (!$user->rights->societe->lire && !$user->rights->fournisseur->lire) { $readok = 0; $nbko++; } } - elseif ($feature == 'contact') - { + elseif ($feature == 'contact') { if (!$user->rights->societe->contact->lire) { $readok = 0; $nbko++; } } - elseif ($feature == 'produit|service') - { + elseif ($feature == 'produit|service') { if (!$user->rights->produit->lire && !$user->rights->service->lire) { $readok = 0; $nbko++; } } - elseif ($feature == 'prelevement') - { + elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->lire) { $readok = 0; $nbko++; } } - elseif ($feature == 'cheque') - { + elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; } } - elseif ($feature == 'projet') - { + elseif ($feature == 'projet') { if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; } } elseif (!empty($feature2)) // This is for permissions on 2 levels @@ -296,30 +290,27 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f { foreach ($featuresarray as $feature) { - if ($feature == 'contact') - { + if ($feature == 'contact') { if (!$user->rights->societe->contact->creer) { $createok = 0; $nbko++; } } - elseif ($feature == 'produit|service') - { + elseif ($feature == 'produit|service') { if (!$user->rights->produit->creer && !$user->rights->service->creer) { $createok = 0; $nbko++; } } - elseif ($feature == 'prelevement') - { + elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->creer) { $createok = 0; $nbko++; } } - elseif ($feature == 'commande_fournisseur') - { + elseif ($feature == 'commande_fournisseur') { if (!$user->rights->fournisseur->commande->creer) { $createok = 0; $nbko++; } } - elseif ($feature == 'banque') - { + elseif ($feature == 'banque') { if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; } } - elseif ($feature == 'cheque') - { + elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; } } + elseif ($feature == 'ecm') { + if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; } + } elseif (!empty($feature2)) // This is for permissions on one level { foreach ($feature2 as $subfeature) diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index 4d314644fb4..637cdb33739 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -97,21 +97,21 @@ class modECM extends DolibarrModules $r++; $this->rights[$r][0] = 2501; - $this->rights[$r][1] = 'Consulter/Télécharger les documents'; + $this->rights[$r][1] = 'Read or download documents'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; $r++; $this->rights[$r][0] = 2503; - $this->rights[$r][1] = 'Soumettre ou supprimer des documents'; + $this->rights[$r][1] = 'Upload a document'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'upload'; $r++; $this->rights[$r][0] = 2515; - $this->rights[$r][1] = 'Administrer les rubriques de documents'; + $this->rights[$r][1] = 'Administer directories of documents'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'setup'; From 600a24346aaad87f0c9f74a576d58a9aca66fdd7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Jun 2020 22:09:17 +0200 Subject: [PATCH 2/9] Some people are missing this table --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index af05a55a8e7..2a7fc17e77e 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -66,6 +66,16 @@ ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafie ALTER TABLE llx_facture_rec MODIFY COLUMN titre varchar(200) NOT NULL; +create table llx_mrp_mo_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_fk_object(fk_object); + -- This var is per entity now, so we remove const if global if exists delete from llx_const where name in ('PROJECT_HIDE_TASKS', 'MAIN_BUGTRACK_ENABLELINK', 'MAIN_HELP_DISABLELINK') and entity = 0; From eb30f6ed1a3d1b54b927b71f8f8801b0d5f428ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 09:15:49 +0200 Subject: [PATCH 3/9] Prepare 12.0.1 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 1697037619f..eedc5c5829f 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('EURO')) define('EURO', chr(128)); From 68b4866438903e087877ccb9d0b9b87f8496d11e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 09:43:39 +0200 Subject: [PATCH 4/9] Trans --- htdocs/langs/en_US/withdrawals.lang | 4 ++-- htdocs/takepos/index.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 49c9f8b5921..1f9c91719da 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -93,8 +93,8 @@ CreditDate=Credit on WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported) ShowWithdraw=Show Direct Debit Order IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one direct debit payment order not yet processed, it won't be set as paid to allow prior withdrawal management. -DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null. -DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Credit transfer orders to manage the credit transfer payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null. +DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to generate and manage the direct debit payment order. When direct debit order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null. +DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Credit transfer orders to generate and manage the credit transfer order. When credit transfer order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null. WithdrawalFile=Withdrawal file SetToStatusSent=Set to status "File Sent" ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dbc68afeaf4..f4b83138416 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -873,7 +873,7 @@ $menus[$r++] = array('title'=>''
'.$langs->trans("Payment").'
', 'action'=>'CloseBill();'); if ($conf->global->TAKEPOS_DIRECT_PAYMENT) { - $menus[$r++] = array('title'=>'
'.$langs->trans("DirectPayment").'
', 'action'=>'DirectPayment();'); + $menus[$r++] = array('title'=>'
'.$langs->trans("DirectPayment").' ('.$langs->trans("Cash").')
', 'action'=>'DirectPayment();'); } // BAR RESTAURANT specific menu From 7c4e737668ad84c54bcf45a7be4b00f6d8c6b96c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 09:53:55 +0200 Subject: [PATCH 5/9] Clean code --- htdocs/core/modules/modAsset.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index c11cf34d257..ebceca2960e 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -102,9 +102,7 @@ class modAsset extends DolibarrModules // Example: $this->const=array(0=>array('ASSETS_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), // 1=>array('ASSETS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) // ); - $this->const = array( - //1=>array('ASSET_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) - ); + $this->const = array(); if (!isset($conf->asset) || !isset($conf->asset->enabled)) From 8bb11039dce1f5a2a60ed459d16580b5434ff7c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 09:56:04 +0200 Subject: [PATCH 6/9] Clean code --- .../modulebuilder/template/core/modules/modMyModule.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index a580a655d85..71fc16f09cd 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -136,9 +136,7 @@ class modMyModule extends DolibarrModules // Example: $this->const=array(1 => array('MYMODULE_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1), // 2 => array('MYMODULE_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) // ); - $this->const = array( - // 1 => array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) - ); + $this->const = array(); // Some keys to add into the overwriting translation tables /*$this->overwrite_translation = array( From 5b3670f30078811b77ba400ea2fc07b5fa7825d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 13:48:00 +0200 Subject: [PATCH 7/9] FIX SQL syntax error when editing extrafields Conflicts: htdocs/core/lib/security.lib.php --- htdocs/core/db/mysqli.class.php | 4 +- htdocs/core/db/pgsql.class.php | 13 ++--- htdocs/core/lib/security.lib.php | 65 ++++++++--------------- htdocs/core/modules/modDebugBar.class.php | 2 +- htdocs/core/modules/modSyslog.class.php | 2 +- 5 files changed, 32 insertions(+), 54 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 7c0d680662d..9c023a05478 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -806,7 +806,7 @@ class DoliDBMysqli extends DoliDB $sql .= $field_desc['type']; if (preg_match("/^[^\s]/i", $field_desc['value'])) { - if (!in_array($field_desc['type'], array('date', 'datetime'))) + if (!in_array($field_desc['type'], array('date', 'datetime')) && $field_desc['value']) { $sql .= "(".$field_desc['value'].")"; } @@ -853,7 +853,7 @@ class DoliDBMysqli extends DoliDB // phpcs:enable $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; - if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { + if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) { $sql .= "(".$field_desc['value'].")"; } if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index bf9b468d4a8..6b71366c46c 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1126,11 +1126,12 @@ class DoliDBPgsql extends DoliDB // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "ALTER TABLE ".$table." ADD ".$field_name." "; $sql .= $field_desc['type']; - if (preg_match("/^[^\s]/i", $field_desc['value'])) - if (!in_array($field_desc['type'], array('int', 'date', 'datetime'))) - { - $sql .= "(".$field_desc['value'].")"; - } + if (preg_match("/^[^\s]/i", $field_desc['value'])) { + if (!in_array($field_desc['type'], array('int', 'date', 'datetime')) && $field_desc['value']) + { + $sql .= "(".$field_desc['value'].")"; + } + } if (preg_match("/^[^\s]/i", $field_desc['attribute'])) $sql .= " ".$field_desc['attribute']; if (preg_match("/^[^\s]/i", $field_desc['null'])) @@ -1167,7 +1168,7 @@ class DoliDBPgsql extends DoliDB // phpcs:enable $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; - if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { + if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) { $sql .= "(".$field_desc['value'].")"; } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 1aec703de4a..3ee5739bc6d 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -223,52 +223,39 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f // Check read permission from module $readok = 1; $nbko = 0; - foreach ($featuresarray as $feature) // first we check nb of test ko - { + foreach ($featuresarray as $feature) { // first we check nb of test ko $featureforlistofmodule = $feature; if ($featureforlistofmodule == 'produit') $featureforlistofmodule = 'product'; - if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) // If limits on modules for external users, module must be into list of modules for external users - { + if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) { // If limits on modules for external users, module must be into list of modules for external users $readok = 0; $nbko++; continue; } if ($feature == 'societe') { if (!$user->rights->societe->lire && !$user->rights->fournisseur->lire) { $readok = 0; $nbko++; } - } - elseif ($feature == 'contact') { + } elseif ($feature == 'contact') { if (!$user->rights->societe->contact->lire) { $readok = 0; $nbko++; } - } - elseif ($feature == 'produit|service') { + } elseif ($feature == 'produit|service') { if (!$user->rights->produit->lire && !$user->rights->service->lire) { $readok = 0; $nbko++; } - } - elseif ($feature == 'prelevement') { + } elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->lire) { $readok = 0; $nbko++; } - } - elseif ($feature == 'cheque') { + } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; } - } - elseif ($feature == 'projet') { + } elseif ($feature == 'projet') { if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; } - } - elseif (!empty($feature2)) // This is for permissions on 2 levels - { + } elseif (!empty($feature2)) { // This is for permissions on 2 levels $tmpreadok = 1; - foreach ($feature2 as $subfeature) - { + foreach ($feature2 as $subfeature) { if ($subfeature == 'user' && $user->id == $objectid) continue; // A user can always read its own card if (!empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $tmpreadok = 0; } elseif (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $tmpreadok = 0; } else { $tmpreadok = 1; break; } // Break is to bypass second test if the first is ok } - if (!$tmpreadok) // We found a test on feature that is ko - { + if (!$tmpreadok) { // We found a test on feature that is ko $readok = 0; // All tests are ko (we manage here the and, the or will be managed later using $nbko). $nbko++; } - } - elseif (!empty($feature) && ($feature != 'user' && $feature != 'usergroup')) // This is permissions on 1 level - { + } elseif (!empty($feature) && ($feature != 'user' && $feature != 'usergroup')) { // This is permissions on 1 level if (empty($user->rights->$feature->lire) && empty($user->rights->$feature->read) && empty($user->rights->$feature->run)) { $readok = 0; $nbko++; } @@ -292,29 +279,21 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f { if ($feature == 'contact') { if (!$user->rights->societe->contact->creer) { $createok = 0; $nbko++; } - } - elseif ($feature == 'produit|service') { + } elseif ($feature == 'produit|service') { if (!$user->rights->produit->creer && !$user->rights->service->creer) { $createok = 0; $nbko++; } - } - elseif ($feature == 'prelevement') { + } elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->creer) { $createok = 0; $nbko++; } - } - elseif ($feature == 'commande_fournisseur') { + } elseif ($feature == 'commande_fournisseur') { if (!$user->rights->fournisseur->commande->creer) { $createok = 0; $nbko++; } - } - elseif ($feature == 'banque') { + } elseif ($feature == 'banque') { if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; } - } - elseif ($feature == 'cheque') { + } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; } - } - elseif ($feature == 'ecm') { + } elseif ($feature == 'ecm') { if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; } } - elseif (!empty($feature2)) // This is for permissions on one level - { - foreach ($feature2 as $subfeature) - { + elseif (!empty($feature2)) { // This is for permissions on one level + foreach ($feature2 as $subfeature) { if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->creer) continue; // User can edit its own card if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->password) continue; // User can edit its own password @@ -329,10 +308,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f break; } } - } - elseif (!empty($feature)) // This is for permissions on 2 levels ('creer' or 'write') - { - //print '
feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write; + } elseif (!empty($feature)) { // This is for permissions on 2 levels ('creer' or 'write') + //print '
feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write; exit; if (empty($user->rights->$feature->creer) && empty($user->rights->$feature->write) && empty($user->rights->$feature->create)) { diff --git a/htdocs/core/modules/modDebugBar.class.php b/htdocs/core/modules/modDebugBar.class.php index bf2bc640c44..f89f3659285 100644 --- a/htdocs/core/modules/modDebugBar.class.php +++ b/htdocs/core/modules/modDebugBar.class.php @@ -54,7 +54,7 @@ class modDebugBar extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->picto = 'technic'; + $this->picto = 'bug'; $this->module_parts = array('moduleforexternal' => 0); diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index 91e90d6540f..01079310e4b 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -58,7 +58,7 @@ class modSyslog extends DolibarrModules // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. - $this->picto = 'technic'; + $this->picto = 'bug'; // Data directories to create when module is enabled $this->dirs = array(); From b64fc7dc3f9e1ca1ff57c5583151853b6f90be24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 14:37:36 +0200 Subject: [PATCH 8/9] FIX Avoid warning when creating a module with already existing files --- htdocs/modulebuilder/index.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 118718db57e..30cde322422 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -151,20 +151,17 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/sql/data.sql'); dol_delete_file($destdir.'/sql/update_x.x.x-y.y.y.sql'); - dol_delete_dir($destdir.'/sql'); dol_delete_file($destdir.'/class/actions_'.strtolower($modulename).'.class.php'); dol_delete_file($destdir.'/class/api_'.strtolower($modulename).'.class.php'); - dol_delete_dir($destdir.'/class'); dol_delete_file($destdir.'/css/'.strtolower($modulename).'.css.php'); - dol_delete_dir($destdir.'/css'); dol_delete_file($destdir.'/js/'.strtolower($modulename).'.js.php'); - dol_delete_dir($destdir.'/js'); dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php'); - dol_delete_dir($destdir.'/scripts'); + + dol_delete_file($destdir.'/test/phpunit/MyModuleFunctionnalTest.php'); // Delete some files related to Object (because the previous dolCopyDir has copied everything) dol_delete_file($destdir.'/myobject_card.php'); @@ -173,18 +170,21 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/myobject_agenda.php'); dol_delete_file($destdir.'/myobject_list.php'); dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php'); - dol_delete_file($destdir.'/test/phpunit/MyModuleFunctionnalTest.php'); dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); - dol_delete_file($destdir.'/test/phpunit'); - dol_delete_file($destdir.'/test'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.sql'); 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'); - dol_delete_dir($destdir.'/sql'); + + dol_delete_dir($destdir.'/class', 1); + dol_delete_dir($destdir.'/sql', 1); + dol_delete_dir($destdir.'/scripts', 1); + dol_delete_dir($destdir.'/js', 1); + dol_delete_dir($destdir.'/css', 1); + dol_delete_dir($destdir.'/test/phpunit', 1); + dol_delete_dir($destdir.'/test', 1); } // Edit PHP files From 3d8d55a531881d7b3d4e60264fcbfb36234e95dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 14:42:09 +0200 Subject: [PATCH 9/9] Fix bad path in import section --- .../modulebuilder/template/core/modules/modMyModule.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 71fc16f09cd..5aecfe915c8 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -333,7 +333,7 @@ class modMyModule extends DolibarrModules $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='myobject@mymodule'; // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array - $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; + $keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; //unset($this->export_fields_array[$r]['t.fieldtoremove']); @@ -363,7 +363,7 @@ class modMyModule extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='myobject@mymodule'; - $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; + $keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';