';
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= '
';
$out = (empty($conf->global->MAIN_UPLOAD_DOC) ? ' disabled' : '');
print '
';
@@ -740,8 +743,8 @@ if ($step == 3 && $datatoimport) {
if ($step == 4 && $datatoimport) {
//var_dump($_SESSION["dol_array_match_file_to_database_select"]);
$serialized_array_match_file_to_database = isset($_SESSION["dol_array_match_file_to_database_select"]) ? $_SESSION["dol_array_match_file_to_database_select"] : '';
- $array_match_file_to_database = array();
$fieldsarray = explode(',', $serialized_array_match_file_to_database);
+ $array_match_file_to_database = array(); // Same than $fieldsarray but with mapped value only (col1 => 's.fielda', col2 => 's.fieldb'...)
foreach ($fieldsarray as $elem) {
$tabelem = explode('=', $elem, 2);
$key = $tabelem[0];
@@ -750,6 +753,11 @@ if ($step == 4 && $datatoimport) {
$array_match_file_to_database[$key] = $val;
}
}
+
+ //var_dump($serialized_array_match_file_to_database);
+ //var_dump($fieldsarray);
+ //var_dump($array_match_file_to_database);
+
$model = $format;
$list = $objmodelimport->liste_modeles($db);
@@ -851,20 +859,15 @@ if ($step == 4 && $datatoimport) {
}
// We found the key of targets that is at position pos
$array_match_file_to_database[$pos] = $key;
- if ($serialized_array_match_file_to_database) {
- $serialized_array_match_file_to_database .= ',';
- }
- $serialized_array_match_file_to_database .= ($pos.'='.$key);
break;
}
}
$pos++;
}
- // Save the match array in session. We now will use the array in session.
- $_SESSION["dol_array_match_file_to_database_select"] = $serialized_array_match_file_to_database;
}
$array_match_database_to_file = array_flip($array_match_file_to_database);
-
+ //var_dump($array_match_database_to_file);
+ //var_dump($_SESSION["dol_array_match_file_to_database_select"]);
$fieldstarget_tmp = array();
$arraykeysfieldtarget = array_keys($fieldstarget);
@@ -1086,8 +1089,8 @@ if ($step == 4 && $datatoimport) {
$optionsall = array();
foreach ($fieldstarget as $code => $line) {
//var_dump($line);
- $labeltoshow = $langs->trans($line["label"]);
- $optionsall[$code] = array('label'=>$labeltoshow, 'required'=>(empty($line["required"]) ? 0 : 1), 'position'=>!empty($line['position']) ? $line['position'] : 0);
+ $labeltoshow = $langs->transnoentities($line["label"]);
+ $optionsall[$code] = array('labelkey'=>$line['label'], 'label'=>$labeltoshow, 'required'=>(empty($line["required"]) ? 0 : 1), 'position'=>!empty($line['position']) ? $line['position'] : 0);
// TODO Get type from an new array into module descriptor.
//$picto = 'email';
$picto = '';
@@ -1104,13 +1107,19 @@ if ($step == 4 && $datatoimport) {
//var_dump($fieldstarget);
//var_dump($optionsall);
//exit;
- /*
- var_dump($_SESSION['dol_array_match_file_to_database']);
- var_dump($_SESSION['dol_array_match_file_to_database_select']);
- var_dump($optionsall);
- var_dump($fieldssource);
- var_dump($fieldstarget);
- */
+
+ //var_dump($_SESSION['dol_array_match_file_to_database']);
+ //var_dump($_SESSION['dol_array_match_file_to_database_select']);
+ //exit;
+ //var_dump($optionsall);
+ //var_dump($fieldssource);
+ //var_dump($fieldstarget);
+
+ $modetoautofillmapping = 'session'; // Use setup in session
+ if ($initialloadofstep4) {
+ $modetoautofillmapping = 'guess';
+ }
+ //var_dump($modetoautofillmapping);
print '
';
foreach ($fieldssource as $code => $line) { // $fieldssource is an array code=column num, line=content on first line for column in source file.
@@ -1130,23 +1139,19 @@ if ($step == 4 && $datatoimport) {
print '=> ';
print '';
- $modetoautofillmapping = 'session'; // Use setup in session
- if ($initialloadofstep4) {
- $modetoautofillmapping = 'guess';
- }
//var_dump($_SESSION['dol_array_match_file_to_database_select']);
- //var_dump($modetoautofillmapping);
//var_dump($_SESSION['dol_array_match_file_to_database']);
- //var_dump($modetoautofillmapping);
- print '';
+ $selectforline = '';
+ $selectforline .= '';
if (!empty($line["imported"])) {
- print ' ';
+ $selectforline .= ' ';
} else {
- print ' ';
+ $selectforline .= ' ';
}
$j = 0;
+ $codeselectedarray = array();
foreach ($optionsall as $tmpcode => $tmpval) { // Loop on each entry to add into each combo list.
$label = '';
if (!empty($tmpval['picto'])) {
@@ -1156,16 +1161,11 @@ if ($step == 4 && $datatoimport) {
$label .= $tmpval['label'];
$label .= $tmpval['required'] ? '*' : '';
- // If we must guess how to fill the preselected value, and we can't because input value are not string
- if ($modetoautofillmapping == 'guess' && $j == 0 && is_numeric($tmpval)) {
- $modetoautofillmapping = 'orderoftargets';
- }
-
- print '';
- print $label;
- print '';
+ $selectforline .= ' data-html="'.dol_escape_htmltag($label).'"';
+ $selectforline .= '>';
+ $selectforline .= $label;
+ $selectforline .= '';
$j++;
}
- print ' ';
- print ajax_combobox('selectorderimport_'.($i+1));
- print " ";
+ $selectforline .= '';
+ $selectforline .= ajax_combobox('selectorderimport_'.($i+1));
+
+ print $selectforline;
+
+ print '';
print '';
$filecolumn = ($i + 1);
@@ -1315,18 +1325,21 @@ if ($step == 4 && $datatoimport) {
print ' console.log("Remove the disabled flag everywhere");'."\n";
print ' $("select.targetselectchange").not($( this )).find(\'option\').prop("disabled", false);'."\n"; // Enable all options
print ' arrayofselectedvalues = [];'."\n";
+
print ' $("select.targetselectchange").each(function(){'."\n";
print ' id = $(this).attr(\'id\')'."\n";
print ' value = $(this).val()'."\n";
- //print ' console.log("a selected value has been found for component "+id+" = "+value);'."\n";
+ print ' console.log("a selected value has been found for component "+id+" = "+value);'."\n";
print ' arrayofselectedvalues.push(value);'."\n";
print ' });'."\n";
- print ' console.log("List of all selected values");'."\n";
+
+ print ' console.log("List of all selected values arrayofselectedvalues");'."\n";
print ' console.log(arrayofselectedvalues);'."\n";
print ' console.log("Set the option to disabled for every entry that is currently selected somewhere else (so into arrayofselectedvalues)");'."\n";
- print ' $.each( arrayofselectedvalues, function( key, value ) {'."\n"; // Loop on each selected value
+
+ print ' $.each(arrayofselectedvalues, function(key, value) {'."\n"; // Loop on each selected value
print ' if (value != -1) {'."\n";
- //print ' console.log("Process key="+key+" value="+value+" to disable.");'."\n";
+ print ' console.log("Process key="+key+" value="+value+" to disable.");'."\n";
print ' $("select.targetselectchange").find(\'option[value="\'+value+\'"]:not(:selected)\').prop("disabled", true);'."\n"; // Set to disabled except if currently selected
print ' }'."\n";
print ' });'."\n";
@@ -1336,12 +1349,13 @@ if ($step == 4 && $datatoimport) {
print 'function saveSelection() {'."\n";
//print ' console.log(arrayofselectedvalues);'."\n";
print ' arrayselectedfields = [];'."\n";
- print ' arrayselectedfields.push("0");'."\n";
+ print ' arrayselectedfields.push(0);'."\n";
+
print ' $.each( arrayofselectedvalues, function( key, value ) {'."\n";
print ' if (value != -1) {'."\n";
- print ' arrayselectedfields.push(value);'."\n";
+ print ' arrayselectedfields.push(value);'."\n";
print ' } else {'."\n";
- print ' arrayselectedfields.push(0);'."\n";
+ print ' arrayselectedfields.push(0);'."\n";
print ' }'."\n";
print ' });'."\n";
@@ -1351,12 +1365,14 @@ if ($step == 4 && $datatoimport) {
print " url: '".dol_escape_js($_SERVER["PHP_SELF"])."?action=saveselectorder&token=".newToken()."',\n";
print " data: 'selectorder='+arrayselectedfields.toString(),\n";
print " success: function(){\n";
- print " console.log('Select order saved');\n";
+ print " console.log('The selected fields have been saved into '+arrayselectedfields.toString());\n";
print " },\n";
print ' });'."\n";
// Now we loop on all target fields that are mandatory to show if they are not mapped yet.
+ print ' console.log("arrayselectedfields");';
print ' console.log(arrayselectedfields);';
+ print ' console.log("arrayoftargetmandatoryfields");';
print ' console.log(arrayoftargetmandatoryfields);';
print " listtoshow = '';";
print " nbelement = arrayoftargetmandatoryfields.length
@@ -1884,16 +1900,17 @@ if ($step == 5 && $datatoimport) {
// Show OK
if (!count($arrayoferrors) && !count($arrayofwarnings)) {
- print ''.img_picto($langs->trans("OK"), 'tick').' '.$langs->trans("NoError").'
';
- print '';
+ 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 '
';
print '
';
} else {
print '
';
- print '
';
- print $langs->trans("NbOfLinesOK", $nbok).'
';
+ print '
';
+ print $langs->trans("NbOfLinesOK", $nbok).'... ';
print '
';
print '
';
}
@@ -2279,10 +2296,10 @@ if ($step == 6 && $datatoimport) {
// Show result
print '
';
- print '
';
+ print '
';
print $langs->trans("NbOfLinesImported", $nbok).' ';
print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).' ';
- print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).' ';
+ print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).' ';
print '
';
print '
';
print $langs->trans("FileWasImported", $importid).'
';
diff --git a/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.sql b/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql
similarity index 54%
rename from htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.sql
rename to htdocs/install/mysql/data/llx_c_asset_disposal_type.sql
index 7ff09176216..4951b9df198 100644
--- a/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.sql
+++ b/htdocs/install/mysql/data/llx_c_asset_disposal_type.sql
@@ -1,4 +1,4 @@
--- Copyright (C) 2018 Alexandre Spangaro
+-- Copyright (C) 2022 OpenDSI
--
-- 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
@@ -12,12 +12,13 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see .
+--
+--
-create table llx_asset_type_extrafields
-(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- fk_object integer NOT NULL,
- import_key varchar(14) -- import key
-) ENGINE=innodb;
+--
+-- Do not include comments at end of line, this file is parsed during install and string '--' are removed.
+--
+INSERT INTO llx_c_asset_disposal_type (rowid, entity, code, label, active) VALUES (1, 1, 'C', 'Sale', 1);
+INSERT INTO llx_c_asset_disposal_type (rowid, entity, code, label, active) VALUES (2, 1, 'HS', 'Putting out of service', 1);
+INSERT INTO llx_c_asset_disposal_type (rowid, entity, code, label, active) VALUES (3, 1, 'D', 'Destruction', 1);
diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
index d4079d4f64c..b57cab5b4eb 100644
--- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
+++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
@@ -136,6 +136,9 @@ ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL;
-- v16
+ALTER TABLE llx_projet_task_time ADD COLUMN intervention_id integer DEFAULT NULL;
+ALTER TABLE llx_projet_task_time ADD COLUMN intervention_line_id integer DEFAULT NULL;
+
ALTER TABLE llx_c_stcomm MODIFY COLUMN code VARCHAR(24) NOT NULL;
ALTER TABLE llx_societe_account DROP FOREIGN KEY llx_societe_account_fk_website;
@@ -178,48 +181,48 @@ ALTER TABLE llx_stock_mouvement_extrafields ADD INDEX idx_stock_mouvement_extraf
CREATE TABLE llx_facture_fourn_rec
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
- titre varchar(200) NOT NULL,
- ref_supplier varchar(180) NOT NULL,
- entity integer DEFAULT 1 NOT NULL,
- fk_soc integer NOT NULL,
+ titre varchar(200) NOT NULL,
+ ref_supplier varchar(180) NOT NULL,
+ entity integer DEFAULT 1 NOT NULL,
+ fk_soc integer NOT NULL,
datec datetime,
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- suspended integer DEFAULT 0,
- libelle varchar(255),
- amount double(24, 8) DEFAULT 0 NOT NULL,
- remise real DEFAULT 0,
- vat_src_code varchar(10) DEFAULT '',
- localtax1 double(24,8) DEFAULT 0,
- localtax2 double(24,8) DEFAULT 0,
- total_ht double(24,8) DEFAULT 0,
- total_tva double(24,8) DEFAULT 0,
- total_ttc double(24,8) DEFAULT 0,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ suspended integer DEFAULT 0,
+ libelle varchar(255),
+ amount double(24,8) DEFAULT 0 NOT NULL,
+ remise real DEFAULT 0,
+ vat_src_code varchar(10) DEFAULT '',
+ localtax1 double(24,8) DEFAULT 0,
+ localtax2 double(24,8) DEFAULT 0,
+ total_ht double(24,8) DEFAULT 0,
+ total_tva double(24,8) DEFAULT 0,
+ total_ttc double(24,8) DEFAULT 0,
fk_user_author integer,
fk_user_modif integer,
fk_projet integer,
fk_account integer,
- fk_cond_reglement integer,
- fk_mode_reglement integer,
+ fk_cond_reglement integer,
+ fk_mode_reglement integer,
date_lim_reglement date,
note_private text,
note_public text,
modelpdf varchar(255),
fk_multicurrency integer,
multicurrency_code varchar(3),
- multicurrency_tx double(24,8) DEFAULT 1,
- multicurrency_total_ht double(24,8) DEFAULT 0,
- multicurrency_total_tva double(24,8) DEFAULT 0,
- multicurrency_total_ttc double(24,8) DEFAULT 0,
- usenewprice integer DEFAULT 0,
+ multicurrency_tx double(24,8) DEFAULT 1,
+ multicurrency_total_ht double(24,8) DEFAULT 0,
+ multicurrency_total_tva double(24,8) DEFAULT 0,
+ multicurrency_total_ttc double(24,8) DEFAULT 0,
+ usenewprice integer DEFAULT 0,
frequency integer,
- unit_frequency varchar(2) DEFAULT 'm',
- date_when datetime DEFAULT NULL,
- date_last_gen datetime DEFAULT NULL,
- nb_gen_done integer DEFAULT NULL,
- nb_gen_max integer DEFAULT NULL,
- auto_validate integer DEFAULT 0,
- generate_pdf integer DEFAULT 1
-)ENGINE=innodb;
+ unit_frequency varchar(2) DEFAULT 'm',
+ date_when datetime DEFAULT NULL,
+ date_last_gen datetime DEFAULT NULL,
+ nb_gen_done integer DEFAULT NULL,
+ nb_gen_max integer DEFAULT NULL,
+ auto_validate integer DEFAULT 0,
+ generate_pdf integer DEFAULT 1
+) ENGINE=innodb;
ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (titre, entity);
ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref_supplier (ref_supplier, fk_soc, entity);
@@ -248,23 +251,23 @@ CREATE TABLE llx_facture_fourn_det_rec
fk_parent_line integer NULL,
fk_product integer NULL,
ref varchar(50),
- label varchar(255) DEFAULT NULL,
+ label varchar(255) DEFAULT NULL,
description text,
pu_ht double(24,8),
pu_ttc double(24,8),
qty real,
- remise_percent real DEFAULT 0,
- fk_remise_except integer NULL,
- vat_src_code varchar(10) DEFAULT '',
+ remise_percent real DEFAULT 0,
+ fk_remise_except integer NULL,
+ vat_src_code varchar(10) DEFAULT '',
tva_tx double(7,4),
- localtax1_tx double(7,4) DEFAULT 0,
- localtax1_type varchar(10) NULL,
- localtax2_tx double(7,4) DEFAULT 0,
- localtax2_type varchar(10) NULL,
+ localtax1_tx double(7,4) DEFAULT 0,
+ localtax1_type varchar(10) NULL,
+ localtax2_tx double(7,4) DEFAULT 0,
+ localtax2_type varchar(10) NULL,
total_ht double(24,8),
total_tva double(24,8),
- total_localtax1 double(24,8) DEFAULT 0,
- total_localtax2 double(24,8) DEFAULT 0,
+ total_localtax1 double(24,8) DEFAULT 0,
+ total_localtax2 double(24,8) DEFAULT 0,
total_ttc double(24,8),
product_type integer DEFAULT 0,
date_start integer DEFAULT NULL,
@@ -282,17 +285,20 @@ CREATE TABLE llx_facture_fourn_det_rec
multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
-)ENGINE=innodb;
+) ENGINE=innodb;
+
ALTER TABLE llx_facture_fourn_det_rec ADD CONSTRAINT fk_facture_fourn_det_rec_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
+
CREATE TABLE llx_facture_fourn_det_rec_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL, -- object id
- import_key varchar(14) -- import key
-)ENGINE=innodb;
+ import_key varchar(14) -- import key
+) ENGINE=innodb;
+
ALTER TABLE llx_facture_fourn_det_rec_extrafields ADD INDEX idx_facture_fourn_det_rec_extrafields (fk_object);
@@ -311,7 +317,8 @@ ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN position INTEGER NOT NU
ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget;
-ALTER TABLE llx_mailing ADD UNIQUE INDEX uk_mailing(titre, entity);
+ALTER TABLE llx_mailing ADD UNIQUE INDEX uk_mailing (titre, entity);
+
create table llx_inventory_extrafields
(
@@ -321,6 +328,7 @@ create table llx_inventory_extrafields
import_key varchar(14) -- import key
) ENGINE=innodb;
+
ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object);
ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128);
@@ -330,6 +338,234 @@ ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER dom
-- Set default ticket type to OTHER if no default exists
UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1);
+-- Assets - New module
+ALTER TABLE llx_asset DROP FOREIGN KEY fk_asset_asset_type;
+ALTER TABLE llx_asset DROP INDEX idx_asset_fk_asset_type;
+
+ALTER TABLE llx_asset CHANGE COLUMN amount_ht acquisition_value_ht double(24,8) NOT NULL;
+ALTER TABLE llx_asset CHANGE COLUMN amount_vat recovered_vat double(24,8);
+
+DELETE FROM llx_asset WHERE fk_asset_type IS NOT NULL;
+
+ALTER TABLE llx_asset DROP COLUMN fk_asset_type;
+ALTER TABLE llx_asset DROP COLUMN description;
+
+ALTER TABLE llx_asset ADD COLUMN fk_asset_model integer AFTER label;
+ALTER TABLE llx_asset ADD COLUMN reversal_amount_ht double(24,8) AFTER fk_asset_model;
+ALTER TABLE llx_asset ADD COLUMN reversal_date date AFTER recovered_vat;
+ALTER TABLE llx_asset ADD COLUMN date_acquisition date NOT NULL AFTER reversal_date;
+ALTER TABLE llx_asset ADD COLUMN date_start date NOT NULL AFTER date_acquisition;
+ALTER TABLE llx_asset ADD COLUMN qty real DEFAULT 1 NOT NULL AFTER date_start;
+ALTER TABLE llx_asset ADD COLUMN acquisition_type smallint DEFAULT 0 NOT NULL AFTER qty;
+ALTER TABLE llx_asset ADD COLUMN asset_type smallint DEFAULT 0 NOT NULL AFTER acquisition_type;
+ALTER TABLE llx_asset ADD COLUMN not_depreciated integer DEFAULT 0 AFTER asset_type;
+ALTER TABLE llx_asset ADD COLUMN disposal_date date AFTER not_depreciated;
+ALTER TABLE llx_asset ADD COLUMN disposal_amount_ht double(24,8) AFTER disposal_date;
+ALTER TABLE llx_asset ADD COLUMN fk_disposal_type integer AFTER disposal_amount_ht;
+ALTER TABLE llx_asset ADD COLUMN disposal_depreciated integer DEFAULT 0 AFTER fk_disposal_type;
+ALTER TABLE llx_asset ADD COLUMN disposal_subject_to_vat integer DEFAULT 0 AFTER disposal_depreciated;
+ALTER TABLE llx_asset ADD COLUMN last_main_doc varchar(255) AFTER fk_user_modif;
+ALTER TABLE llx_asset ADD COLUMN model_pdf varchar(255) AFTER import_key;
+
+DROP TABLE llx_asset_type;
+
+
+CREATE TABLE llx_c_asset_disposal_type
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ entity integer NOT NULL DEFAULT 1,
+ code varchar(16) NOT NULL,
+ label varchar(50) NOT NULL,
+ active integer NOT NULL DEFAULT 1
+) ENGINE=innodb;
+
+
+CREATE TABLE llx_asset_accountancy_codes_economic
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ fk_asset integer,
+ fk_asset_model integer,
+
+ asset varchar(32),
+ depreciation_asset varchar(32),
+ depreciation_expense varchar(32),
+ value_asset_sold varchar(32),
+ receivable_on_assignment varchar(32),
+ proceeds_from_sales varchar(32),
+ vat_collected varchar(32),
+ vat_deductible varchar(32),
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
+
+
+CREATE TABLE llx_asset_accountancy_codes_fiscal
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ fk_asset integer,
+ fk_asset_model integer,
+
+ accelerated_depreciation varchar(32),
+ endowment_accelerated_depreciation varchar(32),
+ provision_accelerated_depreciation varchar(32),
+
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
+
+
+CREATE TABLE llx_asset_depreciation_options_economic
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ fk_asset integer,
+ fk_asset_model integer,
+
+ depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional
+ accelerated_depreciation_option integer, -- activate accelerated depreciation mode (fiscal)
+
+ degressive_coefficient double(24,8),
+ duration smallint NOT NULL,
+ duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily
+
+ amount_base_depreciation_ht double(24,8),
+ amount_base_deductible_ht double(24,8),
+ total_amount_last_depreciation_ht double(24,8),
+
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
+
+
+CREATE TABLE llx_asset_depreciation_options_fiscal
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ fk_asset integer,
+ fk_asset_model integer,
+
+ depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional
+
+ degressive_coefficient double(24,8),
+ duration smallint NOT NULL,
+ duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily
+
+ amount_base_depreciation_ht double(24,8),
+ amount_base_deductible_ht double(24,8),
+ total_amount_last_depreciation_ht double(24,8),
+
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
+
+
+CREATE TABLE llx_asset_depreciation
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+
+ fk_asset integer NOT NULL,
+ depreciation_mode varchar(255) NOT NULL, -- (economic, fiscal or other)
+
+ ref varchar(255) NOT NULL,
+ depreciation_date datetime NOT NULL,
+ depreciation_ht double(24,8) NOT NULL,
+ cumulative_depreciation_ht double(24,8) NOT NULL,
+
+ accountancy_code_debit varchar(32),
+ accountancy_code_credit varchar(32),
+
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
+
+
+CREATE TABLE llx_asset_model(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ entity integer DEFAULT 1 NOT NULL, -- multi company id
+ ref varchar(128) NOT NULL,
+ label varchar(255) NOT NULL,
+
+ asset_type smallint NOT NULL,
+ fk_pays integer DEFAULT 0,
+
+ note_public text,
+ note_private text,
+ date_creation datetime NOT NULL,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_creat integer NOT NULL,
+ fk_user_modif integer,
+ import_key varchar(14),
+ status smallint NOT NULL
+) ENGINE=innodb;
+
+CREATE TABLE llx_asset_model_extrafields
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_object integer NOT NULL,
+ import_key varchar(14) -- import key
+) ENGINE=innodb;
+
+
+ALTER TABLE llx_c_asset_disposal_type ADD UNIQUE INDEX uk_c_asset_disposal_type(code, entity);
+
+ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_model (fk_asset_model);
+ALTER TABLE llx_asset ADD INDEX idx_asset_fk_disposal_type (fk_disposal_type);
+
+ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_disposal_type FOREIGN KEY (fk_disposal_type) REFERENCES llx_c_asset_disposal_type (rowid);
+ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
+ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
+
+ALTER TABLE llx_asset_accountancy_codes_economic ADD INDEX idx_asset_ace_rowid (rowid);
+ALTER TABLE llx_asset_accountancy_codes_economic ADD UNIQUE uk_asset_ace_fk_asset (fk_asset);
+ALTER TABLE llx_asset_accountancy_codes_economic ADD UNIQUE uk_asset_ace_fk_asset_model (fk_asset_model);
+
+ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
+
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD INDEX idx_asset_acf_rowid (rowid);
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD UNIQUE uk_asset_acf_fk_asset (fk_asset);
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD UNIQUE uk_asset_acf_fk_asset_model (fk_asset_model);
+
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
+
+ALTER TABLE llx_asset_depreciation_options_economic ADD INDEX idx_asset_doe_rowid (rowid);
+ALTER TABLE llx_asset_depreciation_options_economic ADD UNIQUE uk_asset_doe_fk_asset (fk_asset);
+ALTER TABLE llx_asset_depreciation_options_economic ADD UNIQUE uk_asset_doe_fk_asset_model (fk_asset_model);
+
+ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
+
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD INDEX idx_asset_dof_rowid (rowid);
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD UNIQUE uk_asset_dof_fk_asset (fk_asset);
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD UNIQUE uk_asset_dof_fk_asset_model (fk_asset_model);
+
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
+
+ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_rowid (rowid);
+ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_fk_asset (fk_asset);
+ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_depreciation_mode (depreciation_mode);
+ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_ref (ref);
+ALTER TABLE llx_asset_depreciation ADD UNIQUE uk_asset_depreciation_fk_asset (fk_asset, depreciation_mode, ref);
+
+ALTER TABLE llx_asset_depreciation ADD CONSTRAINT fk_asset_depreciation_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_depreciation ADD CONSTRAINT fk_asset_depreciation_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
+
+ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_rowid (rowid);
+ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_ref (ref);
+ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_pays (fk_pays);
+ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_entity (entity);
+ALTER TABLE llx_asset_model ADD UNIQUE INDEX uk_asset_model (entity, ref);
+
+ALTER TABLE llx_asset_model ADD CONSTRAINT fk_asset_model_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
+ALTER TABLE llx_asset_model ADD CONSTRAINT fk_asset_model_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
+
+ALTER TABLE llx_asset_model_extrafields ADD INDEX idx_asset_model_extrafields (fk_object);
ALTER TABLE llx_user DROP COLUMN webcal_login;
ALTER TABLE llx_user DROP COLUMN module_comm;
@@ -363,10 +599,11 @@ UPDATE llx_c_availability SET type_duration = 'w', qty = 4 WHERE code = 'AV_4W';
-- Deposit generation helper with specific payment terms
-ALTER TABLE llx_c_payment_term ADD COLUMN deposit_percent VARCHAR(63) DEFAULT NULL AFTER decalage;
-ALTER TABLE llx_societe ADD COLUMN deposit_percent VARCHAR(63) DEFAULT NULL AFTER cond_reglement;
-ALTER TABLE llx_propal ADD COLUMN deposit_percent VARCHAR(63) DEFAULT NULL AFTER fk_cond_reglement;
-ALTER TABLE llx_commande ADD COLUMN deposit_percent VARCHAR(63) DEFAULT NULL AFTER fk_cond_reglement;
+ALTER TABLE llx_c_payment_term ADD COLUMN deposit_percent VARCHAR(63) DEFAULT NULL AFTER decalage;
+ALTER TABLE llx_societe ADD COLUMN deposit_percent VARCHAR(63) DEFAULT NULL AFTER cond_reglement;
+ALTER TABLE llx_propal ADD COLUMN deposit_percent VARCHAR(63) DEFAULT NULL AFTER fk_cond_reglement;
+ALTER TABLE llx_commande ADD COLUMN deposit_percent VARCHAR(63) DEFAULT NULL AFTER fk_cond_reglement;
+
INSERT INTO llx_c_payment_term(code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour, deposit_percent) values ('DEP30PCTDEL', 13, 0, '__DEPOSIT_PERCENT__% deposit', '__DEPOSIT_PERCENT__% deposit, remainder on delivery', 0, 1, '30');
@@ -381,13 +618,13 @@ DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_
ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label);
-ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255);
-ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128);
+ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255);
+ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN firstname varchar(100);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN lastname varchar(100);
-ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN email_company varchar(128) after email;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN firstname varchar(100);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN lastname varchar(100);
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN email_company varchar(128) after email;
ALTER TABLE llx_c_email_template ADD COLUMN email_from varchar(255);
diff --git a/htdocs/install/mysql/tables/llx_adherent_type.sql b/htdocs/install/mysql/tables/llx_adherent_type.sql
index 243372c0452..4144d9b32b7 100644
--- a/htdocs/install/mysql/tables/llx_adherent_type.sql
+++ b/htdocs/install/mysql/tables/llx_adherent_type.sql
@@ -18,22 +18,23 @@
--
-- ===================================================================
--
--- statut
--- 0 : actif
--- 1 : inactif
+-- state / statut
+-- 0 : active / actif
+-- 1 : inactive / inactif
+--
create table llx_adherent_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
- entity integer DEFAULT 1 NOT NULL,
+ entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- statut smallint NOT NULL DEFAULT 0,
- libelle varchar(50) NOT NULL,
- morphy varchar(3) NOT NULL,
- duration varchar(6) DEFAULT NULL,
- subscription varchar(3) NOT NULL DEFAULT '1',
- amount double(24,8) DEFAULT NULL,
- vote varchar(3) NOT NULL DEFAULT '1',
- note text,
- mail_valid text
+ statut smallint NOT NULL DEFAULT 0, -- state 0 = active , 1 = inactive
+ libelle varchar(50) NOT NULL, -- label
+ morphy varchar(3) NOT NULL, -- moral and/or physical entity
+ duration varchar(6) DEFAULT NULL, -- (minimal) duration of membership
+ subscription varchar(3) NOT NULL DEFAULT '1', -- subscription with costs / fee or without / for free
+ amount double(24,8) DEFAULT NULL, -- membership fee
+ vote varchar(3) NOT NULL DEFAULT '1', -- entitled to vote
+ note text, -- description / comment
+ mail_valid text -- text for welcome email
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset-asset.key.sql b/htdocs/install/mysql/tables/llx_asset-asset.key.sql
index a82f29ee58b..6175ed8a2b7 100644
--- a/htdocs/install/mysql/tables/llx_asset-asset.key.sql
+++ b/htdocs/install/mysql/tables/llx_asset-asset.key.sql
@@ -1,4 +1,5 @@
--- Copyright (C) 2018 Alexandre Spangaro
+-- ========================================================================
+-- Copyright (C) 2018-2022 OpenDSI
--
-- 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
@@ -12,12 +13,12 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_model (fk_asset_model);
+ALTER TABLE llx_asset ADD INDEX idx_asset_fk_disposal_type (fk_disposal_type);
-ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
-ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
-ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
-
-ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);
-ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_type) REFERENCES llx_asset_type (rowid);
-
+ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_disposal_type FOREIGN KEY (fk_disposal_type) REFERENCES llx_c_asset_disposal_type (rowid);
+ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
+ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
diff --git a/htdocs/install/mysql/tables/llx_asset-asset.sql b/htdocs/install/mysql/tables/llx_asset-asset.sql
index 52eeda3ba58..2eed188bc14 100644
--- a/htdocs/install/mysql/tables/llx_asset-asset.sql
+++ b/htdocs/install/mysql/tables/llx_asset-asset.sql
@@ -1,4 +1,5 @@
--- Copyright (C) 2018 Alexandre Spangaro
+-- ========================================================================
+-- Copyright (C) 2018-2022 OpenDSI
--
-- 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
@@ -12,23 +13,53 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
-
+-- ========================================================================
+--
+-- Table for fixed asset
+--
+-- Data example:
+-- INSERT INTO llx_asset (ref, entity, label, fk_asset_model, reversal_amount_ht, acquisition_value_ht, recovered_vat, reversal_date, date_acquisition, date_start, qty, acquisition_type, asset_type, not_depreciated, disposal_date, disposal_amount_ht, fk_disposal_type, disposal_depreciated, disposal_subject_to_vat, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status) VALUES
+-- ('LAPTOP', 1, 'LAPTOP xxx for accountancy department', 1, NULL, 1000.00000000, NULL, NULL, '2022-01-18', '2022-01-20', 0, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2022-01-18 14:31:21', '2022-03-09 14:09:46', 1, 1, NULL, NULL, NULL, 0);
CREATE TABLE llx_asset(
- rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
- ref varchar(128) NOT NULL,
- entity integer DEFAULT 1 NOT NULL,
- label varchar(255),
- amount_ht double(24,8) DEFAULT NULL,
- amount_vat double(24,8) DEFAULT NULL,
- fk_asset_type integer NOT NULL,
- description text,
- note_public text,
- note_private text,
- date_creation datetime NOT NULL,
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- fk_user_creat integer NOT NULL,
- fk_user_modif integer,
- import_key varchar(14),
- status integer NOT NULL
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ ref varchar(128) NOT NULL,
+ entity integer DEFAULT 1 NOT NULL,
+ label varchar(255),
+
+ fk_asset_model integer,
+
+ reversal_amount_ht double(24,8),
+ acquisition_value_ht double(24,8) DEFAULT NULL,
+ recovered_vat double(24,8),
+
+ reversal_date date,
+
+ date_acquisition date NOT NULL,
+ date_start date NOT NULL,
+
+ qty real DEFAULT 1 NOT NULL,
+
+ acquisition_type smallint DEFAULT 0 NOT NULL,
+ asset_type smallint DEFAULT 0 NOT NULL,
+
+ not_depreciated integer DEFAULT 0,
+
+ disposal_date date,
+ disposal_amount_ht double(24,8),
+ fk_disposal_type integer,
+ disposal_depreciated integer DEFAULT 0,
+ disposal_subject_to_vat integer DEFAULT 0,
+
+ note_public text,
+ note_private text,
+
+ date_creation datetime NOT NULL,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_creat integer NOT NULL,
+ fk_user_modif integer,
+ last_main_doc varchar(255),
+ import_key varchar(14),
+ model_pdf varchar(255),
+ status integer NOT NULL
) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.key.sql
new file mode 100644
index 00000000000..69bc6754f65
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.key.sql
@@ -0,0 +1,24 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+
+ALTER TABLE llx_asset_accountancy_codes_economic ADD INDEX idx_asset_ace_rowid (rowid);
+ALTER TABLE llx_asset_accountancy_codes_economic ADD UNIQUE uk_asset_ace_fk_asset (fk_asset);
+ALTER TABLE llx_asset_accountancy_codes_economic ADD UNIQUE uk_asset_ace_fk_asset_model (fk_asset_model);
+
+ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset_accountancy_codes_economic ADD CONSTRAINT fk_asset_ace_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql
new file mode 100644
index 00000000000..30969e59916
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_economic-asset.sql
@@ -0,0 +1,40 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+--
+-- Table to store the configuration of the accounting accounts of a fixed asset for economic status (fk_asset will be filled and fk_asset_model will be null)
+-- or to store the configuration of the accounting accounts for templates of asset (fk_asset_model will be filled and fk_asset will be null)
+--
+-- Data example:
+-- INSERT INTO llx_asset_accountancy_codes_economic (fk_asset, fk_asset_model, asset, depreciation_asset, depreciation_expense, value_asset_sold, receivable_on_assignment, proceeds_from_sales, vat_collected, vat_deductible, tms, fk_user_modif) VALUES
+-- (1, NULL, '2183', '2818', '68112', '675', '465', '775', '44571', '44562', '2022-01-18 14:20:20', 1);
+
+CREATE TABLE llx_asset_accountancy_codes_economic(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ fk_asset integer,
+ fk_asset_model integer,
+
+ asset varchar(32),
+ depreciation_asset varchar(32),
+ depreciation_expense varchar(32),
+ value_asset_sold varchar(32),
+ receivable_on_assignment varchar(32),
+ proceeds_from_sales varchar(32),
+ vat_collected varchar(32),
+ vat_deductible varchar(32),
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.key.sql
new file mode 100644
index 00000000000..f7a4109b9fa
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.key.sql
@@ -0,0 +1,24 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD INDEX idx_asset_acf_rowid (rowid);
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD UNIQUE uk_asset_acf_fk_asset (fk_asset);
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD UNIQUE uk_asset_acf_fk_asset_model (fk_asset_model);
+
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset_accountancy_codes_fiscal ADD CONSTRAINT fk_asset_acf_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
diff --git a/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql
new file mode 100644
index 00000000000..9c005727f81
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_accountancy_codes_fiscal-asset.sql
@@ -0,0 +1,35 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+--
+-- Table to store the configuration of the accounting accounts of a fixed asset for fiscal status
+--
+-- Data example:
+-- INSERT INTO llx_asset_accountancy_codes_fiscal (fk_asset, fk_asset_model, accelerated_depreciation, endowment_accelerated_depreciation, provision_accelerated_depreciation, tms, fk_user_modif) VALUES
+-- (1, NULL, NULL, NULL, NULL, '2022-01-18 14:20:20', 1);
+
+CREATE TABLE llx_asset_accountancy_codes_fiscal(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ fk_asset integer,
+ fk_asset_model integer,
+
+ accelerated_depreciation varchar(32),
+ endowment_accelerated_depreciation varchar(32),
+ provision_accelerated_depreciation varchar(32),
+
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.key.sql
new file mode 100644
index 00000000000..531f88d72ba
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.key.sql
@@ -0,0 +1,25 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+
+ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_rowid (rowid);
+ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_fk_asset (fk_asset);
+ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_depreciation_mode (depreciation_mode);
+ALTER TABLE llx_asset_depreciation ADD INDEX idx_asset_depreciation_ref (ref);
+ALTER TABLE llx_asset_depreciation ADD UNIQUE uk_asset_depreciation_fk_asset (fk_asset, depreciation_mode, ref);
+
+ALTER TABLE llx_asset_depreciation ADD CONSTRAINT fk_asset_depreciation_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_depreciation ADD CONSTRAINT fk_asset_depreciation_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql
new file mode 100644
index 00000000000..0347e8d112d
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_depreciation-asset.sql
@@ -0,0 +1,100 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================.
+--
+-- Table to store depreciation of a fixed asset
+--
+-- Data example:
+-- INSERT INTO llx_asset_depreciation (rowid, fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit, tms, fk_user_modif) VALUES
+-- (194, 1, 'economic', '2022-01', '2022-01-31 23:59:59', 2.00000000, 2.00000000, '2818', '68112', '2022-03-09 14:10:29', NULL),
+-- (195, 1, 'economic', '2022-02', '2022-02-28 23:59:59', 5.00000000, 7.00000000, '2818', '68112', '2022-03-09 14:10:29', NULL),
+-- (314, 1, 'economic', '2022-03', '2022-03-31 23:59:59', 8.33000000, 15.33000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (315, 1, 'economic', '2022-04', '2022-04-30 23:59:59', 8.33000000, 23.66000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (316, 1, 'economic', '2022-05', '2022-05-31 23:59:59', 8.33000000, 31.99000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (317, 1, 'economic', '2022-06', '2022-06-30 23:59:59', 8.33000000, 40.32000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (318, 1, 'economic', '2022-07', '2022-07-31 23:59:59', 8.33000000, 48.65000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (319, 1, 'economic', '2022-08', '2022-08-31 23:59:59', 8.33000000, 56.98000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (320, 1, 'economic', '2022-09', '2022-09-30 23:59:59', 8.33000000, 65.31000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (321, 1, 'economic', '2022-10', '2022-10-31 23:59:59', 8.33000000, 73.64000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (322, 1, 'economic', '2022-11', '2022-11-30 23:59:59', 8.33000000, 81.97000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (323, 1, 'economic', '2022-12', '2022-12-31 23:59:59', 8.33000000, 90.30000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (324, 1, 'economic', '2023-01', '2023-01-31 23:59:59', 8.33000000, 98.63000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (325, 1, 'economic', '2023-02', '2023-02-28 23:59:59', 8.33000000, 106.96000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (326, 1, 'economic', '2023-03', '2023-03-31 23:59:59', 8.33000000, 115.29000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (327, 1, 'economic', '2023-04', '2023-04-30 23:59:59', 8.33000000, 123.62000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (328, 1, 'economic', '2023-05', '2023-05-31 23:59:59', 8.33000000, 131.95000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (329, 1, 'economic', '2023-06', '2023-06-30 23:59:59', 8.33000000, 140.28000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (330, 1, 'economic', '2023-07', '2023-07-31 23:59:59', 8.33000000, 148.61000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (331, 1, 'economic', '2023-08', '2023-08-31 23:59:59', 8.33000000, 156.94000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (332, 1, 'economic', '2023-09', '2023-09-30 23:59:59', 8.33000000, 165.27000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (333, 1, 'economic', '2023-10', '2023-10-31 23:59:59', 8.33000000, 173.60000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (334, 1, 'economic', '2023-11', '2023-11-30 23:59:59', 8.33000000, 181.93000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (335, 1, 'economic', '2023-12', '2023-12-31 23:59:59', 8.33000000, 190.26000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (336, 1, 'economic', '2024-01', '2024-01-31 23:59:59', 8.33000000, 198.59000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (337, 1, 'economic', '2024-02', '2024-02-29 23:59:59', 8.33000000, 206.92000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (338, 1, 'economic', '2024-03', '2024-03-31 23:59:59', 8.33000000, 215.25000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (339, 1, 'economic', '2024-04', '2024-04-30 23:59:59', 8.33000000, 223.58000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (340, 1, 'economic', '2024-05', '2024-05-31 23:59:59', 8.33000000, 231.91000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (341, 1, 'economic', '2024-06', '2024-06-30 23:59:59', 8.33000000, 240.24000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (342, 1, 'economic', '2024-07', '2024-07-31 23:59:59', 8.33000000, 248.57000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (343, 1, 'economic', '2024-08', '2024-08-31 23:59:59', 8.33000000, 256.90000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (344, 1, 'economic', '2024-09', '2024-09-30 23:59:59', 8.33000000, 265.23000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (345, 1, 'economic', '2024-10', '2024-10-31 23:59:59', 8.33000000, 273.56000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (346, 1, 'economic', '2024-11', '2024-11-30 23:59:59', 8.33000000, 281.89000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (347, 1, 'economic', '2024-12', '2024-12-31 23:59:59', 8.33000000, 290.22000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (348, 1, 'economic', '2025-01', '2025-01-31 23:59:59', 8.33000000, 298.55000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (349, 1, 'economic', '2025-02', '2025-02-28 23:59:59', 8.33000000, 306.88000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (350, 1, 'economic', '2025-03', '2025-03-31 23:59:59', 8.33000000, 315.21000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (351, 1, 'economic', '2025-04', '2025-04-30 23:59:59', 8.33000000, 323.54000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (352, 1, 'economic', '2025-05', '2025-05-31 23:59:59', 8.33000000, 331.87000000, '2818', '68112', '2022-03-09 14:15:48', NULL),
+-- (353, 1, 'economic', '2025-06', '2025-06-30 23:59:59', 8.33000000, 340.20000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (354, 1, 'economic', '2025-07', '2025-07-31 23:59:59', 8.33000000, 348.53000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (355, 1, 'economic', '2025-08', '2025-08-31 23:59:59', 8.33000000, 356.86000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (356, 1, 'economic', '2025-09', '2025-09-30 23:59:59', 8.33000000, 365.19000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (357, 1, 'economic', '2025-10', '2025-10-31 23:59:59', 8.33000000, 373.52000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (358, 1, 'economic', '2025-11', '2025-11-30 23:59:59', 8.33000000, 381.85000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (359, 1, 'economic', '2025-12', '2025-12-31 23:59:59', 8.33000000, 390.18000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (360, 1, 'economic', '2026-01', '2026-01-31 23:59:59', 8.33000000, 398.51000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (361, 1, 'economic', '2026-02', '2026-02-28 23:59:59', 8.33000000, 406.84000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (362, 1, 'economic', '2026-03', '2026-03-31 23:59:59', 8.33000000, 415.17000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (363, 1, 'economic', '2026-04', '2026-04-30 23:59:59', 8.33000000, 423.50000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (364, 1, 'economic', '2026-05', '2026-05-31 23:59:59', 8.33000000, 431.83000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (365, 1, 'economic', '2026-06', '2026-06-30 23:59:59', 8.33000000, 440.16000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (366, 1, 'economic', '2026-07', '2026-07-31 23:59:59', 8.33000000, 448.49000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (367, 1, 'economic', '2026-08', '2026-08-31 23:59:59', 8.33000000, 456.82000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (368, 1, 'economic', '2026-09', '2026-09-30 23:59:59', 8.33000000, 465.15000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (369, 1, 'economic', '2026-10', '2026-10-31 23:59:59', 8.33000000, 473.48000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (370, 1, 'economic', '2026-11', '2026-11-30 23:59:59', 8.33000000, 481.81000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (371, 1, 'economic', '2026-12', '2026-12-31 23:59:59', 8.33000000, 490.14000000, '2818', '68112', '2022-03-09 14:15:49', NULL),
+-- (372, 1, 'economic', '2027-01', '2027-01-31 23:59:59', 9.86000000, 500.00000000, '2818', '68112', '2022-03-09 14:15:49', NULL);
+
+CREATE TABLE llx_asset_depreciation(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+
+ fk_asset integer NOT NULL,
+ depreciation_mode varchar(255) NOT NULL, -- (economic, fiscal or other)
+
+ ref varchar(255) NOT NULL,
+ depreciation_date datetime NOT NULL,
+ depreciation_ht double(24,8) NOT NULL,
+ cumulative_depreciation_ht double(24,8) NOT NULL,
+
+ accountancy_code_debit varchar(32),
+ accountancy_code_credit varchar(32),
+
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.key.sql
new file mode 100644
index 00000000000..569e4f286a2
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.key.sql
@@ -0,0 +1,24 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+
+ALTER TABLE llx_asset_depreciation_options_economic ADD INDEX idx_asset_doe_rowid (rowid);
+ALTER TABLE llx_asset_depreciation_options_economic ADD UNIQUE uk_asset_doe_fk_asset (fk_asset);
+ALTER TABLE llx_asset_depreciation_options_economic ADD UNIQUE uk_asset_doe_fk_asset_model (fk_asset_model);
+
+ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset_depreciation_options_economic ADD CONSTRAINT fk_asset_doe_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql
new file mode 100644
index 00000000000..e23a2ed1414
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql
@@ -0,0 +1,41 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+--
+-- Table to store economical depreciation of a fixed asset
+--
+-- Data example:
+-- INSERT INTO llx_asset_depreciation_options_economic (fk_asset, fk_asset_model, depreciation_type, accelerated_depreciation_option, degressive_coefficient, duration, duration_type, amount_base_depreciation_ht, amount_base_deductible_ht, total_amount_last_depreciation_ht, tms, fk_user_modif) VALUES
+-- (1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1);
+
+CREATE TABLE llx_asset_depreciation_options_economic(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ fk_asset integer,
+ fk_asset_model integer,
+
+ depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional
+ accelerated_depreciation_option integer, -- activate accelerated depreciation mode (fiscal)
+ degressive_coefficient double(24,8),
+ duration smallint NOT NULL,
+ duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily
+
+ amount_base_depreciation_ht double(24,8),
+ amount_base_deductible_ht double(24,8),
+ total_amount_last_depreciation_ht double(24,8),
+
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.key.sql
new file mode 100644
index 00000000000..1fb678696d1
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.key.sql
@@ -0,0 +1,24 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD INDEX idx_asset_dof_rowid (rowid);
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD UNIQUE uk_asset_dof_fk_asset (fk_asset);
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD UNIQUE uk_asset_dof_fk_asset_model (fk_asset_model);
+
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_asset FOREIGN KEY (fk_asset) REFERENCES llx_asset (rowid);
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_asset_model FOREIGN KEY (fk_asset_model) REFERENCES llx_asset_model (rowid);
+ALTER TABLE llx_asset_depreciation_options_fiscal ADD CONSTRAINT fk_asset_dof_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql
new file mode 100644
index 00000000000..3d9d5e9d091
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_fiscal-asset.sql
@@ -0,0 +1,40 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+--
+-- Table to store fiscal depreciation of a fixed asset
+--
+-- Data example:
+-- INSERT INTO llx_asset_depreciation_options_fiscal (fk_asset, fk_asset_model, depreciation_type, accelerated_depreciation_option, degressive_coefficient, duration, duration_type, amount_base_depreciation_ht, amount_base_deductible_ht, total_amount_last_depreciation_ht, tms, fk_user_modif) VALUES
+-- (1, NULL, 1, NULL, 1.75000000, 60, 1, 500.00000000, 0.00000000, 7.00000000, '2022-03-09 14:15:48', 1);
+
+CREATE TABLE llx_asset_depreciation_options_fiscal(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ fk_asset integer,
+ fk_asset_model integer,
+
+ depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional
+ degressive_coefficient double(24,8),
+ duration smallint NOT NULL,
+ duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily
+
+ amount_base_depreciation_ht double(24,8),
+ amount_base_deductible_ht double(24,8),
+ total_amount_last_depreciation_ht double(24,8),
+
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_modif integer
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql
index fe6bb053ed6..5671e2a5b9f 100644
--- a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql
+++ b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql
@@ -16,5 +16,4 @@
--
-- ===================================================================
-
ALTER TABLE llx_asset_extrafields ADD INDEX idx_asset_extrafields (fk_object);
diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql
index c93fac7b20a..95cae4315da 100644
--- a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql
+++ b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.sql
@@ -1,3 +1,4 @@
+-- ===================================================================
-- Copyright (C) 2018 Alexandre Spangaro
--
-- This program is free software; you can redistribute it and/or modify
@@ -12,12 +13,15 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ===================================================================
+--
+-- Table for extrafields of fixed asset
+--
create table llx_asset_extrafields
(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- fk_object integer NOT NULL,
- import_key varchar(14) -- import key
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_object integer NOT NULL,
+ import_key varchar(14) -- import key
) ENGINE=innodb;
-
diff --git a/htdocs/install/mysql/tables/llx_asset_model-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_model-asset.key.sql
new file mode 100644
index 00000000000..5c301e5c147
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_model-asset.key.sql
@@ -0,0 +1,25 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see .
+-- ========================================================================
+
+ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_rowid (rowid);
+ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_entity (entity);
+ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_ref (ref);
+ALTER TABLE llx_asset_model ADD INDEX idx_asset_model_pays (fk_pays);
+ALTER TABLE llx_asset_model ADD UNIQUE INDEX uk_asset_model (entity, ref);
+
+ALTER TABLE llx_asset_model ADD CONSTRAINT fk_asset_model_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
+ALTER TABLE llx_asset_model ADD CONSTRAINT fk_asset_model_user_modif FOREIGN KEY (fk_user_modif) REFERENCES llx_user (rowid);
diff --git a/htdocs/install/mysql/tables/llx_asset_model-asset.sql b/htdocs/install/mysql/tables/llx_asset_model-asset.sql
new file mode 100644
index 00000000000..8c285515986
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_asset_model-asset.sql
@@ -0,0 +1,39 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see .
+-- ========================================================================
+--
+-- Table for fixed asset model
+--
+-- Data example:
+-- INSERT INTO llx_asset_model (entity, ref, label, asset_type, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, import_key, status) VALUES
+-- (1, 'LAPTOP', 'Laptop', 1, NULL, NULL, '2022-01-18 14:27:09', '2022-01-24 09:31:49', 1, 1, NULL, 1);
+
+CREATE TABLE llx_asset_model(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ entity integer DEFAULT 1 NOT NULL, -- multi company id
+ ref varchar(128) NOT NULL,
+ label varchar(255) NOT NULL,
+ asset_type smallint NOT NULL,
+ fk_pays integer DEFAULT 0,
+ note_public text,
+ note_private text,
+ date_creation datetime NOT NULL,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_user_creat integer NOT NULL,
+ fk_user_modif integer,
+ import_key varchar(14),
+ status smallint NOT NULL
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset_type-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.key.sql
similarity index 67%
rename from htdocs/install/mysql/tables/llx_asset_type-asset.key.sql
rename to htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.key.sql
index 4a7c4cb1145..22a6ee89196 100644
--- a/htdocs/install/mysql/tables/llx_asset_type-asset.key.sql
+++ b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.key.sql
@@ -1,4 +1,5 @@
--- Copyright (C) 2018 Alexandre Spangaro
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
--
-- 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
@@ -12,5 +13,6 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see .
+-- ========================================================================
-ALTER TABLE llx_asset_type ADD UNIQUE INDEX uk_asset_type_label (label, entity);
+ALTER TABLE llx_asset_model_extrafields ADD INDEX idx_asset_model_extrafields (fk_object);
diff --git a/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql
similarity index 52%
rename from htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.key.sql
rename to htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql
index ec0b4b28619..1f42d83fc57 100644
--- a/htdocs/install/mysql/tables/llx_asset_type_extrafields-asset.key.sql
+++ b/htdocs/install/mysql/tables/llx_asset_model_extrafield-asset.sql
@@ -1,4 +1,5 @@
--- Copyright (C) 2018 Alexandre Spangaro
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
--
-- 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
@@ -12,6 +13,15 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see .
+-- ========================================================================
+--
+-- Table for extrafields of fixed asset model
+--
-
-ALTER TABLE llx_asset_type_extrafields ADD INDEX idx_asset_type_extrafields (fk_object);
+CREATE TABLE llx_asset_model_extrafields
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_object integer NOT NULL,
+ import_key varchar(14) -- import key
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_asset_type-asset.sql b/htdocs/install/mysql/tables/llx_asset_type-asset.sql
deleted file mode 100644
index 1205acb959b..00000000000
--- a/htdocs/install/mysql/tables/llx_asset_type-asset.sql
+++ /dev/null
@@ -1,26 +0,0 @@
--- Copyright (C) 2018 Alexandre Spangaro
---
--- This program is free software; you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation; either version 3 of the License, or
--- (at your option) any later version.
---
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program. If not, see .
-
-create table llx_asset_type
-(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- entity integer DEFAULT 1 NOT NULL, -- multi company id
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- label varchar(50) NOT NULL,
- accountancy_code_asset varchar(32),
- accountancy_code_depreciation_asset varchar(32),
- accountancy_code_depreciation_expense varchar(32),
- note text
-)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.key.sql b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.key.sql
new file mode 100644
index 00000000000..3f588dc506d
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.key.sql
@@ -0,0 +1,18 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+
+ALTER TABLE llx_c_asset_disposal_type ADD UNIQUE INDEX uk_c_asset_disposal_type(code, entity);
diff --git a/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql
new file mode 100644
index 00000000000..6eba1e75f14
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_c_asset_disposal_type-asset.sql
@@ -0,0 +1,27 @@
+-- ========================================================================
+-- Copyright (C) 2022 OpenDSI
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+-- ========================================================================
+--
+-- Table to store disposal type for a fixed asset
+
+CREATE TABLE llx_c_asset_disposal_type
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ entity integer NOT NULL DEFAULT 1,
+ code varchar(16) NOT NULL,
+ label varchar(50) NOT NULL,
+ active integer DEFAULT 1 NOT NULL
+)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql
index 63eadb1177f..e91e50b5721 100644
--- a/htdocs/install/mysql/tables/llx_projet_task_time.sql
+++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql
@@ -29,6 +29,8 @@ create table llx_projet_task_time
thm double(24,8),
invoice_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice id here
invoice_line_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice line id here
+ intervention_id integer DEFAULT NULL, -- If we need to have an intervention line for each line of timespent, we can save intervention id here
+ intervention_line_id integer DEFAULT NULL, -- If we need to have an intervention line of timespent line, we can save intervention line id here
import_key varchar(14), -- Import key
datec datetime, -- date creation time
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date
diff --git a/htdocs/intracommreport/admin/intracommreport.php b/htdocs/intracommreport/admin/intracommreport.php
index 13231c43af2..3185e8a030e 100644
--- a/htdocs/intracommreport/admin/intracommreport.php
+++ b/htdocs/intracommreport/admin/intracommreport.php
@@ -117,7 +117,7 @@ foreach ($list_DEB as $key) {
print ''.$label.' ';
// Value
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
@@ -181,7 +181,7 @@ foreach ($list_DES as $key) {
print ''.$label.' ';
// Value
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index e4725704dd5..95ed076f347 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -2252,13 +2252,21 @@ TemplateforBusinessCards=Template for a business card in different size
InventorySetup= Inventory Setup
ExportUseLowMemoryMode=Use a low memory mode
ExportUseLowMemoryModeHelp=Use the low memory mode to execute the exec of the dump (compression is done through a pipe instead of into the PHP memory). This method does not allow to check that file is completed and error message can't be reported if it fails.
-ShowQuickAddLink=Show a button to quickly add an object, in top right menu
+
+ModuleWebhookName = Webhook
+ModuleWebhookDesc = Interface to catch dolibarr triggers and send it to an URL
+WebhookSetup = Webhook setup
+Settings = Settings
+WebhookSetupPage = Webhook setup page
+ShowQuickAddLink=Show a button to quickly add an element in top right menu
+
HashForPing=Hash used for ping
ReadOnlyMode=Is instance in "Read Only" mode
DEBUGBAR_USE_LOG_FILE=Use the dolibarr.log file to trap Logs
UsingLogFileShowAllRecordOfSubrequestButIsSlower=Use the dolibarr.log file to trap Logs instead of live memory catching. It allows to catch all logs instead of only log of current process (so including the one of ajax subrequests pages) but will make your instance very very slow. Not recommended.
FixedOrPercent=Fixed (use keyword 'fixed') or percent (use keyword 'percent')
DefaultOpportunityStatus=Default opportunity status (first status when lead is created)
+
IconAndText=Icon and text
TextOnly=Text only
IconOnlyAllTextsOnHover=Icon only - All texts appears under icon on mouse hover menu bar
@@ -2266,4 +2274,6 @@ IconOnlyTextOnHover=Icon only - Text of icon appears under icon on mouse hover t
IconOnly=Icon only - Text on tooltip only
INVOICE_ADD_ZATCA_QR_CODE=Show the ZATCA QR code on invoices
INVOICE_ADD_ZATCA_QR_CODEMore=Some Arabic countries need this QR Code on their invoices
-UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
\ No newline at end of file
+INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices
+UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
+IfThisCategoryIsChildOfAnother=If this category is a child of another one
diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang
index a2d05767cae..62c2752ff9f 100644
--- a/htdocs/langs/en_US/categories.lang
+++ b/htdocs/langs/en_US/categories.lang
@@ -95,6 +95,7 @@ ShowCategory=Show tag/category
ByDefaultInList=By default in list
ChooseCategory=Choose category
StocksCategoriesArea=Warehouse Categories
+TicketsCategoriesArea=Tickets Categories
ActionCommCategoriesArea=Event Categories
WebsitePagesCategoriesArea=Page-Container Categories
KnowledgemanagementsCategoriesArea=KM article Categories
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index 0e61076345b..82ef7f0be9a 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -300,3 +300,4 @@ InvoiceToPay15Days=To pay (15 to 30 days)
InvoiceToPay30Days=To pay (> 30 days)
ConfirmPreselectAccount=Preselect accountancy code
ConfirmPreselectAccountQuestion=Are you sure you want to preselect the %s selected lines with this accountancy code ?
+AmountPaidMustMatchAmountOfDownPayment=Amount paid must match amount of down payment
\ No newline at end of file
diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang
index f06acd49f41..c4c629c9a87 100644
--- a/htdocs/langs/en_US/exports.lang
+++ b/htdocs/langs/en_US/exports.lang
@@ -141,4 +141,5 @@ WarningFirstImportedLine=The first line(s) will not be imported with the current
NotUsedFields=Fields of database not used
SelectImportFieldsSource = Choose the source file fields you want to import and their target field in database by choosing the fields in each select boxes, or select a predefined import profile:
MandatoryTargetFieldsNotMapped=Some mandatory target fields are not mapped
-AllTargetMandatoryFieldsAreMapped=All target fields that need a mandatory value are mapped
\ No newline at end of file
+AllTargetMandatoryFieldsAreMapped=All target fields that need a mandatory value are mapped
+ResultOfSimulationNoError=Result of simulation: No error
\ No newline at end of file
diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang
index ff917913eee..a45028aba60 100644
--- a/htdocs/langs/en_US/hrm.lang
+++ b/htdocs/langs/en_US/hrm.lang
@@ -70,9 +70,9 @@ RequiredSkills=Required skills for this job
UserRank=User Rank
SkillList=Skill list
SaveRank=Save rank
-knowHow=Know how
-HowToBe=How to be
-knowledge=Knowledge
+TypeKnowHow=Know how
+TypeHowToBe=How to be
+TypeKnowledge=Knowledge
AbandonmentComment=Abandonment comment
DateLastEval=Date last evaluation
NoEval=No evaluation done for this employee
@@ -88,3 +88,4 @@ DeleteSkill = Skill removed
SkillsExtraFields=Attributs supplémentaires (Compétences)
JobsExtraFields=Attributs supplémentaires (Emplois)
EvaluationsExtraFields=Attributs supplémentaires (Evaluations)
+NeedBusinessTravels=Need business travels
\ No newline at end of file
diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang
index 349cb42fbab..6de4824ecea 100644
--- a/htdocs/langs/en_US/languages.lang
+++ b/htdocs/langs/en_US/languages.lang
@@ -13,6 +13,7 @@ Language_az_AZ=Azerbaijani
Language_bn_BD=Bengali
Language_bn_IN=Bengali (India)
Language_bg_BG=Bulgarian
+Language_bo_CN=Tibetan
Language_bs_BA=Bosnian
Language_ca_ES=Catalan
Language_cs_CZ=Czech
diff --git a/htdocs/langs/fr_FR/hrm.lang b/htdocs/langs/fr_FR/hrm.lang
index 4a640a2e639..c812afa1fc9 100644
--- a/htdocs/langs/fr_FR/hrm.lang
+++ b/htdocs/langs/fr_FR/hrm.lang
@@ -70,9 +70,9 @@ RequiredSkills=Compétences requises pour cet emploi
UserRank=Niveau employé
SkillList=Liste compétence
SaveRank=Sauvegarder niveau
-knowHow=Savoir comment
-HowToBe=Comment être
-knowledge=Connaissances
+TypeKnowHow=Savoir comment
+TypeHowToBe=Comment être
+TypeKnowledge=Connaissances
AbandonmentComment=Commentaire sur l'abandon
DateLastEval=Date dernière évaluation
NoEval=Aucune évaluation effectuée pour cet employé
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index d07f5375657..64b4c080ec0 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -441,7 +441,7 @@ class MyObject extends CommonObject
$sql .= $this->getFieldList('t');
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
- $sql .= " WHERE t.entity IN (".getEntity($this->table_element).")";
+ $sql .= " WHERE t.entity IN (".getEntity($this->element).")";
} else {
$sql .= " WHERE 1 = 1";
}
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 ec2d42edf83..4338c2b7d6a 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
@@ -185,7 +185,13 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$texte .= ' ';
// Add input to upload a new template file.
- $texte .= ''.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
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 b849389d048..561a705dc4b 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
@@ -716,6 +716,9 @@ class pdf_standard_myobject extends ModelePDFMyObject
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index 22ce7e61e7f..14fd3a52171 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -334,7 +334,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
-$sql .= $db->order($sortfield, $sortorder);
/* If a group by is required
$sql .= " GROUP BY ";
@@ -564,7 +563,7 @@ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
}
foreach ($object->fields as $key => $val) {
$searchkey = empty($search[$key]) ? '' : $search[$key];
- $cssforfield = (empty($val['css']) ? '' : $val['css']);
+ $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index 16249087403..f6aba7f2597 100644
--- a/htdocs/mrp/mo_production.php
+++ b/htdocs/mrp/mo_production.php
@@ -747,7 +747,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
print '';
- if ($conf->stock->enabled) {
+ if (isModEnabled('stock')) {
// Available
print '
';
if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
@@ -756,7 +756,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' ';
}
// Lot - serial
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
print $langs->trans("Batch");
@@ -787,11 +787,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' ';
print ' ';
print ' ';
- if ($conf->stock->enabled) {
+ if (isModEnabled('stock')) {
print '
';
}
// Lot - serial
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
}
// Action
@@ -909,7 +909,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '
';
print ' ';
// Stock
- if ($conf->stock->enabled) {
+ if (isModEnabled('stock')) {
print '
';
if ($tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) {
print img_warning($langs->trans('StockTooLow')).' ';
@@ -918,7 +918,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' ';
}
// Lot
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
}
// Action delete line
@@ -965,12 +965,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '';
// Stock
- if ($conf->stock->enabled) {
+ if (isModEnabled('stock')) {
print '
';
}
// Lot Batch
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
if ($line2['batch'] != '') {
$tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']);
@@ -1033,12 +1033,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' ';
// Stock
- if ($conf->stock->enabled) {
+ if (isModEnabled('stock')) {
print '
';
}
// Lot / Batch
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
if ($tmpproduct->status_batch) {
$preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : '');
@@ -1121,7 +1121,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print $langs->trans("Warehouse");
}
print ' ';
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
print $langs->trans("Batch");
@@ -1149,7 +1149,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' ';
print ' ';
// Lot - serial
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
}
// Action
@@ -1236,7 +1236,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '';
print '
'; // Warehouse
print ' ';
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
'; // Lot
}
@@ -1277,7 +1277,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
print '';
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
if ($line2['batch'] != '') {
$tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']);
@@ -1324,7 +1324,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ''.$langs->trans("NoStockChangeOnServices").' ';
}
print ' ';
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
print '
';
if ($tmpproduct->status_batch) {
$preselected = (GETPOSTISSET('batchtoproduce-'.$line->id.'-'.$i) ? GETPOST('batchtoproduce-'.$line->id.'-'.$i) : '');
diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php
index fdb138eaf76..20985a52647 100644
--- a/htdocs/opensurvey/card.php
+++ b/htdocs/opensurvey/card.php
@@ -404,7 +404,7 @@ print load_fiche_titre($langs->trans("CommentsOfVoters"), '', '');
// Comment list
$comments = $object->getComments();
-if ($comments) {
+if (!empty($comments)) {
foreach ($comments as $comment) {
if ($user->rights->opensurvey->write) {
print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', '', 0).' ';
diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php
index d155abdc2c2..9e6db35754e 100644
--- a/htdocs/product/canvas/product/actions_card_product.class.php
+++ b/htdocs/product/canvas/product/actions_card_product.class.php
@@ -32,6 +32,8 @@ class ActionsCardProduct
public $canvas;
public $card;
+ public $object;
+
//! Template container
public $tpl = array();
@@ -98,13 +100,13 @@ class ActionsCardProduct
$this->tpl['canvas'] = $this->canvas;
// id
- $this->tpl['id'] = $this->id;
+ $this->tpl['id'] = $this->object->id;
// Ref
- $this->tpl['ref'] = $this->ref;
+ $this->tpl['ref'] = $this->object->ref;
// Label
- $this->tpl['label'] = $this->label;
+ $this->tpl['label'] = $this->object->label;
// Description
$this->tpl['description'] = nl2br($this->description);
@@ -113,12 +115,12 @@ class ActionsCardProduct
$this->tpl['status'] = $this->object->getLibStatut(2);
// Note
- $this->tpl['note'] = nl2br($this->note);
+ $this->tpl['note'] = nl2br($this->object->note_private);
if ($action == 'create') {
// Price
- $this->tpl['price'] = $this->price;
- $this->tpl['price_min'] = $this->price_min;
+ $this->tpl['price'] = $this->object->price;
+ $this->tpl['price_min'] = $this->object->price_min;
$this->tpl['price_base_type'] = $form->selectPriceBaseType($this->price_base_type, "price_base_type");
// VAT
@@ -149,7 +151,7 @@ class ActionsCardProduct
$this->tpl['label'] = $this->object->label;
$this->tpl['id'] = $this->object->id;
$this->tpl['type'] = $this->object->type;
- $this->tpl['note'] = $this->object->note;
+ $this->tpl['note'] = $this->object->note_private;
$this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;
if ($action == 'create') {
@@ -169,8 +171,8 @@ class ActionsCardProduct
$statutarray = array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
$this->tpl['status_buy'] = $form->selectarray('statut_buy', $statutarray, $this->object->status_buy);
- $this->tpl['description'] = $this->description;
- $this->tpl['note'] = $this->note;
+ $this->tpl['description'] = $this->object->description;
+ $this->tpl['note'] = $this->object->note;
// Finished
$statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index a1b450f7a0c..d0b7e4ece73 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -13,7 +13,7 @@
* Copyright (C) 2014-2015 Ferran Marcet
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2015 Raphaël Doursenaud
- * Copyright (C) 2016 Charlie Benke
+ * Copyright (C) 2016-2022 Charlene Benke
* Copyright (C) 2016 Meziane Sof
* Copyright (C) 2017 Josep Lluís Amador
* Copyright (C) 2019-2021 Frédéric France
@@ -1860,7 +1860,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
// Batch number managment
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
print '
'.$langs->trans("ManageLotSerial").' ';
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
@@ -1964,7 +1964,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' '.$langs->trans("Description").' ';
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
- $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
+ $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor->Create();
print " ";
@@ -2146,7 +2146,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
print '
'.$langs->trans("NoteNotVisibleOnBill").' ';
- $doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
+ $doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor->Create();
print " ";
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 96ce57c5bbe..49242eb47e4 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -285,34 +285,8 @@ if (empty($reshook)) {
if (GETPOSTISSET('ref_fourn_price_id')) {
$object->fetch_product_fournisseur_price(GETPOST('ref_fourn_price_id', 'int'));
}
-
$extralabels = $extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");
- if (!empty($extrafield_values)) {
- $resql = $db->query("SELECT fk_object FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".((int) $object->product_fourn_price_id));
- // Insert a new extrafields row, if none exists
- if ($db->num_rows($resql) != 1) {
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields (fk_object, ";
- foreach ($extrafield_values as $key => $value) {
- $sql .= str_replace('options_', '', $key).', ';
- }
- $sql = substr($sql, 0, strlen($sql) - 2).") VALUES (".((int) $object->product_fourn_price_id).", ";
- foreach ($extrafield_values as $key => $value) {
- $sql .= "'".$db->escape($value)."', ";
- }
- $sql = substr($sql, 0, strlen($sql) - 2).')';
- } else {
- // update the existing one
- $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields SET ";
- foreach ($extrafield_values as $key => $value) {
- $sql .= str_replace('options_', '', $key)." = '".$db->escape($value)."', ";
- }
- $sql = substr($sql, 0, strlen($sql) - 2).' WHERE fk_object = '.((int) $object->product_fourn_price_id);
- }
-
- // Execute the sql command from above
- $db->query($sql);
- }
$newprice = price2num(GETPOST("price", "alpha"));
@@ -330,9 +304,9 @@ if (empty($reshook)) {
$multicurrency_price = price2num(GETPOST("multicurrency_price", 'alpha'));
$multicurrency_code = GETPOST("multicurrency_code", 'alpha');
- $ret = $object->update_buyprice($quantity, $newprice, $user, GETPOST("price_base_type"), $supplier, GETPOST("oselDispo"), $ref_fourn, $tva_tx, GETPOST("charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', $multicurrency_price, GETPOST("multicurrency_price_base_type"), $multicurrency_tx, $multicurrency_code, $supplier_description, $barcode, $fk_barcode_type);
+ $ret = $object->update_buyprice($quantity, $newprice, $user, GETPOST("price_base_type"), $supplier, GETPOST("oselDispo"), $ref_fourn, $tva_tx, GETPOST("charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', $multicurrency_price, GETPOST("multicurrency_price_base_type"), $multicurrency_tx, $multicurrency_code, $supplier_description, $barcode, $fk_barcode_type, $extrafield_values);
} else {
- $ret = $object->update_buyprice($quantity, $newprice, $user, GETPOST("price_base_type"), $supplier, GETPOST("oselDispo"), $ref_fourn, $tva_tx, GETPOST("charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', 0, 'HT', 1, '', $supplier_description, $barcode, $fk_barcode_type);
+ $ret = $object->update_buyprice($quantity, $newprice, $user, GETPOST("price_base_type"), $supplier, GETPOST("oselDispo"), $ref_fourn, $tva_tx, GETPOST("charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', 0, 'HT', 1, '', $supplier_description, $barcode, $fk_barcode_type, $extrafield_values);
}
if ($ret < 0) {
$error++;
@@ -806,7 +780,7 @@ END;
print '
'.$langs->trans('ProductSupplierDescription').' ';
print '
';
- $doleditor = new DolEditor('supplier_description', $object->desc_supplier, '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
+ $doleditor = new DolEditor('supplier_description', $object->desc_supplier, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor->Create();
print ' ';
@@ -1230,9 +1204,9 @@ END;
print '
';
if ($usercancreate) {
- print ''.img_edit()." ";
+ print ''.img_edit()." ";
print ' ';
- print ''.img_picto($langs->trans("Remove"), 'delete').' ';
+ print ''.img_picto($langs->trans("Remove"), 'delete').' ';
}
print ' ';
diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php
index 639ed284523..5989b94ce28 100644
--- a/htdocs/product/inventory/class/inventory.class.php
+++ b/htdocs/product/inventory/class/inventory.class.php
@@ -322,7 +322,7 @@ class Inventory extends CommonObject
$inventoryline->batch = $obj->batch;
$inventoryline->datec = dol_now();
- if ($conf->productbatch->enabled) {
+ if (isModEnabled('productbatch')) {
$inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty
} else {
$inventoryline->qty_stock = $obj->reel;
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 0e7189ae038..3ef85adeb84 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -314,7 +314,7 @@ if ($action == 'create') {
$langs->load('projects');
print '
'.$langs->trans('Project').' ';
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
- print ' ';
+ print ' ';
print ' ';
}
@@ -447,7 +447,7 @@ if ($action == 'create') {
$morehtmlref .= '
';
$morehtmlref .= '';
} else {
- $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, ($socid > 0 ? $socid : -1), $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (!empty($object->fk_project)) {
@@ -854,7 +854,7 @@ if ($action == 'create') {
$langs->load('projects');
print '
'.$langs->trans('Project').' ';
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
- print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'"> ';
+ print ' 0 ? '&socid='.$socid : "")).'"> ';
print ' ';
}
diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php
index e77d87aafd3..85848942fbe 100644
--- a/htdocs/product/stock/massstockmove.php
+++ b/htdocs/product/stock/massstockmove.php
@@ -475,13 +475,17 @@ print '
';
print '
';
diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php
index 58172c2e767..1ab24288401 100644
--- a/htdocs/recruitment/admin/setup_candidatures.php
+++ b/htdocs/recruitment/admin/setup_candidatures.php
@@ -226,7 +226,7 @@ if ($action == 'edit') {
print '