From 016a74e98bb9862b4f44efeadf00a3d6664220fe Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 24 Nov 2022 03:58:34 +0100 Subject: [PATCH 1/6] Language key missing --- htdocs/langs/en_US/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2b86c2d3e65..2289e0602da 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -488,6 +488,7 @@ ActionsOnContact=Events for this contact/address ActionsOnContract=Events for this contract ActionsOnMember=Events about this member ActionsOnProduct=Events about this product +ActionsOnAsset=Events for this fixed asset NActionsLate=%s late ToDo=To do Completed=Completed From 409a114038da29ca349e36c32c779229e13eb8aa Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 24 Nov 2022 03:58:59 +0100 Subject: [PATCH 2/6] Wrong variable --- htdocs/asset/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index b5896f2817e..dba49857aec 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -407,6 +407,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; + $morehtmlcenter = ''; $MAXEVENT = 10; $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id); @@ -414,7 +415,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlright); + $somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter); print '
'; } From 035f7c57c4d54004a7714db6cd5dc8dab53b088e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 25 Nov 2022 04:38:30 +0100 Subject: [PATCH 3/6] Compatibility - Remove WITH --- htdocs/asset/class/asset.class.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 5c50b972c93..b1a11051860 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -652,6 +652,7 @@ class Asset extends CommonObject return -1; } + /* $sql = "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= " SELECT DISTINCT fk_docdet"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; @@ -663,6 +664,14 @@ class Asset extends CommonObject $sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; $sql .= " WHERE ad.fk_asset = " . (int) $this->id; $sql .= " ORDER BY ad.depreciation_date ASC"; + */ + + $sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht"; + $sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0) . " AS bookkeeping"; + $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; + $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; + $sql .= " WHERE ad.fk_asset = " . (int) $this->id; + $sql .= " ORDER BY ad.depreciation_date ASC"; $resql = $this->db->query($sql); if (!$resql) { @@ -708,6 +717,7 @@ class Asset extends CommonObject return -1; } + /* $sql = "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= " SELECT DISTINCT fk_docdet"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; @@ -718,6 +728,13 @@ class Asset extends CommonObject $sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; $sql .= " WHERE ad.fk_asset = " . (int) $this->id; $sql .= " AND iab.fk_docdet IS NOT NULL"; + */ + + $sql = "SELECT COUNT(*) AS has_bookkeeping"; + $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; + $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; + $sql .= " WHERE ad.fk_asset = " . (int) $this->id; + $sql .= " AND iab.fk_docdet IS NOT NULL"; $resql = $this->db->query($sql); if (!$resql) { @@ -866,6 +883,7 @@ class Asset extends CommonObject foreach ($options->deprecation_options as $mode_key => $fields) { // Get last depreciation lines save in bookkeeping //----------------------------------------------------- + /* $sql = "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= " SELECT fk_docdet"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; @@ -879,6 +897,17 @@ class Asset extends CommonObject $sql .= " AND iab.fk_docdet IS NOT NULL"; $sql .= " ORDER BY ad.depreciation_date DESC"; $sql .= " LIMIT 1"; + */ + + $sql = "SELECT ad.depreciation_date, ad.cumulative_depreciation_ht"; + $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; + $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; + $sql .= " WHERE ad.fk_asset = " . (int) $this->id; + $sql .= " AND ad.depreciation_mode = '" . $this->db->escape($mode_key) . "'"; + $sql .= " AND iab.fk_docdet IS NOT NULL"; + $sql .= " ORDER BY ad.depreciation_date DESC"; + $sql .= " LIMIT 1"; + $resql = $this->db->query($sql); if (!$resql) { $this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key) . ': ' . $this->db->lasterror(); From 517544e7c3084133b92173100fc3aaf96fc319f2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 25 Nov 2022 04:42:10 +0100 Subject: [PATCH 4/6] Compatibility - Remove WITH --- htdocs/asset/class/asset.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index b1a11051860..7c2b55c045e 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -652,6 +652,7 @@ class Asset extends CommonObject return -1; } + // Old request with 'WITH' /* $sql = "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= " SELECT DISTINCT fk_docdet"; @@ -717,6 +718,7 @@ class Asset extends CommonObject return -1; } + // Old request with 'WITH' /* $sql = "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= " SELECT DISTINCT fk_docdet"; @@ -883,6 +885,8 @@ class Asset extends CommonObject foreach ($options->deprecation_options as $mode_key => $fields) { // Get last depreciation lines save in bookkeeping //----------------------------------------------------- + + // Old request with 'WITH' /* $sql = "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= " SELECT fk_docdet"; From 01a0a108322d68d3a5b2a5e2def2b5b8881483e9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 25 Nov 2022 04:42:31 +0100 Subject: [PATCH 5/6] Move module asset to experimental --- htdocs/core/modules/modAsset.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index a0fb405887e..3a7caa1cb57 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -63,7 +63,7 @@ class modAsset extends DolibarrModules $this->descriptionlong = "Asset module to manage assets module and depreciation charge on Dolibarr"; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = 'development'; + $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where ASSETS 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. From 70e6b3c14193d465d0cba71cba338dcf8e614387 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 25 Nov 2022 04:49:43 +0100 Subject: [PATCH 6/6] ChangeLog --- ChangeLog | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48002248c4f..82805bb0b74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,7 +12,7 @@ NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6 NEW: #21780 Add pid field to Cronjob class and store PID on job execution NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link NEW: #20650 can move the checkbox column on left (experimental option) -NEW: #21000 Added columns 'alias_name' on poject, supplier invoice, supplier order, supplier proposals and taks list +NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list NEW: #21395 Added option for dark theme mode in display - color and theme NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup NEW: #21399 @@ -22,11 +22,11 @@ NEW: #22048 Added notes to productlot module NEW: #22298 Bank - Add salaries & vat in the tab of planned entries of a bank account NEW: #22328 NEW: #22424 -NEW: #22500 member module set up made easier +NEW: #22500 member module set up made easier NEW: #22527 projects and thirdparties can be viewed as conversation ("Message" view), like events/agenda. NEW: #22546 can now set user supervisors using mass action in htdocs/user NEW: #22594 can chose if VAT ID is unique or not for third parties -NEW: #22622 all partneships displayed on tab partnership of a thirdparty and member +NEW: #22622 all partnerships displayed on tab partnership of a thirdparty and member NEW: #22676 massaction for updating product prices NEW: #22735 Massaction to affect users on projects NEW: #25594 can chose if VAT ID is unique or not for third parties @@ -66,7 +66,7 @@ NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD NEW: Add option --force on CLI cron_run_jobs.php NEW: Add option "Show price on the generated documents for receptions" NEW: Add performance index (name for company and contact) and llx_bank_url(url_id) -NEW: Add picto property on sub-module for paswword generation +NEW: Add picto property on sub-module for password generation NEW: Add price to product box in TakePOS NEW: add redirect on action confirm addconsumedline and addproduceline NEW: Add a new advanced permission "read price" @@ -85,7 +85,7 @@ NEW: Can enter the unit price including the vat NEW: Can invoice task time per different services NEW: Can join several files by default on email form NEW: Can send an email on scheduled job error -NEW: Can set a commercial discount by entereing amount including VAT +NEW: Can set a commercial discount by entering amount including VAT NEW: Can set a monthly frequency (or multiple) in cron tasks. NEW: Can set start and end dates and comment on button "Activate all services" NEW: can sort and preselected best supplier price @@ -133,7 +133,7 @@ NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone) NEW: Page for mass stock transfer can be used with no source stock NEW: parent company column and filter in invoice and order list NEW: Add show "Sales rep" option for PDF -NEW: Picto for shared link is clicable +NEW: Picto for shared link is clickable NEW: possibility to select scopes with checkbox for Oauth tokens NEW: private and public note on user, thirdparty and contact list NEW: product categories filter on inventory list @@ -147,7 +147,7 @@ NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token NEW: Save one click to select on delivery ack, on emails. NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template NEW: set thirdparty type with company modify trigger -NEW: Show also shceduled task never finished in scheduled task widget +NEW: Show also scheduled task never finished in scheduled task widget NEW: show badge with number of extrafields in setup NEW: show category tree in sellist and chkbxlst for common object NEW: Show picto and color into combo for selection of tags @@ -167,6 +167,8 @@ NEW: expand/collapse permissions on user permission page NEW: Show delivery mode on PDF for proposals NEW: Add the target to select attendees of event for emailings + Modules +NEW: Experimental module Asset For developers or integrators: ------------------------------