From 77552fa32ae0fa5e3882980f5712318a0c6835e3 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 7 Jul 2022 10:17:56 +0200 Subject: [PATCH 01/19] FIX : We must remove empty values of $features array in fetchByProductCombination2ValuePairs() because some products can use only several attributes in their variations and not necessarily all. In this case, fetch doesn't work without my correction --- htdocs/variants/class/ProductCombination.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index ac9d5403671..c4c660e61d8 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -602,6 +602,8 @@ class ProductCombination $prodcomb2val = new ProductCombination2ValuePair($this->db); $prodcomb = new ProductCombination($this->db); + $features = array_filter($features); + foreach ($features as $attr => $attr_val) { $actual_comp[$attr] = $attr_val; } From f10788e4c6c50ee60f8722b4cb8d88720d34c121 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 7 Jul 2022 10:24:39 +0200 Subject: [PATCH 02/19] fix export resource type filter --- htdocs/core/modules/modResource.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 0478cdff2a7..82ee03a4df7 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -238,20 +238,22 @@ class modResource extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = "ResourceSingular"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("resource", "read")); - $this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceType', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification"); - $this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text', 'r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.label'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text'); - $this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.label'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource"); + $this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.code'=>'ResourceTypeCode', 'c.rowid'=>'ResourceType', 'c.label'=>'ResourceTypeLabel', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification"); + $this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text','r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.rowid'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text'); + $this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.rowid'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource"); + $keyforselect = 'resource'; $keyforelement = 'resource'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.code = r.fk_code_type_resource'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid'; $this->export_sql_end[$r] .= ' WHERE r.entity IN ('.getEntity('resource').')'; + // Imports //-------- $r = 0; From 787f52fd7f463cdcc7622ae7e8423974071f19e6 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 8 Jul 2022 09:32:20 +0200 Subject: [PATCH 03/19] FIX : with callback function --- htdocs/variants/class/ProductCombination.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index c4c660e61d8..7d90c1b247d 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -602,7 +602,9 @@ class ProductCombination $prodcomb2val = new ProductCombination2ValuePair($this->db); $prodcomb = new ProductCombination($this->db); - $features = array_filter($features); + $features = array_filter($features, function($v) { + return !empty($v); + }); foreach ($features as $attr => $attr_val) { $actual_comp[$attr] = $attr_val; From 04fd17347e78e480fc99cb1e2d8cc2d1fa326568 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 8 Jul 2022 07:36:09 +0000 Subject: [PATCH 04/19] Fixing style errors. --- htdocs/variants/class/ProductCombination.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 7d90c1b247d..472c474c81c 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -602,7 +602,7 @@ class ProductCombination $prodcomb2val = new ProductCombination2ValuePair($this->db); $prodcomb = new ProductCombination($this->db); - $features = array_filter($features, function($v) { + $features = array_filter($features, function ($v) { return !empty($v); }); From d375c9fbbe7fc44c07c5c6d31aa0ef57ddf91c3d Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 8 Jul 2022 10:35:43 +0200 Subject: [PATCH 05/19] FIX : backport commit 5b3fcc5e43979b1b0789bf81fb8f1b2b59c93056, chkbxlst cannot be emptied --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6e4f6892e05..3d10525c568 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2072,7 +2072,7 @@ class ExtraFields if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) { continue; } - if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && $this->attributes[$object->table_element]['type'][$key] != 'boolean') { + if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')))) { //when unticking boolean field, it's not set in POST continue; } From 9db3c1bbd682670ea3e2543d5e78680f291e2e48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Jul 2022 10:56:36 +0200 Subject: [PATCH 06/19] Fix currency missing --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 6b11d31c2ff..d1ca876b7cc 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -960,7 +960,7 @@ class ProductFournisseur extends Product public function display_price_product_fournisseur($showunitprice = 1, $showsuptitle = 1, $maxlen = 0, $notooltip = 0, $productFournList = array()) { // phpcs:enable - global $langs; + global $conf, $langs; $out = ''; $langs->load("suppliers"); @@ -978,7 +978,7 @@ class ProductFournisseur extends Product } $out .= ''; } else { - $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise).' '.$langs->trans("HT").'   (' : ''); + $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").'   (' : ''); $out .= ($showsuptitle ? ''.$langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->ref_supplier; $out .= ($showunitprice ? ')' : ''); } From 61f1595f8c8404634add718b000ae7576657e3cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Jul 2022 11:21:54 +0200 Subject: [PATCH 07/19] Fix look and feel v15 --- htdocs/core/lib/functions.lib.php | 5 ++++- htdocs/product/price.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ffc88c157ff..8bc9a453ab2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5187,9 +5187,10 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be * @param boolean $addpercent Add a percent % sign in output * @param int $info_bits Miscellaneous information on vat (0=Default, 1=French NPR vat) * @param int $usestarfornpr -1=Never show, 0 or 1=Use '*' for NPR vat rates + * @param int $html Used for html output * @return string String with formated amounts ('19,6' or '19,6%' or '8.5% (NPR)' or '8.5% *' or '19,6 (CODEX)') */ -function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0) +function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0, $html = 0) { $morelabel = ''; @@ -5197,9 +5198,11 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0) $rate = str_replace('%', '', $rate); $addpercent = true; } + $reg = array(); if (preg_match('/\((.*)\)/', $rate, $reg)) { $morelabel = ' ('.$reg[1].')'; $rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate); + $morelabel = ' '.($html ? '' : '').'('.$reg[1].')'.($html ? '' : ''); } if (preg_match('/\*/', $rate)) { $rate = str_replace('*', '', $rate); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index ab3086bfd0b..e83816b84ce 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1177,7 +1177,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ if (empty($positiverates)) { $positiverates = '0'; } - echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), '%', $object->tva_npr); + echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), '%', $object->tva_npr, 0, 1); /* if ($object->default_vat_code) { From 226488b7edeb0f89f1740537b1b9dd1dd0837951 Mon Sep 17 00:00:00 2001 From: jpb Date: Fri, 8 Jul 2022 12:32:17 +0200 Subject: [PATCH 08/19] rank change. if we only have one order we leave the origin rank otherwhise we pass -1 --- htdocs/core/actions_massactions.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 70b79ffbefc..56492276c73 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -604,7 +604,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $nb_bills_created = 0; $db->begin(); - + $nbOrders = is_array($orders) ? count($orders) : 1; foreach ($orders as $id_order) { $cmd = new Commande($db); @@ -726,7 +726,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } - + $rankedLine = ($nbOrders > 1) ? -1 : $lines[$i]->rang; $result = $objecttmp->addline( $desc, $lines[$i]->subprice, @@ -744,7 +744,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders 'HT', 0, $product_type, - $lines[$i]->rang, + $rankedLine, $lines[$i]->special_code, $objecttmp->origin, $lines[$i]->rowid, From 56ea6989cf8a67557d4abaa551f66fcb5b65eaf3 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 8 Jul 2022 15:30:31 +0200 Subject: [PATCH 09/19] check batch on receptions->addline when module is enabled --- htdocs/reception/class/reception.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0be0ea7ba37..9f8fb616582 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -752,6 +752,23 @@ class Reception extends CommonObject } } + // Check batch is set + $product = new Product($this->db); + $product->fetch($fk_product); + if (!empty($conf->productbatch->enabled)) { + $langs->load("errors"); + if (!empty($product->status_batch) && empty($batch)) { + $this->error = $langs->trans('ErrorProductNeedBatchNumber', $product->ref); + setEventMessages($this->error, $this->errors, 'errors'); + return -1; + } elseif (empty($product->status_batch) && !empty($batch)) { + $this->error = $langs->trans('ErrorProductDoesNotNeedBatchNumber', $product->ref); + setEventMessages($this->error, $this->errors, 'errors'); + return -1; + } + } + unset ($product); + // extrafields $line->array_options = $supplierorderline->array_options; if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) { From f042a62a1c8e3604f87ce82c72d668d00dbf135c Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 8 Jul 2022 15:47:13 +0200 Subject: [PATCH 10/19] remove overkill setEventMessage() --- htdocs/reception/class/reception.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 9f8fb616582..3cf5220edbb 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -759,11 +759,9 @@ class Reception extends CommonObject $langs->load("errors"); if (!empty($product->status_batch) && empty($batch)) { $this->error = $langs->trans('ErrorProductNeedBatchNumber', $product->ref); - setEventMessages($this->error, $this->errors, 'errors'); return -1; } elseif (empty($product->status_batch) && !empty($batch)) { $this->error = $langs->trans('ErrorProductDoesNotNeedBatchNumber', $product->ref); - setEventMessages($this->error, $this->errors, 'errors'); return -1; } } From c0d3aaf445763473bbc002143f177fc16127f506 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 8 Jul 2022 15:53:41 +0200 Subject: [PATCH 11/19] stickler fix --- htdocs/reception/class/reception.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 3cf5220edbb..53acd077d2b 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -765,7 +765,7 @@ class Reception extends CommonObject return -1; } } - unset ($product); + unset($product); // extrafields $line->array_options = $supplierorderline->array_options; From 56c4817d6decea4c69c16adfa438cf72e51adb16 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 8 Jul 2022 17:30:15 +0200 Subject: [PATCH 12/19] fix: Bad amount calc on Invoice index --- htdocs/core/lib/invoice.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index c64c63fc0dd..552658f091d 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -1165,6 +1165,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $i++; $total += $obj->total_ht; $total_ttc += $obj->total_ttc; + $totalam += $obj->am; continue; } From 6362cdfe2efd64660ebad1fb513ce678632d8d31 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 10 Jul 2022 13:00:34 +0200 Subject: [PATCH 13/19] FIX regression by php8 fix on setVarsFromFetchObj --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9cfe5b47de5..c432fbd8b60 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8891,7 +8891,7 @@ abstract class CommonObject } } } else { - $this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null; + $this->{$field} = isset($obj->{$field}) ? $obj->{$field} : null; } } From 384652086281bff0512e200bdf3cc334d6561d41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 14:55:36 +0200 Subject: [PATCH 14/19] Trans --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 6de4824ecea..9350efef602 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -40,6 +40,7 @@ Language_es_AR=Spanish (Argentina) Language_es_BO=Spanish (Bolivia) Language_es_CL=Spanish (Chile) Language_es_CO=Spanish (Colombia) +Language_es_CR=Spanish (Costa Rica) Language_es_DO=Spanish (Dominican Republic) Language_es_EC=Spanish (Ecuador) Language_es_GT=Spanish (Guatemala) From 09932000dd06c5b6b4aae370c4a2ed02f2aa72f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 18:06:41 +0200 Subject: [PATCH 15/19] FIX online signature works partially on ODT templates. --- htdocs/core/ajax/onlineSign.php | 48 ++++++++++++------- htdocs/core/class/commonobject.class.php | 7 ++- .../doc/doc_generic_proposal_odt.modules.php | 1 + .../core/modules/propale/modules_propale.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 2 +- 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 994ba5c42f3..5f3cc281f90 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -69,10 +69,10 @@ $type = $mode; // Check securitykey $securekeyseed = ''; if ($type == 'proposal') { - $securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN; + $securekeyseed = isset($conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN : ''; } -if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) { +if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) { http_response_code(403); print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); exit(-1); @@ -122,28 +122,40 @@ if ($action == "importSignature") { } if (!$error) { - $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; + // Defined modele of doc + $directdownloadlink = $object->getLastMainDocLink('proposal'); - $pdf = pdf_getInstance(); - $pdf->Open(); - $pdf->AddPage(); - $pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF + if (preg_match('/\.pdf/i', $directdownloadlink)) { + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; + $sourcefile = $upload_dir.$ref.".pdf"; - for ($i=1;$i<($pagecount+1);$i++) { - if ($i>1) $pdf->AddPage(); - $tppl=$pdf->importPage($i); - $pdf->useTemplate($tppl); + if (dol_is_file($sourcefile)) { + $pdf = pdf_getInstance(); + $pdf->Open(); + $pdf->AddPage(); + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF + + for ($i=1; $i<($pagecount+1); $i++) { + if ($i>1) $pdf->AddPage(); + $tppl=$pdf->importPage($i); + $pdf->useTemplate($tppl); + } + + $pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset. + $pdf->Close(); + $pdf->Output($newpdffilename, "F"); + + // Index the new file and update the last_main_doc property of object. + $object->indexFile($newpdffilename, 1); + } + } else { + // Adding signature on doc not yet supported } + } - $pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset. - $pdf->Close(); - $pdf->Output($newpdffilename, "F"); - + if (!$error) { $db->begin(); - // Index the new file and update the last_main_doc property of object. - $object->indexFile($newpdffilename, 1); - $online_sign_ip = getUserRemoteIP(); $online_sign_name = ''; // TODO Ask name on form to sign diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9cfe5b47de5..62782d28a96 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -602,6 +602,8 @@ abstract class CommonObject // No constructor as it is an abstract class + + /** * Check an object id/ref exists * If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch @@ -648,6 +650,7 @@ abstract class CommonObject return -1; } + /** * Method to output saved errors * @@ -5530,7 +5533,9 @@ abstract class CommonObject * Index a file into the ECM database * * @param string $destfull Full path of file to index - * @param int $update_main_doc_field Update field main_doc file into table of object + * @param int $update_main_doc_field Update field main_doc fied into the table of object. + * This param is set when called for a document generation if document generator hase + * ->update_main_doc_field set and returns ->result['fullpath']. * @return int <0 if KO, >0 if OK */ public function indexFile($destfull, $update_main_doc_field) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 6f91d676949..7f2e0733e9d 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -71,6 +71,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $this->db = $db; $this->name = "ODT templates"; $this->description = $langs->trans("DocumentModelOdt"); + $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template $this->scandir = 'PROPALE_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan // Page size for A4 format diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index ee7df804c59..dcb386947a3 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -67,7 +67,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator /** - * Classe mere des modeles de numerotation des references de propales + * Parent class for numbering rules of proposals */ abstract class ModeleNumRefPropales { diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index d1020dc2c1d..5e920444c35 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -328,7 +328,7 @@ if ($source == 'proposal') { // Object $text = ''.$langs->trans("SignatureProposalRef", $proposal->ref).''; - print ''.$langs->trans("Designation"); + print ''.$langs->trans("Designation"); print ''.$text; if ($proposal->status == $proposal::STATUS_VALIDATED) { $directdownloadlink = $proposal->getLastMainDocLink('proposal'); From cccb453a053ca763ce73affa6977cdbcb057696a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 18:35:23 +0200 Subject: [PATCH 16/19] Fix doc --- htdocs/expedition/class/expedition.class.php | 1 + htdocs/fourn/class/fournisseur.commande.dispatch.class.php | 3 +++ htdocs/reception/class/reception.class.php | 1 + 3 files changed, 5 insertions(+) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 2de87f93666..22d1d0c7b19 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -898,6 +898,7 @@ class Expedition extends CommonObject * Add an expedition line. * If STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS is set, you can add a shipment line, with no stock source defined * If STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT is not set, you can add a shipment line, even if not enough into stock + * Note: For product that need a batch number, you must use addline_batch() * * @param int $entrepot_id Id of warehouse * @param int $id Id of source line (order line) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 27c991e5896..dfb1e371636 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -79,6 +79,9 @@ class CommandeFournisseurDispatch extends CommonObjectLine */ public $fk_commandefourndet; + public $fk_reception; + + public $qty; public $qty_asked; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 1a7a079cd31..7244fdcb60b 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -879,6 +879,7 @@ class Reception extends CommonObject $line->status = 1; $line->cost_price = $cost_price; $line->fk_reception = $this->id; + $this->lines[$num] = $line; return $num; From c16cd502d00b561950525206c255af6a2afe19c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 18:43:25 +0200 Subject: [PATCH 17/19] Update actions_massactions.inc.php --- htdocs/core/actions_massactions.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 56492276c73..811e9b80d44 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -604,7 +604,9 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $nb_bills_created = 0; $db->begin(); - $nbOrders = is_array($orders) ? count($orders) : 1; + + $nbOrders = is_array($orders) ? count($orders) : 1; + foreach ($orders as $id_order) { $cmd = new Commande($db); From c71616f45dec608fb7cd73bc9917f498bd7a41e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 19:13:09 +0200 Subject: [PATCH 18/19] css --- htdocs/admin/tools/dolibarr_export.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 7d02aea0e73..56b975f0202 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -172,7 +172,7 @@ print ''; print ''; -print ''; +print ''; print '
'; print '
'.$langs->trans("ExportMethod").''; @@ -195,7 +195,7 @@ print '
'; print '
'; print ''; -print ''; +print ''; print '
'; From 5de434eb3721e833065001306fbf76ec3a15d65a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 19:14:33 +0200 Subject: [PATCH 19/19] css --- htdocs/admin/system/perf.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 0bdb442863d..f43bc3bf49a 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -51,6 +51,9 @@ print load_fiche_titre($langs->trans("PerfDolibarr"), '', 'title_setup'); print ''.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' ('.$langs->trans("Reload").')
'; +print '
'; +print '
'; + // Recupere la version de PHP $phpversion = version_php(); print "
PHP - ".$langs->trans("Version").": ".$phpversion."
\n";