From 9ef27355205dc9067792b8a37271ce07c1d602a1 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Thu, 2 Dec 2021 18:25:14 +0100 Subject: [PATCH 001/184] Adds import for customer invoices and invoices lines --- .../facture/class/paymentterm.class.php | 10 +- htdocs/core/modules/modFacture.class.php | 268 ++++++++++++++++++ 2 files changed, 276 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index f94ad573a81..143f4bcf746 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -172,9 +172,10 @@ class PaymentTerm // extends CommonObject * Load object in memory from database * * @param int $id Id object + * @param string $code * @return int <0 if KO, >0 if OK */ - public function fetch($id) + public function fetch($id, $code = '') { global $langs; $sql = "SELECT"; @@ -192,7 +193,12 @@ class PaymentTerm // extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; - $sql .= " WHERE t.rowid = ".((int) $id); + if ($id) { + $sql .= " WHERE t.rowid = ".((int) $id); + } + if ($code) { + $sql .= " WHERE t.code='".$this->db->escape($code)."' AND t.entity IN (".getEntity('payment_term').")"; + } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index ef341c83e89..73ca71bcf73 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -232,6 +232,274 @@ class modFacture extends DolibarrModules $this->menu = 1; // This module add menu entries. They are coded into menu manager. + // Imports + //-------- + $r = 1; + + $r++; + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "Invoices"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('f' => MAIN_DB_PREFIX.'facture', 'extra' => MAIN_DB_PREFIX.'facture_extrafields'); + $this->import_tables_creator_array[$r] = array('f' => 'fk_user_author'); // Fields to store import user id + $this->import_fields_array[$r] = array( + 'f.ref' => 'InvoiceRef*', + 'f.ref_ext' => 'ExternalRef', + 'f.ref_int' => 'ExternalRef', + 'f.ref_client' => 'CutomerRef', + 'f.type' => 'Type*', + 'f.fk_soc' => 'Customer*', + 'f.datec' => 'InvoiceDateCreation', + 'f.datef' => 'DateInvoice', + 'f.date_valid' => 'Validation Date', + 'f.paye' => 'InvoicePaid', + 'f.remise_percent' => 'RemisePercent', + 'f.remise_absolue' => 'RemiseAbsolue', + 'f.remise' => 'Remise', + 'f.total_tva' => 'TotalVAT', + 'f.total_ht' => 'TotalHT', + 'f.total_ttc' => 'TotalTTC', + 'f.fk_statut' => 'InvoiceStatus', + 'f.fk_user_modif' => 'Modifier Id', + 'f.fk_user_valid' => 'Validator Id', + 'f.fk_user_closing' => 'Closer Id', + 'f.fk_facture_source' => 'Invoice Source Id', + 'f.fk_projet' => 'Project Id', + 'f.fk_account' => 'Bank Account', + 'f.fk_currency' => 'Currency*', + 'f.fk_cond_reglement' => 'Payment Condition', + 'f.fk_mode_reglement' => 'Payment Mode', + 'f.date_lim_reglement' => 'DateMaxPayment', + 'f.note_public' => 'InvoiceNote', + 'f.note_private' => 'NotePrivate', + 'f.model_pdf' => 'Model' + ); + if (!empty($conf->multicurrency->enabled)) { + $this->import_fields_array[$r]['f.multicurrency_code'] = 'Currency'; + $this->import_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; + $this->import_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->import_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->import_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } + // Add extra fields + $import_extrafield_sample = array(); + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); + $import_extrafield_sample[$fieldname] = $fieldlabel; + } + } + // End add extra fields + $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture'); + $this->import_regex_array[$r] = array('f.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'); + $import_sample = array( + 'f.ref' => '(PROV0001)', + 'f.ref_ext' => '', + 'f.ref_int' => '', + 'f.ref_client' => '', + 'f.type' => '0', + 'f.fk_soc' => '80LIMIT', + 'f.datec' => '2021-11-24', + 'f.datef' => '2021-11-24', + 'f.date_valid' => '2021-11-24', + 'f.paye' => '1', + 'f.remise_percent' => '0', + 'f.remise_absolue' => '0', + 'f.remise' => '0', + 'f.total_tva' => '21', + 'f.total_ht' => '100', + 'f.total_ttc' => '121', + 'f.fk_statut' => '1', + 'f.fk_user_modif' => '', + 'f.fk_user_valid' => '', + 'f.fk_user_closing' => '', + 'f.fk_facture_source' => '', + 'f.fk_projet' => '', + 'f.fk_account' => '', + 'f.fk_currency' => 'EUR', + 'f.fk_cond_reglement' => '30D', + 'f.fk_mode_reglement' => 'VIR', + 'f.date_lim_reglement' => '2021-12-24', + 'f.note_public' => '', + 'f.note_private' => '', + 'f.model_pdf' => 'crabe', + 'f.multicurrency_code' => 'EUR', + 'f.multicurrency_tx' => '1', + 'f.multicurrency_total_ht' => '100', + 'f.multicurrency_total_tva' => '21', + 'f.multicurrency_total_ttc' => '121' + ); + $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); + $this->import_updatekeys_array[$r] = array('f.ref' => 'Ref'); + $this->import_convertvalue_array[$r] = array( + 'f.fk_soc' => array( + 'rule' => 'fetchidfromref', + 'file' => '/societe/class/societe.class.php', + 'class' => 'Societe', + 'method' => 'fetch', + 'element' => 'ThirdParty' + ), + 'f.fk_projet' => array( + 'rule' => 'fetchidfromref', + 'file' => '/projet/class/project.class.php', + 'class' => 'Project', + 'method' => 'fetch', + 'element' => 'facture' + ), + 'f.fk_cond_reglement' => array( + 'rule' => 'fetchidfromcodeorlabel', + 'file' => '/compta/facture/class/paymentterm.class.php', + 'class' => 'PaymentTerm', + 'method' => 'fetch', + 'element' => 'c_payment_term' + ) + ); + + //Import Supplier Invoice Lines + $r++; + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "InvoiceLine"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('fd' => MAIN_DB_PREFIX.'facturedet', 'extra' => MAIN_DB_PREFIX.'facturedet_extrafields'); + $this->import_fields_array[$r] = array( + 'fd.fk_facture' => 'InvoiceRef*', + 'fd.fk_parent_line' => 'FacParentLine', + 'fd.fk_product' => 'IdProduct', + 'fd.label' => 'Label', + 'fd.description' => 'LineDescription*', + 'fd.vat_src_code' => 'Vat Source Code', + 'fd.tva_tx' => 'LineVATRate*', + // localtax1_tx + // localtax1_type + // localtax2_tx + // localtax2_type + 'fd.qty' => 'LineQty', + 'fd.remise_percent' => 'Reduc. (%)', + // remise + // fk_remise_except + // subprice + // price + 'fd.total_ht' => 'LineTotalHT', + 'fd.total_tva' => 'LineTotalVAT', + // total_localtax1 + // total_localtax2 + 'fd.total_ttc' => 'LineTotalTTC', + 'fd.product_type' => 'TypeOfLineServiceOrProduct', + 'fd.date_start' => 'Start Date', + 'fd.date_end' => 'End Date', + // info_bits + // buy_price_ht + // fk_product_fournisseur_price + // specia_code + // rang + // fk_contract_line + 'fd.fk_unit' => 'Unit', + // fk_code_ventilation + // situation_percent + // fk_prev_id + // fk_user_author + // fk_user_modif + // ref_ext + ); + if (!empty($conf->multicurrency->enabled)) { + $this->import_fields_array[$r]['fd.multicurrency_code'] = 'Currency'; + $this->import_fields_array[$r]['fd.multicurrency_subprice'] = 'CurrencyRate'; + $this->import_fields_array[$r]['fd.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->import_fields_array[$r]['fd.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->import_fields_array[$r]['fd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } + // Add extra fields + $import_extrafield_sample = array(); + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_det' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); + $import_extrafield_sample[$fieldname] = $fieldlabel; + } + } + // End add extra fields + $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facturedet'); + $this->import_regex_array[$r] = array( + 'fd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', + 'fd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency' + ); + $import_sample = array( + 'fd.fk_facture' => '(PROV00001)', + 'fd.fk_parent_line' => '', + 'fd.fk_product' => '', + 'fd.label' => '', + 'fd.description' => 'Test product', + 'fd.vat_src_code' => '', + 'fd.tva_tx' => '21', + // localtax1_tx + // localtax1_type + // localtax2_tx + // localtax2_type + 'fd.qty' => '1', + 'fd.remise_percent' => '0', + // remise + // fk_remise_except + // subprice + // price + 'fd.total_ht' => '100', + 'fd.total_tva' => '21', + // total_localtax1 + // total_localtax2 + 'fd.total_ttc' => '121', + 'fd.product_type' => '0', + 'fd.date_start' => '', + 'fd.date_end' => '', + // info_bits + // buy_price_ht + // fk_product_fournisseur_price + // specia_code + // rang + // fk_contract_line + 'fd.fk_unit' => '', + // fk_code_ventilation + // situation_percent + // fk_prev_id + // fk_user_author + // fk_user_modif + // ref_ext + 'fd.multicurrency_code' => 'EUR', + 'fd.multicurrency_tx' => '21', + 'fd.multicurrency_total_ht' => '100', + 'fd.multicurrency_total_tva' => '21', + 'fd.multicurrency_total_ttc' => '121' + ); + $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); + $this->import_updatekeys_array[$r] = array( + 'fd.rowid' => 'Row Id', + 'fd.fk_facture' => 'Invoice Id' + ); + $this->import_convertvalue_array[$r] = array( + 'fd.fk_facture' => array( + 'rule' => 'fetchidfromref', + 'file' => '/compta/facture/class/facture.class.php', + 'class' => 'Facture', + 'method' => 'fetch', + 'element' => 'facture' + ), + 'fd.fk_projet' => array( + 'rule' => 'fetchidfromref', + 'file' => '/projet/class/project.class.php', + 'class' => 'Project', + 'method' => 'fetch', + 'element' => 'facture' + ), + ); + + // Exports //-------- $r = 1; From e58d783ced53ba4101bbeb4d7c1dd151abdeff54 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Thu, 6 Jan 2022 10:41:38 +0100 Subject: [PATCH 002/184] add comment to parameter --- htdocs/compta/facture/class/paymentterm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 143f4bcf746..fd842e3485f 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -172,7 +172,7 @@ class PaymentTerm // extends CommonObject * Load object in memory from database * * @param int $id Id object - * @param string $code + * @param string $code Code object * @return int <0 if KO, >0 if OK */ public function fetch($id, $code = '') From f6e53b40dac2138cb700ffa1279df640527d56e0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Jun 2022 15:20:00 +0200 Subject: [PATCH 003/184] fix: actioncomm.code have to be updated with correct c_actioncomm code (like in create) until we decide to remove this column --- htdocs/comm/action/class/actioncomm.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 1e640f7afbe..6369fe82cb7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1128,6 +1128,12 @@ class ActionComm extends CommonObject $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { $sql .= ", fk_action = '".$this->db->escape($this->type_id)."'"; + $cactioncomm = new CActionComm($this->db); + $result = $cactioncomm->fetch($this->type_id); + if ($result>=0) { + $sql .= ", code = '" . $this->db->escape($cactioncomm->code) . "'"; + } + } $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); From d73982d1eb6f551856f2a15b4be9629388b085bf Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jun 2022 13:26:06 +0000 Subject: [PATCH 004/184] Fixing style errors. --- htdocs/comm/action/class/actioncomm.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6369fe82cb7..2c130117154 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1133,7 +1133,6 @@ class ActionComm extends CommonObject if ($result>=0) { $sql .= ", code = '" . $this->db->escape($cactioncomm->code) . "'"; } - } $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); From 43207429aefda6537385e2ff157cc17642ae945f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Jun 2022 15:32:16 +0200 Subject: [PATCH 005/184] fix: actioncomm.code have to be updated with correct c_actioncomm code (like in create) until we decide to remove this column --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6369fe82cb7..f21face045f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1127,7 +1127,7 @@ class ActionComm extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { - $sql .= ", fk_action = '".$this->db->escape($this->type_id)."'"; + $sql .= ", fk_action = ".(int)$this->type_id; $cactioncomm = new CActionComm($this->db); $result = $cactioncomm->fetch($this->type_id); if ($result>=0) { From 19dc0f124ce65b1c1f5a320b6471bccbec9b65e9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jun 2022 13:37:55 +0000 Subject: [PATCH 006/184] Fixing style errors. --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c92adc0a413..efb6d618e6f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1127,7 +1127,7 @@ class ActionComm extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { - $sql .= ", fk_action = ".(int)$this->type_id; + $sql .= ", fk_action = ".(int) $this->type_id; $cactioncomm = new CActionComm($this->db); $result = $cactioncomm->fetch($this->type_id); if ($result>=0) { From d0101fdc90434bf9f0a8f7f21fe44bdfaa7f9fc9 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 2 Jun 2022 18:57:52 +0200 Subject: [PATCH 007/184] errors is an array --- htdocs/emailcollector/class/emailcollector.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index e2493a338fd..0a8b17d56d4 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1911,7 +1911,7 @@ class EmailCollector extends CommonObject $sql = "SELECT rowid as id FROM " . MAIN_DB_PREFIX . "user WHERE email LIKE '%" . $from . "%'"; $resql = $this->db->query($sql); if ($resql->num_rows == 0) { - $this->errors = 'User Not allowed to add documents'; + $this->errors[] = 'User Not allowed to add documents'; } $arrayobject = array( 'propale' => array('table' => 'propal', @@ -2043,7 +2043,7 @@ class EmailCollector extends CommonObject $path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : ''); $dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/'; } else { - $this->errors = 'object not found'; + $this->errors[] = 'object not found'; } } } @@ -2053,12 +2053,12 @@ class EmailCollector extends CommonObject $resr = saveAttachment($target, $prefix . '_' . $filename, $content); if ($resr == -1) { - $this->errors = 'Doc not saved'; + $this->errors[] = 'Doc not saved'; } } } } else { - $this->errors = 'no joined piece'; + $this->errors[] = 'no joined piece'; } } elseif ($operation['type'] == 'project') { // Create project / lead From f53060fec38aea4fc6888b11b8d437fecc0bdb54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jun 2022 19:43:41 +0200 Subject: [PATCH 008/184] FIX selection of type of invoice --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a4ad571867d..f807871c508 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3158,7 +3158,7 @@ if ($action == 'create') { // Standard invoice print '
'; - $tmp = ' '; + $tmp = ' '; $tmp = $tmp.''; $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); print ''; From 6f6d7d7f48c0b196698b9b01eb4ceff7c4c641f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jun 2022 20:15:49 +0200 Subject: [PATCH 009/184] Fix ODT tags in BOM template Conflicts: htdocs/core/class/commonobjectline.class.php --- htdocs/core/class/commondocgenerator.class.php | 1 + .../modules/bom/doc/doc_generic_bom_odt.modules.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 5d0242657ef..3d94469759b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -586,6 +586,7 @@ abstract class CommonDocGenerator 'line_product_label'=>(empty($line->product_label) ? '' : $line->product_label), 'line_product_type'=>(empty($line->product_type) ? '' : $line->product_type), 'line_product_barcode'=>(empty($line->product_barcode) ? '' : $line->product_barcode), + 'line_product_desc'=>(empty($line->product_desc) ? '' : $line->product_desc), 'line_desc'=>$line->desc, 'line_vatrate'=>vatrate($line->tva_tx, true, $line->info_bits), diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 946d9f32649..31c20cf1ecd 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -89,7 +89,7 @@ class doc_generic_bom_odt extends ModelePDFBom $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined @@ -113,7 +113,7 @@ class doc_generic_bom_odt extends ModelePDFBom $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= '
'; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -173,6 +173,11 @@ class doc_generic_bom_odt extends ModelePDFBom } $texte .= ''; } + // Add input to upload a new template file. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; $texte .= ''; @@ -225,6 +230,7 @@ class doc_generic_bom_odt extends ModelePDFBom $sav_charset_output = $outputlangs->charset_output; $outputlangs->charset_output = 'UTF-8'; + // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); if ($conf->bom->dir_output) { From 7f38d556485883f142f442292f1675b83b743531 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Jun 2022 21:28:17 +0200 Subject: [PATCH 010/184] better fix --- htdocs/comm/action/class/actioncomm.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c92adc0a413..b9cd825ad49 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1128,12 +1128,15 @@ class ActionComm extends CommonObject $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { $sql .= ", fk_action = ".(int)$this->type_id; - $cactioncomm = new CActionComm($this->db); - $result = $cactioncomm->fetch($this->type_id); - if ($result>=0) { - $sql .= ", code = '" . $this->db->escape($cactioncomm->code) . "'"; + if (empty($this->type_code)) { + $cactioncomm = new CActionComm($this->db); + $result = $cactioncomm->fetch($this->type_id); + if ($result>=0) { + $this->type_code = $cactioncomm->code; + } } } + $sql .= ", code = " . (isset($this->type_code)? "'".$this->db->escape($this->type_code) . "'":"null"); $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); From e48ce5b159c7d14dce501821de393505dee2ce41 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jun 2022 19:34:39 +0000 Subject: [PATCH 011/184] Fixing style errors. --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fe5769473c7..a5c8a11ade0 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1127,7 +1127,7 @@ class ActionComm extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; if ($this->type_id > 0) { - $sql .= ", fk_action = ".(int)$this->type_id; + $sql .= ", fk_action = ".(int) $this->type_id; if (empty($this->type_code)) { $cactioncomm = new CActionComm($this->db); $result = $cactioncomm->fetch($this->type_id); From d15dee282e1880d6a3efd4c8fb6a856d17db0ad7 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 2 Jun 2022 21:08:25 +0200 Subject: [PATCH 012/184] fix hookmanager is null --- htdocs/emailcollector/class/emailcollector.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index e2493a338fd..9762e3faa39 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2008,6 +2008,7 @@ class EmailCollector extends CommonObject 'object' => 'Mo'), ); + global $hookmanager; $hookmanager->initHooks(array('emailcolector')); $parameters = array('arrayobject' => $arrayobject); $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks From d950533bdb3e369698a0bef308a8fd968ae5bcd9 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 2 Jun 2022 23:55:58 +0200 Subject: [PATCH 013/184] fix #21118: undefined function getAttachments --- htdocs/emailcollector/class/emailcollector.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index e2493a338fd..eda6383dd38 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // supplier order require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // supplier proposal require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php"; // reception +include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php'; //require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; // Holidays (leave request) //require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; // expernse report From 303b6d6e9e06889d22904fa45e31fa940b526d04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jun 2022 11:23:10 +0200 Subject: [PATCH 014/184] Fix object not defined --- .../class/emailcollector.class.php | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index f00ec802b39..ea8913bae23 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -504,7 +504,7 @@ class EmailCollector extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $conf, $langs, $hookmanager; + global $conf, $langs, $action, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -537,13 +537,6 @@ class EmailCollector extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - - /* - $hookmanager->initHooks(array('myobjectdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } @@ -562,7 +555,6 @@ class EmailCollector extends CommonObject $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); - global $action, $hookmanager; $hookmanager->initHooks(array('emailcollectordao')); $parameters = array('id'=>$this->id, 'getnomurl'=>$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks @@ -965,6 +957,7 @@ class EmailCollector extends CommonObject public function doCollectOneCollector() { global $conf, $langs, $user; + global $hookmanager; //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; @@ -2009,11 +2002,16 @@ class EmailCollector extends CommonObject 'object' => 'Mo'), ); - global $hookmanager; + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } $hookmanager->initHooks(array('emailcolector')); $parameters = array('arrayobject' => $arrayobject); $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $arrayobject = $hookmanager->resArray; + if ($reshook > 0) { + $arrayobject = $hookmanager->resArray; + } $resultobj = array(); @@ -2365,8 +2363,6 @@ class EmailCollector extends CommonObject } elseif (substr($operation['type'], 0, 4) == 'hook') { // Create event specific on hook // this code action is hook..... for support this call - global $hookmanager; - if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($this->db); @@ -2391,9 +2387,9 @@ class EmailCollector extends CommonObject 'header'=>$header, 'attachments'=>$attachments, ); - $res = $hookmanager->executeHooks('doCollectOneCollector', $parameters, $this, $operation['type']); + $reshook = $hookmanager->executeHooks('doCollectOneCollector', $parameters, $this, $operation['type']); - if ($res < 0) { + if ($reshook < 0) { $errorforthisaction++; $this->error = $hookmanager->resPrint; } From 309eccc426bab636b5c00b69b2abeb0b16dfbf47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jun 2022 14:08:04 +0200 Subject: [PATCH 015/184] Fix phpcs --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f807871c508..6f9d7398324 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2844,7 +2844,7 @@ if ($action == 'create') { $currency_code = $conf->currency; $fk_account = 0; - + // Load objectsrc $remise_absolue = 0; if (!empty($origin) && !empty($originid)) { From a29aa48100535db440af5b2314c5e4421a48faea Mon Sep 17 00:00:00 2001 From: Abdelaziz MISBAH Date: Tue, 7 Jun 2022 13:11:30 +0100 Subject: [PATCH 016/184] Send Notification Without File when E-mail Template does'nt attach file When we create an Email Template that does'nt require main file to be attached, we still send notification with an attached file, eg: when we send a notification when validating proposal it send proposal with attached file with mention NOT VALIDATED. I added OR condition on checking pdf_path. --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 452d066886e..e66b378ca38 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -615,7 +615,7 @@ class Notify $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref.".pdf"; - if (!dol_is_file($pdf_path)) { + if (!dol_is_file($pdf_path)||!$arraydefaultmessage->joinfiles) { // We can't add PDF as it is not generated yet. $filepdf = ''; } else { From d4bbc72b1bee0f3291341d1481c4be306a2c25e1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 7 Jun 2022 14:31:22 +0200 Subject: [PATCH 017/184] fix: 21139 --- htdocs/ticket/card.php | 3 ++- htdocs/ticket/class/ticket.class.php | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index f46a9ecc61d..b5759d194d4 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -387,6 +387,7 @@ if (empty($reshook)) { // Si déjà un user assigné on le supprime des contacts if ($useroriginassign > 0) { $internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC'); + foreach ($internal_contacts as $key => $contact) { if ($contact['id'] !== $usertoassign) { $result = $object->delete_contact($contact['rowid']); @@ -1055,7 +1056,7 @@ if ($action == 'create' || $action == 'presend') { print ''; print ''; //print ' '; - print $form->select_dolusers($user->id, 'fk_user_assign', 1); + print $form->select_dolusers(empty($object->fk_user_assign)?$user->id:$object->fk_user_assign, 'fk_user_assign', 1); print ' '; print ''; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e267ffce6c1..3ac3727af13 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -496,6 +496,13 @@ class Ticket extends CommonObject } } + if (!$error && $this->fk_user_assign > 0) { + if ($this->add_contact($this->fk_user_assign, 'SUPPORTTEC', 'internal') < 0) { + $error++; + } + } + + //Update extrafield if (!$error) { $result = $this->insertExtraFields(); @@ -2194,6 +2201,10 @@ class Ticket extends CommonObject $sql .= " AND tc.source = 'external'"; } + if (!empty($code)) { + $sql .= " AND tc.code = '".$this->db->escape($code)."'"; + } + $sql .= " AND tc.active=1"; if ($status >= 0) { $sql .= " AND ec.statut = ".((int) $status); From 85f95e86b727b02944777780c7080ee473d864aa Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 7 Jun 2022 14:39:19 +0200 Subject: [PATCH 018/184] fix: 21139 --- htdocs/ticket/contact.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index 89822df2676..ee76045ffec 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -137,6 +137,16 @@ if ($action == 'swapstatut' && $user->rights->ticket->write) { // Efface un contact if ($action == 'deletecontact' && $user->rights->ticket->write) { if ($object->fetch($id, '', $track_id)) { + $internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC'); + foreach ($internal_contacts as $key => $contact) { + if ($contact['rowid'] == $lineid && $object->fk_user_assign==$contact['id']) { + $ret = $object->assignUser($user, null); + if ($ret < 0) { + $error ++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } $result = $object->delete_contact($lineid); if ($result >= 0) { From 0bff392de8e10f32d1c56d6fa33c3369aaf02108 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 7 Jun 2022 14:40:21 +0200 Subject: [PATCH 019/184] fix: 21139 --- htdocs/ticket/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index b5759d194d4..efa2eba0999 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -387,7 +387,6 @@ if (empty($reshook)) { // Si déjà un user assigné on le supprime des contacts if ($useroriginassign > 0) { $internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC'); - foreach ($internal_contacts as $key => $contact) { if ($contact['id'] !== $usertoassign) { $result = $object->delete_contact($contact['rowid']); From b6724f60616413527aaf274c369c3aea3f898ac7 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 7 Jun 2022 16:43:49 +0200 Subject: [PATCH 020/184] FIX #20696 --- htdocs/accountancy/bookkeeping/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f9ec739e63d..0eaeed73d9e 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -533,23 +533,23 @@ if ($action == 'create') { print '
'; print ''; print ''; print ''; - // Date document creation + // Date document export print ''; print ''; print ''; print ''; - // Date document creation + // Date document validation print ''; print ''; print ''; print ''; From 3fb2c6eaa19dcf6f8a4636487f9303ce1859bf40 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Tue, 7 Jun 2022 16:55:57 +0200 Subject: [PATCH 021/184] FIX - Invoices index page Supplier enable --- htdocs/compta/index.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 8cef74e4fc7..def6318ed95 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -104,11 +104,18 @@ print '
'; print getNumberInvoicesPieChart('customers'); print '
'; -print getNumberInvoicesPieChart('fourn'); -print '
'; + +if (!empty($conf->fournisseur->enabled)) { + print getNumberInvoicesPieChart('fourn'); + print '
'; +} + print getCustomerInvoiceDraftTable($max, $socid); -print '
'; -print getDraftSupplierTable($max, $socid); + +if (!empty($conf->fournisseur->enabled)) { + print '
'; + print getDraftSupplierTable($max, $socid); +} print '
'; From 03f8d49c949134e2bcf8ec3d94d7bd597154e598 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Tue, 7 Jun 2022 17:25:33 +0200 Subject: [PATCH 022/184] FIX - php V8 warning class html form --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c9b336725f5..c5c9f7164ec 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4977,7 +4977,7 @@ class Form if (!empty($input['label'])) { $more .= $input['label'].'
'; } - $more .= $this->selectarray($input['name'], $input['values'], $input['default'], $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss); + $more .= $this->selectarray($input['name'], $input['values'], isset($input['default'])?$input['default']:'', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss); $more .= '
'."\n"; } elseif ($input['type'] == 'checkbox') { $more .= '
'; From 1cf8b3421f777155b71eb60152613a579dffc278 Mon Sep 17 00:00:00 2001 From: melina Date: Tue, 7 Jun 2022 17:46:17 +0200 Subject: [PATCH 023/184] add constant for freezone --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3a55d82b8ad..3b0861956b7 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -585,7 +585,7 @@ if (empty($reshook)) { $localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr); - $invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', 'TTC', $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0); + $invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') ? 'HT' : 'TTC', $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0); $invoice->fetch($placeid); } From 0146be0d157198eb1f6f65419e3cbdb2388e8a3d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 7 Jun 2022 18:13:21 +0200 Subject: [PATCH 024/184] fix: filter status do not work on peruser action comm --- htdocs/comm/action/peruser.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index f74974a26d9..5adf5946f35 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -99,7 +99,7 @@ $month = GETPOST("month", "int") ?GETPOST("month", "int") : date("m"); $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W"); $day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d"); $pid = GETPOST("search_projectid", "int", 3) ?GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3); -$status = GETPOST("search_status", 'alpha') ?GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha'); +$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo' $type = GETPOST("search_type", 'alpha') ?GETPOST("search_type", 'alpha') : GETPOST("type", 'alpha'); $maxprint = ((GETPOST("maxprint", 'int') != '') ?GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -153,9 +153,10 @@ if ($end_d < $begin_d) { $end_d = $begin_d + 1; } -if ($status == '' && !GETPOSTISSET('status')) { +if ($status == '' && !GETPOSTISSET('search_status')) { $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); } + if (empty($mode) && !GETPOSTISSET('mode')) { $mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); } @@ -512,7 +513,7 @@ print '
'; if (empty($search_status)) { $search_status = ''; } -print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); +print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); print '
'; @@ -623,6 +624,7 @@ if ($type) { $sql .= " AND ca.id = ".((int) $type); } if ($status == '0') { + $sql .= " AND a.percent = 0"; } if ($status == '-1') { From 70892c18c5e7f1163bf8c05701be20d3c28cb65a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 7 Jun 2022 18:14:15 +0200 Subject: [PATCH 025/184] fix: filter status do not work on peruser action comm --- htdocs/comm/action/peruser.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 5adf5946f35..82c15392349 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -624,7 +624,6 @@ if ($type) { $sql .= " AND ca.id = ".((int) $type); } if ($status == '0') { - $sql .= " AND a.percent = 0"; } if ($status == '-1') { From 75e05ac412d5169f4b6781857f37c1448306adb8 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Tue, 7 Jun 2022 18:25:24 +0200 Subject: [PATCH 026/184] FIX - php V8 warning actions addupdatedelete --- htdocs/core/actions_addupdatedelete.inc.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index fb4461f94e3..b90f3c8ebd0 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -31,6 +31,11 @@ // $noback may be defined // $triggermodname may be defined +$hidedetails = isset($hidedetails) ? $hidedetails : ''; +$hidedesc = isset($hidedesc) ? $hidedesc : ''; +$hideref = isset($hideref) ? $hideref : ''; + + if (!empty($permissionedit) && empty($permissiontoadd)) { $permissiontoadd = $permissionedit; // For backward compatibility } @@ -381,10 +386,10 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) { if (method_exists($object, 'generateDocument')) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { From 48fdfe26fa78c0066d3896a3b257d505757a9e2e Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Tue, 7 Jun 2022 18:44:00 +0200 Subject: [PATCH 027/184] Fix: rollback on success create_individual Fix: Societe::create_individual rollback on success --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 0f7ad23acb0..beb0f699246 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1078,7 +1078,7 @@ class Societe extends CommonObject } } - if (!empty($error)) { + if (empty($error)) { dol_syslog(get_class($this)."::create_individual success"); $this->db->commit(); } else { From 054eefb1f7e176ab00f14c2be2a3ba8f27b9437d Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Tue, 7 Jun 2022 18:49:29 +0200 Subject: [PATCH 028/184] FIX - php V8 lib pdf --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ca94353ee19..709d6e5d404 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2359,13 +2359,13 @@ function pdf_getLinkedObjects(&$object, $outputlangs) if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) { $object->note_public = dol_concatdesc($object->note_public, '
'.$outputlangs->transnoentities("RefOrder").' :
'); foreach ($objects as $elementobject) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '').($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : '').' '); + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ? ' ('.$elementobject->ref_client.')' : '').(!empty($elementobject->ref_supplier) ? ' ('.$elementobject->ref_supplier.')' : '').' '); $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs).'
'); } } elseif (count($objects) == 1) { $elementobject = array_shift($objects); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '').($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ? ' ('.$elementobject->ref_client.')' : '').(!empty($elementobject->ref_supplier) ? ' ('.$elementobject->ref_supplier.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date, 'day', '', $outputlangs); } From 648a8f5c18f9cded56c362201ab6a03bdd676d8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jun 2022 18:58:53 +0200 Subject: [PATCH 029/184] FIX xml file for company with special chars in name --- .../class/bonprelevement.class.php | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index afd6b5e075c..fcf13fe8c0e 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1489,7 +1489,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$i.''.$CrLf); fputs($this->file, ' '.$this->total.''.$CrLf); fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).''.$CrLf); + fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); @@ -1605,7 +1605,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$i.''.$CrLf); fputs($this->file, ' '.$this->total.''.$CrLf); fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).''.$CrLf); + fputs($this->file, ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); @@ -1855,16 +1855,16 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; - $XML_DEBITOR .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).''.$CrLf; + $XML_DEBITOR .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom)))).''.$CrLf; $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$row_country_code.''.$CrLf; $addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")); if (trim($addressline1)) { - $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline1), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).''.$CrLf; } if (trim($addressline2)) { - $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline2), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).''.$CrLf; } $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; @@ -1906,16 +1906,16 @@ class BonPrelevement extends CommonObject $XML_CREDITOR .= ' '.$CrLf; $XML_CREDITOR .= ' '.$CrLf; $XML_CREDITOR .= ' '.$CrLf; - $XML_CREDITOR .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).''.$CrLf; + $XML_CREDITOR .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom)))).''.$CrLf; $XML_CREDITOR .= ' '.$CrLf; $XML_CREDITOR .= ' '.$row_country_code.''.$CrLf; $addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")); if (trim($addressline1)) { - $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline1), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).''.$CrLf; } if (trim($addressline2)) { - $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline2), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).''.$CrLf; } $XML_CREDITOR .= ' '.$CrLf; $XML_CREDITOR .= ' '.$CrLf; @@ -2078,16 +2078,16 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$dateTime_ETAD.''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; $addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")); if ($addressline1) { - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline1), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).''.$CrLf; } if ($addressline2) { - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline2), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).''.$CrLf; } $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; @@ -2102,11 +2102,11 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; /* $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS.'').$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS))).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN)).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf;*/ $XML_SEPA_INFO .= ' SLEV'.$CrLf; // Field "Responsible of fees". Must be SLEV @@ -2144,16 +2144,16 @@ class BonPrelevement extends CommonObject */ $XML_SEPA_INFO .= ' '.dol_print_date($dateTime_ETAD, 'dayrfc').''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; $addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")); $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")); if ($addressline1) { - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline1), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).''.$CrLf; } if ($addressline2) { - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_unaccent($addressline2), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).''.$CrLf; } $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; @@ -2168,11 +2168,11 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; /* $XML_SEPA_INFO .= ' '.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS).''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS))).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN)).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf;*/ $XML_SEPA_INFO .= ' SLEV'.$CrLf; // Field "Responsible of fees". Must be SLEV From 8303347ab8c7136247221d9c170377d0027d14b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jun 2022 19:27:43 +0200 Subject: [PATCH 030/184] FIX label and get_substitutionarray_each_var_object on ODT generation --- htdocs/core/class/commondocgenerator.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 3d94469759b..3167bd0c64c 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -421,8 +421,9 @@ abstract class CommonDocGenerator $resarray = array( $array_key.'_id'=>$object->id, - $array_key.'_ref'=>$object->ref, - $array_key.'_ref_ext'=>$object->ref_ext, + $array_key.'_ref' => (property_exists($object, 'ref') ? $object->ref : ''), + $array_key.'_label' => (property_exists($object, 'label') ? $object->label : ''), + $array_key.'_ref_ext' => (property_exists($object, 'ref_ext') ? $object->ref_ext : ''), $array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)), $array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)), $array_key.'_source_invoice_ref'=>$invoice_source->ref, @@ -443,7 +444,7 @@ abstract class CommonDocGenerator $array_key.'_payment_term_code'=>$object->cond_reglement_code, $array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)), - $array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''), + $array_key.'_incoterms' => (method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''), $array_key.'_bank_iban'=>$bank_account->iban, $array_key.'_bank_bic'=>$bank_account->bic, @@ -820,8 +821,9 @@ abstract class CommonDocGenerator if (!empty($value)) { if (!is_array($value) && !is_object($value)) { $array_other['object_'.$key] = $value; - } - if (is_array($value) && $recursive) { + } elseif (is_array($value) && $recursive) { + $array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value, $outputlangs, false); + } elseif (is_object($value) && $recursive) { $array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value, $outputlangs, false); } } From 7ee4cccc840e2faeb3ad23d8222891bb6feab5c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jun 2022 19:59:33 +0200 Subject: [PATCH 031/184] FIX ODT tags for subobjects {object_subobject_yyy} was not working. --- .../core/class/commondocgenerator.class.php | 20 +++++++++++++++---- .../bom/doc/doc_generic_bom_odt.modules.php | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 3167bd0c64c..21c1cce4cfd 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -809,26 +809,38 @@ abstract class CommonDocGenerator * * @param Object $object Dolibarr Object * @param Translate $outputlangs Language object for output - * @param boolean $recursive Want to fetch child array or child object + * @param boolean|int $recursive Want to fetch child array or child object. * @return array Array of substitution key->code */ - public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = true) + public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = 1) { // phpcs:enable $array_other = array(); if (!empty($object)) { foreach ($object as $key => $value) { + if (in_array($key, array('db', 'fields', 'lines', 'modelpdf', 'model_pdf'))) { // discard some properties + continue; + } if (!empty($value)) { if (!is_array($value) && !is_object($value)) { $array_other['object_'.$key] = $value; } elseif (is_array($value) && $recursive) { - $array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value, $outputlangs, false); + $tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0); + foreach ($tmparray as $key2 => $value2) { + $array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2; + } } elseif (is_object($value) && $recursive) { - $array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value, $outputlangs, false); + $tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0); + foreach ($tmparray as $key2 => $value2) { + $array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2; + } } } } } + + //var_dump($array_other); + return $array_other; } diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 31c20cf1ecd..c070e3b1058 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -246,6 +246,7 @@ class doc_generic_bom_odt extends ModelePDFBom } $object->fetch_thirdparty(); + $object->fetch_product(); $dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1]; $objectref = dol_sanitizeFileName($object->ref); From d85d3fe378a8a7fe95915f9a1c1527f4b4c26850 Mon Sep 17 00:00:00 2001 From: "Esteban L. Castro" <43482256+elcf@users.noreply.github.com> Date: Tue, 7 Jun 2022 17:18:01 -0400 Subject: [PATCH 032/184] Added US-GAAP-Basic COA COA is based on https://www.ifrs-gaap.com/us-gaap-chart-accounts --- .../mysql/data/llx_accounting_account_us.sql | 148 +++++++++++++++++- 1 file changed, 145 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/data/llx_accounting_account_us.sql b/htdocs/install/mysql/data/llx_accounting_account_us.sql index f0ca038ca08..3b0fade993a 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_us.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_us.sql @@ -20,9 +20,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- Note: INCOME = REVENUE --- Note: EXPENSE = EXPENSES --- Note: CAPITAL = EQUITY +-- Note (US-BASE): INCOME = REVENUE +-- Note (US-BASE): EXPENSE = EXPENSES +-- Note (US-BASE): CAPITAL = EQUITY -- -- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors -- de l''install et tous les sigles '--' sont supprimés. @@ -31,6 +31,7 @@ -- Descriptif des plans comptables USA US-BASE -- ID 1000 - 9999 +-- ID 10000 - 10999 -- ADD 1100000 to rowid # Do no remove this comment -- INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1000, 'US-BASE', 'ASSETS', '1', '0', 'Assets', 1); @@ -171,3 +172,144 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1136, 'US-BASE', 'OTHER_EXPENSES', '8800', '8000', 'Utilities Expense', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1137, 'US-BASE', 'OTHER_EXPENSES', '8900', '8000', 'Gain/Loss on Sale of Assets', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1138, 'US-BASE', 'OTHER_EXPENSES', '8950', '8000', 'Other Expense', 1); + + +-- US-GAAP-Basic + + +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10000, 'US-GAAP-BASIC', 'ASSETS', '1', '0', 'Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10001, 'US-GAAP-BASIC', 'ASSETS', '11', '10000', 'Cash And Financial Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10002, 'US-GAAP-BASIC', 'ASSETS', '111', '10001', 'Cash And Cash Equivalents', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10003, 'US-GAAP-BASIC', 'ASSETS', '112', '10001', 'Financial Assets (Investments)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10004, 'US-GAAP-BASIC', 'ASSETS', '113', '10001', 'Restricted Cash And Financial Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10005, 'US-GAAP-BASIC', 'ASSETS', '114', '10001', 'Additional Financial Assets And Investments', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10006, 'US-GAAP-BASIC', 'ASSETS', '12', '10000', 'Receivables And Contracts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10007, 'US-GAAP-BASIC', 'ASSETS', '121', '10006', 'Accounts, Notes And Loans Receivable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10008, 'US-GAAP-BASIC', 'ASSETS', '122', '10006', 'Contracts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10009, 'US-GAAP-BASIC', 'ASSETS', '123', '10006', 'Nontrade And Other Receivables', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10010, 'US-GAAP-BASIC', 'ASSETS', '13', '10000', 'Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10011, 'US-GAAP-BASIC', 'ASSETS', '131', '10010', 'Merchandise', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10012, 'US-GAAP-BASIC', 'ASSETS', '132', '10010', 'Raw Material, Parts And Supplies', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10013, 'US-GAAP-BASIC', 'ASSETS', '133', '10010', 'Work In Process', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10014, 'US-GAAP-BASIC', 'ASSETS', '134', '10010', 'Finished Goods', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10015, 'US-GAAP-BASIC', 'ASSETS', '135', '10010', 'Other Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10016, 'US-GAAP-BASIC', 'ASSETS', '14', '10000', 'Accruals And Additional Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10017, 'US-GAAP-BASIC', 'ASSETS', '141', '10016', 'Prepaid Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10018, 'US-GAAP-BASIC', 'ASSETS', '142', '10016', 'Accrued Income', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10019, 'US-GAAP-BASIC', 'ASSETS', '143', '10016', 'Additional Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10020, 'US-GAAP-BASIC', 'ASSETS', '15', '10000', 'Property, Plant And Equipment', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10021, 'US-GAAP-BASIC', 'ASSETS', '151', '10020', 'Land And Land Improvements', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10022, 'US-GAAP-BASIC', 'ASSETS', '152', '10020', 'Buildings, Structures And Improvements', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10023, 'US-GAAP-BASIC', 'ASSETS', '153', '10020', 'Machinery And Equipment', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10024, 'US-GAAP-BASIC', 'ASSETS', '154', '10020', 'Furniture And Fixtures', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10025, 'US-GAAP-BASIC', 'ASSETS', '155', '10020', 'Additional Property, Plant And Equipment', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10026, 'US-GAAP-BASIC', 'ASSETS', '156', '10020', 'Construction In Progress', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10027, 'US-GAAP-BASIC', 'ASSETS', '16', '10000', 'Intangible Assets (Excluding Goodwill)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10028, 'US-GAAP-BASIC', 'ASSETS', '161', '10027', 'Intellectual Property', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10029, 'US-GAAP-BASIC', 'ASSETS', '162', '10027', 'Computer Software', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10030, 'US-GAAP-BASIC', 'ASSETS', '163', '10027', 'Trade And Distribution Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10031, 'US-GAAP-BASIC', 'ASSETS', '164', '10027', 'Contracts And Rights', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10032, 'US-GAAP-BASIC', 'ASSETS', '165', '10027', 'Right To Use Assets (Classified By Type)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10033, 'US-GAAP-BASIC', 'ASSETS', '166', '10027', 'Other Intangible Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10034, 'US-GAAP-BASIC', 'ASSETS', '167', '10027', 'Acquisition In Progress', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10035, 'US-GAAP-BASIC', 'ASSETS', '17', '10000', 'Goodwill', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10036, 'US-GAAP-BASIC', 'LIABILITIES', '2', '0', 'Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10037, 'US-GAAP-BASIC', 'LIABILITIES', '21', '10036', 'Payables', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10038, 'US-GAAP-BASIC', 'LIABILITIES', '211', '10037', 'Trade Payables', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10039, 'US-GAAP-BASIC', 'LIABILITIES', '212', '10037', 'Dividends Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10040, 'US-GAAP-BASIC', 'LIABILITIES', '213', '10037', 'Interest Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10041, 'US-GAAP-BASIC', 'LIABILITIES', '214', '10037', 'Other Payables', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10042, 'US-GAAP-BASIC', 'LIABILITIES', '22', '10036', 'Accruals And Other Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10043, 'US-GAAP-BASIC', 'LIABILITIES', '221', '10042', 'Accrued Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10044, 'US-GAAP-BASIC', 'LIABILITIES', '222', '10042', 'Deferred Income (Unearned Revenue) ', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10045, 'US-GAAP-BASIC', 'LIABILITIES', '223', '10042', 'Accrued Taxes (Other Than Payroll)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10046, 'US-GAAP-BASIC', 'LIABILITIES', '224', '10042', 'Other Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10047, 'US-GAAP-BASIC', 'LIABILITIES', '23', '10036', 'Financial Labilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10048, 'US-GAAP-BASIC', 'LIABILITIES', '231', '10047', 'Notes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10049, 'US-GAAP-BASIC', 'LIABILITIES', '232', '10047', 'Loans Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10050, 'US-GAAP-BASIC', 'LIABILITIES', '233', '10047', 'Bonds (Debentures)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10051, 'US-GAAP-BASIC', 'LIABILITIES', '234', '10047', 'Other Debts And Borrowings', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10052, 'US-GAAP-BASIC', 'LIABILITIES', '235', '10047', 'Lease Obligations', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10053, 'US-GAAP-BASIC', 'LIABILITIES', '236', '10047', 'Derivative Financial Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10054, 'US-GAAP-BASIC', 'LIABILITIES', '24', '10036', 'Provisions (Contingencies)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10055, 'US-GAAP-BASIC', 'LIABILITIES', '241', '10054', 'Customer Related Provisions', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10056, 'US-GAAP-BASIC', 'LIABILITIES', '242', '10054', 'Ligation And Regulatory Provisions', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10057, 'US-GAAP-BASIC', 'LIABILITIES', '243', '10054', 'Additional Provisions', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10058, 'US-GAAP-BASIC', 'EQUITY', '3', '0', 'Equity', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10059, 'US-GAAP-BASIC', 'EQUITY', '31', '10058', 'Owners Equity (Attributable To Owners Of Parent)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10060, 'US-GAAP-BASIC', 'EQUITY', '311', '10059', 'Equity At Par (Issued Capital)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10061, 'US-GAAP-BASIC', 'EQUITY', '312', '10059', 'Additional Paid-In Capital', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10062, 'US-GAAP-BASIC', 'EQUITY', '32', '10058', 'Retained Earnings', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10063, 'US-GAAP-BASIC', 'EQUITY', '321', '10062', 'Appropriated', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10064, 'US-GAAP-BASIC', 'EQUITY', '322', '10062', 'Unappropriated', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10065, 'US-GAAP-BASIC', 'EQUITY', '323', '10062', 'Deficit ', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10066, 'US-GAAP-BASIC', 'EQUITY', '324', '10062', 'In Suspense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10067, 'US-GAAP-BASIC', 'EQUITY', '33', '10058', 'Accumulated OCI', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10068, 'US-GAAP-BASIC', 'EQUITY', '331', '10067', 'Exchange Differences On Translation', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10069, 'US-GAAP-BASIC', 'EQUITY', '332', '10067', 'Remeasurements Cash Flow Hedges', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10070, 'US-GAAP-BASIC', 'EQUITY', '333', '10067', 'Remeasurements Available-For-Sale Financial Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10071, 'US-GAAP-BASIC', 'EQUITY', '334', '10067', 'Remeasurement Of Defined Benefit Plans', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10072, 'US-GAAP-BASIC', 'EQUITY', '34', '10058', 'Other Equity Items', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10073, 'US-GAAP-BASIC', 'EQUITY', '341', '10072', 'ESOP Related Items', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10074, 'US-GAAP-BASIC', 'EQUITY', '342', '10072', 'Subscribed Stock Receivables', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10075, 'US-GAAP-BASIC', 'EQUITY', '343', '10072', 'Treasury Stock', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10076, 'US-GAAP-BASIC', 'EQUITY', '344', '10072', 'Miscellaneous Equity', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10077, 'US-GAAP-BASIC', 'EQUITY', '35', '10058', 'Non-controlling (Minority) Interest', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10078, 'US-GAAP-BASIC', 'REVENUE', '4', '0', 'Revenue', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10079, 'US-GAAP-BASIC', 'REVENUE', '41', '10078', 'Recognized Point Of Time', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10080, 'US-GAAP-BASIC', 'REVENUE', '411', '10079', 'Goods', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10081, 'US-GAAP-BASIC', 'REVENUE', '412', '10079', 'Services', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10082, 'US-GAAP-BASIC', 'REVENUE', '42', '10078', 'Recognized Over Time', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10083, 'US-GAAP-BASIC', 'REVENUE', '421', '10082', 'Products', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10084, 'US-GAAP-BASIC', 'REVENUE', '422', '10082', 'Services', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10085, 'US-GAAP-BASIC', 'REVENUE', '43', '10078', 'Adjustments', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10086, 'US-GAAP-BASIC', 'REVENUE', '431', '10085', 'Variable Consideration', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10087, 'US-GAAP-BASIC', 'REVENUE', '432', '10085', 'Consideration Paid (Payable) To Customers', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10088, 'US-GAAP-BASIC', 'REVENUE', '433', '10085', 'Other Adjustments', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10089, 'US-GAAP-BASIC', 'EXPENSES', '5', '0', 'Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10090, 'US-GAAP-BASIC', 'EXPENSES', '51', '10089', 'Expenses Classified By Nature', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10091, 'US-GAAP-BASIC', 'EXPENSES', '511', '10090', 'Material And Merchandise', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10092, 'US-GAAP-BASIC', 'EXPENSES', '512', '10090', 'Employee Benefits', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10093, 'US-GAAP-BASIC', 'EXPENSES', '513', '10090', 'Services', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10094, 'US-GAAP-BASIC', 'EXPENSES', '514', '10090', 'Rent, Depreciation, Amortization And Depletion', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10095, 'US-GAAP-BASIC', 'EXPENSES', '52', '10089', 'Expenses Classified By Function', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10096, 'US-GAAP-BASIC', 'EXPENSES', '521', '10095', 'Cost Of Sales', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10097, 'US-GAAP-BASIC', 'EXPENSES', '522', '10095', 'Selling, General And Administrative ', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10098, 'US-GAAP-BASIC', 'EXPENSES', '523', '10095', 'Provision For Doubtful Accounts (US GAAP)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10099, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '6', '0', 'Other (Non-Operating) Income And Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10100, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '61', '10099', 'Other Revenue And Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10101, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '611', '10100', 'Other Revenue', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10102, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '612', '10100', 'Other Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10103, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '62', '10099', 'Gains And Losses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10104, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '621', '10103', 'Foreign Currency Transaction Gain (Loss)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10105, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '622', '10103', 'Gain (Loss) On Investments', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10106, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '623', '10103', 'Gain (Loss) On Derivatives', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10107, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '624', '10103', 'Gain (Loss) On Disposal Of Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10108, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '625', '10103', 'Debt Related Gain (Loss)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10109, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '626', '10103', 'Impairment Loss', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10110, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '628', '10103', 'Other Gains And (Losses)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10111, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '63', '10099', 'Taxes (Other Than Income And Payroll) And Fees', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10112, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '631', '10111', 'Real Estate Taxes And Insurance', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10113, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '632', '10111', 'Highway (Road) Taxes And Tolls', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10114, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '633', '10111', 'Direct Tax And License Fees', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10115, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '634', '10111', 'Excise And Sales Taxes', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10116, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '635', '10111', 'Customs Fees And Duties (Not Classified As Sales Or Excise)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10117, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '636', '10111', 'Non-Deductible VAT (GST)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10118, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '637', '10111', 'General Insurance Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10119, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '638', '10111', 'Administrative Fees (Revenue Stamps)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10120, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '639', '10111', 'Fines And Penalties', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10121, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '6310', '10111', 'Miscellaneous Taxes', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10122, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '6311', '10111', 'Other Taxes And Fees', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10123, 'US-GAAP-BASIC', 'OTHER_INCOME_EXPENSES', '64', '10099', 'Income Tax Expense (Benefit)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10124, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '7', '0', 'Intercompany And Related Party Accounts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10125, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '71', '10124', 'Intercompany And Related Party Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10126, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '711', '10125', 'Intercompany Balances (Eliminated In Consolidation)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10127, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '712', '10125', 'Related Party Balances (Reported Or Disclosed)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10128, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '713', '10125', 'Intercompany Investments', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10129, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '72', '10124', 'Intercompany And Related Party Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10130, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '721', '10129', 'Intercompany Balances (Eliminated In Consolidation)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10131, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '722', '10129', 'Related Party Balances (Reported Or Disclosed)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10132, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '73', '10124', 'Intercompany And Related Party Income And Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10133, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '731', '10132', 'Intercompany And Related Party Income', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10134, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '732', '10132', 'Intercompany And Related Party Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 10135, 'US-GAAP-BASIC', 'INTERCOMPANY_RELPARTY_ACCOUNTS', '733', '10132', 'Income (Loss) From Equity Method Investments', 1); From 1fa9a8c9d7b1ed0f8997c2eb59aaf4d10d437d91 Mon Sep 17 00:00:00 2001 From: "Esteban L. Castro" <43482256+elcf@users.noreply.github.com> Date: Tue, 7 Jun 2022 17:23:31 -0400 Subject: [PATCH 033/184] Added US-GAAP-BASIC --- htdocs/install/mysql/data/llx_accounting_abc.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/data/llx_accounting_abc.sql b/htdocs/install/mysql/data/llx_accounting_abc.sql index 806d084ce85..847cbf68790 100644 --- a/htdocs/install/mysql/data/llx_accounting_abc.sql +++ b/htdocs/install/mysql/data/llx_accounting_abc.sql @@ -176,6 +176,9 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE -- Description of chart of account USA US-BASE INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 11, 'US-BASE', 'USA basic chart of accounts', 1); +-- Description of chart of account USA US-GAAP-BASIC +INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 11, 'US-GAAP-BASIC', 'USA GAAP basic chart of accounts', 1); + -- Description of chart of account Canada CA-ENG-BASE INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 14, 'CA-ENG-BASE', 'Canadian basic chart of accounts - English', 1); From f872585ea26cba4d86dcc11dd2798798e3ba1d87 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 8 Jun 2022 01:02:02 +0200 Subject: [PATCH 034/184] Fix #21150 - Regression Can't insert manual lines Fix #21150 - Regression Can not insert manual lines for automatically created transactions to the general ledger, this was possible before. --- .../accountancy/class/bookkeeping.class.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5f3def1d3ee..dc4c4992bc0 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1722,6 +1722,38 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { + // Add an empty line when transaction is validated to permit to add new line manually + if ($mode != "_tmp") { + $line = new BookKeepingLine(); + + $line->id = $obj->rowid; + + $line->doc_date = $this->db->jdate($obj->doc_date); + $line->doc_type = $obj->doc_type; + $line->doc_ref = $obj->doc_ref; + $line->fk_doc = $obj->fk_doc; + $line->fk_docdet = $obj->fk_docdet; + $line->thirdparty_code = $obj->thirdparty_code; + $line->subledger_account = $obj->subledger_account; + $line->subledger_label = $obj->subledger_label; + $line->numero_compte = $obj->numero_compte; + $line->label_compte = $obj->label_compte; + $line->label_operation = $obj->label_operation; + $line->debit = $obj->debit; + $line->credit = $obj->credit; + $line->montant = $obj->amount; + $line->amount = $obj->amount; + $line->sens = $obj->sens; + $line->code_journal = $obj->code_journal; + $line->journal_label = $obj->journal_label; + $line->piece_num = $obj->piece_num; + $line->date_creation = $obj->date_creation; + $line->date_modification = $obj->date_modification; + $line->date_export = $obj->date_export; + $line->date_validation = $obj->date_validation; + + $this->linesmvt[] = $line; + } while ($obj = $this->db->fetch_object($result)) { $line = new BookKeepingLine(); From 0641b661183654eaf57e498df590a1410581c125 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 8 Jun 2022 01:39:53 +0200 Subject: [PATCH 035/184] Clean code --- .../accountancy/class/bookkeeping.class.php | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index dc4c4992bc0..000ac06f3c6 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1725,33 +1725,6 @@ class BookKeeping extends CommonObject // Add an empty line when transaction is validated to permit to add new line manually if ($mode != "_tmp") { $line = new BookKeepingLine(); - - $line->id = $obj->rowid; - - $line->doc_date = $this->db->jdate($obj->doc_date); - $line->doc_type = $obj->doc_type; - $line->doc_ref = $obj->doc_ref; - $line->fk_doc = $obj->fk_doc; - $line->fk_docdet = $obj->fk_docdet; - $line->thirdparty_code = $obj->thirdparty_code; - $line->subledger_account = $obj->subledger_account; - $line->subledger_label = $obj->subledger_label; - $line->numero_compte = $obj->numero_compte; - $line->label_compte = $obj->label_compte; - $line->label_operation = $obj->label_operation; - $line->debit = $obj->debit; - $line->credit = $obj->credit; - $line->montant = $obj->amount; - $line->amount = $obj->amount; - $line->sens = $obj->sens; - $line->code_journal = $obj->code_journal; - $line->journal_label = $obj->journal_label; - $line->piece_num = $obj->piece_num; - $line->date_creation = $obj->date_creation; - $line->date_modification = $obj->date_modification; - $line->date_export = $obj->date_export; - $line->date_validation = $obj->date_validation; - $this->linesmvt[] = $line; } while ($obj = $this->db->fetch_object($result)) { From dc2979ad4d31b4b2e96d60daaea12181ceb2b889 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Wed, 8 Jun 2022 09:02:24 +0200 Subject: [PATCH 036/184] php V8 warning --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 56aa24a8523..710e2eb8ed1 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -208,7 +208,7 @@ function project_prepare_head(Project $project, $moreparam = '') $h++; } - if ($conf->eventorganization->enabled && !empty($project->usage_organize_event)) { + if (!empty($conf->eventorganization->enabled) && !empty($project->usage_organize_event)) { $langs->load('eventorganization'); $head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id; $head[$h][1] = $langs->trans("EventOrganization"); From 777de32736ed8d5fbd1969d23a1963aa54167a00 Mon Sep 17 00:00:00 2001 From: jyhere Date: Wed, 8 Jun 2022 11:20:16 +0200 Subject: [PATCH 037/184] Add sql queries duration to debugbar --- htdocs/debugbar/class/DataCollector/DolQueryCollector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/debugbar/class/DataCollector/DolQueryCollector.php b/htdocs/debugbar/class/DataCollector/DolQueryCollector.php index 575efb10fac..ca5aa284dd2 100644 --- a/htdocs/debugbar/class/DataCollector/DolQueryCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolQueryCollector.php @@ -45,6 +45,7 @@ class DolQueryCollector extends DataCollector implements Renderable, AssetProvid $queries[] = array( 'sql' => $query['sql'], 'duration' => $query['duration'], + 'duration_str' => round($query['duration'] * 1000, 2), 'memory' => $query['memory_usage'], 'is_success' => $query['is_success'], 'error_code' => $query['error_code'], From c368ff69dff781755a8ed2227af78f34b881e2d6 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 8 Jun 2022 12:36:55 +0200 Subject: [PATCH 038/184] New : add of socialmedias in contact update --- htdocs/core/modules/modSociete.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 322988e7a7b..4b09207283f 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -834,6 +834,15 @@ class modSociete extends DolibarrModules $this->import_updatekeys_array[$r] = array( 's.rowid' => 'Id' ); + if (!empty($conf->socialnetworks->enabled)) { + $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; + $resql = $this->db->query($sql); + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 's.socialnetworks_'.$obj->code; + $fieldlabel = ucfirst($obj->label); + $this->import_updatekeys_array[$r][$fieldname] = $fieldlabel; + } + } // Import Bank Accounts $r++; From c9049a9c85fac248c6cdf81f70298c90c0d619c2 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 8 Jun 2022 12:35:31 +0200 Subject: [PATCH 039/184] Fix non numeric warning --- htdocs/product/class/productcustomerprice.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index a9444d1c569..64db4a4eb55 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -135,7 +135,7 @@ class Productcustomerprice extends CommonObject $this->price_base_type = trim($this->price_base_type); } if (isset($this->tva_tx)) { - $this->tva_tx = trim($this->tva_tx); + $this->tva_tx = (float) $this->tva_tx; } if (isset($this->recuperableonly)) { $this->recuperableonly = trim($this->recuperableonly); @@ -621,7 +621,7 @@ class Productcustomerprice extends CommonObject $this->price_base_type = trim($this->price_base_type); } if (isset($this->tva_tx)) { - $this->tva_tx = trim($this->tva_tx); + $this->tva_tx = (float) $this->tva_tx; } if (isset($this->recuperableonly)) { $this->recuperableonly = trim($this->recuperableonly); From 5aef26d8cc8117007e0c8e3bc2e7219db887ee6e Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Wed, 8 Jun 2022 13:11:28 +0200 Subject: [PATCH 040/184] Update project.lib.php --- htdocs/core/lib/project.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 710e2eb8ed1..14b25a517c6 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2,7 +2,8 @@ /* Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2022 Charlene Benke * * 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 @@ -635,7 +636,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $taskstatic->id = $lines[$i]->id; $taskstatic->ref = $lines[$i]->ref; - $taskstatic->label = ($taskrole[$lines[$i]->id] ? $langs->trans("YourRole").': '.$taskrole[$lines[$i]->id] : ''); + $taskstatic->label = (!empty($taskrole[$lines[$i]->id]) ? $langs->trans("YourRole").': '.$taskrole[$lines[$i]->id] : ''); $taskstatic->projectstatus = $lines[$i]->projectstatus; $taskstatic->progress = $lines[$i]->progress; $taskstatic->fk_statut = $lines[$i]->status; From c257f32559b780f756ccf63fc4e28789151bbb70 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 8 Jun 2022 13:35:32 +0200 Subject: [PATCH 041/184] add of names in update --- htdocs/core/modules/modSociete.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 4b09207283f..327262ce39f 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -832,7 +832,8 @@ class modSociete extends DolibarrModules 's.note_public' => "My public note" ); $this->import_updatekeys_array[$r] = array( - 's.rowid' => 'Id' + 's.rowid' => 'Id', + 's.lastname' => "Lastname", ); if (!empty($conf->socialnetworks->enabled)) { $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1"; From cde67b0d65dc8ce2ca4a8fd04a3b1347863b4a33 Mon Sep 17 00:00:00 2001 From: bagtaib Date: Wed, 8 Jun 2022 15:35:07 +0200 Subject: [PATCH 042/184] FIX #21140 --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d76b090d839..0a69c72799b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -942,8 +942,8 @@ class Societe extends CommonObject $sql .= ", accountancy_code_sell"; } $sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".((int) $this->entity).", '".$this->db->idate($now)."'"; - $sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null"); $sql .= ", ".(!empty($user->id) ? ((int) $user->id) : "null"); + $sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null"); $sql .= ", ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null"); $sql .= ", ".((int) $this->status); $sql .= ", ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null"); From f0a8765ee6d62fe94d0e2830561174b5726c2a83 Mon Sep 17 00:00:00 2001 From: Faustin Date: Wed, 8 Jun 2022 16:05:44 +0200 Subject: [PATCH 043/184] FIX #20696 --- htdocs/accountancy/bookkeeping/card.php | 6 +++--- htdocs/accountancy/class/bookkeeping.class.php | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 0eaeed73d9e..148608116e7 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -533,7 +533,7 @@ if ($action == 'create') { print '
'; print ''; print ''; print ''; @@ -541,7 +541,7 @@ if ($action == 'create') { print ''; print ''; print ''; print ''; @@ -549,7 +549,7 @@ if ($action == 'create') { print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5f3def1d3ee..5d2a9d63f9a 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1649,11 +1649,10 @@ class BookKeeping extends CommonObject $this->doc_date = $this->db->jdate($obj->doc_date); $this->doc_ref = $obj->doc_ref; $this->doc_type = $obj->doc_type; - $this->date_creation = $obj->date_creation; - $this->date_modification = $obj->date_modification; - $this->date_export = $obj->date_export; - $this->date_validation = $obj->date_validated; - $this->date_validation = $obj->date_validation; + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_modification = $this->db->jdate($obj->date_modification); + $this->date_export = $this->db->jdate($obj->date_export); + $this->date_validation = $this->db->jdate($obj->date_validation); } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(__METHOD__.$this->error, LOG_ERR); From 4d327dcc185f75b6eb685ef45b319489f625067e Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Wed, 8 Jun 2022 17:00:04 +0200 Subject: [PATCH 044/184] datee and dateo not filled now we user date_end and date_start --- htdocs/projet/class/project.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index b66452b2c5f..9937a551c1a 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2014-2017 Marcos García * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2019 Juanjo Menent + * Copyright (C) 2022 Charlene Benke * * 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 @@ -1212,11 +1213,11 @@ class Project extends CommonObject if (!empty($this->thirdparty_name)) { $label .= ($label ? '
' : '').''.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto } - if (!empty($this->dateo)) { - $label .= ($label ? '
' : '').''.$langs->trans('DateStart').': '.dol_print_date($this->dateo, 'day'); // The space must be after the : to not being explode when showing the title in img_picto + if (!empty($this->date_start)) { + $label .= ($label ? '
' : '').''.$langs->trans('DateStart').': '.dol_print_date($this->date_start, 'day'); // The space must be after the : to not being explode when showing the title in img_picto } - if (!empty($this->datee)) { - $label .= ($label ? '
' : '').''.$langs->trans('DateEnd').': '.dol_print_date($this->datee, 'day'); // The space must be after the : to not being explode when showing the title in img_picto + if (!empty($this->date_ent)) { + $label .= ($label ? '
' : '').''.$langs->trans('DateEnd').': '.dol_print_date($this->date_end, 'day'); // The space must be after the : to not being explode when showing the title in img_picto } if ($moreinpopup) { $label .= '
'.$moreinpopup; @@ -2073,7 +2074,7 @@ class Project extends CommonObject $project_static->statut = $obj->status; $project_static->opp_status = $obj->fk_opp_status; - $project_static->datee = $this->db->jdate($obj->datee); + $project_static->date_end = $this->db->jdate($obj->datee); if ($project_static->hasDelay()) { $response->nbtodolate++; @@ -2155,13 +2156,13 @@ class Project extends CommonObject if (!($this->statut == self::STATUS_VALIDATED)) { return false; } - if (!$this->datee && !$this->date_end) { + if (!$this->date_end) { return false; } $now = dol_now(); - return ($this->datee ? $this->datee : $this->date_end) < ($now - $conf->projet->warning_delay); + return ($this->date_end) < ($now - $conf->projet->warning_delay); } From 6f40c002b7fd569547d387e680090f86d1953147 Mon Sep 17 00:00:00 2001 From: ButterflyOfFire <42316180+BoFFire@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:13:52 +0100 Subject: [PATCH 045/184] Fixing algerian provinces names Fixing the names of the algerian provinces by removing the "Wilaya de xxx" and adding 10 more new provinces as Algeria has now 58 provinces instead of 48. And more fixes to come. --- .../mysql/data/llx_20_c_departements.sql | 107 ++++++++++-------- 1 file changed, 59 insertions(+), 48 deletions(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 6ccc22776f9..642bd69960b 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -14,6 +14,7 @@ -- Copyright (C) 2015 Ferran Marcet -- Copyright (C) 2020-2021 Udo Tamm -- Copyright (C) 2022 Miro Sertić +-- Copyright (C) 2022 ButterflyOfFire -- -- License ---------------------------------------------------------------------- @@ -84,54 +85,64 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc -- Algeria Provinces (id country=13) -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL01', '', 0, '', 'Wilaya d''Adrar'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL02', '', 0, '', 'Wilaya de Chlef'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL03', '', 0, '', 'Wilaya de Laghouat'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL04', '', 0, '', 'Wilaya d''Oum El Bouaghi'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL05', '', 0, '', 'Wilaya de Batna'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL06', '', 0, '', 'Wilaya de Béjaïa'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL07', '', 0, '', 'Wilaya de Biskra'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL08', '', 0, '', 'Wilaya de Béchar'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL09', '', 0, '', 'Wilaya de Blida'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL10', '', 0, '', 'Wilaya de Bouira'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL11', '', 0, '', 'Wilaya de Tamanrasset'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL12', '', 0, '', 'Wilaya de Tébessa'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL13', '', 0, '', 'Wilaya de Tlemcen'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL14', '', 0, '', 'Wilaya de Tiaret'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL15', '', 0, '', 'Wilaya de Tizi Ouzou'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL16', '', 0, '', 'Wilaya d''Alger'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL17', '', 0, '', 'Wilaya de Djelfa'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL18', '', 0, '', 'Wilaya de Jijel'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL19', '', 0, '', 'Wilaya de Sétif'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL20', '', 0, '', 'Wilaya de Saïda'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL21', '', 0, '', 'Wilaya de Skikda'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL22', '', 0, '', 'Wilaya de Sidi Bel Abbès'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL23', '', 0, '', 'Wilaya d''Annaba'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL24', '', 0, '', 'Wilaya de Guelma'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL25', '', 0, '', 'Wilaya de Constantine'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL26', '', 0, '', 'Wilaya de Médéa'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL27', '', 0, '', 'Wilaya de Mostaganem'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL28', '', 0, '', 'Wilaya de M''Sila'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL29', '', 0, '', 'Wilaya de Mascara'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL30', '', 0, '', 'Wilaya d''Ouargla'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL31', '', 0, '', 'Wilaya d''Oran'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL32', '', 0, '', 'Wilaya d''El Bayadh'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL33', '', 0, '', 'Wilaya d''Illizi'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL34', '', 0, '', 'Wilaya de Bordj Bou Arreridj'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL35', '', 0, '', 'Wilaya de Boumerdès'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL36', '', 0, '', 'Wilaya d''El Tarf'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL37', '', 0, '', 'Wilaya de Tindouf'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL38', '', 0, '', 'Wilaya de Tissemsilt'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL39', '', 0, '', 'Wilaya d''El Oued'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL40', '', 0, '', 'Wilaya de Khenchela'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL41', '', 0, '', 'Wilaya de Souk Ahras'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL42', '', 0, '', 'Wilaya de Tipaza'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL43', '', 0, '', 'Wilaya de Mila'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL44', '', 0, '', 'Wilaya d''Aïn Defla'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL45', '', 0, '', 'Wilaya de Naâma'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL46', '', 0, '', 'Wilaya d''Aïn Témouchent'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL47', '', 0, '', 'Wilaya de Ghardaia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, 'AL48', '', 0, '', 'Wilaya de Relizane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '01', '', 0, '', 'Adrar'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '02', '', 0, '', 'Chlef'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '03', '', 0, '', 'Laghouat'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '04', '', 0, '', 'Oum El Bouaghi'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '05', '', 0, '', 'Batna'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '06', '', 0, '', 'Béjaïa'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '07', '', 0, '', 'Biskra'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '08', '', 0, '', 'Béchar'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '09', '', 0, '', 'Blida'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '10', '', 0, '', 'Bouira'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '11', '', 0, '', 'Tamanrasset'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '12', '', 0, '', 'Tébessa'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '13', '', 0, '', 'Tlemcen'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '14', '', 0, '', 'Tiaret'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '15', '', 0, '', 'Tizi Ouzou'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '16', '', 0, '', 'Alger'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '17', '', 0, '', 'Djelfa'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '18', '', 0, '', 'Jijel'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '19', '', 0, '', 'Sétif'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '20', '', 0, '', 'Saïda'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '21', '', 0, '', 'Skikda'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '22', '', 0, '', 'Sidi Bel Abbès'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '23', '', 0, '', 'Annaba'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '24', '', 0, '', 'Guelma'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '25', '', 0, '', 'Constantine'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '26', '', 0, '', 'Médéa'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '27', '', 0, '', 'Mostaganem'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '28', '', 0, '', 'M''Sila'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '29', '', 0, '', 'Mascara'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '30', '', 0, '', 'Ouargla'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '31', '', 0, '', 'Oran'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '32', '', 0, '', 'El Bayadh'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '33', '', 0, '', 'Illizi'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '34', '', 0, '', 'Bordj Bou Arreridj'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '35', '', 0, '', 'Boumerdès'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '36', '', 0, '', 'El Tarf'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '37', '', 0, '', 'Tindouf'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '38', '', 0, '', 'Tissemsilt'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '39', '', 0, '', 'El Oued'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '40', '', 0, '', 'Khenchela'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '41', '', 0, '', 'Souk Ahras'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '42', '', 0, '', 'Tipaza'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '43', '', 0, '', 'Mila'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '44', '', 0, '', 'Aïn Defla'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '45', '', 0, '', 'Naâma'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '46', '', 0, '', 'Aïn Témouchent'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '47', '', 0, '', 'Ghardaïa'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '48', '', 0, '', 'Relizane'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '49', '', 0, '', 'Timimoun'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '50', '', 0, '', 'Bordj Badji Mokhtar'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '51', '', 0, '', 'Ouled Djellal'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '52', '', 0, '', 'Béni Abbès'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '53', '', 0, '', 'In Salah'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '54', '', 0, '', 'In Guezzam'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '55', '', 0, '', 'Touggourt'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '56', '', 0, '', 'Djanet'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '57', '', 0, '', 'El M''Ghair'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1301, '58', '', 0, '', 'El Ménéa'); -- Andorra Parròquies (id country=34) From 1f26dee5548d739b5aa4213c6edf5e4dd0d6abdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jun 2022 17:19:12 +0200 Subject: [PATCH 046/184] Fix deprecated functions --- htdocs/admin/stocktransfer.php | 6 +++--- .../stock/stocktransfer/stocktransfer_agenda.php | 4 ++-- .../stock/stocktransfer/stocktransfer_card.php | 12 ++++++------ .../stock/stocktransfer/stocktransfer_contact.php | 4 ++-- .../stock/stocktransfer/stocktransfer_document.php | 4 ++-- .../stock/stocktransfer/stocktransfer_note.php | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index e0ce72eeb25..541947bf442 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -174,10 +174,10 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'stock'); // Configuration header $head = stocktransferAdminPrepareHead(); -dol_fiche_head($head, 'settings', '', -1, "stocktransfer@stocktransfer"); +print dol_get_fiche_head($head, 'settings', '', -1, "stocktransfer@stocktransfer"); // Setup page goes here -echo ''.$langs->trans("StockTransferSetupPage").''; +print ''.$langs->trans("StockTransferSetupPage").''; /*if ($action == 'edit') @@ -478,7 +478,7 @@ if (empty($setupnotempty)) { } // Page end -dol_fiche_end(); +print dol_get_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php index ccbdf12e712..f649e46cc27 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php @@ -134,7 +134,7 @@ if ($object->id > 0) { $head = stocktransferPrepareHead($object); - dol_fiche_head($head, 'agenda', $langs->trans("StockTransfer"), -1, $object->picto); + print dol_get_fiche_head($head, 'agenda', $langs->trans("StockTransfer"), -1, $object->picto); // Object card // ------------------------------------------------------------ @@ -191,7 +191,7 @@ if ($object->id > 0) { print ''; - dol_fiche_end(); + print dol_get_fiche_end(); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 84e87dd32f1..0c97674191e 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -422,7 +422,7 @@ if ($action == 'create') { if ($backtopage) print ''; if ($backtopageforcancel) print ''; - dol_fiche_head(array(), ''); + print dol_get_fiche_head(array(), ''); // Set some default values //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; @@ -454,7 +454,7 @@ if ($action == 'create') { print '
'.$langs->trans("DateCreation").''; - print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; + print $object->date_creation ? dol_print_date($db->jdate($object->date_creation), 'day') : ' '; print '
'.$langs->trans("DateExport").''; - print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; + print $object->date_export ? dol_print_date($db->jdate($object->date_export), 'dayhour') : ' '; print '
'.$langs->trans("DateValidation").''; - print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print $object->date_validation ? dol_print_date($db->jdate($object->date_validation), 'dayhour') : ' '; print '
'.$langs->trans("DateCreation").''; - print $object->date_creation ? dol_print_date($db->jdate($object->date_creation), 'day') : ' '; + print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; print '
'.$langs->trans("DateExport").''; - print $object->date_export ? dol_print_date($db->jdate($object->date_export), 'dayhour') : ' '; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; print '
'.$langs->trans("DateValidation").''; - print $object->date_validation ? dol_print_date($db->jdate($object->date_validation), 'dayhour') : ' '; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; print '
'."\n"; - dol_fiche_end(); + print dol_get_fiche_end(); print '
'; print ''; @@ -479,7 +479,7 @@ if (($id || $ref) && $action == 'edit') { if ($backtopage) print ''; if ($backtopageforcancel) print ''; - dol_fiche_head(); + print dol_get_fiche_head(); print '' . "\n"; @@ -491,7 +491,7 @@ if (($id || $ref) && $action == 'edit') { print '
'; - dol_fiche_end(); + print dol_get_fiche_end(); print '
'; print '   '; @@ -506,7 +506,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = stocktransferPrepareHead($object); - dol_fiche_head($head, 'card', $langs->trans("StockTransfer"), -1, $object->picto); + print dol_get_fiche_head($head, 'card', $langs->trans("StockTransfer"), -1, $object->picto); $formconfirm = ''; @@ -675,7 +675,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; - dol_fiche_end(); + print dol_get_fiche_end(); /* diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php index 97ac4c28a73..d2cb095932b 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php @@ -126,7 +126,7 @@ $formother = new FormOther($db); if ($object->id > 0) { $head = stocktransferPrepareHead($object); - dol_fiche_head($head, 'contact', $langs->trans("StockTransfer"), -1, 'stock'); + print dol_get_fiche_head($head, 'contact', $langs->trans("StockTransfer"), -1, 'stock'); // Proposal card @@ -178,7 +178,7 @@ if ($object->id > 0) { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); + print dol_get_fiche_end(); $user->rights->stocktransfer->write = $user->rights->stocktransfer->stocktransfer->write; // Contacts lines (modules that overwrite templates must declare this into descriptor) diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_document.php b/htdocs/product/stock/stocktransfer/stocktransfer_document.php index 4fba0c3fea5..ab4b45b6864 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_document.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_document.php @@ -114,7 +114,7 @@ if ($object->id) { */ $head = stocktransferPrepareHead($object); - dol_fiche_head($head, 'document', $langs->trans("StockTransfer"), -1, $object->picto); + print dol_get_fiche_head($head, 'document', $langs->trans("StockTransfer"), -1, $object->picto); // Build file list @@ -185,7 +185,7 @@ if ($object->id) { print '
'; - dol_fiche_end(); + print dol_get_fiche_end(); $modulepart = 'stocktransfer'; //$permission = $user->rights->stocktransfer->stocktransfer->write; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_note.php b/htdocs/product/stock/stocktransfer/stocktransfer_note.php index 51ad1c32df3..41842d07ee5 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_note.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_note.php @@ -95,7 +95,7 @@ if ($id > 0 || !empty($ref)) { $head = stocktransferPrepareHead($object); - dol_fiche_head($head, 'note', $langs->trans("StockTransfer"), -1, $object->picto); + print dol_get_fiche_head($head, 'note', $langs->trans("StockTransfer"), -1, $object->picto); // Object card // ------------------------------------------------------------ @@ -139,7 +139,7 @@ if ($id > 0 || !empty($ref)) { } } }*/ - $morehtmlref .= '
'; + $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -154,7 +154,7 @@ if ($id > 0 || !empty($ref)) { print '
'; - dol_fiche_end(); + print dol_get_fiche_end(); } // End of page From 636d59430146ccc398a93dbca61c1af724454ab7 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 8 Jun 2022 17:26:30 +0200 Subject: [PATCH 047/184] Fix reception set-draft with stock rule enabled. --- htdocs/reception/class/reception.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 9f0a6342a24..7263a20dde7 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1944,7 +1944,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1956,7 +1956,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; From 48142c69bd2c9e1cabf5322249922ffe299eb40a Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 8 Jun 2022 17:20:48 +0200 Subject: [PATCH 048/184] Fix reception re-open with stock rule enabled. --- htdocs/reception/class/reception.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7263a20dde7..8cd1387152e 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1813,7 +1813,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), '', '', '', '', 0, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), '', '', '', '', 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; @@ -1825,7 +1825,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', $obj->fk_origin_stock, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', $obj->fk_origin_stock, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; From 36e5e8850e0cd59ebfb6d510f96302dd39c1886e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jun 2022 17:43:33 +0200 Subject: [PATCH 049/184] typo --- htdocs/langs/en_US/install.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 9d76ad15d43..a6716034c2d 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -8,7 +8,7 @@ ConfFileIsNotWritable=Configuration file %s is not writable. Check permis ConfFileIsWritable=Configuration file %s is writable. ConfFileMustBeAFileNotADir=Configuration file %s must be a file, not a directory. ConfFileReload=Reloading parameters from configuration file. -NoReadableConfFileSoStartInstall=The configuration file conf/conf.php does not exists or is not reabable. We will run the installation process to try to initialize it. +NoReadableConfFileSoStartInstall=The configuration file conf/conf.php does not exists or is not readable. We will run the installation process to try to initialize it. PHPSupportPOSTGETOk=This PHP supports variables POST and GET. PHPSupportPOSTGETKo=It's possible your PHP setup does not support variables POST and/or GET. Check the parameter variables_order in php.ini. PHPSupportSessions=This PHP supports sessions. From 41683b9025e34a64aa367ce12120248efc4848be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jun 2022 18:09:21 +0200 Subject: [PATCH 050/184] Typo --- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/errors.lang | 2 +- htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/en_US/stocks.lang | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d3f62c0dc9d..e4725704dd5 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2252,7 +2252,7 @@ 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 element in top right menu +ShowQuickAddLink=Show a button to quickly add an object, 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 diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 13f480be0ed..3955f0f9bb3 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -285,7 +285,7 @@ ErrorPaymentInBothCurrency=Error, all amounts must be entered in the same column ErrorYouTryToPayInvoicesInACurrencyFromBankWithAnotherCurrency=You try to pay invoices in the currency %s from an account with the currency %s ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s" ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s" -ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by actual object status +ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by current object status ErrorAjaxRequestFailed=Request failed # Warnings diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 05d0ec1e060..9241120c9db 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1174,7 +1174,7 @@ ConfirmAllocateCommercial=Assign sales representative confirmation ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)? CommercialsAffected=Sales representatives affected CommercialAffected=Sales representative affected -YourMessage=Votre message +YourMessage=Your message YourMessageHasBeenReceived=Your message has been received. We will answer or contact you as soon as possible. UrlToCheck=Url to check Automation=Automation \ No newline at end of file diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index dbd15ec4da2..f28151c9efe 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -274,8 +274,8 @@ NoWarehouseDefinedForTerminal=No warehouse defined for terminal ClearQtys=Clear all quantities ModuleStockTransferName=Advanced Stock Transfer ModuleStockTransferDesc=Advanced management of Stock Transfer, with generation of transfer sheet -StockTransferNew=New stocks transfer -StockTransferList=Stocks transfers list +StockTransferNew=New stock transfer +StockTransferList=Stock transfers list ConfirmValidateStockTransfer=Are you sure you want to validate this stocks transfer with reference %s ? ConfirmDestock=Decrease of stocks with transfer %s ConfirmDestockCancel=Cancel decrease of stocks with transfer %s From e1f4d99aa62618287a03a634ee1e7b6e603117be Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 8 Jun 2022 18:27:47 +0200 Subject: [PATCH 051/184] Debug #18770 edit buy price for WAP update. --- htdocs/reception/class/reception.class.php | 39 ++++++++-------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 8cd1387152e..d1d448b8dcb 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -593,22 +593,12 @@ class Reception extends CommonObject $mouvS->origin = &$this; $mouvS->setOrigin($this->element, $this->id); - // get unit price with discount - $up_ht_disc = $obj->subprice; - if (!empty($obj->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { - $up_ht_disc = price2num($up_ht_disc * (100 - $obj->remise_percent) / 100, 'MU'); - } - if (empty($obj->batch)) { // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. $inventorycode = ''; - if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode); - } else { - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode); - } + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode); if ($result < 0) { $error++; @@ -622,11 +612,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) $inventorycode = ''; - if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); - } else { - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); - } + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); if ($result < 0) { $error++; @@ -1618,7 +1604,8 @@ class Reception extends CommonObject // TODO possibilite de receptionner a partir d'une propale ou autre origine ? $sql = "SELECT cd.fk_product, cd.subprice,"; $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; - $sql .= " ed.eatby, ed.sellby, ed.batch"; + $sql .= " ed.eatby, ed.sellby, ed.batch,"; + $sql .= " ed.cost_price"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= " WHERE ed.fk_reception = ".((int) $this->id); @@ -1648,7 +1635,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1659,7 +1646,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; @@ -1782,7 +1769,8 @@ class Reception extends CommonObject // TODO possibilite de receptionner a partir d'une propale ou autre origine $sql = "SELECT ed.fk_product, cd.subprice,"; $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; - $sql .= " ed.eatby, ed.sellby, ed.batch"; + $sql .= " ed.eatby, ed.sellby, ed.batch,"; + $sql .= " ed.cost_price"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= " WHERE ed.fk_reception = ".((int) $this->id); @@ -1813,7 +1801,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), '', '', '', '', 0, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), '', '', '', '', 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; @@ -1825,7 +1813,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', $obj->fk_origin_stock, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', $obj->fk_origin_stock, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1913,7 +1901,8 @@ class Reception extends CommonObject // TODO possibilite de receptionner a partir d'une propale ou autre origine $sql = "SELECT cd.fk_product, cd.subprice,"; $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; - $sql .= " ed.eatby, ed.sellby, ed.batch"; + $sql .= " ed.eatby, ed.sellby, ed.batch,"; + $sql .= " ed.cost_price"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= " WHERE ed.fk_reception = ".((int) $this->id); @@ -1944,7 +1933,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1956,7 +1945,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; From 54019b7d76b5a8196b3b04ee384ca300329907e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jun 2022 20:07:16 +0200 Subject: [PATCH 052/184] Debug v16 --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/functions.lib.php | 5 +++-- htdocs/core/tpl/filemanager.tpl.php | 8 ++++--- htdocs/ecm/file_card.php | 2 +- htdocs/ecm/file_note.php | 2 ++ htdocs/ecm/index.php | 2 +- htdocs/ecm/tpl/enablefiletreeajax.tpl.php | 3 +++ htdocs/holiday/card.php | 3 +++ htdocs/holiday/class/holiday.class.php | 20 ++++++++--------- htdocs/holiday/document.php | 1 + .../template/class/myobject.class.php | 22 +++++++++++-------- 11 files changed, 43 insertions(+), 27 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f3b42a4789e..97f5eca5822 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1470,7 +1470,7 @@ class FormFile print ''; if ($useinecm == 1 || $useinecm == 5) { // ECM manual tree only // $section is inside $param - $newparam .= preg_replace('/&file=.*$/', '', $param); // We don't need param file= + $newparam = preg_replace('/&file=.*$/', '', $param); // We don't need param file= $backtopage = DOL_URL_ROOT.'/ecm/index.php?§ion_dir='.urlencode($relativepath).$newparam; print ''.img_edit('default', 0, 'class="paddingrightonly"').''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 12e217c02e8..b17b837aa88 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10045,7 +10045,7 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi $resql = $db->query($sql); if ($resql) { while ($obj = $db->fetch_object($resql)) { - $dictvalues[$obj->{$rowidfield}] = $obj; + $dictvalues[$obj->{$rowidfield}] = $obj; // $obj is stdClass } } else { dol_print_error($db); @@ -10056,7 +10056,8 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi if (!empty($dictvalues[$id])) { // Found - return $dictvalues[$id]->{$field}; + $tmp = $dictvalues[$id]; + return (property_exists($tmp, $field) ? $tmp->$field : ''); } else { // Not found return ''; diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 955e9dd479a..ddcb23da891 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -94,9 +94,11 @@ if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage med print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); print ''; } elseif ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm - print ''; - print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); - print ''; + if (getDolGlobalInt('ECM_SHOW_GENERATE_WEBP_BUTTON')) { + print ''; + print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); + print ''; + } } print "