From 4c4d3623485e4fc24921035982f069637778f8cf Mon Sep 17 00:00:00 2001 From: Jay Yeo Date: Fri, 17 Dec 2021 14:31:06 +0700 Subject: [PATCH 001/381] NEW : add margin in paiement/card.php --- htdocs/compta/paiement/card.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index ab6f0f5e574..3595de67759 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -35,6 +35,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; if (!empty($conf->banque->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; } +if (!empty($conf->margin->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; +} // Load translation files required by the page $langs->loadLangs(array('bills', 'banks', 'companies')); @@ -359,10 +362,15 @@ if ($resql) { print ''; print ''.$langs->trans('Bill').''; + print ''.$langs->trans('Company').''; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) { print ''.$langs->trans('Entity').''; } + //Add Margin + if (!empty($conf->margin->enabled)) { + print ''.$langs->trans('Margin').''; + } print ''.$langs->trans('ExpectedToPay').''; print ''.$langs->trans('PayedByThisPayment').''; print ''.$langs->trans('RemainderToPay').''; @@ -378,6 +386,14 @@ if ($resql) { $invoice = new Facture($db); $invoice->fetch($objp->facid); + // Add Margin + if (!empty($conf->margin->enabled)) { + $formmargin = new FormMargin($db); + $marginInfo = array(); + $invoice->fetch_lines(); + $marginInfo = $formmargin->getMarginInfosArray($invoice); + } + $paiement = $invoice->getSommePaiement(); $creditnotes = $invoice->getSumCreditNotesUsed(); $deposits = $invoice->getSumDepositsUsed(); @@ -403,6 +419,12 @@ if ($resql) { print $mc->label; print ''; } + + // Add margin + if (!empty($conf->margin->enabled)) { + print ''.price($marginInfo['total_margin']).''; + } + // Expected to pay print ''.price($objp->total_ttc).''; From 492fe288bdea427c60acd6e1aed51caa7a835cf3 Mon Sep 17 00:00:00 2001 From: Jay Yeo Date: Fri, 17 Dec 2021 14:44:47 +0700 Subject: [PATCH 002/381] NEW : add margin in paiement/card.php --- htdocs/compta/paiement/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 3595de67759..3609c10bfd1 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -362,7 +362,6 @@ if ($resql) { print ''; print ''.$langs->trans('Bill').''; - print ''.$langs->trans('Company').''; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) { print ''.$langs->trans('Entity').''; From d5f0fe6c105d8ecd2a8d91c6e547bdef06c57eaa Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 21 Jan 2022 10:55:06 +0100 Subject: [PATCH 003/381] OF consumption batch select : wip --- htdocs/mrp/mo_production.php | 5 ++- .../product/class/html.formproduct.class.php | 38 ++++++++++++++----- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index bc1a0457325..efe922a304a 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1023,8 +1023,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); - print ''; - print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', ''); +// print ''; + print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, 1, ''); +// print $formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 0, '', $line->fk_product); } print ''; } diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index da10faa4f34..c6365935fb8 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -626,13 +626,13 @@ class FormProduct { global $conf, $langs; - dol_syslog(get_class($this)."::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot,$objectLines", LOG_DEBUG); + dol_syslog(get_class($this) . "::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot,$objectLines", LOG_DEBUG); $out = ''; $productIdArray = array(); if (!is_array($objectLines) || !count($objectLines)) { if (!empty($fk_product) && $fk_product > 0) { - $productIdArray[] = (int) $fk_product; + $productIdArray[] = (int)$fk_product; } } else { foreach ($objectLines as $line) { @@ -644,26 +644,44 @@ class FormProduct $nboflot = $this->loadLotStock($productIdArray); - $out .= ''; + $out .= ''; return $out; } From 378473ca1f96429c6422b68d363cf2f96b983fa5 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 21 Jan 2022 12:21:47 +0100 Subject: [PATCH 004/381] OF Consumption batch select : WIP --- htdocs/mrp/mo_production.php | 3 +- .../product/class/html.formproduct.class.php | 42 ++++++++++++------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index efe922a304a..ce35b526025 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -184,6 +184,7 @@ if (empty($reshook)) { $pos = 0; // Process line to consume foreach ($object->lines as $line) { + if ($line->role == 'toconsume') { $tmpproduct = new Product($db); $tmpproduct->fetch($line->fk_product); @@ -1024,7 +1025,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); // print ''; - print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, 1, ''); + print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 1, $line->fk_product, ''); // print $formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 0, '', $line->fk_product); } print ''; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index c6365935fb8..d357383df23 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -622,7 +622,7 @@ class FormProduct * @param array $objectLines Only cache lot numbers for products in lines of object. If no lines only for fk_product. If no fk_product, all. * @return string HTML datalist */ - public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array()) + public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $disabled = 0, $selected = '', $empty_label = '') { global $conf, $langs; @@ -644,7 +644,16 @@ class FormProduct $nboflot = $this->loadLotStock($productIdArray); + if ($conf->use_javascript_ajax && !$forcecombo) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $comboenhancement = ajax_combobox($htmlname, $events); + $out .= $comboenhancement; + } + $out .= ''; + // Qty print ''; @@ -1022,8 +1024,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea element.change(function(){ + var element = $(this); - console.log($(this).val()); + var product_element_name = element.attr('name').replace('idwarehouse', 'product'); $.ajax({ type: "POST", @@ -1031,11 +1034,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea data: { action: "updateselectbatchbywarehouse", warehouse_id: $(this).val(), - fk_product : fk_product ?> + product_id: $("input[name='"+product_element_name+"']").val() } }).done(function( data ) { - var element2 = $("#id.'-'.$i ?>"); + var element2_name = element.attr('name').replace('idwarehouse', 'batch'); + var element2 = $("select[name*='"+element2_name+"']"); element2.empty(); @@ -1082,10 +1086,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea - - stock->enabled) { print ''; @@ -1081,49 +1031,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // print $formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 0, '', $line->fk_product); } print ''; - - ?> - - - - id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; + + ?> + + + + Date: Tue, 25 Jan 2022 12:33:28 +0100 Subject: [PATCH 008/381] WIP --- htdocs/mrp/mo_production.php | 56 ++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 5a7de44e7bd..c74f286323d 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1332,13 +1332,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //Lorsqu'un entrepôt est sélectionné, on propose seulement les numéro de séries qui sont disponibles dans celui-ci //TODO : revoir requête sql de l'interface pour les cas suivants : si entrepôt sélectionné, alors quantité des nums individuel, sinon quantité globale function updateselectbatchbywarehouse() { - var element = $("select[name*='idwarehouse']"); element.change(function () { - var element = $(this); + var element2_name = element.attr('name').replace('idwarehouse', 'batch'); + var element2 = $("select[name*='" + element2_name + "']"); + var product_element_name = element.attr('name').replace('idwarehouse', 'product'); $.ajax({ @@ -1351,9 +1352,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } }).done(function (data) { - console.log(data); - var element2_name = element.attr('name').replace('idwarehouse', 'batch'); - var element2 = $("select[name*='" + element2_name + "']"); + console.log(data) + var selected = element2.val(); element2.empty(); @@ -1366,10 +1366,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $.each(data, function (key, value) { - element2.append($(''; + } else { + var option =''; + } + + element2.append(option); + }); }); @@ -1386,6 +1396,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea var element = $(this); + var element2_name = element.attr('name').replace('batch', 'idwarehouse'); + var element2 = $("select[name*='" + element2_name + "']"); + + var selected = element2.val(); + + if(selected != -1){ + return; + } + var product_element_name = element.attr('name').replace('batch', 'product'); $.ajax({ @@ -1398,24 +1417,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } }).done(function (data) { - var element2_name = element.attr('name').replace('batch', 'idwarehouse'); - var element2 = $("select[name*='" + element2_name + "']"); - - element2.empty(); - var data = JSON.parse(data); - element2.append($(''; return $out; } From f5446e0801ce5d0307acc19c35df8d7c0f3a58ee Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 25 Jan 2022 17:23:48 +0100 Subject: [PATCH 011/381] Clean --- htdocs/product/class/html.formproduct.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index ce4681db7ba..da10faa4f34 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -622,7 +622,7 @@ class FormProduct * @param array $objectLines Only cache lot numbers for products in lines of object. If no lines only for fk_product. If no fk_product, all. * @return string HTML datalist */ - public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $disabled = 0, $selected = '', $empty_label = '') + public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array()) { global $conf, $langs; From 25e8a2c75833f29a3003127aeac3a0ddb306a74b Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Jan 2022 09:40:15 +0100 Subject: [PATCH 012/381] Ajout interface.php --- htdocs/mrp/ajax/interface.php | 86 +++++++++++++++++++ htdocs/mrp/mo_production.php | 9 +- .../product/class/html.formproduct.class.php | 2 +- 3 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 htdocs/mrp/ajax/interface.php diff --git a/htdocs/mrp/ajax/interface.php b/htdocs/mrp/ajax/interface.php new file mode 100644 index 00000000000..b91cfc34c13 --- /dev/null +++ b/htdocs/mrp/ajax/interface.php @@ -0,0 +1,86 @@ + 0) $sql .= " AND fk_entrepot = '" . $warehouse_id . "'"; + $sql .= " ORDER BY e.ref, pb.batch"; + + $resql = $db->query($sql); + + if ($resql) { + while ($obj = $db->fetch_object($resql)) { + $TRes[$obj->batch] += $obj->qty; + } + } + + print json_encode($TRes); +} elseif($action == 'updateselectwarehousebybatch'){ + + $res = 0; + + $sql = "SELECT pb.batch, pb.rowid, ps.fk_entrepot, e.ref, pb.qty"; + $sql .= " FROM " . MAIN_DB_PREFIX . "product_batch as pb"; + $sql .= " JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock"; + $sql .= " JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")"; + $sql .= " WHERE ps.fk_product = '" . $fk_product . "'"; + if ($batch_id > 0) $sql.= " AND pb.batch = '" . $batch_id . "'"; + $sql .= " ORDER BY e.ref, pb.batch"; + + $resql = $db->query($sql); + + if($resql){ + if($db->num_rows($resql) == 1){ + $obj = $db->fetch_object($resql); + $res = $obj->fk_entrepot; + } + } + + print json_encode($res); + +} + + + diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index a9d56c1a850..cfb1616e751 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1027,8 +1027,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); print ''; - print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 1, $line->fk_product, ''); -// print $formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 0, '', $line->fk_product); + print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', '');// print $formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 0, '', $line->fk_product); } print ''; } @@ -1357,7 +1356,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea }).done(function (data) { selectbatch.empty(); - $('input[name*='+selectbatch_name+']').val(''); var data = JSON.parse(data); @@ -1381,11 +1379,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } selectbatch.append(option); - }); - }); - }); } @@ -1420,14 +1415,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } }).done(function (data) { - console.log(data); var data = JSON.parse(data); if(data != 0){ selectwarehouse.val(data).change(); } }); - }); } diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index da10faa4f34..b9a01af1666 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -659,7 +659,7 @@ class FormProduct if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) { $label = $arraytypes['entrepot_label'].' - '; $label .= $arraytypes['batch']; - $out .= ''; + $out .= ''; } } } From ccacf2e89aee64b9f16a070d7546027266cd2311 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 26 Jan 2022 09:49:06 +0100 Subject: [PATCH 013/381] Clean code --- htdocs/mrp/ajax/interface.php | 6 +----- htdocs/mrp/mo_production.php | 16 ++++------------ 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/htdocs/mrp/ajax/interface.php b/htdocs/mrp/ajax/interface.php index b91cfc34c13..45709b81ac0 100644 --- a/htdocs/mrp/ajax/interface.php +++ b/htdocs/mrp/ajax/interface.php @@ -1,16 +1,12 @@ id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); print ''; - print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', '');// print $formproduct->selectLotStock('', 'batch-'.$line->id.'-'.$i, '', 0, '', $line->fk_product); + print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', ''); } print ''; } @@ -1324,25 +1324,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea \n"; + return $out; +} diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9a4ee8976ce..92ceba99563 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2042,7 +2042,9 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab if (!$notab || $notab == -1 || $notab == -2 || $notab == -3) { $out .= "\n".'
'."\n"; } - + if (!empty($dragdropfile)) { + print dragAndDropFileUpload(); + } $parameters = array('tabname' => $active, 'out' => $out); $reshook = $hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead" if ($reshook > 0) { From 175747e345c053d0a067a039208964a4a359d9e7 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 20 Mar 2023 00:32:15 +0100 Subject: [PATCH 076/381] copy same params than move --- htdocs/core/lib/files.lib.php | 76 +++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 60adcc64003..17c68de8e7d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -707,12 +707,14 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask * @param string $destfile Destination file (can't be a directory) * @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK). Example: '0666' * @param int $overwriteifexists Overwrite file if exists (1 by default) + * @param int $testvirus Do an antivirus test. Move is canceled if a virus is found. + * @param int $indexdatabase Index new file into database. * @return int <0 if error, 0 if nothing done (dest file already exists and overwriteifexists=0), >0 if OK * @see dol_delete_file() dolCopyDir() */ -function dol_copy($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1) +function dol_copy($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $testvirus = 0, $indexdatabase = 1) { - global $conf; + global $conf, $db, $user; dol_syslog("files.lib.php::dol_copy srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwriteifexists=".$overwriteifexists); @@ -737,6 +739,17 @@ function dol_copy($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1) dol_syslog("files.lib.php::dol_copy failed Permission denied to write into target directory ".$newdirdestfile, LOG_WARNING); return -2; } + + // Check virus + $testvirusarray = array(); + if ($testvirus) { + $testvirusarray = dolCheckVirus($srcfile); + if (count($testvirusarray)) { + dol_syslog("files.lib.php::dol_copy canceled because a virus was found into source file. we ignore the copy request.", LOG_WARNING); + return -3; + } + } + // Copy with overwriting if exists $result = @copy($newpathofsrcfile, $newpathofdestfile); //$result=copy($newpathofsrcfile, $newpathofdestfile); // To see errors, remove @ @@ -754,7 +767,64 @@ function dol_copy($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1) dolChmod($newpathofdestfile, $newmask); - return 1; + if ($result && $indexdatabase) { + // Add entry into ecm database + $rel_filetocopyafter = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $newpathofdestfile); + if (!preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filetocopyafter)) { // If not a tmp file + $rel_filetocopyafter = preg_replace('/^[\\/]/', '', $rel_filetocopyafter); + //var_dump($rel_filetorenamebefore.' - '.$rel_filetocopyafter);exit; + + dol_syslog("Try to copy also entries in database for: ".$rel_filetocopyafter, LOG_DEBUG); + include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; + + $ecmfiletarget = new EcmFiles($db); + $resultecmtarget = $ecmfiletarget->fetch(0, '', $rel_filetocopyafter); + if ($resultecmtarget > 0) { // An entry for target name already exists for target, we delete it, a new one will be created. + dol_syslog("ECM dest file found, remove it", LOG_DEBUG); + $ecmfiletarget->delete($user); + } else { + dol_syslog("ECM dest file not found, create it", LOG_DEBUG); + } + + $ecmSrcfile = new EcmFiles($db); + $resultecm = $ecmSrcfile->fetch(0, '', $srcfile); + if ($resultecm) { + dol_syslog("Fetch src file ok", LOG_DEBUG); + } else { + dol_syslog("Fetch src file error", LOG_DEBUG); + } + + $ecmfile = new EcmFiles($db); + $filename = basename($rel_filetocopyafter); + $rel_dir = dirname($rel_filetocopyafter); + $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); + $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); + + $ecmfile->filepath = $rel_dir; + $ecmfile->filename = $filename; + $ecmfile->label = md5_file(dol_osencode($destfile)); // $destfile is a full path to file + $ecmfile->fullpath_orig = $srcfile; + $ecmfile->gen_or_uploaded = 'copy'; + $ecmfile->description = $ecmSrcfile->description; + $ecmfile->keywords = $ecmSrcfile->keywords; + $resultecm = $ecmfile->create($user); + if ($resultecm < 0) { + dol_syslog("Create ECM file ok", LOG_DEBUG); + setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); + } else { + dol_syslog("Create ECM file error", LOG_DEBUG); + setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); + } + + if ($resultecm > 0) { + $result = true; + } else { + $result = false; + } + } + } + + return $result; } /** From 8dd7a22482dcb0a5048dce045dad04881f87cd73 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 20 Mar 2023 09:45:02 +0100 Subject: [PATCH 077/381] FIX limit after order in get objects in category --- htdocs/categories/class/categorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 786af013dc6..87c0888ed6f 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -848,10 +848,10 @@ class Categorie extends CommonObject if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) { $sql .= " AND o.rowid = ".((int) $user->socid); } + $sql .= $this->db->order($sortfield, $sortorder); if ($limit > 0 || $offset > 0) { $sql .= $this->db->plimit($limit + 1, $offset); } - $sql .= $this->db->order($sortfield, $sortorder); dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); $resql = $this->db->query($sql); From 14fd90dbaddb4ae845f9461ea8e94a7d3554388f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Mar 2023 14:20:35 +0100 Subject: [PATCH 078/381] Fix sign in llx_bank of amount_main_currency --- htdocs/install/mysql/migration/repair.sql | 21 +++++++++++++-------- htdocs/install/mysql/tables/llx_bank.sql | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 737ee1bf511..4c6c4fc1117 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -569,14 +569,19 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee'; --- Sequence to fix the content of llx_bank.amount_main_currency --- Note: amount is amount in currency of bank account + +-- Sequence to fix the content of llx_bank.amount_main_currency (value was empty and should not for payment on bank account with a different currency so when amount_main_currency is different than amount) +-- Note: amount is amount in the currency of the bank account -- Note: pamount is always amount into the main currency --- Note: pmulticurrencyamount is in currency of invoice --- Note: amount_main_currency must be amount in main currency +-- Note: pmulticurrencyamount is in the currency of invoice +-- Note: amount_main_currency must be NULL or amount in main currency of company (we set it when the currency of the bank account differs from main currency) -- DROP TABLE tmp_bank; --- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount; --- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL; +-- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount, b.datec FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount; +-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL AND b.rowid IN (SELECT rowid FROM tmp_bank); -- DROP TABLE tmp_bank2; --- CREATE TABLE tmp_bank2 SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment_supplier' INNER JOIN llx_paiementfourn as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount; --- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank2 as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL; +-- CREATE TABLE tmp_bank2 SELECT b.rowid, b.amount, p.rowid as pid, - p.amount as pamount, - p.multicurrency_amount as pmulticurrencyamount, b.datec FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment_supplier' INNER JOIN llx_paiementfourn as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount; +-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank2 as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL AND b.rowid IN (SELECT rowid FROM tmp_bank2); + +-- Sequence to fix the content of llx_bank.amount_main_currency (sign was wrong with some version) +-- UPDATE llx_bank as b SET b.amount_main_currency = -b.amount_main_currency WHERE b.amount IS NOT NULL AND b.amount_main_currency IS NOT NULL AND SIGN(b.amount_main_currency) <> SIGN(b.amount); + diff --git a/htdocs/install/mysql/tables/llx_bank.sql b/htdocs/install/mysql/tables/llx_bank.sql index d0a8e34790b..e5194cadc88 100644 --- a/htdocs/install/mysql/tables/llx_bank.sql +++ b/htdocs/install/mysql/tables/llx_bank.sql @@ -25,7 +25,7 @@ create table llx_bank datev date, -- date de valeur dateo date, -- date operation amount double(24,8) NOT NULL default 0, -- amount in the currency of the bank account - amount_main_currency double(24,8) NULL, -- amount in the main currency of the company + amount_main_currency double(24,8) NULL, -- amount in the main currency of the company when payment done in a bank account with a different currency label varchar(255), fk_account integer, fk_user_author integer, From 3f45699695d733e602db61ccd6daaadb7dc40654 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Mar 2023 14:25:08 +0100 Subject: [PATCH 079/381] Prepare 16.0.5 --- ChangeLog | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f9e22813487..70e8cd5ad06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,51 @@ English Dolibarr ChangeLog ***** ChangeLog for 16.0.5 compared to 16.0.4 ***** -TODO +FIX: 16.0 propalestats Unknown column 'p.fk_soc' in 'on clause' +FIX: #23804 +FIX: #23860 +FIX: #23966 Error "Param dbt_keyfield is required but not defined" +FIX: accountancy lettering: better error management +FIX: accountancy lettering: correctly calculated number of lettering operations done +FIX: accountancy lettering: error management and prevention +FIX: accountancy lettering: prevent null results when fetching link with payments +FIX: Add missing hook on LibStatut +FIX: Add more context for selectForFormsListWhere Hook +FIX: attach file and send by mail in ticket +FIX: bad check on if in get_all_ways +FIX: Cannot import find type_fees with cgenericdic.class because it has id and not rowid +FIX: clicktodial backtopage +FIX: discount wasn't taken into account when adding a line in BOM +FIX: expense reports: error when selecting mileage fees expense type if MAIN_USE_EXPENSE_IK disabled +FIX: expense reports: JS error when selecting mileage fees expense type if MAIN_USE_EXPENSE_IK disabled +FIX: Extrafields in Notes to unify with orders or invoices. +FIX: fatal error on clicktodial backtopage +FIX: filter sql accounting account +FIX: Get data back on product update +FIX: Get data back when error on command create +FIX: label dictionary is used by barcode and member module +FIX: mandatory date for service didnt work for invoice +FIX: missing "authorid" for getNomUrl link right access +FIX: missing getEntity filter +FIX: vulnerability: missing protection on ajax public ticket page for valid email. +FIX: Missing right to edit service note when module product is disabled +FIX: multicompany compatibility +FIX: object $user is not defined +FIX: Object of class LDAP\Connection could not be converted to string +FIX: parse error and NAN +FIX: product ref fourn same size in supplier order/invoice as in product price fourn +FIX: Profit calculation on project preview tab. +FIX: Remove orphelan $this->db->rollback() in the function insertExtrafields() +FIX: request new password with "mc" and "twofactor" authentication +FIX: Resolve error message due to missing arguments +FIX: select for task in event card +FIX: several email sent to the same recipient when adding message from ticket +FIX: shipping list for external user +FIX: SQL error "unknown column p.fk_soc" because ANSI-92 joins take precedence over ANSI-89 joins +FIX: strato pdf +FIX: typos in getAttchments() $arrayobject +FIX: whitespaces +FIX: wrong url param name action ***** ChangeLog for 16.0.4 compared to 16.0.3 ***** From 0e6a3aa2be59ebef17c3298919d618982e09c3d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Mar 2023 15:52:49 +0100 Subject: [PATCH 080/381] Fix param --- htdocs/accountancy/bookkeeping/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 9231ae96a95..b57e0a10157 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1460,7 +1460,7 @@ while ($i < min($num, $limit)) { // Creation operation date if (!empty($arrayfields['t.date_creation']['checked'])) { - print ''.dol_print_date($line->date_creation, 'dayhour', 'tzuserel').''; + print ''.dol_print_date($line->date_creation, 'dayhour', 'tzuserrel').''; if (!$i) { $totalarray['nbfield']++; } @@ -1468,7 +1468,7 @@ while ($i < min($num, $limit)) { // Modification operation date if (!empty($arrayfields['t.tms']['checked'])) { - print ''.dol_print_date($line->date_modification, 'dayhour', 'tzuserel').''; + print ''.dol_print_date($line->date_modification, 'dayhour', 'tzuserrel').''; if (!$i) { $totalarray['nbfield']++; } @@ -1476,7 +1476,7 @@ while ($i < min($num, $limit)) { // Exported operation date if (!empty($arrayfields['t.date_export']['checked'])) { - print ''.dol_print_date($line->date_export, 'dayhour', 'tzuserel').''; + print ''.dol_print_date($line->date_export, 'dayhour', 'tzuserrel').''; if (!$i) { $totalarray['nbfield']++; } @@ -1484,7 +1484,7 @@ while ($i < min($num, $limit)) { // Validated operation date if (!empty($arrayfields['t.date_validated']['checked'])) { - print ''.dol_print_date($line->date_validation, 'dayhour', 'tzuserel').''; + print ''.dol_print_date($line->date_validation, 'dayhour', 'tzuserrel').''; if (!$i) { $totalarray['nbfield']++; } From fab9d26254f2508fac53e01417df7362cdd179e8 Mon Sep 17 00:00:00 2001 From: hystepik Date: Mon, 20 Mar 2023 16:38:45 +0100 Subject: [PATCH 081/381] add of tyext when overing --- htdocs/core/lib/files.lib.php | 28 +++++++++++++++------------- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/langs/en_US/main.lang | 1 + htdocs/theme/eldy/global.inc.php | 19 ++++++++++++++++--- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 3e1c6892bbd..caeeb9c2976 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3321,30 +3321,32 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathre * Function to manage the drag and drop file. * We use global variable $object * - * @return string Js script to display + * @param string $htmlname The id of the component where we need to drag and drop + * @return string Js script to display */ -function dragAndDropFileUpload() +function dragAndDropFileUpload($htmlname) { - global $object; - //TODO: Find a way to display text over div - $out = "'; + } + $generated_password = ''; if (empty($ldap_sid)) { // ldap_sid is for activedirectory $generated_password = getRandomPassword(false); From 19dfe73c22ae2de28ff0e3b16248bf448000d0b1 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 29 Mar 2023 11:21:28 +0200 Subject: [PATCH 251/381] fix : Warning: Undefined array key xStartPos in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/class/commondocgenerator.class.php on line 1554 --- htdocs/core/class/commondocgenerator.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 1b59d44bdde..7fa56125e6c 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1550,9 +1550,9 @@ abstract class CommonDocGenerator $colDef['title']['label'] = !empty($colDef['title']['label']) ? $colDef['title']['label'] : $outputlangs->transnoentities($colDef['title']['textkey']); // Add column separator - if (!empty($colDef['border-left'])) { + if (!empty($colDef['border-left']) && isset($colDef['xStartPos'])) { $pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height); - } + } if (empty($hidetop)) { // save curent cell padding From 846fe52da84bc84666ae7f614b133af435f96ea4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 29 Mar 2023 09:25:45 +0000 Subject: [PATCH 252/381] Fixing style errors. --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 7fa56125e6c..283fd3e4437 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1552,7 +1552,7 @@ abstract class CommonDocGenerator // Add column separator if (!empty($colDef['border-left']) && isset($colDef['xStartPos'])) { $pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height); - } + } if (empty($hidetop)) { // save curent cell padding From 2721ccd23c6886ae1ceef2c55a43aab2b30ede05 Mon Sep 17 00:00:00 2001 From: priojk Date: Wed, 29 Mar 2023 11:43:31 +0200 Subject: [PATCH 253/381] add hook to modify amount to pay --- htdocs/compta/facture/prelevement.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 319b93c4dcb..17b45162974 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -676,6 +676,16 @@ if ($object->id > 0) { $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT'); + // Hook to change amount for other reasons, e.g. apply cash discount for payment before agreed date + $parameters = array('remaintopay' => $resteapayer); + $reshook = $hookmanager->executeHooks('finalizeAmountOfSupplierInvoice', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + print $hookmanager->resPrint; + if (!empty($remaintopay = $hookmanager->resArray['remaintopay'])) { + $resteapayer = $remaintopay; + } + } + // TODO Replace this by an include with same code to show already done payment visible in invoice card print ''.$langs->trans('RemainderToPay').''.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).''; From 5683b2182335c0ef0b5c67e3a96148a6e48cfebb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 12:03:52 +0200 Subject: [PATCH 254/381] Look and feel export tool --- htdocs/admin/tools/dolibarr_export.php | 28 +++++++++++++------------- htdocs/theme/eldy/global.inc.php | 5 ++++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 3ce6dbd48a4..707ecd6dc2a 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -163,13 +163,13 @@ $title = $langs->trans("BackupDumpWizard"); print load_fiche_titre($title); -print ''; -print ''; -print ''; -print ''; -print ''; + print ''; } // Supplier From e957e8faaf15303c8ae27869b22f4d58e9b34c2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 01:24:13 +0200 Subject: [PATCH 295/381] Update 17.0.0-18.0.0.sql --- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 9fcc01e1525..fb8cb956a6d 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -382,4 +382,4 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN status integer DEFAULT 1; ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_product_fournisseur (fk_product_fournisseur); ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_user (fk_user); -ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_multicurrency (fk_multicurrency); +--ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_multicurrency (fk_multicurrency); From 43f0cf8513c114fc80a8a328e07c3de8f9b36a55 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 01:24:25 +0200 Subject: [PATCH 296/381] Update llx_product_fournisseur_price_log.key.sql --- .../mysql/tables/llx_product_fournisseur_price_log.key.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price_log.key.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price_log.key.sql index 711d2a815cd..63949eeaf53 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price_log.key.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price_log.key.sql @@ -18,4 +18,4 @@ ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_product_fournisseur (fk_product_fournisseur); ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_user (fk_user); -ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_multicurrency (fk_multicurrency); +--ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_multicurrency (fk_multicurrency); From 28f4bea8a3b6d61f81cea2b64a82b6bf0ae475f4 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 29 Mar 2023 16:46:06 +0200 Subject: [PATCH 297/381] forceduedate is an option of the function --- htdocs/compta/facture/class/facture.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2419050cafc..3d37de709c1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -586,8 +586,6 @@ class Facture extends CommonInvoice // We do not add link to template invoice or next invoice will be linked to all generated invoices //$this->linked_objects['facturerec'][0] = $this->fac_rec; - $forceduedate = $this->calculate_date_lim_reglement(); - // For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice if ($_facrec->frequency > 0) { dol_syslog("This is a recurring invoice so we set date_last_gen and next date_when"); From a30f9331f30a74fc0f4170ffbc77ef16aa5ef6f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 01:36:20 +0200 Subject: [PATCH 298/381] Debug v17 --- htdocs/compta/facture/class/facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3d37de709c1..af8caa73b12 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -569,6 +569,7 @@ class Facture extends CommonInvoice $this->type = self::TYPE_STANDARD; } $this->ref_client = trim($this->ref_client); + $this->ref_customer = trim($this->ref_customer); $this->note_public = trim($this->note_public); $this->note_private = trim($this->note_private); $this->note_private = dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref)); From 5b47abbe38e8408317a3626048546d86e7bbf862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Mar 2023 09:24:28 +0200 Subject: [PATCH 299/381] Doc --- htdocs/core/class/commonobject.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f11548d6a5a..c0fc7805bec 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -86,6 +86,11 @@ abstract class CommonObject */ public $element; + /** + * @var int The related element + */ + public $fk_element; + /** * @var string Name to use for 'features' parameter to check module permissions user->rights->feature with restrictedArea(). * Undefined means same value than $element. Can be use to force a check on another element for example for class of line, we mention here the parent element. From c2f5db9d9c9b8da7df76616bc7a8bc9a785203ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 11:40:34 +0200 Subject: [PATCH 300/381] Better compatibility --- htdocs/core/class/html.form.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fb4aa830ea0..0ef7115ba21 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5198,8 +5198,11 @@ class Form $more .= '
' . $input['label'] . '
'; $more .= '
'; $addnowlink = (empty($input['datenow']) ? 0 : 1); - $h = $input['hours'] ?: 0; - $m = $input['minutes'] ?: 0; + $h = $m = 0; + if ($input['type'] == 'datetime) { + $h = isset($input['hours']) ? $input['hours'] : 1; + $m = isset($input['minutes']) ? $input['minutes'] : 1; + } $more .= $this->selectDate($input['value'], $input['name'], $h, $m, 0, '', 1, $addnowlink); $more .= '
'."\n"; $formquestion[] = array('name'=>$input['name'].'day'); From 0bdb6bae64d9245c7b5614ed952899a0d57367e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 11:44:58 +0200 Subject: [PATCH 301/381] Update html.form.class.php --- 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 0ef7115ba21..99c0305d2cb 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5199,7 +5199,7 @@ class Form $more .= '
'; $addnowlink = (empty($input['datenow']) ? 0 : 1); $h = $m = 0; - if ($input['type'] == 'datetime) { + if ($input['type'] == 'datetime') { $h = isset($input['hours']) ? $input['hours'] : 1; $m = isset($input['minutes']) ? $input['minutes'] : 1; } From 148645d220fc6e1edd4c343e2d879b7e6f2c4923 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 12:10:48 +0200 Subject: [PATCH 302/381] Fix error 500 on payment --- htdocs/public/payment/paymentko.php | 4 +++- htdocs/public/payment/paymentok.php | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 4174267a769..05dc401d158 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -131,7 +131,9 @@ dol_syslog("Callback url when an online payment is refused or canceled. query_st $tracepost = ""; foreach ($_POST as $k => $v) { - $tracepost .= "{$k} - {$v}\n"; + if (is_scalar($k) && is_scalar($v)) { + $tracepost .= "{$k} - {$v}\n"; + } } dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index e596fd3d261..e19fd856f23 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -173,12 +173,16 @@ dol_syslog("_SERVER[SERVER_ADDR] = ".(empty($_SERVER["SERVER_ADDR"]) ? '' : dol_ $tracepost = ""; foreach ($_POST as $k => $v) { - $tracepost .= "{$k} - {$v}\n"; + if (is_scalar($k) && is_scalar($v)) { + $tracepost .= "{$k} - {$v}\n"; + } } dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); $tracesession = ""; foreach ($_SESSION as $k => $v) { - $tracesession .= "{$k} - {$v}\n"; + if (is_scalar($k) && is_scalar($v)) { + $tracesession .= "{$k} - {$v}\n"; + } } dol_syslog("SESSION=".$tracesession, LOG_DEBUG, 0, '_payment'); From e9d92531478c998448feca24c56510327b4c17eb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 31 Mar 2023 12:36:43 +0200 Subject: [PATCH 303/381] fix : Warning: Undefined array key align in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/class/commondocgenerator.class.php on line 1575 --- htdocs/core/class/commondocgenerator.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 1b59d44bdde..2278a1de8dc 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1567,17 +1567,21 @@ abstract class CommonDocGenerator // set cell padding with column title definition $pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], $colDef['title']['padding'][2]); } - + if (isset($colDef['title']['align'])) { + $align = $colDef['title']['align']; + } else { + $align = ''; + } $pdf->SetXY($colDef['xStartPos'], $tab_top); $textWidth = $colDef['width']; - $pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']); + $pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $align); // Add variant of translation if $outputlangsbis is an object if (is_object($outputlangsbis) && trim($colDef['title']['label'])) { $pdf->setCellPaddings($colDef['title']['padding'][3], 0, $colDef['title']['padding'][1], $colDef['title']['padding'][2]); $pdf->SetXY($colDef['xStartPos'], $pdf->GetY()); $textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']); - $pdf->MultiCell($textWidth, 2, $textbis, '', $colDef['title']['align']); + $pdf->MultiCell($textWidth, 2, $textbis, '', $align); } $this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight); From a823b10b58682623147d3f1e3dffec358de61b86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 12:41:52 +0200 Subject: [PATCH 304/381] Fix load lang --- htdocs/eventorganization/conferenceorboothattendee_list.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 1bc9c12d4f6..fc8db4ff6b3 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -41,11 +41,8 @@ if (isModEnabled('categorie')) { global $dolibarr_main_url_root; -// for other modules -//dol_include_once('/othermodule/class/otherobject.class.php'); - // Load translation files required by the page -$langs->loadLangs(array("eventorganization", "other", "projects")); +$langs->loadLangs(array("eventorganization", "other", "projects", "bills")); // Get Paramters $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... From 57156dd022ed6ac7007edae36935546a7a9f744e Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Fri, 31 Mar 2023 13:15:44 +0200 Subject: [PATCH 305/381] FIX: Invoice Thirdparty never loaded at this point Attempt to read property "default_lang" on null in /var/www/html/fourn/class/paiementfourn.class.php on line 353 --- htdocs/fourn/class/paiementfourn.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index e3b7be2c42a..b587922b71d 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -362,6 +362,7 @@ class PaiementFourn extends Paiement $newlang = ''; $outputlangs = $langs; if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { + $invoice->fetch_thirdparty(); $newlang = $invoice->thirdparty->default_lang; } if (!empty($newlang)) { From 49fa0f31073e26471ea60be54bd605d4afc247cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 13:31:23 +0200 Subject: [PATCH 306/381] Fix public pages --- .../public/eventorganization/attendee_new.php | 51 ++++++++------- htdocs/public/project/index.php | 56 ++++++++++++++-- htdocs/public/project/suggestbooth.php | 61 +++++++++++++----- htdocs/public/project/suggestconference.php | 64 ++++++++++++++----- 4 files changed, 170 insertions(+), 62 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 9d6f30850e6..cc8e9ada81b 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -1,5 +1,6 @@ + * Copyright (C) 2023 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -678,22 +679,25 @@ $formcompany = new FormCompany($db); llxHeaderVierge($langs->trans("NewRegistration")); -print '
'; -print load_fiche_titre($langs->trans("NewRegistration"), '', '', 0, 0, 'center'); - print '
'; print '
'; -print '
'; +// Sub banner +print '
'; +print load_fiche_titre($langs->trans("NewRegistration"), '', '', 0, 0, 'center'); // Welcome message print ''.$langs->trans("EvntOrgWelcomeMessage").''; print '
'; - // Title -print ''.dol_escape_htmltag($project->title . ' '. $conference->label).'
'; +print ''.dol_escape_htmltag($project->title . ' '. $conference->label).'
'; +print '
'; + +// Help text +print '
'; + if ($project->date_start_event || $project->date_end_event) { - print '
'; + print '
'; } if ($project->date_start_event) { $format = 'day'; @@ -718,29 +722,31 @@ if ($project->date_start_event || $project->date_end_event) { print '
'; } if ($project->location) { - print ''.dol_escape_htmltag($project->location).'
'; + print ''.dol_escape_htmltag($project->location).'
'; } +print '
'; + + $maxattendees = 0; if ($conference->id > 0) { /* date of project is not date of event so commented - print $langs->trans("Date").': '; - print dol_print_date($conference->datep); - if ($conference->date_end) { - print ' - '; - print dol_print_date($conference->datef); - }*/ + print $langs->trans("Date").': '; + print dol_print_date($conference->datep); + if ($conference->date_end) { + print ' - '; + print dol_print_date($conference->datef); + }*/ } else { /* date of project is not date of event so commented - print $langs->trans("Date").': '; - print dol_print_date($project->date_start); - if ($project->date_end) { - print ' - '; - print dol_print_date($project->date_end); - }*/ + print $langs->trans("Date").': '; + print dol_print_date($project->date_start); + if ($project->date_end) { + print ' - '; + print dol_print_date($project->date_end); + }*/ $maxattendees = $project->max_attendees; // Max attendeed for the project/event } -print '
'; if ($maxattendees && $currentnbofattendees >= $maxattendees) { print '
'; @@ -882,12 +888,13 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print "\n"; print "
"; - print '
'; } } else { print $langs->trans("ConferenceIsNotConfirmed"); } +print '
'; + llxFooterVierge(); $db->close(); diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 8cefe20909b..3edc7f97a75 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -125,10 +125,13 @@ $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; + llxHeader($head, $langs->trans("SuggestForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); + print ''."\n"; print '
'."\n"; + print '
'."\n"; print ''."\n"; print ''."\n"; @@ -185,21 +188,55 @@ if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_ORGANIZEDEVENT)) { print '
'; +print '
'; +print '
'; + + // Event summary print '
'; -print ''.$project->title.'
'; -print img_picto('', 'calendar', 'class="pictofixedwidth"').$langs->trans("Date").': '; -print dol_print_date($project->date_start, 'daytext'); -if ($project->date_end && $project->date_start != $project->date_end) { - print ' - '.dol_print_date($project->date_end, 'daytext'); -} +print ''.dol_escape_htmltag($project->title . ' '. $project->label).'
'; print '

'."\n"; -print $langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; +print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; print $project->note_public."\n"; //print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx'; print '
'; +// Help text +print '
'; + +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->date_start_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_start_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_start_event, $format); +} +if ($project->date_start_event && $project->date_end_event) { + print ' - '; +} +if ($project->date_end_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_end_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_end_event, $format); +} +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->location) { + print ''.dol_escape_htmltag($project->location).'
'; +} + +print '
'; + + print '
'; print '
'; -print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
'; -print '
'; +//print ''; +//print ''; +//print ''; +//print ''; +//print ''; +//print '
'; +print ''.$langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'

'; +//print '
'; print ''; @@ -589,8 +589,8 @@ if (!empty($_SESSION["commandbackuptorun"])) { print "\n"; -print ''; -print '
'; +//print '
'; print " \n"; @@ -598,7 +598,7 @@ print " \n"; print '
'; $filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1); -$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:480px; overflow: auto;"'); +$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow: auto;"'); print '
'; print '
'; @@ -652,12 +652,12 @@ foreach ($filecompression as $key => $val) { if ($key == 'gz') { $checked = ' checked'; } - print ''; - print ' '; + print ''; + print ' '; } else // Disabled export format { - print ''; - print ' '; + print ''; + print ' '; print ' ('.$langs->trans("NotAvailable").')'; } print '     '; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b784de02b32..36dc47066e8 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -565,11 +565,14 @@ input:-moz-placeholder { color: #ccc; } input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } fieldset { - border: 1px solid #AAAAAA !important; + border: 1px solid #aaa !important; padding-inline-start: 2em; padding-inline-end: 2em; min-inline-size: auto; } +#div_container_exportoptions fieldset, #div_container_sub_exportoptions fieldset { + border: 1px solid #ccc !important; +} .legendforfieldsetstep { padding-bottom: 10px; } input#onlinepaymenturl, input#directdownloadlink { opacity: 0.7; From 9ab9f068c6273c2ef3bb0e3d02f7bf5466b7a106 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 12:03:52 +0200 Subject: [PATCH 255/381] Look and feel export tool --- htdocs/admin/tools/dolibarr_export.php | 30 ++++++++++++++------------ htdocs/theme/eldy/global.inc.php | 5 ++++- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 3ce6dbd48a4..856113eef4d 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -163,13 +163,13 @@ $title = $langs->trans("BackupDumpWizard"); print load_fiche_titre($title); -print ''; -print ''; -print ''; -print ''; -print ''; // TODO Use a denormalized field + print ''; // TODO Use a denormalized field if (!$i) { $totalarray['nbfield']++; } @@ -2440,7 +2440,7 @@ if ($resql) { if (!empty($arrayfields['multicurrency_rtp']['checked'])) { print ''; // TODO Use a denormalized field + print ''; // TODO Use a denormalized field ? if (!$i) { $totalarray['nbfield']++; } @@ -2448,14 +2448,14 @@ if ($resql) { // Total buying or cost price if (!empty($arrayfields['total_pa']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } } // Total margin if (!empty($arrayfields['total_margin']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dc1f39aa43a..ef68d5c5ff2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5740,8 +5740,8 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0, * @param integer $form Type of format, HTML or not (not by default) * @param Translate|string $outlangs Object langs for output. '' use default lang. 'none' use international separators. * @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless. - * @param int $rounding MINIMUM number of decimal to show. 0=no change, -1=we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT) - * @param int|string $forcerounding Force the MAXIMUM of decimal to forcerounding decimal (-1=no change, 'MU' or 'MT' or numeric to round to MU or MT or to a given number of decimal) + * @param int $rounding MINIMUM number of decimal to show: 0=no change, -1=we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT) + * @param int|string $forcerounding MAXIMUM number of decimal to forcerounding decimal: -1=no change, 'MU' or 'MT' or numeric to round to MU or MT or to a given number of decimal * @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency) * @return string String with formated amount * @@ -5756,7 +5756,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ $amount = 0; // To have a numeric value if amount not defined or = '' } $amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number) - if ($rounding < 0) { + if ($rounding == -1) { $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); } $nbdecimal = $rounding; From 1c1e93bb3783e80bcc730f0fcd8af941e13e3a54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Mar 2023 16:35:07 +0200 Subject: [PATCH 286/381] Fix use MT rounding for cost price and margin on list of invoice --- htdocs/compta/facture/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c22d551be04..702cc057568 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1916,8 +1916,8 @@ if ($resql) { // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } } // Total margin if (!empty($arrayfields['total_margin']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } @@ -2528,7 +2528,7 @@ if ($resql) { // Action column (Show the massaction button only when this page is not opend from the Extended POS) - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (!getDolGlobalInt('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - print ''; - print ''; + print ''; print ''; diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 8290f14a765..0ec98d01a12 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -29,7 +29,7 @@ DescCP=Description SendRequestCP=Create leave request DelayToRequestCP=Leave requests must be made at least %s day(s) before them. MenuConfCP=Balance of leave -SoldeCPUser=Leave balance (in days) %s +SoldeCPUser=Leave balance (in days) : %s ErrorEndDateCP=You must select an end date greater than the start date. ErrorSQLCreateCP=An SQL error occurred during the creation: ErrorIDFicheCP=An error has occurred, the leave request does not exist. diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index 642a67cb11c..c95d5bf4e54 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -5,7 +5,7 @@ Holiday=Demande de congés CPTitreMenu=Demande de congés MenuReportMonth=État mensuel MenuAddCP=Créer demande de congés -MenuCollectiveAddCP=Nouvelle demande de congé collectif +MenuCollectiveAddCP=Demande de congé collectif NotActiveModCP=Vous devez activer le module Congés pour afficher cette page. AddCP=Créer une demande de congés DateDebCP=Date Début @@ -95,7 +95,7 @@ UseralreadyCPexist=Une demande de congé a déjà été faite pour cette périod groups=Groupes users=Utilisateurs AutoSendMail=Envoi automatique d'email -NewHolidayForGroup=Nouvelle demande de congé collectif +NewHolidayForGroup=Demande de congé collectif SendRequestCollectiveCP=Envoyer la demande de congé collectif AutoValidationOnCreate=Validation automatique FirstDayOfHoliday=Premier jour de congés diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 36dc47066e8..310d2899a37 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1744,6 +1744,8 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select .hideonsmartphone { display: none; } .hideonsmartphoneimp { display: none !important; } + .margintoponsmartphone { margin-top: 6px; } + span.pictotitle { margin-: 0 !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ef8f97716b2..25843c8c407 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1968,6 +1968,8 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select .hideonsmartphone { display: none; } .hideonsmartphoneimp { display: none !important; } + .margintoponsmartphone { margin-top: 6px; } + select.minwidth100imp, select.minwidth100, select.minwidth200, select.minwidth200imp, select.minwidth300 { width: calc(100% - 40px) !important; display: inline-block; @@ -1988,13 +1990,13 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select .smallonsmartphone { font-size: 0.8em; } - + .nopaddingtoponsmartphone { padding-top: 0 !important; } .nopaddingbottomonsmartphone { padding-bottom: 0 !important; - } + } } /* Force values for small screen 570 */ From 7d1d187148bfb7929208d251989e73af87b53cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Mar 2023 21:31:06 +0200 Subject: [PATCH 288/381] fix missing comma in sql --- htdocs/variants/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index a83ecf7be89..ad17c162d95 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -226,8 +226,7 @@ $morecss = array(); // Build and execute select // -------------------------------------------------------------------- -$sql = "SELECT "; -$sql .= " COUNT(DISTINCT pav.rowid) AS nb_of_values, COUNT(DISTINCT pac2v.fk_prod_combination) AS nb_products"; +$sql = "SELECT COUNT(DISTINCT pav.rowid) AS nb_of_values, COUNT(DISTINCT pac2v.fk_prod_combination) AS nb_products, "; $sql .= $object->getFieldList("t"); // Add fields from extrafields //if (!empty($extrafields->attributes[$object->table_element]['label'])) { From a8d4ea406beb6907cf815a714cf737abb79601f7 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Thu, 30 Mar 2023 22:14:04 +0200 Subject: [PATCH 289/381] Update description of products on cloning --- htdocs/comm/propal/card.php | 5 +- htdocs/comm/propal/class/propal.class.php | 58 +++++++++++++---------- htdocs/langs/en_US/propal.lang | 1 + htdocs/langs/fr_FR/propal.lang | 1 + 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 5c4c4aae9f1..6c063c61a8d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -221,7 +221,7 @@ if (empty($reshook)) { } } - $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false)); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false), (GETPOST('update_desc', 'aZ') ? true : false)); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -2137,7 +2137,8 @@ if ($action == 'create') { // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')), - array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)), + array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 0), + array('type' => 'checkbox', 'name' => 'update_desc', 'label' => $langs->trans('PuttingDescUpToDate'), 'value' => 0), ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 40e8fe385d7..52399c161a6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1360,9 +1360,10 @@ class Propal extends CommonObject * @param int $socid Id of thirdparty * @param int $forceentity Entity id to force * @param bool $update_prices [=false] Update prices if true + * @param bool $update_desc [=false] Update description if true * @return int New id of clone */ - public function createFromClone(User $user, $socid = 0, $forceentity = null, $update_prices = false) + public function createFromClone(User $user, $socid = 0, $forceentity = null, $update_prices = false, $update_desc = false) { global $conf, $hookmanager, $mysoc; @@ -1413,7 +1414,7 @@ class Propal extends CommonObject } // update prices - if ($update_prices === true) { + if ($update_prices === true || $update_desc === true) { if ($objsoc->id > 0 && !empty($object->lines)) { if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // If price per customer @@ -1425,36 +1426,41 @@ class Propal extends CommonObject $prod = new Product($this->db); $res = $prod->fetch($line->fk_product); if ($res > 0) { - $pu_ht = $prod->price; - $tva_tx = get_default_tva($mysoc, $objsoc, $prod->id); - $remise_percent = $objsoc->remise_percent; + if ($update_prices === true) { + $pu_ht = $prod->price; + $tva_tx = get_default_tva($mysoc, $objsoc, $prod->id); + $remise_percent = $objsoc->remise_percent; - if (!empty($conf->global->PRODUIT_MULTIPRICES) && $objsoc->price_level > 0) { - $pu_ht = $prod->multiprices[$objsoc->price_level]; - if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility - if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) { - $tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level]; + if (!empty($conf->global->PRODUIT_MULTIPRICES) && $objsoc->price_level > 0) { + $pu_ht = $prod->multiprices[$objsoc->price_level]; + if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility + if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) { + $tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level]; + } } - } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - $prodcustprice = new Productcustomerprice($this->db); - $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id); - $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); - if ($result) { - // If there is some prices specific to the customer - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines[0]->price); - $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); - if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { - $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + $prodcustprice = new Productcustomerprice($this->db); + $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); + if ($result) { + // If there is some prices specific to the customer + if (count($prodcustprice->lines) > 0) { + $pu_ht = price($prodcustprice->lines[0]->price); + $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); + if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { + $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + } } } } - } - $line->subprice = $pu_ht; - $line->tva_tx = $tva_tx; - $line->remise_percent = $remise_percent; + $line->subprice = $pu_ht; + $line->tva_tx = $tva_tx; + $line->remise_percent = $remise_percent; + } + if ($update_desc === true) { + $line->desc = $prod->description; + } } } } diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 595507a4bf4..194e2ca0dcd 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -55,6 +55,7 @@ CopyPropalFrom=Create commercial proposal by copying existing proposal CreateEmptyPropal=Create empty commercial proposal or from list of products/services DefaultProposalDurationValidity=Default commercial proposal validity duration (in days) DefaultPuttingPricesUpToDate=By default update prices with current known prices on cloning a proposal +DefaultPuttingDescUpToDate=By default update descriptions with current known descriptions on cloning a proposal UseCustomerContactAsPropalRecipientIfExist=Use contact/address with type 'Contact following-up proposal' if defined instead of third party address as proposal recipient address ConfirmClonePropal=Are you sure you want to clone the commercial proposal %s? ConfirmReOpenProp=Are you sure you want to open back the commercial proposal %s? diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index 66a0093db96..6e3d8b16870 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -55,6 +55,7 @@ CopyPropalFrom=Créer proposition/devis par recopie d'un proposition existante CreateEmptyPropal=Créer proposition/devis vierge ou avec la liste des produits/services DefaultProposalDurationValidity=Délai de validité par défaut (en jours) DefaultPuttingPricesUpToDate=Par défaut, mettre à jour les prix avec les prix connus actuels lors du clonage d'une proposition +DefaultPuttingDescUpToDate=Par défaut, mettre à jour les descriptions lors de clonage d'une proposition commerciale UseCustomerContactAsPropalRecipientIfExist=Utiliser l'adresse de 'contact suivi client' si définie plutôt que l'adresse du tiers comme destinataire des propositions ConfirmClonePropal=Êtes-vous sûr de vouloir cloner la proposition commerciale %s ? ConfirmReOpenProp=Êtes-vous sûr de vouloir réouvrir la proposition commerciale %s ? From 3e599b1c635685874c150b9f6d745e3c29c9da78 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Mar 2023 22:25:29 +0200 Subject: [PATCH 290/381] Fix dump of mail log file --- htdocs/core/class/CMailFile.class.php | 20 +++++++++++++++---- .../core/modules/syslog/mod_syslog_file.php | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 3c732f84bf4..eef112a00e2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1030,7 +1030,7 @@ class CMailFile $res = false; if (!empty($conf->global->MAIN_MAIL_DEBUG)) { - $this->save_dump_mail_in_err('Mail with topic '.$this->subject); + $this->save_dump_mail_in_err('Mail smtp error '.$smtperrorcode.' with topic '.$this->subject); } } } @@ -1289,13 +1289,25 @@ class CMailFile global $dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir - // Add message to dolibarr_mail.log + $srcfile = $dolibarr_main_data_root."/dolibarr_mail.log"; + + // Add message to dolibarr_mail.log. We do not use dol_syslog() on purpose, + // to be sure to write into dolibarr_mail.log if ($message) { - dol_syslog($message, LOG_DEBUG, 0, '_mail'); + // Test constant SYSLOG_FILE_NO_ERROR (should stay a constant defined with define('SYSLOG_FILE_NO_ERROR',1); + if (defined('SYSLOG_FILE_NO_ERROR')) { + $filefd = @fopen($srcfile, 'a+'); + } else { + $filefd = fopen($srcfile, 'a+'); + } + if ($filefd) { + fwrite($filefd, $message."\n"); + fclose($filefd); + dolChmod($srcfile); + } } // Move dolibarr_mail.log into a dolibarr_mail.err or dolibarr_mail.date.err - $srcfile = $dolibarr_main_data_root."/dolibarr_mail.log"; if (getDolGlobalString('MAIN_MAIL_DEBUG_ERR_WITH_DATE')) { $destfile = $dolibarr_main_data_root."/dolibarr_mail.".dol_print_date(dol_now(), 'dayhourlog', 'gmt').".err"; } else { diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 73ebc0d1d90..116e49487f9 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -125,7 +125,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface } } - return $suffixinfilename ?preg_replace('/\.log$/i', $suffixinfilename.'.log', $tmp) : $tmp; + return $suffixinfilename ? preg_replace('/\.log$/i', $suffixinfilename.'.log', $tmp) : $tmp; } /** From 639bf8ddd340b8b83fb2211d0c00f8543e541f22 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Thu, 30 Mar 2023 22:38:10 +0200 Subject: [PATCH 291/381] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 52399c161a6..09bdfb94d73 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1416,7 +1416,7 @@ class Propal extends CommonObject // update prices if ($update_prices === true || $update_desc === true) { if ($objsoc->id > 0 && !empty($object->lines)) { - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + if ($update_prices === true && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // If price per customer require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; } From ea77bf53fcef2bcc66f1a8ecae96101f1a0b90df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 00:39:46 +0200 Subject: [PATCH 292/381] Fix #24399 --- htdocs/product/stock/list.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index b6291958144..3201bb5f507 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -659,6 +659,9 @@ while ($i < $imaxinloop) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } foreach ($warehouse->fields as $key => $val) { if ($key == 'statut') { @@ -717,7 +720,7 @@ while ($i < $imaxinloop) { // Stock qty if (!empty($arrayfields["stockqty"]['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } @@ -789,9 +792,9 @@ while ($i < $imaxinloop) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print ''."\n"; From 917d8e7985bc5cd7e43601790db95df30c98abfa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 00:57:14 +0200 Subject: [PATCH 293/381] Look and feel v18 --- htdocs/variants/list.php | 381 ++++++++++++++++++++++++--------------- 1 file changed, 234 insertions(+), 147 deletions(-) diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index ad17c162d95..8464ecc5bee 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -30,15 +30,16 @@ require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; // Load translation files required by the page $langs->loadLangs(array("products", "other")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'productattributelist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOST('id', 'int'); @@ -75,7 +76,7 @@ if (!$sortorder) { } // Initialize array of search criterias -$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); +$search_all = GETPOST('search_all', 'alphanohtml'); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { @@ -96,6 +97,13 @@ foreach ($object->fields as $key => $val) { $fieldstosearchall['t.'.$key] = $val['label']; } } +$parameters = array('fieldstosearchall'=>$fieldstosearchall); +$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook > 0) { + $fieldstosearchall = empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']; +} elseif ($reshook == 0) { + $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']); +} // Definition of array of fields for columns $arrayfields = array(); @@ -106,7 +114,7 @@ foreach ($object->fields as $key => $val) { $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -219,7 +227,7 @@ $form = new Form($db); $now = dol_now(); $help_url = ''; -$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("ProductAttributes")); +$title = $langs->trans("ProductAttributes"); $morejs = array(); $morecss = array(); @@ -236,7 +244,7 @@ $sql .= $object->getFieldList("t"); //} // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; @@ -247,7 +255,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination2val AS pac2v $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_value AS pav ON pav.fk_product_attribute = t.rowid"; // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; @@ -255,17 +263,7 @@ if ($object->ismultientitymanaged == 1) { $sql .= " WHERE 1 = 1"; } foreach ($search as $key => $val) { - if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { - $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); - if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { - if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; - } - if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; - } - } - } elseif (array_key_exists($key, $object->fields)) { + if (array_key_exists($key, $object->fields)) { if ($key == 'status' && $search[$key] == -1) { continue; } @@ -277,7 +275,19 @@ foreach ($search as $key => $val) { $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search("t.".$key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + } + } else { + if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { + $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); + if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { + if (preg_match('/_dtstart$/', $key)) { + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; + } + if (preg_match('/_dtend$/', $key)) { + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; + } + } } } } @@ -289,7 +299,7 @@ if ($search_all) { //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $hasgroupby = true; @@ -343,7 +353,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $objforcount = $db->fetch_object($resql); $nbtotalofrecords = $objforcount->nbtotalofrecords; } - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -383,19 +393,26 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { if ($skey != '') { $param .= '&search_'.$key.'[]='.urlencode($skey); } } + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } @@ -404,10 +421,10 @@ if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } // Add $param from extra fields -//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -417,7 +434,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -436,8 +453,14 @@ print ''; print ''; print ''; print ''; +print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/variants/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitleSeparator(); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/variants/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -449,10 +472,13 @@ $trackid = 'pa'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'."\n"; } $moreforfilter = ''; @@ -461,7 +487,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': '; print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print ''; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -484,8 +513,16 @@ print '
'; -print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
'; -print '
'; +//print ''; +//print ''; +//print ''; +//print ''; +//print ''; +//print '
'; +print ''.$langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'

'; +//print '
'; print ''; @@ -589,8 +589,8 @@ if (!empty($_SESSION["commandbackuptorun"])) { print "\n"; -print ''; -print '
'; +//print '
'; print " \n"; @@ -598,7 +598,7 @@ print " \n"; print '
'; $filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1); -$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:480px; overflow: auto;"'); +$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow: auto;"'); print '
'; print '
'; @@ -652,12 +652,12 @@ foreach ($filecompression as $key => $val) { if ($key == 'gz') { $checked = ' checked'; } - print ''; - print ' '; + print ''; + print ' '; } else // Disabled export format { - print ''; - print ' '; + print ''; + print ' '; print ' ('.$langs->trans("NotAvailable").')'; } print '     '; @@ -686,6 +686,8 @@ print ''; print ''; print ''; +print '
'; + // End of page llxFooter(); $db->close(); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b784de02b32..36dc47066e8 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -565,11 +565,14 @@ input:-moz-placeholder { color: #ccc; } input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } fieldset { - border: 1px solid #AAAAAA !important; + border: 1px solid #aaa !important; padding-inline-start: 2em; padding-inline-end: 2em; min-inline-size: auto; } +#div_container_exportoptions fieldset, #div_container_sub_exportoptions fieldset { + border: 1px solid #ccc !important; +} .legendforfieldsetstep { padding-bottom: 10px; } input#onlinepaymenturl, input#directdownloadlink { opacity: 0.7; From dbc12cb1696f7aa4c70d87a2b09a684b0aa19f70 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Mar 2023 12:27:29 +0200 Subject: [PATCH 256/381] FIX can not show all csv fields (a reason for that ?) --- htdocs/imports/import.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index a6982bd0a4e..62059231f2d 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1079,9 +1079,9 @@ if ($step == 4 && $datatoimport) { $valforsourcefieldnb[$lefti] = $key; $lefti++; - if ($lefti > count($fieldstarget)) { + /*if ($lefti > count($fieldstarget)) { break; // Other fields are in the not imported area - } + }*/ } //var_dump($valforsourcefieldnb); @@ -1134,9 +1134,9 @@ if ($step == 4 && $datatoimport) { print ''; foreach ($fieldssource as $code => $line) { // $fieldssource is an array code=column num, line=content on first line for column in source file. - if ($i == $minpos) { + /*if ($i == $minpos) { break; - } + }*/ print ''; $entity = (!empty($objimport->array_import_entities[0][$code]) ? $objimport->array_import_entities[0][$code] : $objimport->array_import_icon[0]); From a31491fce28576c8fde07bf096e017af79ab131a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Mar 2023 22:27:14 +0200 Subject: [PATCH 257/381] Fix warning --- htdocs/core/modules/export/export_excel2007.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index fba0dfa1c4a..92feafb3859 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -464,6 +464,7 @@ class ExportExcel2007 extends ModeleExports return ''; } + $letter = ''; while ($c != 0) { $p = ($c - 1) % 26; $c = intval(($c - $p) / 26); From 8556327499b5a8d15bb7e258619afe49a380171a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Mar 2023 23:53:16 +0200 Subject: [PATCH 258/381] Hide session ID --- htdocs/admin/system/browser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/browser.php b/htdocs/admin/system/browser.php index 7e2c772183d..f86b6404019 100644 --- a/htdocs/admin/system/browser.php +++ b/htdocs/admin/system/browser.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2023 Laurent Destailleur * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2007-2012 Regis Houssin * @@ -65,7 +65,7 @@ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { } print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''; print ''; + // Firstname print ''; print ''; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 0fd23753fdf..ba5fde87468 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -27,6 +27,7 @@ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; // Load translation files required by the page @@ -42,6 +43,9 @@ if ($user->socid) { $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $object = new Contact($db); +$errors = array(); + + /* * Action */ @@ -123,6 +127,7 @@ $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); $form = new Form($db); +$formcompany = new FormCompany($db); $object->fetch($id, $user); @@ -143,38 +148,13 @@ if ($action == 'edit') { print '
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("SessionId").'********
'.$langs->trans("Screen").''; print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; From b2722e79dc7a54fbae151eb27f4b69c1802eba96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 14:27:28 +0200 Subject: [PATCH 259/381] Doc --- .../includes/OAuth/Common/Storage/DoliStorage.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index 60af1f631c6..145bc2add2b 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -236,8 +236,16 @@ class DoliStorage implements TokenStorageInterface */ public function clearAllTokens() { - // TODO - $this->conf->remove($this->key); + // TODO Remove token using a loop on each $service + /* + $servicepluskeyforprovider = $service; + if (!empty($this->keyforprovider)) { + // We clean the keyforprovider after the - to be sure it is not present + $servicepluskeyforprovider = preg_replace('/\-'.preg_quote($this->keyforprovider, '/').'$/', '', $servicepluskeyforprovider); + // Now we add the keyforprovider + $servicepluskeyforprovider .= '-'.$this->keyforprovider; + } + */ // allow chaining return $this; @@ -332,7 +340,6 @@ class DoliStorage implements TokenStorageInterface { // TODO // get previously saved tokens - //$states = $this->conf->get($this->stateKey); if (is_array($this->states) && array_key_exists($service, $this->states)) { unset($this->states[$service]); @@ -351,7 +358,6 @@ class DoliStorage implements TokenStorageInterface public function clearAllAuthorizationStates() { // TODO - //$this->conf->remove($this->stateKey); // allow chaining return $this; From 898a4bad159925ac7bdf327af0d118f85fb461e5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Mar 2023 14:30:32 +0200 Subject: [PATCH 260/381] FIX menu force entity = 0 if core module --- htdocs/core/class/menubase.class.php | 10 ++++++++-- htdocs/core/modules/DolibarrModules.class.php | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 3630d137136..19b5535493f 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -49,6 +49,11 @@ class Menubase */ public $id; + /** + * @var int Entity + */ + public $entity; + /** * @var string Menu handler */ @@ -185,6 +190,7 @@ class Menubase if (!isset($this->enabled)) { $this->enabled = '1'; } + $this->entity = (isset($this->entity) ? (int) $this->entity : $conf->entity); $this->menu_handler = trim((string) $this->menu_handler); $this->module = trim((string) $this->module); $this->type = trim((string) $this->type); @@ -246,7 +252,7 @@ class Menubase $sql .= " AND fk_menu = ".((int) $this->fk_menu); $sql .= " AND position = ".((int) $this->position); $sql .= " AND url = '".$this->db->escape($this->url)."'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity IN (0, ".$conf->entity.")"; $result = $this->db->query($sql); if ($result) { @@ -275,7 +281,7 @@ class Menubase $sql .= "usertype"; $sql .= ") VALUES ("; $sql .= " '".$this->db->escape($this->menu_handler)."',"; - $sql .= " '".$this->db->escape($conf->entity)."',"; + $sql .= " '".$this->db->escape($this->entity)."',"; $sql .= " '".$this->db->escape($this->module)."',"; $sql .= " '".$this->db->escape($this->type)."',"; $sql .= " ".($this->mainmenu ? "'".$this->db->escape($this->mainmenu)."'" : "''").","; // Can't be null diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 6c43c945b65..62dbd494082 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1986,7 +1986,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public function insert_menus() { // phpcs:enable - global $user; + global $conf, $user; if (!is_array($this->menu) || empty($this->menu)) { return 0; @@ -1998,6 +1998,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err = 0; + // Common module + $entity = ((!empty($this->always_enabled) || !empty($this->core_enabled)) ? 0 : $conf->entity); + $this->db->begin(); foreach ($this->menu as $key => $value) { @@ -2049,6 +2052,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $menu->user = $this->menu[$key]['user']; $menu->enabled = isset($this->menu[$key]['enabled']) ? $this->menu[$key]['enabled'] : 0; $menu->position = $this->menu[$key]['position']; + $menu->entity = $entity; if (!$err) { $result = $menu->create($user); // Save menu entry into table llx_menu @@ -2092,7 +2096,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql .= " WHERE module = '".$this->db->escape($module)."'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity IN (0, ".$conf->entity.")"; dol_syslog(get_class($this)."::delete_menus", LOG_DEBUG); $resql = $this->db->query($sql); From 0579c3f2f3e8b4551304ca154ce24da61b695bd0 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 29 Mar 2023 14:48:47 +0200 Subject: [PATCH 261/381] FIX PDF Espadon Expedition : notes and tracking number --- .../expedition/doc/pdf_espadon.modules.php | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 5280c2b7a1e..a62398b4f9e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -368,11 +368,15 @@ class pdf_espadon extends ModelePdfExpedition if (!empty($notetoshow) || !empty($object->tracking_number)) { $tab_top -= 2; + $tab_topbeforetrackingnumber = $tab_top; // Tracking number if (!empty($object->tracking_number)) { + + $height_trackingnumber = 4; + $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber") . " : " . $object->tracking_number, 0, 1, false, true, 'L'); + $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber") . " : " . $object->tracking_number, 0, 1, false, true, 'L'); $tab_top_alt = $pdf->GetY(); $object->getUrlTrackingStatus($object->tracking_number); @@ -390,8 +394,10 @@ class pdf_espadon extends ModelePdfExpedition $label .= " : "; $label .= $object->tracking_url; } + + $height_trackingnumber += 6; $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L'); + $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L'); $tab_top = $pdf->GetY(); } @@ -401,7 +407,7 @@ class pdf_espadon extends ModelePdfExpedition // Notes $pagenb = $pdf->getPage(); - if (!empty($notetoshow)) { + if (!empty($notetoshow) || !empty($object->tracking_number)) { $tab_top -= 2; $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite; @@ -465,10 +471,22 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetDrawColor(128, 128, 128); // Draw note frame if ($i > $pageposbeforenote) { - $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter); + if(empty($height_trackingnumber)) { + $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter); + } + else { + $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter) + $height_trackingnumber + 1; + $tab_top_newpage = $tab_topbeforetrackingnumber; + } $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); } else { - $height_note = $this->page_hauteur - ($tab_top + $heightforfooter); + if(empty($height_trackingnumber)) { + $height_note = $this->page_hauteur - ($tab_top + $heightforfooter); + } + else { + $height_note = $this->page_hauteur - ($tab_top + $heightforfooter)+ $height_trackingnumber + 1; + $tab_top = $tab_topbeforetrackingnumber; + } $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1); } @@ -489,7 +507,13 @@ class pdf_espadon extends ModelePdfExpedition { $pdf->commitTransaction(); $posyafter = $pdf->GetY(); - $height_note = $posyafter - $tab_top; + if(empty($height_trackingnumber)) { + $height_note = $posyafter - $tab_top + 1; + } + else { + $height_note = $posyafter - $tab_top + $height_trackingnumber + 1; + $tab_top = $tab_topbeforetrackingnumber; + } $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1); From 507abd4cc2c467db74b46fd82b78a862a1e79e9b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 29 Mar 2023 12:56:47 +0000 Subject: [PATCH 262/381] Fixing style errors. --- .../expedition/doc/pdf_espadon.modules.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index a62398b4f9e..12f20d74d7e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -372,7 +372,6 @@ class pdf_espadon extends ModelePdfExpedition // Tracking number if (!empty($object->tracking_number)) { - $height_trackingnumber = 4; $pdf->SetFont('', 'B', $default_font_size - 2); @@ -471,19 +470,17 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetDrawColor(128, 128, 128); // Draw note frame if ($i > $pageposbeforenote) { - if(empty($height_trackingnumber)) { + if (empty($height_trackingnumber)) { $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter); - } - else { + } else { $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter) + $height_trackingnumber + 1; $tab_top_newpage = $tab_topbeforetrackingnumber; } $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); } else { - if(empty($height_trackingnumber)) { + if (empty($height_trackingnumber)) { $height_note = $this->page_hauteur - ($tab_top + $heightforfooter); - } - else { + } else { $height_note = $this->page_hauteur - ($tab_top + $heightforfooter)+ $height_trackingnumber + 1; $tab_top = $tab_topbeforetrackingnumber; } @@ -507,10 +504,9 @@ class pdf_espadon extends ModelePdfExpedition { $pdf->commitTransaction(); $posyafter = $pdf->GetY(); - if(empty($height_trackingnumber)) { + if (empty($height_trackingnumber)) { $height_note = $posyafter - $tab_top + 1; - } - else { + } else { $height_note = $posyafter - $tab_top + $height_trackingnumber + 1; $tab_top = $tab_topbeforetrackingnumber; } From f870a8ea2f90fcce6259b0c6ffff6c80847ef269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 22:16:04 +0200 Subject: [PATCH 263/381] work on printing --- htdocs/core/modules/printing/printgcp.modules.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index c1b6ba6c86e..0a2d59368ec 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -121,7 +121,7 @@ class printing_printgcp extends PrintingDriver $this->google_id = getDolGlobalString('OAUTH_GOOGLE_ID'); $this->google_secret = getDolGlobalString('OAUTH_GOOGLE_SECRET'); // Token storage - $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); + $storage = new DoliStorage($this->db, $conf, $keyforprovider); //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); // Setup the credentials for the requests $credentials = new Credentials( @@ -255,12 +255,13 @@ class printing_printgcp extends PrintingDriver */ public function getlistAvailablePrinters() { + global $conf; $ret = array(); $keyforprovider = ''; // @FIXME // Token storage - $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); + $storage = new DoliStorage($this->db, $conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, @@ -376,7 +377,7 @@ class printing_printgcp extends PrintingDriver * @return array status array */ public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype) - { + {global $conf; // Check if printer id if (empty($printerid)) { return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'No provided printer ID'); @@ -401,7 +402,7 @@ class printing_printgcp extends PrintingDriver $keyforprovider = ''; // @FIXME // Dolibarr Token storage - $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); + $storage = new DoliStorage($this->db, $conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, From 222ad02e49c92c8cc62939030cbfff7adf237e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 22:17:38 +0200 Subject: [PATCH 264/381] work on printing --- htdocs/core/modules/printing/printgcp.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 0a2d59368ec..d62dbd94ab2 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -377,7 +377,8 @@ class printing_printgcp extends PrintingDriver * @return array status array */ public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype) - {global $conf; + { + global $conf; // Check if printer id if (empty($printerid)) { return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'No provided printer ID'); @@ -454,7 +455,7 @@ class printing_printgcp extends PrintingDriver $keyforprovider = ''; // @FIXME // Token storage - $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); + $storage = new DoliStorage($this->db, $conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, From 48333a7205fb77737741612e18d164c5212b1be1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Mar 2023 15:09:43 +0200 Subject: [PATCH 265/381] FIX wrong test --- htdocs/core/class/menubase.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 19b5535493f..2965db0f7c5 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -190,7 +190,7 @@ class Menubase if (!isset($this->enabled)) { $this->enabled = '1'; } - $this->entity = (isset($this->entity) ? (int) $this->entity : $conf->entity); + $this->entity = (isset($this->entity) && (int) $this->entity >= 0 ? (int) $this->entity : $conf->entity); $this->menu_handler = trim((string) $this->menu_handler); $this->module = trim((string) $this->module); $this->type = trim((string) $this->type); From 6e8a72a434979e2cad27316a5aa5e69409fc5a37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 16:31:55 +0200 Subject: [PATCH 266/381] Fix filter on holiday dates --- htdocs/comm/action/index.php | 10 +++++----- htdocs/comm/action/info.php | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 91f749a1cd0..bcef5f77474 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1000,7 +1000,7 @@ if ($showbirthday) { } } -// LEAVE CALENDAR +// LEAVE-HOLIDAY CALENDAR $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = x.fk_user"; @@ -1012,12 +1012,12 @@ if ($mode == 'show_day') { $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time } elseif ($mode == 'show_week') { // Restrict on current month (we get more, but we will filter later) - $sql .= " AND date_debut < '".dol_get_last_day($year, $month)."'"; - $sql .= " AND date_fin >= '".dol_get_first_day($year, $month)."'"; + $sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'"; } elseif ($mode == 'show_month') { // Restrict on current month - $sql .= " AND date_debut <= '".dol_get_last_day($year, $month)."'"; - $sql .= " AND date_fin >= '".dol_get_first_day($year, $month)."'"; + $sql .= " AND date_debut <= '".$db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'"; } $resql = $db->query($sql); diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index aa14224014a..ee34d07ea4b 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2023 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,8 +98,6 @@ if (empty($reshook)) { $linkback .= $out; $morehtmlref = '
'; -// Thirdparty -//$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects"); From 48136f465b841ba026ffad277257f980e6cbe1dd Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 29 Mar 2023 16:46:06 +0200 Subject: [PATCH 267/381] forceduedate is an option of the function --- htdocs/compta/facture/class/facture.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0269babd064..81c426a934c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -530,8 +530,6 @@ class Facture extends CommonInvoice // We do not add link to template invoice or next invoice will be linked to all generated invoices //$this->linked_objects['facturerec'][0] = $this->fac_rec; - $forceduedate = $this->calculate_date_lim_reglement(); - // For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice if ($_facrec->frequency > 0) { From 758c6a62635cd45f18d54cc7424368850be46540 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 17:06:19 +0200 Subject: [PATCH 268/381] colspan war --- htdocs/contact/card.php | 1 + htdocs/contact/perso.php | 83 ++++++++++++++++++++--------------- htdocs/langs/en_US/other.lang | 1 + htdocs/societe/card.php | 2 +- 4 files changed, 50 insertions(+), 37 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 7197eabb19c..cbdce0c5d04 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -680,6 +680,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
lastname).'" autofocus="autofocus">
'; // Ref - print ''; - // Photo - print ''; - // Name - print ''; - print ''; + print ''; + print ''; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { @@ -182,31 +162,62 @@ if ($action == 'edit') { $objsoc = new Societe($db); $objsoc->fetch($object->socid); - print ''; + print ''; } else { - print ''; } } // Civility - print ''; + // Photo + print ''; + print ''; + print ''; + print ''; + // Date To Birth print ''; - - print ''; + print ''; } else { - print ''; + print ''; } + print ''; print ''; print "
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $object->id; print ''; - print $form->showphoto('contact', $object)."\n"; - if ($object->photo) { - print "
\n"; - } - - print ''; - - if ($object->photo) { - print ''; - } - print ''; - print ''; - print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; - $maxfilesizearray = getMaxFileSizeArray(); - $maxmin = $maxfilesizearray['maxmin']; - if ($maxmin > 0) { - print ''; // MAX_FILE_SIZE must precede the field type=file - } - print ''; - print '
'; - - print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.'
'.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.'
'.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).'
'.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).'
'.$langs->trans("ThirdParty").''; + print '
'.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print '
'.$langs->trans("UserTitle").''; + print '
'; print $object->getCivilityLabel(); + //print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'alpha') : $object->civility_code, 'civility_code'); print '
'.$form->editfieldkey('PhotoFile', 'photoinput', '', $object, 0).''; + if ($object->photo) { + print $form->showphoto('contact', $object); + } + $caneditfield = 1; + if ($caneditfield) { + if ($object->photo) { + print "
\n"; + } + print ''; + if ($object->photo) { + print ''; + } + //print ''; + print ''; + print '
'.$langs->trans("PhotoFile").'
'; + $maxfilesizearray = getMaxFileSizeArray(); + $maxmin = $maxfilesizearray['maxmin']; + if ($maxmin > 0) { + print ''; // MAX_FILE_SIZE must precede the field type=file + } + print ''; + print '
'; + } + print '
'.$langs->trans("DateOfBirth").''; $form = new Form($db); print $form->selectDate($object->birthday, 'birthday', 0, 0, 1, "perso", 1, 0); - print ''.$langs->trans("Alert").': '; + print '     '; + print ' '; if (!empty($object->birthday_alert)) { - print '
"; diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index e2d46564ea2..cd9d2a6589c 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -5,6 +5,7 @@ Tools=Tools TMenuTools=Tools ToolsDesc=All tools not included in other menu entries are grouped here.
All the tools can be accessed via the left menu. Birthday=Birthday +BirthdayAlert=Birthday alert BirthdayAlertOn=birthday alert active BirthdayAlertOff=birthday alert inactive TransKey=Translation of the key TransKey diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d298c34719d..cc901a8bbe2 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2618,7 +2618,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print ''; if ($object->logo) { - print ''; + print ''; } //print ''; print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; From c02fc4e177d2aab2ba077890eb13936794f240a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 17:57:52 +0200 Subject: [PATCH 269/381] Debug v18 --- htdocs/comm/action/index.php | 40 ++++++++++++++++++++++++++----- htdocs/core/lib/functions.lib.php | 9 ++++++- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index bcef5f77474..ed96199e4c3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -927,6 +927,7 @@ if ($resql) { } //var_dump($eventarray); + // BIRTHDATES CALENDAR // Complete $eventarray with birthdates if ($showbirthday) { @@ -972,6 +973,8 @@ if ($showbirthday) { $event->percentage = 100; $event->fulldayevent = 1; + $event->contact_id = $obj->rowid; + $event->date_start_in_calendar = $db->jdate($event->datep); $event->date_end_in_calendar = $db->jdate($event->datef); @@ -1800,7 +1803,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $color = ($event->icalcolor ? $event->icalcolor : -1); $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); } elseif ($event->type_code == 'BIRTHDAY') { - $numbirthday++; $colorindex = 2; $cssclass = 'family_birthday '; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); + $numbirthday++; + $colorindex = 2; + $cssclass = 'family_birthday '; + $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); } else { $numother++; $color = ($event->icalcolor ? $event->icalcolor : -1); @@ -1930,9 +1936,31 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $daterange = ''; - if ($event->type_code == 'BIRTHDAY') { // It's birthday calendar - print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); - } elseif ($event->type_code == 'HOLIDAY') { // It's holiday calendar + if ($event->type_code == 'BIRTHDAY') { + // It's birthday calendar + $picb = ''; + //$pice = ''; + //$typea = ($objp->typea == 'birth') ? $picb : $pice; + //var_dump($event); + print $picb.' '.$langs->trans("Birthday").'
'; + //print img_picto($langs->trans("Birthday"), 'birthday-cake').' '; + + $tmpid = $event->id; + if (empty($cachecontacts[$tmpid])) { + $newcontact = new Contact($db); + $newcontact->fetch($tmpid); + $cachecontact[$tmpid] = $newcontact; + } + print $cachecontact[$tmpid]->getNomUrl(1); + + //$event->picto = 'birthday-cake'; + //print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); + /*$listofcontacttoshow = ''; + $listofcontacttoshow .= '
'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle'); + print $listofcontacttoshow; + */ + } elseif ($event->type_code == 'HOLIDAY') { + // It's holiday calendar $tmpholiday->fetch($event->id); print $tmpholiday->getNomUrl(1); @@ -1947,8 +1975,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $listofusertoshow = ''; $listofusertoshow .= '
'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle'); print $listofusertoshow; - } else { // Other calendar - // Picto + } else { + // Other calendar if (empty($event->fulldayevent)) { //print $event->getNomUrl(2).' '; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f8074ffcd46..0e8aeb31518 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4131,7 +4131,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', - 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building', + 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'birthday-cake', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building', 'card', 'calendarlist', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype', 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes', 'currency', 'multicurrency', @@ -11259,6 +11259,11 @@ function getElementProperties($element_type) $classpath = 'categories/class'; $module = 'categorie'; $subelement = 'categorie'; + } elseif ($element_type == 'contact') { + $classpath = 'contact/class'; + $classfile = 'contact'; + $module = 'societe'; + $subelement = 'contact'; } elseif ($element_type == 'stock') { $classpath = 'product/stock/class'; $classfile = 'entrepot'; @@ -11377,6 +11382,8 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '') $ret = 0; $element_prop = getElementProperties($element_type); + //var_dump($element_prop); + if (is_array($element_prop) && isModEnabled($element_prop['module'])) { dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php'); From 93125e7841d180b820103dffbb82bff8cbdbca3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 18:11:24 +0200 Subject: [PATCH 270/381] Debug v18 --- htdocs/core/class/vcard.class.php | 3 +++ htdocs/public/users/view.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 7b5a320f678..0bb532e33c4 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -421,6 +421,9 @@ class vCard if (!empty($object->socialnetworks)) { foreach ($object->socialnetworks as $key => $val) { + if (empty($val)) { // Disacard social network if empty + continue; + } $urlsn = ''; if ($key == 'linkedin') { if (!preg_match('/^http/', $val)) { diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index c62420c76d8..53bc597aaa9 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -262,8 +262,8 @@ if ($showbarcode) { $qrcodecontent = $output = $v->buildVCardString($object, $company, $langs); print '
'; - print '
'; - print ''; + print '
'; + print ''; print '
'; print '
'; } From 021309d7617dcc9fe20b4febc53e6190f4662965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Mar 2023 18:22:36 +0200 Subject: [PATCH 271/381] fix shipping ajax tooltip --- htdocs/core/lib/functions.lib.php | 5 +++++ htdocs/expedition/class/expedition.class.php | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f8074ffcd46..2852de2ccf3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11280,6 +11280,11 @@ function getElementProperties($element_type) $subelement = 'commande'; } elseif ($element_type == 'propal') { $classpath = 'comm/propal/class'; + } elseif ($element_type == 'shipping') { + $classpath = 'expedition/class'; + $classfile = 'expedition'; + $classname = 'Expedition'; + $module = 'expedition'; } elseif ($element_type == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; $module = 'supplier_proposal'; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 7b1c8ae6df7..dcd567908f6 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1834,7 +1834,8 @@ class Expedition extends CommonObject { global $conf, $langs; - $langs->load('shipping'); + $langs->load('sendings'); + $nofetch = !empty($params['nofetch']); $datas = array(); From 8165b2eba86efba1150268345c2b3235cd472d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Mar 2023 18:25:53 +0200 Subject: [PATCH 272/381] fix shipping ajax tooltip --- htdocs/expedition/class/expedition.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index dcd567908f6..6e987b38050 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1845,6 +1845,13 @@ class Expedition extends CommonObject } $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); + if (!$nofetch) { + $langs->load('companies'); + if (empty($this->thirdparty)) { + $this->fetch_thirdparty(); + } + $datas['customer'] = '
'.$langs->trans('Customer').': '.$this->thirdparty->getNomUrl(1, '', 0, 1); + } return $datas; } From 381cc394194b74c5533d4726efa68392965a0ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Mar 2023 18:36:50 +0200 Subject: [PATCH 273/381] doc --- htdocs/core/class/commonobject.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5415a96ed4f..f11548d6a5a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -391,6 +391,22 @@ abstract class CommonObject */ public $shipping_method_id; + /** + * @var string Shipping method label + * @see setShippingMethod() + */ + public $shipping_method; + + /** + * @var string multicurrency code + */ + public $multicurrency_code; + + /** + * @var string multicurrency tx + */ + public $multicurrency_tx; + /** * @var string * @see SetDocModel() From f0b94f8869eaec4ec711765d621215bf0ea9f8ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 18:42:32 +0200 Subject: [PATCH 274/381] Look and feel v18 --- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/core/lib/payments.lib.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0e8aeb31518..3d57dc9f50c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4133,7 +4133,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'birthday-cake', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building', 'card', 'calendarlist', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype', - 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes', + 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cross', 'cubes', 'currency', 'multicurrency', 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice', 'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye', @@ -4179,7 +4179,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'billd'=>'file-medical', 'supplier_invoice'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'supplier_invoicer'=>'file-invoice-dollar', 'supplier_invoiced'=>'file-medical', 'bom'=>'shapes', - 'card'=>'address-card', 'chart'=>'chart-line', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'collab'=>'people-arrows', 'conversation'=>'comments', 'country'=>'globe-americas', 'cron'=>'business-time', + 'card'=>'address-card', 'chart'=>'chart-line', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'collab'=>'people-arrows', 'conversation'=>'comments', 'country'=>'globe-americas', 'cron'=>'business-time', 'cross'=>'times', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accounting'=>'search-dollar', 'category'=>'tag', 'dollyrevert'=>'dolly', diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 93c7a17de2f..2a5b8a182eb 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -487,7 +487,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print ''."\n"; - print '
'."\n"; + print '
'."\n"; print '
'; if ($addformmessage) { print ''; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index f67894988c9..03cae42c094 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -610,15 +610,19 @@ if ($action == "dosign" && empty($cancel)) { if ($object->status == $object::STATUS_SIGNED) { print '
'; if ($message == 'signed') { + print img_picto('', 'check', '', false, 0, 0, '', 'size2x').'
'; print ''.$langs->trans("PropalSigned").''; } else { + print img_picto('', 'check', '', false, 0, 0, '', 'size2x').'
'; print ''.$langs->trans("PropalAlreadySigned").''; } } elseif ($object->status == $object::STATUS_NOTSIGNED) { print '
'; if ($message == 'refused') { + print img_picto('', 'cross', '', false, 0, 0, '', 'size2x').'
'; print ''.$langs->trans("PropalRefused").''; } else { + print img_picto('', 'cross', '', false, 0, 0, '', 'size2x').'
'; print ''.$langs->trans("PropalAlreadyRefused").''; } } else { From 0349b1095a6657238109cdbe57da459196b48910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Mar 2023 20:06:11 +0200 Subject: [PATCH 275/381] fix ajax tooltip --- htdocs/core/ajax/ajaxtooltip.php | 2 +- htdocs/core/lib/functions.lib.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 90c416100cb..9a4d42ce5bb 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -79,7 +79,7 @@ top_httphead(); $html = ''; if (is_object($object)) { - if ($object->id > 0) { + if ($object->id > 0 || !empty($object->ref)) { $html = $object->getTooltipContent($params); } elseif ($res == 0) { $html = $langs->trans('Deleted'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2852de2ccf3..17a9bb30e0d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11323,6 +11323,10 @@ function getElementProperties($element_type) $classpath = 'comm/propal/class'; $module = 'propal'; $subelement = 'propaleligne'; + } elseif ($element_type == 'opensurvey_sondage') { + $classpath = 'opensurvey/class'; + $module = 'opensurvey'; + $subelement = 'opensurveysondage'; } elseif ($element_type == 'order_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; @@ -11340,7 +11344,7 @@ function getElementProperties($element_type) } elseif ($element_type == "service") { $classpath = 'product/class'; $subelement = 'product'; - } elseif ($objecttype == 'salary') { + } elseif ($element_type == 'salary') { $classpath = 'salaries/class'; $module = 'salaries'; } From 2c0f92bccfabac0a678173f1b8ce7024dab65ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Mar 2023 20:47:44 +0200 Subject: [PATCH 276/381] fix substitution for online sign contract --- htdocs/core/lib/functions.lib.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3d57dc9f50c..3175de19d21 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8064,14 +8064,6 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : ''); $substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl; - if (is_object($object) && $object->element == 'propal') { - require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref); - } - if (is_object($object) && $object->element == 'fichinter') { - require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; - $substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref); - } if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') { $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element); } else { @@ -8105,6 +8097,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'propal') { $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id; + require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; + $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref); } if (is_object($object) && $object->element == 'commande') { $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id; @@ -8114,9 +8108,13 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } if (is_object($object) && $object->element == 'contrat') { $substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id; + require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; + $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'contract', $object->ref); } if (is_object($object) && $object->element == 'fichinter') { $substitutionarray['__URL_FICHINTER__'] = DOL_MAIN_URL_ROOT."/fichinter/card.php?id=".$object->id; + require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; + $substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref); } if (is_object($object) && $object->element == 'supplier_proposal') { $substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id; From 5924e626b060ef033cd42cf1cd41e534d6918a85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Mar 2023 10:18:43 +0200 Subject: [PATCH 277/381] The method htmlPrintOnlinePaymentFooter() used for public footer pages has been renamed into htmlPrintOnlineFooter() and moved into company.lib.php --- ChangeLog | 2 + htdocs/core/lib/company.lib.php | 106 ++++++++++++++++++ htdocs/core/lib/payments.lib.php | 106 ------------------ .../eventorganization/subscriptionok.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 2 +- htdocs/public/payment/newpayment.php | 2 +- htdocs/public/payment/paymentko.php | 2 +- htdocs/public/payment/paymentok.php | 2 +- htdocs/public/project/index.php | 2 +- htdocs/public/project/viewandvote.php | 2 +- htdocs/public/recruitment/index.php | 4 +- htdocs/public/recruitment/view.php | 2 +- htdocs/public/ticket/create_ticket.php | 2 +- htdocs/public/ticket/index.php | 2 +- htdocs/public/ticket/list.php | 2 +- htdocs/public/ticket/view.php | 2 +- 16 files changed, 122 insertions(+), 120 deletions(-) diff --git a/ChangeLog b/ChangeLog index e45d746e4da..900dff4a9ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ Following changes may create regressions for some external modules, but were nec * Deprecated property libelle removed from entrepot class. * The type 'text' in ->fields property dos not accept html content anymore. Use the type 'html' for that. * The module for WebService SOAP API have been deprecated. Use instead the Webservice REST API module. +* The method htmlPrintOnlinePaymentFooter() used for public footer pages has been renamed into htmlPrintOnlineFooter() and moved into company.lib.php + ***** ChangeLog for 17.0.1 compared to 17.0.0 ***** diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 04874dd9d90..29b8a15564d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2297,3 +2297,109 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) return ''; } } + + + +/** + * Show footer of company in HTML pages + * + * @param Societe $fromcompany Third party + * @param Translate $langs Output language + * @param int $addformmessage Add the payment form message + * @param string $suffix Suffix to use on constants + * @param Object $object Object related to payment + * @return void + */ +function htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage = 0, $suffix = '', $object = null) +{ + global $conf; + + $reg = array(); + + // Juridical status + $line1 = ""; + if ($fromcompany->forme_juridique_code) { + $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code); + } + // Capital + if ($fromcompany->capital) { + $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency); + } + // Prof Id 1 + if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { + $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code); + if (preg_match('/\((.*)\)/i', $field, $reg)) { + $field = $reg[1]; + } + $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1; + } + // Prof Id 2 + if ($fromcompany->idprof2) { + $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code); + if (preg_match('/\((.*)\)/i', $field, $reg)) { + $field = $reg[1]; + } + $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2; + } + + // Second line of company infos + $line2 = ""; + // Prof Id 3 + if ($fromcompany->idprof3) { + $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code); + if (preg_match('/\((.*)\)/i', $field, $reg)) { + $field = $reg[1]; + } + $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3; + } + // Prof Id 4 + if ($fromcompany->idprof4) { + $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code); + if (preg_match('/\((.*)\)/i', $field, $reg)) { + $field = $reg[1]; + } + $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4; + } + // IntraCommunautary VAT + if ($fromcompany->tva_intra != '') { + $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; + } + + print ''."\n"; + + print '
'."\n"; + print '
'; + if ($addformmessage) { + print ''; + print '
'; + + $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; + if (!empty($conf->global->$parammessageform)) { + print $langs->transnoentities($conf->global->$parammessageform); + } elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) { + print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); + } + + // Add other message if VAT exists + if (!empty($object->total_vat) || !empty($object->total_tva)) { + $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; + if (!empty($conf->global->$parammessageform)) { + print $langs->transnoentities($conf->global->$parammessageform); + } elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) { + print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); + } + } + } + + print '

'."\n"; + print $fromcompany->name.'
'; + print $line1; + if (strlen($line1.$line2) > 50) { + print '
'; + } else { + print ' - '; + } + print $line2; + print '
'; + print '
'."\n"; +} diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 2a5b8a182eb..ef89c65bdf1 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -417,109 +417,3 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag return $out; } - - - -/** - * Show footer of company in HTML pages - * - * @param Societe $fromcompany Third party - * @param Translate $langs Output language - * @param int $addformmessage Add the payment form message - * @param string $suffix Suffix to use on constants - * @param Object $object Object related to payment - * @return void - */ -function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, $suffix = '', $object = null) -{ - global $conf; - - $reg = array(); - - // Juridical status - $line1 = ""; - if ($fromcompany->forme_juridique_code) { - $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code); - } - // Capital - if ($fromcompany->capital) { - $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency); - } - // Prof Id 1 - if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { - $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code); - if (preg_match('/\((.*)\)/i', $field, $reg)) { - $field = $reg[1]; - } - $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1; - } - // Prof Id 2 - if ($fromcompany->idprof2) { - $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code); - if (preg_match('/\((.*)\)/i', $field, $reg)) { - $field = $reg[1]; - } - $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2; - } - - // Second line of company infos - $line2 = ""; - // Prof Id 3 - if ($fromcompany->idprof3) { - $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code); - if (preg_match('/\((.*)\)/i', $field, $reg)) { - $field = $reg[1]; - } - $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3; - } - // Prof Id 4 - if ($fromcompany->idprof4) { - $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code); - if (preg_match('/\((.*)\)/i', $field, $reg)) { - $field = $reg[1]; - } - $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4; - } - // IntraCommunautary VAT - if ($fromcompany->tva_intra != '') { - $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; - } - - print ''."\n"; - - print '
'."\n"; - print '
'; - if ($addformmessage) { - print ''; - print '
'; - - $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; - if (!empty($conf->global->$parammessageform)) { - print $langs->transnoentities($conf->global->$parammessageform); - } elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) { - print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); - } - - // Add other message if VAT exists - if (!empty($object->total_vat) || !empty($object->total_tva)) { - $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; - if (!empty($conf->global->$parammessageform)) { - print $langs->transnoentities($conf->global->$parammessageform); - } elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) { - print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); - } - } - } - - print '

'."\n"; - print $fromcompany->name.'
'; - print $line1; - if (strlen($line1.$line2) > 50) { - print '
'; - } else { - print ' - '; - } - print $line2; - print '
'; - print '
'."\n"; -} diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index 043e0e8d021..d87d231d599 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -167,7 +167,7 @@ print $langs->trans("SubscriptionOk"); print "\n
\n"; -htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); +htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix); // Clean session variables to avoid duplicate actions if post is resent diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 03cae42c094..d05ad3558c5 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -650,7 +650,7 @@ print ''."\n"; print '
'; -htmlPrintOnlinePaymentFooter($mysoc, $langs); +htmlPrintOnlineFooter($mysoc, $langs); llxFooter('', 'public'); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 17474adddf8..f6b5b03aac2 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2678,7 +2678,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme } } -htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); +htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 4174267a769..627a9e1ff5e 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -286,7 +286,7 @@ if ($type || $tag) { print "\n\n"; -htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); +htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix); llxFooter('', 'public'); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index cb9eaab2863..f34aced8c16 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1799,7 +1799,7 @@ print "\n\n"; print "\n"; -htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); +htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix); // Clean session variables to avoid duplicate actions if post is resent diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index ef3f1d1dab0..8cefe20909b 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -251,7 +251,7 @@ print ''."\n"; print '
'; -htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); +htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 5659fd00dfd..c4d840afbfc 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -294,7 +294,7 @@ print '
'."\n"; $object = null; -htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); +htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 4f82139656c..7fa61c93cf7 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/public/recruitment/view.php + * \file htdocs/public/recruitment/index.php * \ingroup recruitment * \brief Public file to show on job */ @@ -302,7 +302,7 @@ print ''."\n"; print '
'; -htmlPrintOnlinePaymentFooter($mysoc, $langs); +htmlPrintOnlineFooter($mysoc, $langs); llxFooter('', 'public'); diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 3626693ce89..0f7f7933e58 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -350,7 +350,7 @@ print ''."\n"; print '
'; -htmlPrintOnlinePaymentFooter($mysoc, $langs); +htmlPrintOnlineFooter($mysoc, $langs); llxFooter('', 'public'); diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 2bb574def50..68cd4eb87d6 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -545,7 +545,7 @@ if ($action != "infos_success") { print ''; // End of page -htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); +htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index a36a0023324..f97bdd15966 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -94,7 +94,7 @@ print ''; print ''; // End of page -htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); +htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object); llxFooter('', 'public'); diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 8e56d57e871..f7ad050df96 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -758,7 +758,7 @@ if ($action == "view_ticketlist") { } // End of page -htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); +htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object); llxFooter('', 'public'); diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index b8f5b48fbac..3364a3b7850 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -425,7 +425,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print ""; // End of page -htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); +htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object); llxFooter('', 'public'); From 0243fe9d51a64cca3a3bc51bbd5fdc40927cfa07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Mar 2023 10:21:27 +0200 Subject: [PATCH 278/381] optimize supplier price log --- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index a63c5313bae..9fcc01e1525 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -380,3 +380,6 @@ ALTER TABLE llx_product_lot ADD COLUMN last_main_doc varchar(255) AFTER model_pd ALTER TABLE llx_product_fournisseur_price ADD COLUMN status integer DEFAULT 1; +ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_product_fournisseur (fk_product_fournisseur); +ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_user (fk_user); +ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_multicurrency (fk_multicurrency); From 6d211b9a1ad6dbe9e3917b7f18528f3c2c5c9c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Mar 2023 10:21:42 +0200 Subject: [PATCH 279/381] optimize supplier price log --- .../llx_product_fournisseur_price_log.key.sql | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_product_fournisseur_price_log.key.sql diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price_log.key.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price_log.key.sql new file mode 100644 index 00000000000..711d2a815cd --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price_log.key.sql @@ -0,0 +1,21 @@ +-- ============================================================================ +-- Copyright (C) 2023 Frédéric France +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_product_fournisseur (fk_product_fournisseur); +ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_user (fk_user); +ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_price_log_fk_multicurrency (fk_multicurrency); From fa81a9867c3929d9e3fce0818bf545b50c5874a2 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Thu, 30 Mar 2023 10:37:48 +0200 Subject: [PATCH 280/381] FIX: Fix css error on wordbreak for view extrafields (case on type 'text') --- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index ec7578e0aa4..38b99fc5736 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -212,7 +212,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l $html_id = !empty($object->id) ? $object->element.'_extras_'.$tmpkeyextra.'_'.$object->id : ''; - print '
'; + print ''; // Convert date into timestamp format if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date'))) { From 6860325f96f1abf5c936a005198edbb171caa8ad Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Thu, 30 Mar 2023 11:13:17 +0200 Subject: [PATCH 281/381] Correction --- htdocs/product/class/html.formproduct.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 14457c312ed..f9ea6b54beb 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -867,8 +867,11 @@ class FormProduct $productIdList = implode(',', $productIdArray); $batch_count = 0; - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($this->db); + global $hookmanager; + if (empty($hookmanager)) { + include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } $hookmanager->initHooks(array('productdao')); $parameters = array('productIdList' => $productIdList); $reshook = $hookmanager->executeHooks('loadLotStock', $parameters, $this); From 5cf1ed058fab7e7e03479771ca587cac0b2f2c79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Mar 2023 12:42:39 +0200 Subject: [PATCH 282/381] Fix data next run of a job mandatory only if status is enabled --- htdocs/cron/class/cronjob.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 566a9c959e9..7e288f265ba 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -741,7 +741,7 @@ class Cronjob extends CommonObject // Check parameters // Put here code to add a control on parameters values - if (dol_strlen($this->datenextrun) == 0) { + if (dol_strlen($this->datenextrun) == 0 && $this->status == self::STATUS_ENABLED) { $this->errors[] = $langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtNextLaunch')); $error++; } From 12735f23f6ce4bf3f3008f1b0169e92c48e26d84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Mar 2023 12:55:17 +0200 Subject: [PATCH 283/381] Fix doc comment --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 22fa0a79b50..2419050cafc 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5425,10 +5425,10 @@ class Facture extends CommonInvoice /** - * Send reminders by emails for ivoices that are due + * Send reminders by emails for invoices that are due * CAN BE A CRON TASK * - * @param int $nbdays Delay after due date (or before if delay is negative) + * @param int $nbdays Delay before due date (or after if delay is negative) * @param string $paymentmode '' or 'all' by default (no filter), or 'LIQ', 'CHQ', CB', ... * @param int|string $template Name (or id) of email template (Must be a template of type 'facture_send') * @param string $forcerecipient Force email of recipient (for example to send the email to an accountant supervisor instead of the customer) From 53d530f126eb05aa0513621ea4c7c3a6525d1ef7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Mar 2023 14:48:04 +0200 Subject: [PATCH 284/381] More data into log --- htdocs/core/class/CMailFile.class.php | 15 +++++++++++---- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index e350cae47bc..3c732f84bf4 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -849,7 +849,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); if (!empty($conf->global->MAIN_MAIL_DEBUG)) { - $this->save_dump_mail_in_err(); + $this->save_dump_mail_in_err('Mail with topic '.$this->subject); } } else { dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG); @@ -1030,7 +1030,7 @@ class CMailFile $res = false; if (!empty($conf->global->MAIN_MAIL_DEBUG)) { - $this->save_dump_mail_in_err(); + $this->save_dump_mail_in_err('Mail with topic '.$this->subject); } } } @@ -1170,7 +1170,7 @@ class CMailFile $res = false; if (!empty($conf->global->MAIN_MAIL_DEBUG)) { - $this->save_dump_mail_in_err(); + $this->save_dump_mail_in_err('Mail with topic '.$this->subject); } } else { dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG); @@ -1281,13 +1281,20 @@ class CMailFile * Save content if mail is in error * Used for debugging. * + * @param string $message Add also a message * @return void */ - public function save_dump_mail_in_err() + public function save_dump_mail_in_err($message = '') { global $dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir + // Add message to dolibarr_mail.log + if ($message) { + dol_syslog($message, LOG_DEBUG, 0, '_mail'); + } + + // Move dolibarr_mail.log into a dolibarr_mail.err or dolibarr_mail.date.err $srcfile = $dolibarr_main_data_root."/dolibarr_mail.log"; if (getDolGlobalString('MAIN_MAIL_DEBUG_ERR_WITH_DATE')) { $destfile = $dolibarr_main_data_root."/dolibarr_mail.".dol_print_date(dol_now(), 'dayhourlog', 'gmt').".err"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3d57dc9f50c..dc1f39aa43a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1661,7 +1661,7 @@ function dol_ucwords($string, $encoding = "UTF-8") * On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr * On Linux LOG_ERR=3, LOG_WARNING=4, LOG_NOTICE=5, LOG_INFO=6, LOG_DEBUG=7 * @param int $ident 1=Increase ident of 1 (after log), -1=Decrease ident of 1 (before log) - * @param string $suffixinfilename When output is a file, append this suffix into default log filename. + * @param string $suffixinfilename When output is a file, append this suffix into default log filename. Example '_stripe', '_mail' * @param string $restricttologhandler Force output of log only to this log handler * @param array|null $logcontext If defined, an array with extra informations (can be used by some log handlers) * @return void From d684204bed339fba5573fdc7d30cd5454a8fac56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Mar 2023 16:33:24 +0200 Subject: [PATCH 285/381] Fix use MT rounding for cost price and margin on list of invoice --- htdocs/compta/facture/list.php | 8 ++++---- htdocs/core/lib/functions.lib.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 83b609f91f7..4a7485545a6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2430,7 +2430,7 @@ if ($resql) { } } if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) { - print ''.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : ' ').''.(!empty($multicurrency_totalpay) ? price($multicurrency_totalpay, 0, $langs) : ' ').''; print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ' '); - print ''.price($marginInfo['pa_total']).''.price($marginInfo['pa_total'], 0, $langs, 1, -1, 'MT').''.price($marginInfo['total_margin']).''.price($marginInfo['total_margin'], 0, $langs, 1, -1, 'MT').''; + if (getDolGlobalInt('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->id, $arrayofselected)) { @@ -2407,14 +2407,14 @@ if ($resql) { // Total buying or cost price if (!empty($arrayfields['total_pa']['checked'])) { - print ''.price($marginInfo['pa_total']).''.price($marginInfo['pa_total'], 0, $langs, 1, -1, 'MT').''.price($marginInfo['total_margin']).''.price($marginInfo['total_margin'], 0, $langs, 1, -1, 'MT').''; if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; From 1be9364971ebbcf97b288aa07d39ee2bab935eb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Mar 2023 19:46:01 +0200 Subject: [PATCH 287/381] Look and feel v18 --- htdocs/core/class/html.form.class.php | 48 +++++++++--------- htdocs/holiday/card.php | 72 +++++++++++++++++---------- htdocs/langs/en_US/holiday.lang | 2 +- htdocs/langs/fr_FR/holiday.lang | 4 +- htdocs/theme/eldy/global.inc.php | 2 + htdocs/theme/md/style.css.php | 6 ++- 6 files changed, 80 insertions(+), 54 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1c453d49a8a..8a2ab3e0d42 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -609,22 +609,22 @@ class Form } /** - * Show a text and picto with tooltip on text or picto. + * Show a text and picto with tooltip on text or picto. * Can be called by an instancied $form->textwithtooltip or by a static call Form::textwithtooltip * - * @param string $text Text to show - * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. - * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip sur les 2 - * @param int $direction -1=image is before, 0=no image, 1=image is after - * @param string $img Html code for image (use img_xxx() function to get it) - * @param string $extracss Add a CSS style to td tags - * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param string $incbefore Include code before the text - * @param int $noencodehtmltext Do not encode into html entity the htmltext - * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) - * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) - * @return string Code html du tooltip (texte+picto) - * @see textwithpicto() Use thisfunction if you can. + * @param string $text Text to show + * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. + * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip sur les 2 + * @param int $direction -1=image is before, 0=no image, 1=image is after + * @param string $img Html code for image (use img_xxx() function to get it) + * @param string $extracss Add a CSS style to td tags + * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span + * @param string $incbefore Include code before the text + * @param int $noencodehtmltext Do not encode into html entity the htmltext + * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) + * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) + * @return string Code html du tooltip (texte+picto) + * @see textwithpicto() Use thisfunction if you can. */ public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) { @@ -725,16 +725,16 @@ class Form /** * Show a text with a picto and a tooltip on picto * - * @param string $text Text to show - * @param string $htmltext Content of tooltip - * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon - * @param string $type Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none' - * @param string $extracss Add a CSS style to td, div or span tag - * @param int $noencodehtmltext Do not encode into html entity the htmltext - * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param string $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable') - * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) - * @return string HTML code of text, picto, tooltip + * @param string $text Text to show + * @param string $htmltext Content of tooltip + * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon + * @param string $type Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none' + * @param string $extracss Add a CSS style to td, div or span tag + * @param int $noencodehtmltext Do not encode into html entity the htmltext + * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span + * @param string $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable') + * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) + * @return string HTML code of text, picto, tooltip */ public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0) { diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 3e800760606..d8a25d06842 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1003,27 +1003,6 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''."\n"; print ''."\n"; - if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { - print dol_get_fiche_head('', '', '', -1); - - $out = ''; - $nb_holiday = 0; - $typeleaves = $object->getTypes(1, 1); - foreach ($typeleaves as $key => $val) { - $nb_type = $object->getCPforUser($user->id, $val['rowid']); - $nb_holiday += $nb_type; - - $out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': '.($nb_type ? price2num($nb_type) : 0).'
'; - //$out .= ' - '.$val['label'].': '.($nb_type ?price2num($nb_type) : 0).'
'; - } - print $langs->trans('SoldeCPUser', round($nb_holiday, 5)).'
'; - print $out; - - print dol_get_fiche_end(); - } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) { - print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'
'; - } - print dol_get_fiche_head(); //print ''.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'

'; @@ -1033,14 +1012,57 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { // User for leave request print '
'.$langs->trans("User").''; + print ''.$langs->trans("User").'
'; if ($cancreate && !$cancreateall) { - print img_picto('', 'user').$form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500'); + print img_picto('', 'user').$form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500 inline-block'); //print ''; } else { - print img_picto('', 'user').$form->select_dolusers($fuserid ? $fuserid : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500'); + print img_picto('', 'user').$form->select_dolusers($fuserid ? $fuserid : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500 inline-block'); } + print '
'; + + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { + print '
'; + + $out = ''; + $nb_holiday = 0; + $typeleaves = $object->getTypes(1, 1); + foreach ($typeleaves as $key => $val) { + $nb_type = $object->getCPforUser(($fuserid ? $fuserid : $user->id), $val['rowid']); + $nb_holiday += $nb_type; + + $out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': '.($nb_type ? price2num($nb_type) : 0).'
'; + //$out .= ' - '.$val['label'].': '.($nb_type ?price2num($nb_type) : 0).'
'; + } + print '     '; + + $htmltooltip = $langs->trans("Detail").'
'; + $htmltooltip .= $out; + + print $form->textwithtooltip($langs->trans('SoldeCPUser', round($nb_holiday, 5)).' '.img_picto('', 'help'), $htmltooltip); + + print '
'; + if (!empty($conf->use_javascript_ajax)) { + print ''; + } + } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) { + print '
'; + print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE); + print '
'; + } + print '
'.price2num($obj->stockqty, 5).''.price(price2num($obj->stockqty, 'MS')).'
'; +print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} foreach ($object->fields as $key => $val) { + $searchkey = empty($search[$key]) ? '' : $search[$key]; $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -493,15 +530,15 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; } -// Fields from hook -$parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; // Action column -print ''; -print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} +// Move print ''; print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -558,15 +604,22 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; + $totalarray['nbfield']++; } } // Extra fields -//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + $key = 'nb_of_values'; if (!empty($arrayfields[$key]['checked'])) { print getTitleFieldOfList($arrayfields[$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, 'class="center"', $sortfield, $sortorder, 'center ')."\n"; @@ -575,13 +628,12 @@ $key = 'nb_products'; if (!empty($arrayfields[$key]['checked'])) { print getTitleFieldOfList($arrayfields[$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, 'class="center"', $sortfield, $sortorder, 'center ')."\n"; } -// Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; // Action column -print getTitleFieldOfList('', 0, '', '', '', '', '', '', '', 'linecoledit ')."\n"; -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} +// Move print getTitleFieldOfList('', 0, '', '', '', '', '', '', '', 'linecolmove ')."\n"; print ''."\n"; @@ -600,122 +652,157 @@ $needToFetchEachLine = 0; // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen } + // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; - - if (!empty($arrayfields['t.' . $key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; if (!$i) { $totalarray['nbfield']++; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + } + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; + } + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '') . 'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.' . $key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.' . $key])) { + $totalarray['val']['t.' . $key] = 0; + } + $totalarray['val']['t.' . $key] += $object->$key; } - if (!isset($totalarray['val']['t.' . $key])) { - $totalarray['val']['t.' . $key] = 0; - } - $totalarray['val']['t.' . $key] += $object->$key; } } - } - // Extra fields - //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - $key = 'nb_of_values'; - if (!empty($arrayfields[$key]['checked'])) { - print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + $key = 'nb_products'; + if (!empty($arrayfields[$key]['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Move + print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - $key = 'nb_products'; - if (!empty($arrayfields[$key]['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Fields from hook - $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print '' . "\n"; + print '' . "\n"; + } $i++; } @@ -737,7 +824,7 @@ if ($num == 0) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ''."\n"; From 230759ca1448a6d1c0449e125bfed1b50a3c3f81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 01:14:48 +0200 Subject: [PATCH 294/381] Fix #24391 --- htdocs/product/fournisseurs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 0604ec6a6d0..a6922471bd1 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -1106,7 +1106,7 @@ END; // Date from if (!empty($arrayfields['pfp.datec']['checked'])) { - print '
'.dol_print_date(($productfourn->fourn_date_creation ? $productfourn->fourn_date_creation : $productfourn->date_creation), 'dayhour').''.dol_print_date(($productfourn->fourn_date_creation ? $productfourn->fourn_date_creation : $productfourn->date_creation), 'dayhour', 'tzuserrel').'
'."\n"; @@ -246,11 +283,16 @@ print ''."\n"; print '
'."\n"; + +print '
'; + + print ''."\n"; print ''."\n"; print '
'; + htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index cc7b6bb8e01..503fa69a730 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -475,6 +475,7 @@ if (empty($reshook) && $action == 'add') { } } } + if (!$error) { $db->commit(); @@ -540,30 +541,61 @@ $formcompany = new FormCompany($db); llxHeaderVierge($langs->trans("NewSuggestionOfBooth")); + +print '
'; +print '
'; + print '
'; // Event summary print '
'; -print ''.$project->title.'
'; -print img_picto('', 'calendar', 'class="pictofixedwidth"').$langs->trans("Date").': '; -print dol_print_date($project->date_start, 'daytext'); -if ($project->date_end && $project->date_start != $project->date_end) { - print ' - '.dol_print_date($project->date_end, 'daytext'); -} +print ''.dol_escape_htmltag($project->title . ' '. $project->label).'
'; print '

'."\n"; -//print $langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; -//print $project->note_public."\n"; +print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; +print $project->note_public."\n"; //print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx'; print '
'; +// Help text +print '
'; + +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->date_start_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_start_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_start_event, $format); +} +if ($project->date_start_event && $project->date_end_event) { + print ' - '; +} +if ($project->date_end_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_end_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_end_event, $format); +} +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->location) { + print ''.dol_escape_htmltag($project->location).'
'; +} + +print '
'; + +print '
'; + print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, 0, 'center'); -print '
'; -print '
'; -print '
'; - dol_htmloutput_errors($errmsg); // Print form @@ -574,7 +606,6 @@ print ''; print ''; print ''; -print '
'; print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; @@ -614,8 +645,7 @@ print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'se print ''; // Country print ''.$langs->trans('Country'); -print '*'; - +print '*'; print ''; $country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { @@ -668,7 +698,6 @@ print '
'; print '

'; - print "\n"; print "
"; print '
'; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 5078164f6ce..9418e7640eb 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -70,8 +70,8 @@ $email = GETPOST("email"); $societe = GETPOST("societe"); $label = GETPOST("label"); $note = GETPOST("note"); -$datestart = GETPOST("datestart"); -$dateend = GETPOST("dateend"); +$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int')); +$dateend = dol_mktime(23, 59, 59, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int')); $id = GETPOST('id'); @@ -452,6 +452,7 @@ if (empty($reshook) && $action == 'add') { } } } + if (!$error) { $db->commit(); $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); @@ -473,29 +474,60 @@ $formcompany = new FormCompany($db); llxHeaderVierge($langs->trans("NewSuggestionOfConference")); + +print '
'; +print '
'; + print '
'; // Event summary print '
'; -print ''.$project->title.'
'; -print img_picto('', 'calendar', 'class="pictofixedwidth"').$langs->trans("Date").': '; -print dol_print_date($project->date_start, 'daytext'); -if ($project->date_end && $project->date_start != $project->date_end) { - print ' - '.dol_print_date($project->date_end, 'daytext'); -} +print ''.dol_escape_htmltag($project->title . ' '. $project->label).'
'; print '

'."\n"; -//print $langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; -//print $project->note_public."\n"; +print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; +print $project->note_public."\n"; //print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx'; print '
'; +// Help text +print '
'; + +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->date_start_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_start_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_start_event, $format); +} +if ($project->date_start_event && $project->date_end_event) { + print ' - '; +} +if ($project->date_end_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_end_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_end_event, $format); +} +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->location) { + print ''.dol_escape_htmltag($project->location).'
'; +} + +print '
'; + +print '
'; print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center'); -print '
'; -print '
'; -print '
'; dol_htmloutput_errors($errmsg, $errors); @@ -507,8 +539,6 @@ print ''; print ''; print ''; -print '
'; - print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; @@ -584,10 +614,10 @@ print ''.$langs->trans("Format").'*'."\n" print ''.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).''; // Label print ''.$langs->trans("LabelOfconference").'*'."\n"; -print ''."\n"; +print ''."\n"; // Note print ''.$langs->trans("Description").'*'."\n"; -print ''."\n"; +print ''."\n"; print "\n"; From d388ac58beac00a71a6317f90bb89de7a06f09b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 13:31:23 +0200 Subject: [PATCH 307/381] Fix public pages --- .../public/eventorganization/attendee_new.php | 53 ++++---- htdocs/public/project/index.php | 118 ++++++++++++++++-- htdocs/public/project/suggestbooth.php | 61 ++++++--- htdocs/public/project/suggestconference.php | 68 +++++++--- 4 files changed, 234 insertions(+), 66 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index a345897070c..1b9a555f246 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -1,5 +1,6 @@ + * Copyright (C) 2023 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -680,22 +681,25 @@ $formcompany = new FormCompany($db); llxHeaderVierge($langs->trans("NewRegistration")); -print '
'; -print load_fiche_titre($langs->trans("NewRegistration"), '', '', 0, 0, 'center'); - print '
'; print '
'; -print '
'; +// Sub banner +print '
'; +print load_fiche_titre($langs->trans("NewRegistration"), '', '', 0, 0, 'center'); // Welcome message print ''.$langs->trans("EvntOrgWelcomeMessage").''; print '
'; - // Title -print ''.dol_escape_htmltag($project->title . ' '. $conference->label).'
'; +print ''.dol_escape_htmltag($project->title . ' '. $conference->label).'
'; +print '
'; + +// Help text +print '
'; + if ($project->date_start_event || $project->date_end_event) { - print '
'; + print '
'; } if ($project->date_start_event) { $format = 'day'; @@ -720,29 +724,31 @@ if ($project->date_start_event || $project->date_end_event) { print '
'; } if ($project->location) { - print ''.dol_escape_htmltag($project->location).'
'; + print ''.dol_escape_htmltag($project->location).'
'; } +print '
'; + + $maxattendees = 0; if ($conference->id > 0) { /* date of project is not date of event so commented - print $langs->trans("Date").': '; - print dol_print_date($conference->datep); - if ($conference->date_end) { - print ' - '; - print dol_print_date($conference->datef); - }*/ + print $langs->trans("Date").': '; + print dol_print_date($conference->datep); + if ($conference->date_end) { + print ' - '; + print dol_print_date($conference->datef); + }*/ } else { /* date of project is not date of event so commented - print $langs->trans("Date").': '; - print dol_print_date($project->date_start); - if ($project->date_end) { - print ' - '; - print dol_print_date($project->date_end); - }*/ + print $langs->trans("Date").': '; + print dol_print_date($project->date_start); + if ($project->date_end) { + print ' - '; + print dol_print_date($project->date_end); + }*/ $maxattendees = $project->max_attendees; // Max attendeed for the project/event } -print '
'; if ($maxattendees && $currentnbofattendees >= $maxattendees) { print '
'; @@ -884,12 +890,15 @@ if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS print "\n"; print "
"; - print '
'; } } else { + print '

'; print $langs->trans("ConferenceIsNotConfirmed"); + print '

'; } +print '
'; + llxFooterVierge(); $db->close(); diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index dfcfde94b17..3488fe8e4c4 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -124,10 +124,14 @@ $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $langs->trans("SuggestForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); + + +llxHeaderVierge($langs->trans("SuggestForm")); + print ''."\n"; print '
'."\n"; + print '
'."\n"; print ''."\n"; print ''."\n"; @@ -150,7 +154,7 @@ if (!empty($conf->global->$paramlogo)) { } elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) { $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; } -//print ''."\n"; +//print '- Show logo (logosmall='.$logosmall.' logo='.$logo.') '."\n"; // Define urllogo $urllogo = ''; $urllogofull = ''; @@ -184,21 +188,55 @@ if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_ORGANIZEDEVENT)) { print '
'; +print '
'; +print '
'; + + // Event summary print '
'; -print ''.$project->title.'
'; -print img_picto('', 'calendar', 'class="pictofixedwidth"').$langs->trans("Date").': '; -print dol_print_date($project->date_start, 'daytext'); -if ($project->date_end && $project->date_start != $project->date_end) { - print ' - '.dol_print_date($project->date_end, 'daytext'); -} +print ''.dol_escape_htmltag($project->title . ' '. $project->label).'
'; print '

'."\n"; -print $langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; +print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; print $project->note_public."\n"; //print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx'; print '
'; +// Help text +print '
'; + +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->date_start_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_start_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_start_event, $format); +} +if ($project->date_start_event && $project->date_end_event) { + print ' - '; +} +if ($project->date_end_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_end_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_end_event, $format); +} +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->location) { + print ''.dol_escape_htmltag($project->location).'
'; +} + +print '
'; + + print '
'; print ''."\n"; @@ -245,6 +283,10 @@ print ''."\n"; print '
'."\n"; + +print '
'; + + print '
'."\n"; print '
'."\n"; print '
'; @@ -255,3 +297,61 @@ htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); $db->close(); + + + +/** + * Show header for new member + * + * @param string $title Title + * @param string $head Head array + * @param int $disablejs More content into html header + * @param int $disablehead More content into html header + * @param array $arrayofjs Array of complementary js files + * @param array $arrayofcss Array of complementary css files + * @return void + */ +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') +{ + global $user, $conf, $langs, $mysoc; + + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + + print ''; + + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } + + print '
'; + + // Output html code for logo + if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; + } + + if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE)) { + print '
'; + print ''; + print '
'; + } + + print '
'; + + print '
'; +} diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 0b2e24716d5..772822374d4 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -477,6 +477,7 @@ if (empty($reshook) && $action == 'add') { } } } + if (!$error) { $db->commit(); @@ -542,30 +543,61 @@ $formcompany = new FormCompany($db); llxHeaderVierge($langs->trans("NewSuggestionOfBooth")); + +print '
'; +print '
'; + print '
'; // Event summary print '
'; -print ''.$project->title.'
'; -print img_picto('', 'calendar', 'class="pictofixedwidth"').$langs->trans("Date").': '; -print dol_print_date($project->date_start, 'daytext'); -if ($project->date_end && $project->date_start != $project->date_end) { - print ' - '.dol_print_date($project->date_end, 'daytext'); -} +print ''.dol_escape_htmltag($project->title . ' '. $project->label).'
'; print '

'."\n"; -//print $langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; -//print $project->note_public."\n"; +print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; +print $project->note_public."\n"; //print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx'; print '
'; +// Help text +print '
'; + +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->date_start_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_start_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_start_event, $format); +} +if ($project->date_start_event && $project->date_end_event) { + print ' - '; +} +if ($project->date_end_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_end_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_end_event, $format); +} +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->location) { + print ''.dol_escape_htmltag($project->location).'
'; +} + +print '
'; + +print '
'; + print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, 0, 'center'); -print '
'; -print '
'; -print '
'; - dol_htmloutput_errors($errmsg); // Print form @@ -576,7 +608,6 @@ print ''; print ''; print ''; -print '
'; print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; @@ -616,8 +647,7 @@ print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'se print ''; // Country print ''.$langs->trans('Country'); -print '*'; - +print '*'; print ''; $country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { @@ -670,7 +700,6 @@ print '
'; print '

'; - print "\n"; print "
"; print '
'; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index b3418ec9e84..77196c8c6fa 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -72,8 +72,8 @@ $email = GETPOST("email"); $societe = GETPOST("societe"); $label = GETPOST("label"); $note = GETPOST("note"); -$datestart = GETPOST("datestart"); -$dateend = GETPOST("dateend"); +$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int')); +$dateend = dol_mktime(23, 59, 59, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int')); $id = GETPOST('id'); @@ -454,6 +454,7 @@ if (empty($reshook) && $action == 'add') { } } } + if (!$error) { $db->commit(); $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); @@ -475,29 +476,60 @@ $formcompany = new FormCompany($db); llxHeaderVierge($langs->trans("NewSuggestionOfConference")); + +print '
'; +print '
'; + print '
'; // Event summary print '
'; -print ''.$project->title.'
'; -print img_picto('', 'calendar', 'class="pictofixedwidth"').$langs->trans("Date").': '; -print dol_print_date($project->date_start, 'daytext'); -if ($project->date_end && $project->date_start != $project->date_end) { - print ' - '.dol_print_date($project->date_end, 'daytext'); -} +print ''.dol_escape_htmltag($project->title . ' '. $project->label).'
'; print '

'."\n"; -//print $langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; -//print $project->note_public."\n"; +print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; +print $project->note_public."\n"; //print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx'; print '
'; +// Help text +print '
'; + +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->date_start_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_start_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_start_event, $format); +} +if ($project->date_start_event && $project->date_end_event) { + print ' - '; +} +if ($project->date_end_event) { + $format = 'day'; + $tmparray = dol_getdate($project->date_end_event, false, ''); + if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) { + $format = 'dayhour'; + } + print dol_print_date($project->date_end_event, $format); +} +if ($project->date_start_event || $project->date_end_event) { + print '
'; +} +if ($project->location) { + print ''.dol_escape_htmltag($project->location).'
'; +} + +print '
'; + +print '
'; print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center'); -print '
'; -print '
'; -print '
'; dol_htmloutput_errors($errmsg, $errors); @@ -509,8 +541,6 @@ print ''; print ''; print ''; -print '
'; - print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; @@ -585,11 +615,11 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''.$langs->trans("Format").'*'."\n"; print ''.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).''; // Label -print ''.$langs->trans("LabelOfconference").'*'."\n"; -print ''."\n"; +print ''.$langs->trans("LabelOfconference").'*'."\n"; +print ''."\n"; // Note -print ''.$langs->trans("Description").'*'."\n"; -print ''."\n"; +print ''.$langs->trans("Description").'*'."\n"; +print ''."\n"; print "\n"; From 3fdec7cecf647a21af9997eb6c72a199872131a9 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 31 Mar 2023 15:36:16 +0200 Subject: [PATCH 308/381] FIX - PDF Espadon => display extrafields --- .../modules/expedition/doc/pdf_espadon.modules.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 12f20d74d7e..9a1cac5fecc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -394,20 +394,20 @@ class pdf_espadon extends ModelePdfExpedition $label .= $object->tracking_url; } - $height_trackingnumber += 6; + $height_trackingnumber += 4; $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1, false, true, 'L'); - $tab_top = $pdf->GetY(); } } + $tab_top = $pdf->GetY(); } // Notes $pagenb = $pdf->getPage(); if (!empty($notetoshow) || !empty($object->tracking_number)) { - $tab_top -= 2; + $tab_top -= 1; $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite; $pageposbeforenote = $pagenb; @@ -476,7 +476,7 @@ class pdf_espadon extends ModelePdfExpedition $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter) + $height_trackingnumber + 1; $tab_top_newpage = $tab_topbeforetrackingnumber; } - $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); + $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 2); } else { if (empty($height_trackingnumber)) { $height_note = $this->page_hauteur - ($tab_top + $heightforfooter); @@ -484,7 +484,7 @@ class pdf_espadon extends ModelePdfExpedition $height_note = $this->page_hauteur - ($tab_top + $heightforfooter)+ $height_trackingnumber + 1; $tab_top = $tab_topbeforetrackingnumber; } - $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 2); } // Add footer @@ -510,7 +510,7 @@ class pdf_espadon extends ModelePdfExpedition $height_note = $posyafter - $tab_top + $height_trackingnumber + 1; $tab_top = $tab_topbeforetrackingnumber; } - $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1); + $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 2); if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) { From 96d23fac5f9fa8fa307e8c8cc50af3115a9257fa Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:57:03 +0200 Subject: [PATCH 309/381] FIX: project referent elements list: conf to hide tasks was flipped --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 935275bfe54..1bdefbcc1e6 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -580,7 +580,7 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'buttonnew'=>'AddTimeSpent', 'testnew'=>$user->hasRight('project', 'creer'), - 'test'=>!empty($conf->project->enabled) && $user->hasRight('projet', 'lire') && !empty($conf->global->PROJECT_HIDE_TASKS)), + 'test'=>!empty($conf->project->enabled) && $user->hasRight('projet', 'lire') && empty($conf->global->PROJECT_HIDE_TASKS)), 'stock_mouvement'=>array( 'name'=>"MouvementStockAssociated", 'title'=>"ListMouvementStockProject", From 3f4879d494a50c261f526651b5328afed4c2da00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20de=20Grandpr=C3=A9?= Date: Fri, 31 Mar 2023 13:41:29 -0400 Subject: [PATCH 310/381] Read of correct global variable --- htdocs/adherents/admin/member.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index f9e15e88fca..5a562fec537 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -511,7 +511,7 @@ foreach ($dirmodels as $reldir) { // Defaut print ''; - if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) { + if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; From 89aa79058c6cfb8d794134a1df9f987c1d24a52e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Mar 2023 19:47:52 +0200 Subject: [PATCH 311/381] Code comment --- htdocs/core/lib/pdf.lib.php | 2 +- .../mysql/tables/llx_commande_fournisseur_dispatch.sql | 6 +++--- .../llx_commande_fournisseur_dispatch_extrafields.sql | 1 + htdocs/install/mysql/tables/llx_expeditiondet.sql | 1 + htdocs/install/mysql/tables/llx_expeditiondet_batch.sql | 4 +++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4e2d5e37242..03e816a63f9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1667,7 +1667,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, // Show information for lot if (!empty($dbatch)) { // $object is a shipment. - //var_dump($object->lines[$i]->details_entrepot); // array from llx_expeditiondet (we can have seral lines for one fk_origin_line) + //var_dump($object->lines[$i]->details_entrepot); // array from llx_expeditiondet (we can have several lines for one fk_origin_line) //var_dump($object->lines[$i]->detail_batch); // array from llx_expeditiondet_batch (each line with a lot is linked to llx_expeditiondet) include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index 058a74eea19..869225a534c 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -18,9 +18,9 @@ -- particular supplier order. A movement with same information is also done -- into stock_movement so this table may be useless. -- --- Detail of each lines of a reception (qty, batch and into wich warehouse is --- received a purchase order line). --- This table should be also name llx_receptiondet. +-- Detail of each lines of a reception (qty, batch and into which warehouse must be +-- received or has been receveived a purchase order line). +-- This table should have been named llx_receptiondet_batch -- =================================================================== create table llx_commande_fournisseur_dispatch diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql index 2c85521ea84..d8720358cec 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql @@ -14,6 +14,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- This table should have been named llx_receptiondet_batch_extrafields -- =================================================================== create table llx_commande_fournisseur_dispatch_extrafields diff --git a/htdocs/install/mysql/tables/llx_expeditiondet.sql b/htdocs/install/mysql/tables/llx_expeditiondet.sql index 4a8a5423ce3..cccee9e5747 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet.sql @@ -16,6 +16,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- doe not contains the batch -- =================================================================== create table llx_expeditiondet diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql index 43b64451364..a4bd120503d 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql @@ -14,7 +14,9 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- Similar for supplier to llx_commande_fournisseur_dispatch=llx_receptiondet_batch -- ============================================================================ + CREATE TABLE llx_expeditiondet_batch ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_expeditiondet int NOT NULL, @@ -22,6 +24,6 @@ CREATE TABLE llx_expeditiondet_batch ( sellby date DEFAULT NULL, batch varchar(128) DEFAULT NULL, qty double NOT NULL DEFAULT '0', - fk_origin_stock integer NOT NULL + fk_origin_stock integer NOT NULL -- id into table llx_product_batch (may be renamed into llx_product_stock_batch in another version). TODO We should add and use instead a fk_warehouse field ) ENGINE=innodb; From ae7b31e71627f4206317be91a44427cd05b34668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20de=20Grandpr=C3=A9?= Date: Fri, 31 Mar 2023 17:31:20 -0400 Subject: [PATCH 312/381] Fix #24410 - No $resql overwrite --- htdocs/core/lib/functions2.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2eda8cbbdcc..ce639624f1a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1936,14 +1936,14 @@ function getListOfModels($db, $type, $maxfilenamelength = 0) $sql .= " ORDER BY description DESC"; dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); + $resql_models = $db->query($sql); + if ($resql_models) { + $num = $db->num_rows($resql_models); $i = 0; while ($i < $num) { $found = 1; - $obj = $db->fetch_object($resql); + $obj = $db->fetch_object($resql_models); // If this generation module needs to scan a directory, then description field is filled // with the constant that contains list of directories to scan (COMPANY_ADDON_PDF_ODT_PATH, ...). From 6a470dbcf7110f4b0c615b961b5ce12b541a39c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Apr 2023 12:05:29 +0200 Subject: [PATCH 313/381] Kanban on inventory list. Look and feel v18 --- htdocs/admin/emailcollector_list.php | 2 +- htdocs/bom/bom_list.php | 4 +- htdocs/bookcal/availabilities_list.php | 4 +- htdocs/bookcal/booking_list.php | 4 +- .../compta/cashcontrol/cashcontrol_list.php | 4 +- .../conferenceorbooth_list.php | 2 +- htdocs/hrm/job_list.php | 4 +- htdocs/hrm/position_list.php | 4 +- htdocs/hrm/skill_list.php | 2 +- .../knowledgerecord_list.php | 2 +- .../modulebuilder/template/myobject_list.php | 3 +- htdocs/partnership/partnership_list.php | 2 +- .../inventory/class/inventory.class.php | 52 +++- htdocs/product/inventory/list.php | 291 +++++++++++------- htdocs/product/stock/productlot_list.php | 4 +- .../recruitmentcandidature_list.php | 2 +- htdocs/variants/list.php | 2 +- 17 files changed, 245 insertions(+), 143 deletions(-) diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index b58bb5bb15d..ccee1f604b2 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -597,7 +597,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index a12bd7fdb2d..065a3a578b7 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -728,8 +728,8 @@ while ($i < $imaxinloop) { } if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php index 208190aaad5..fd5866eaff8 100644 --- a/htdocs/bookcal/availabilities_list.php +++ b/htdocs/bookcal/availabilities_list.php @@ -682,8 +682,8 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index 033c8ec121f..e030a52b7e3 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -682,8 +682,8 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index a050cf7ffec..1333a6b2346 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -622,8 +622,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 5892cda191b..17b0bc2e570 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -933,7 +933,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index dad366d14f1..3616c696d54 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -650,8 +650,8 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index 4644382416e..3f605a84d4a 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -678,8 +678,8 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index 07084815b13..b11af391ae2 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -673,7 +673,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index 7e12bee4dc4..2b1b67c82e2 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -710,7 +710,7 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { print ' title="'.dol_escape_htmltag(dol_nl2br($object->$key, 1)).'"'; // We add dol_nl2br for the question and answer fields } print '>'; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 8af27e60caf..a1fcce9092a 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -630,6 +630,7 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; @@ -752,7 +753,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index f03608929a5..7259ae0ff2b 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -914,7 +914,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 9acc4232490..80189f29845 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -98,19 +98,19 @@ class Inventory extends CommonObject */ public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), - 'ref' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Reference of object', 'css'=>'maxwidth200'), + 'ref' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Reference of object', 'css'=>'maxwidth150'), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), - 'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax200'), - 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'get_name_url_params' => '0::0:-1:0::1', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), + 'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax150'), + 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax150'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'get_name_url_params' => '0::0:-1:0::1', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax150'), 'categories_product' => array('type'=>'chkbxlst:categorie:label:rowid::type=0:0:', 'label'=>'OrProductsWithCategories', 'visible'=>3, 'enabled'=>1, 'position'=>33, 'help'=>'', 'picto'=>'category', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx'), 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35, 'csslist'=>'nowraponall'), // This date is not used so disabled by default. 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500, 'csslist'=>'nowraponall'), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501, 'csslist'=>'nowraponall'), 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502, 'csslist'=>'nowraponall'), - 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax200'), - 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511, 'csslist'=>'tdoverflowmax200'), - 'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512, 'csslist'=>'tdoverflowmax200'), + 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150'), + 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511, 'csslist'=>'tdoverflowmax150'), + 'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512, 'csslist'=>'tdoverflowmax150'), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>4, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed', 9=>'Canceled')) ); @@ -648,6 +648,44 @@ class Inventory extends CommonObject return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode); } + /** + * Return a thumb for kanban views + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array $arraydata Array of data + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '', $arraydata = null) + { + global $conf, $langs; + + $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); + + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + $return .= ''; + if (property_exists($this, 'label')) { + $return .= '
'.$this->label.'
'; + } + if (property_exists($this, 'amount')) { + $return .= '
'; + $return .= ''.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(3).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + + return $return; + } + /** * Charge les informations d'ordre info dans l'objet commande * diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index fda3f60602b..d1d5f542b0d 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -40,9 +40,10 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'inventorylist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOST('id', 'int'); @@ -51,8 +52,8 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { - // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; @@ -112,11 +113,11 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = (int) dol_eval($val['visible'], 1, 1, '1'); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -202,9 +203,9 @@ $form = new Form($db); $now = dol_now(); +$title = $langs->trans('Inventories'); //$help_url="EN:Module_Inventory|FR:Module_Inventory_FR|ES:Módulo_Inventory"; $help_url = ''; -$title = $langs->trans('ListOfInventories'); $morejs = array(); $morecss = array(); @@ -221,7 +222,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); @@ -233,7 +234,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array } // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; @@ -253,17 +254,17 @@ foreach ($search as $key => $val) { $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } @@ -305,18 +306,19 @@ if (!empty($searchCategoryProductList)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; /* If a group by is required $sql.= " GROUP BY "; -foreach($object->fields as $key => $val) -{ - $sql .= "t.".$key.", "; +foreach($object->fields as $key => $val) { + $sql .= "t.".$db->escape($key).", "; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); + } } // Add where from hooks $parameters=array(); @@ -325,7 +327,7 @@ $sql.=$hookmanager->resPrint; $sql=preg_replace('/,\s*$/','', $sql); */ -/// Count total nb of records +// Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ @@ -372,23 +374,32 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ // Output page // -------------------------------------------------------------------- -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if ($skey != '') { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } } - } else { + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); + } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } @@ -402,7 +413,7 @@ foreach ($searchCategoryProductList as $searchCategoryProduct) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -412,7 +423,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -431,8 +442,14 @@ print ''; print ''; print ''; print ''; +print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/inventory/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitleSeparator(); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/inventory/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -444,10 +461,13 @@ $trackid = 'stockinv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'."\n"; } $moreforfilter = ''; @@ -469,7 +489,7 @@ if (!empty($conf->global->MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS) && isModEnabled } $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -479,11 +499,14 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '
'; print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
'; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -492,15 +515,16 @@ print ''; +print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } foreach ($object->fields as $key => $val) { + $searchkey = empty($search[$key]) ? '' : $search[$key]; $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -508,17 +532,15 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; } @@ -535,17 +563,19 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- @@ -553,6 +583,7 @@ print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); @@ -562,22 +593,25 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; + $totalarray['nbfield']++; } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } print ''."\n"; @@ -586,7 +620,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if ($val && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } @@ -595,9 +629,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -606,88 +642,115 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + print $object->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print ''; + print ''; } - - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; if (!$i) { $totalarray['nbfield']++; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; - } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); - } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; - } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print ''."\n"; + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print '$key)) { + print ' title="'.dol_escape_htmltag($object->$key).'"'; + } + print '>'; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + print ''."\n"; + } $i++; } @@ -704,14 +767,14 @@ if ($num == 0) { $colspan++; } } - print ''; + print ''; } $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; + print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); - } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - print ''; + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
'; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -526,6 +548,12 @@ foreach ($object->fields as $key => $val) { print '
'; print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; + } elseif ($key == 'lang') { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin = new FormAdmin($db); + print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); + } else { + print ''; } print '
'; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; + } + // Output Kanban + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($object->id, $arrayofselected)) { $selected = 1; } - print ''; } - print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - print ''; - } - print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'.$langs->trans("NoRecordFound").'
'.$langs->trans("NoRecordFound").'
'."\n"; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 302a02ba108..ef6315446aa 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -639,8 +639,8 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 789e9564c87..ce30277a82e 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -800,7 +800,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index 8464ecc5bee..87925eda11a 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -722,7 +722,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.' . $key]['checked'])) { print '$key)) { print ' title="'.dol_escape_htmltag($object->$key).'"'; } print '>'; From e3ed7b47d609cf93c97ac8c22b9d9df5731bd79a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Apr 2023 13:17:42 +0200 Subject: [PATCH 314/381] Code comment --- htdocs/install/mysql/tables/llx_ticket-ticket.key.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql index d4805d8a788..858f7c7eec5 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql @@ -21,3 +21,8 @@ ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_soc (fk_soc); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_user_assign (fk_user_assign); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_project (fk_project); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_statut (fk_statut); + +-- Idea for better perf to get last num of ticket on large databases +--ALTER TABLE llx_ticket ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TS' THEN CAST(SUBSTRING(ref FROM 8) AS SIGNED) ELSE 0 END) PERSISTENT; +--ALTER TABLE llx_ticket ADD INDEX idx_calculated_numrefonly (calculated_numrefonly); +--Then, the numering module can use the column calculated_numrefonly to get the max with SELECT MAX(calculated_numrefonly) FROM llx_ticket From b73f746f57327b31ba37e6902fc1e7a4fbd1a25c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Apr 2023 13:42:45 +0200 Subject: [PATCH 315/381] Update card.php --- htdocs/compta/paiement/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 3609c10bfd1..ee75a51ac43 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -367,7 +367,7 @@ if ($resql) { print ''.$langs->trans('Entity').''; } //Add Margin - if (!empty($conf->margin->enabled)) { + if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) { print ''.$langs->trans('Margin').''; } print ''.$langs->trans('ExpectedToPay').''; @@ -386,7 +386,7 @@ if ($resql) { $invoice->fetch($objp->facid); // Add Margin - if (!empty($conf->margin->enabled)) { + if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) { $formmargin = new FormMargin($db); $marginInfo = array(); $invoice->fetch_lines(); @@ -420,7 +420,7 @@ if ($resql) { } // Add margin - if (!empty($conf->margin->enabled)) { + if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) { print ''.price($marginInfo['total_margin']).''; } From 7525aea76c3c93920a9a02f0105781dc4841ea1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Apr 2023 14:38:07 +0200 Subject: [PATCH 316/381] Debug v18 --- htdocs/core/ajax/ajaxtooltip.php | 2 +- htdocs/core/class/commonobject.class.php | 1 + htdocs/core/lib/functions.lib.php | 7 +++++++ htdocs/core/lib/security.lib.php | 3 +++ htdocs/product/class/productbatch.class.php | 3 ++- htdocs/product/stock/class/entrepot.class.php | 9 ++++++--- .../product/stock/class/productlot.class.php | 18 ++++++++++-------- htdocs/reception/card.php | 18 +++++++++++------- 8 files changed, 41 insertions(+), 20 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 9a4d42ce5bb..33cdfb4831f 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -53,7 +53,7 @@ if (GETPOSTISSET('option')) { // Load object according to $element $object = fetchObjectByElement($id, $objecttype); if (empty($object->element)) { - httponly_accessforbidden('Failed to get object from objecttype='.$objecttype.' id='.$id); + httponly_accessforbidden('Failed to get object with fetchObjectByElement(id='.$id.', objectype='.$objecttype.')'); } $module = $object->module; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c0fc7805bec..44e2b280391 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -735,6 +735,7 @@ abstract class CommonObject $datas = $this->getTooltipContentArray($params); + // Add extrafields if (!empty($extrafields->attributes[$this->table_element]['label'])) { if (count($extrafields->attributes[$this->table_element]['label']) < $MAX_EXTRAFIELDS_TO_SHOW_IN_TOOLTIP) { foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f6b39d1784a..a16cc34fd10 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11350,6 +11350,13 @@ function getElementProperties($element_type) } elseif ($element_type == 'salary') { $classpath = 'salaries/class'; $module = 'salaries'; + } elseif ($element_type == 'productlot') { + $module = 'productbatch'; + $classpath = 'product/stock/class'; + $classfile = 'productlot'; + $classname = 'Productlot'; + $element = 'productlot'; + $subelement = ''; } if (empty($classfile)) { diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 4fdd85f3f24..2fe9460e822 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -399,6 +399,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($features == 'product') { $features = 'produit'; } + if ($features == 'productbatch') { + $features = 'produit'; + } if ($features == 'fournisseur') { // When vendor invoice and pruchase order are into module 'fournisseur' $features = 'fournisseur'; $feature2 = ''; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 750e5d5bd7c..46c6c219f7f 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -19,7 +19,8 @@ /** * \file product/class/productbatch.class.php * \ingroup productbatch - * \brief Manage record and specific data for batch number management + * \brief Manage record and specific data for batch number management. + * Manage table llx_product_batch (should have been named product_stock_batch) */ require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 8ecbce06cde..ff239307f02 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -696,14 +696,17 @@ class Entrepot extends CommonObject /** * getTooltipContentArray - * @param array $params params to construct tooltip data - * @since v18 - * @return array + * + * @param array $params Params to construct tooltip data + * @since v18 + * @return array */ public function getTooltipContentArray($params) { global $conf, $langs, $user; + $langs->load('stocks'); + $datas = []; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { return ['optimize' => $langs->trans("Warehouse")]; diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index da2f412af17..6818c5b8335 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -877,9 +877,10 @@ class Productlot extends CommonObject /** * getTooltipContentArray - * @param array $params params to construct tooltip data - * @since v18 - * @return array + * + * @param array $params Params to construct tooltip data + * @since v18 + * @return array */ public function getTooltipContentArray($params) { @@ -887,18 +888,19 @@ class Productlot extends CommonObject $langs->loadLangs(['stocks', 'productbatch']); - $datas = []; $option = $params['option'] ?? ''; - $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Batch").''; - $datas['divopen'] = '
'; - $datas['batch'] = ''.$langs->trans('Batch').': '.$this->batch; + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Batch").''; + //$datas['divopen'] = '
'; + $datas['batch'] = '
'.$langs->trans('Batch').': '.$this->batch; if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) { $datas['eatby'] = '
'.$langs->trans('EatByDate').': '.dol_print_date($this->eatby, 'day'); } if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) { $datas['sellby'] = '
'.$langs->trans('SellByDate').': '.dol_print_date($this->sellby, 'day'); } - $datas['divclose'] = '
'; + //$datas['divclose'] = '
'; return $datas; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 4c911d64560..3059bac5f4e 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1655,7 +1655,7 @@ if ($action == 'create') { '; } - print '
'; + print '

'; print '
'; print ''; @@ -1888,8 +1888,8 @@ if ($action == 'create') { } } } + print ''; } - print ''; if ($action == 'editline' && $lines[$i]->id == $line_id) { // edit mode @@ -1904,7 +1904,7 @@ if ($action == 'create') { print ''; // Batch number managment if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) { - print ''; } elseif ($object->statut == Reception::STATUS_DRAFT) { // edit-delete buttons print '
'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'
'; + print '

'; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print $langs->trans('SellByDate').' : '; print $form->selectDate($lines[$i]->sellby, 'dlc'.$line_id, '', '', 1, "").'
'; @@ -1998,9 +1998,10 @@ if ($action == 'create') { if ($action == 'editline' && $lines[$i]->id == $line_id) { - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; + print '
'; @@ -2024,7 +2025,10 @@ if ($action == 'create') { // Display lines extrafields $extralabelslines = $extrafields->attributes[$lines[$i]->table_element]; if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) { - $colspan = empty($conf->productbatch->enabled) ? 8 : 9; + $colspan = 8; + if (isModEnabled('stock')) { $colspan++; } + if (isModEnabled('productbatch')) { $colspan++; } + $line = new CommandeFournisseurDispatch($db); $line->id = $lines[$i]->id; $line->fetch_optionals(); From 6c589955a679506792676256fe992dff30c0054a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Apr 2023 15:00:54 +0200 Subject: [PATCH 317/381] FIX Autofill / clear qty in inventory page --- htdocs/product/inventory/inventory.php | 1516 ++++++++++++------------ 1 file changed, 761 insertions(+), 755 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 506b6e0c198..5f72928ed13 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -428,772 +428,779 @@ $help_url = ''; llxHeader('', $langs->trans('Inventory'), $help_url); // Part to show record -if ($object->id > 0) { - $res = $object->fetch_optionals(); - - $head = inventoryPrepareHead($object); - print dol_get_fiche_head($head, 'inventory', $langs->trans("Inventory"), -1, 'stock'); - - $formconfirm = ''; - - // Confirmation to delete - if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1); - } - // Confirmation to delete line - if ($action == 'deleteline') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid.'&page='.$page.$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); - } - - // Clone confirmation - if ($action == 'clone') { - // Create an array for form - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); - } - - // Confirmation to close - if ($action == 'record') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1); - $action = 'view'; - } - - // Confirmation to close - if ($action == 'confirm_cancel') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancel'), 'cancel_record', '', 0, 1); - $action = 'view'; - } - - // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $formconfirm .= $hookmanager->resPrint; - } elseif ($reshook > 0) { - $formconfirm = $hookmanager->resPrint; - } - - // Print form confirm - print $formconfirm; +if ($object->id <= 0) { + dol_print_error('', 'Bad value for object id'); + exit; +} - // Object card - // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; +$res = $object->fetch_optionals(); - $morehtmlref = '
'; - /* - // Ref bis - $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); - // Project - if (!empty($conf->project->enabled)) +$head = inventoryPrepareHead($object); +print dol_get_fiche_head($head, 'inventory', $langs->trans("Inventory"), -1, 'stock'); + +$formconfirm = ''; + +// Confirmation to delete +if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1); +} +// Confirmation to delete line +if ($action == 'deleteline') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid.'&page='.$page.$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); +} + +// Clone confirmation +if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); +} + +// Confirmation to close +if ($action == 'record') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1); + $action = 'view'; +} + +// Confirmation to close +if ($action == 'confirm_cancel') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancel'), 'cancel_record', '', 0, 1); + $action = 'view'; +} + +// Call Hook formConfirm +$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); +$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; +} elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; +} + +// Print form confirm +print $formconfirm; + + +// Object card +// ------------------------------------------------------------ +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref = '
'; +/* +// Ref bis +$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', null, null, '', 1); +// Thirdparty +$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); +// Project +if (!empty($conf->project->enabled)) +{ + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->inventory->creer) { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->inventory->creer) + if ($action != 'classify') { - if ($action != 'classify') - { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=$proj->getNomUrl(); } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=$proj->getNomUrl(); - } else { - $morehtmlref.=''; - } + $morehtmlref.=''; } } - */ - $morehtmlref .= '
'; +} +*/ +$morehtmlref .= '
'; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; - print '
'; - print ''."\n"; +print '
'; +print '
'; +print '
'; +print '
'."\n"; - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; +// Common attributes +include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - // Other attributes. Fields from hook formObjectOptions and Extrafields. - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; +// Other attributes. Fields from hook formObjectOptions and Extrafields. +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - //print ''; +//print ''; - print '
'.$langs->trans("InventoryCode").'INV'.$object->id.'
'.$langs->trans("InventoryCode").'INV'.$object->id.'
'; - print '
'; - print '
'; +print '
'; +print '
'; +print '
'; - print '
'; +print '
'; - print dol_get_fiche_end(); +print dol_get_fiche_end(); - print '
'; - print ''; - print ''; - print ''; - if ($backtopage) { - print ''; +print ''; +print ''; +print ''; +print ''; +if ($backtopage) { + print ''; +} + + +// Buttons for actions +if ($action != 'record') { + print '
'."\n"; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - - // Buttons for actions - if ($action != 'record') { - print '
'."\n"; - $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } - - if (empty($reshook)) { - if ($object->status == Inventory::STATUS_DRAFT) { - if ($permissiontoadd) { - print ''.$langs->trans("Validate").' ('.$langs->trans("Start").')'."\n"; - } else { - print ''.$langs->trans('Validate').' ('.$langs->trans("Start").')'."\n"; - } - } - - // Save - if ($object->status == $object::STATUS_VALIDATED) { - if ($permissiontoadd) { - print ''.$langs->trans("MakeMovementsAndClose").''."\n"; - } else { - print ''.$langs->trans('MakeMovementsAndClose').''."\n"; - } - - if ($permissiontoadd) { - print ''.$langs->trans("Cancel").''."\n"; - } - } - } - print '
'."\n"; - - if ($object->status != Inventory::STATUS_DRAFT && $object->status != Inventory::STATUS_VALIDATED) { - print '

'; - } - } - - - - if ($object->status == Inventory::STATUS_VALIDATED) { - print '
'; - if (!empty($conf->use_javascript_ajax)) { + if (empty($reshook)) { + if ($object->status == Inventory::STATUS_DRAFT) { if ($permissiontoadd) { - // Link to launch scan tool - if (isModEnabled('barcode') || isModEnabled('productbatch')) { - print ''.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").''; - } - - // Link to autofill - print ''.img_picto('', 'autofill', 'class="paddingrightonly"').$langs->trans('AutofillWithExpected').''; - print ''; - - // Link to reset qty - print ''.img_picto('', 'eraser', 'class="paddingrightonly"').$langs->trans("ClearQtys").''; + print ''.$langs->trans("Validate").' ('.$langs->trans("Start").')'."\n"; } else { - print ''.$langs->trans("Save").''."\n"; + print ''.$langs->trans('Validate').' ('.$langs->trans("Start").')'."\n"; } } - print '
'; - print '
'; - print '
'; - } - - - // Popup for mass barcode scanning - if ($action == 'updatebyscaning') { - if ($permissiontoadd) { - // Output the javascript to manage the scanner tool. - print ''; + + // Link to reset qty + print ''.img_picto('', 'eraser', 'class="paddingrightonly"').$langs->trans("ClearQtys").''; + } else { + print ''.$langs->trans("Save").''."\n"; + } + } + print '
'; + print '
'; + print ''; +} + + +// Popup for mass barcode scanning +if ($action == 'updatebyscaning') { + if ($permissiontoadd) { + // Output the javascript to manage the scanner tool. + print ''; + if(BarcodeIsInProduct > 0){ + result = true; + } + return result; } - include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; - $formother = new FormOther($db); - print $formother->getHTMLScannerForm("barcodescannerjs", 'all'); + '; + print ''; } + include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + $formother = new FormOther($db); + print $formother->getHTMLScannerForm("barcodescannerjs", 'all'); +} - //Call method to undo changes in real qty - print ''; +//Call method to undo changes in real qty +print ''; - print '
'; - //print '
'; - print '
'; +print '
'; +//print '
'; +print '
'; - //print load_fiche_titre($langs->trans('Consumption'), '', ''); +//print load_fiche_titre($langs->trans('Consumption'), '', ''); - print '
'; - print ''; +print '
'; +print '
'; - print ''; - print ''; - print ''; +print ''; +print ''; +print ''; +if (isModEnabled('productbatch')) { + print ''; +} +print ''; +if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + print ''; + print ''; + print ''; + print ''; + print ''; +} else { + print ''; +} +if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { + // Actions or link to stock movement + print ''; +} else { + // Actions or link to stock movement + print ''; +} +print ''; + +// Line to add a new line in inventory +if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { + print ''; + print ''; + print ''; if (isModEnabled('productbatch')) { print ''; } - print ''; + print ''; if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; } else { print ''; - } - if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { - // Actions or link to stock movement - print ''; - } else { - // Actions or link to stock movement - print ''; } + // Actions + print ''; print ''; +} - // Line to add a new line in inventory - if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { - print ''; - print ''; + print ''; - print ''; + if (isModEnabled('productbatch')) { - print ''; } - print ''; - if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { - print ''; - print ''; - print ''; - print ''; + + // Expected quantity = Quantity in stock when we start inventory + print ''; + + // Real quantity + if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { + $qty_view = GETPOST("id_".$obj->rowid) && price2num(GETPOST("id_".$obj->rowid), 'MS') >= 0 ? GETPOST("id_".$obj->rowid) : $obj->qty_view; + + //if (!$hasinput && $qty_view !== null && $obj->qty_stock != $qty_view) { + if ($qty_view != '') { + $hasinput = true; + } + + if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + //PMP Expected + if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; + else $pmp_expected = $product_static->pmp; + $pmp_valuation = $pmp_expected * $valuetoshow; + print ''; + print ''; + + print ''; + + //PMP Real + print ''; + print ''; + + $totalExpectedValuation += $pmp_valuation; + $totalRealValuation += $pmp_valuation_real; + } else { + print ''; + } + + // Picto delete line print ''; } else { - print ''; - } - // Actions - print ''; - print ''; - } - - // Request to show lines of inventory (prefilled after start/validate step) - $sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,'; - $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; - $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); - $sql .= $db->order('id.rowid', 'ASC'); - $sql .= $db->plimit($limit, $offset); - - $cacheOfProducts = array(); - $cacheOfWarehouses = array(); - - //$sql = ''; - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - - if (!empty($limit != 0) || $num > $limit || $page) { - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '', $limit); - } - - $i = 0; - $hasinput = false; - $totalarray = array(); - while ($i < $num) { - $obj = $db->fetch_object($resql); - - if (isset($cacheOfWarehouses[$obj->fk_warehouse])) { - $warehouse_static = $cacheOfWarehouses[$obj->fk_warehouse]; - } else { - $warehouse_static = new Entrepot($db); - $warehouse_static->fetch($obj->fk_warehouse); - - $cacheOfWarehouses[$warehouse_static->id] = $warehouse_static; - } - - // Load real stock we have now - $option = ''; - if (isset($cacheOfProducts[$obj->fk_product])) { - $product_static = $cacheOfProducts[$obj->fk_product]; - } else { - $product_static = new Product($db); - $result = $product_static->fetch($obj->fk_product, '', '', '', 1, 1, 1); - - //$option = 'nobatch'; - $option .= ',novirtual'; - $product_static->load_stock($option); // Load stock_reel + stock_warehouse. - - $cacheOfProducts[$product_static->id] = $product_static; - } - - print ''; - print ''; - print ''; - - if (isModEnabled('productbatch')) { - print ''; - } - - // Expected quantity = Quantity in stock when we start inventory - print ''; - - // Real quantity - if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { - $qty_view = GETPOST("id_".$obj->rowid) && price2num(GETPOST("id_".$obj->rowid), 'MS') >= 0 ? GETPOST("id_".$obj->rowid) : $obj->qty_view; - - //if (!$hasinput && $qty_view !== null && $obj->qty_stock != $qty_view) { - if ($qty_view != '') { - $hasinput = true; - } - - if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { - //PMP Expected - if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; - else $pmp_expected = $product_static->pmp; - $pmp_valuation = $pmp_expected * $valuetoshow; - print ''; - print ''; - - print ''; - - //PMP Real - print ''; - print ''; - - $totalExpectedValuation += $pmp_valuation; - $totalRealValuation += $pmp_valuation_real; - } else { - print ''; - } - - // Picto delete line + if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + //PMP Expected + if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; + else $pmp_expected = $product_static->pmp; + $pmp_valuation = $pmp_expected * $valuetoshow; print ''; + print ''; + + print ''; + + //PMP Real + print ''; + print ''; + print ''; - print ''; - - print ''; - - //PMP Real - print ''; - print ''; - print ''; - } - if ($obj->fk_movement > 0) { - $stockmovment = new MouvementStock($db); - $stockmovment->fetch($obj->fk_movement); - print $stockmovment->getNomUrl(1, 'movements'); - } + print ''; } - print ''; - - $i++; + if ($obj->fk_movement > 0) { + $stockmovment = new MouvementStock($db); + $stockmovment->fetch($obj->fk_movement); + print $stockmovment->getNomUrl(1, 'movements'); + } + print ''; } - } else { - dol_print_error($db); - } - if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { - print ''; - print ''; - print ''; - print ''; - print ''; print ''; + + $i++; } - print '
'.$langs->trans("Warehouse").''.$langs->trans("Product").'
'.$langs->trans("Warehouse").''.$langs->trans("Product").''; + print $langs->trans("Batch"); + print ''.$langs->trans("ExpectedQty").''.$langs->trans('PMPExpected').''.$langs->trans('ExpectedValuation').''.$form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp")).''.$langs->trans('PMPReal').''.$langs->trans('RealValuation').''; + print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp")); + print ''; + print ''; + //print $langs->trans("StockMovement"); + print '
'; + print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? GETPOST('fk_warehouse', 'int') : $object->fk_warehouse), 'fk_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'maxwidth300'); + print ''; + print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOST('fk_product', 'int') : $object->fk_product), 'fk_product', '', 0, 0, -1, 2, '', 0, null, 0, '1', 0, 'maxwidth300'); + print ''; - print $langs->trans("Batch"); + print ''; print ''.$langs->trans("ExpectedQty").''.$langs->trans('PMPExpected').''.$langs->trans('ExpectedValuation').''.$form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp")).''.$langs->trans('PMPReal').''.$langs->trans('RealValuation').''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp")); - print ''; - print ''; - //print $langs->trans("StockMovement"); + print ''; print ''; + print ''; + print '
'; - print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? GETPOST('fk_warehouse', 'int') : $object->fk_warehouse), 'fk_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'maxwidth300'); +// Request to show lines of inventory (prefilled after start/validate step) +$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,'; +$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected'; +$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; +$sql .= ' WHERE id.fk_inventory = '.((int) $object->id); +$sql .= $db->order('id.rowid', 'ASC'); +$sql .= $db->plimit($limit, $offset); + +$cacheOfProducts = array(); +$cacheOfWarehouses = array(); + +//$sql = ''; +$resql = $db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); + + if (!empty($limit != 0) || $num > $limit || $page) { + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '', $limit); + } + + $i = 0; + $hasinput = false; + $totalarray = array(); + while ($i < $num) { + $obj = $db->fetch_object($resql); + + if (isset($cacheOfWarehouses[$obj->fk_warehouse])) { + $warehouse_static = $cacheOfWarehouses[$obj->fk_warehouse]; + } else { + $warehouse_static = new Entrepot($db); + $warehouse_static->fetch($obj->fk_warehouse); + + $cacheOfWarehouses[$warehouse_static->id] = $warehouse_static; + } + + // Load real stock we have now + $option = ''; + if (isset($cacheOfProducts[$obj->fk_product])) { + $product_static = $cacheOfProducts[$obj->fk_product]; + } else { + $product_static = new Product($db); + $result = $product_static->fetch($obj->fk_product, '', '', '', 1, 1, 1); + + //$option = 'nobatch'; + $option .= ',novirtual'; + $product_static->load_stock($option); // Load stock_reel + stock_warehouse. + + $cacheOfProducts[$product_static->id] = $product_static; + } + + print '
'; + print $warehouse_static->getNomUrl(1); print ''; - print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOST('fk_product', 'int') : $object->fk_product), 'fk_product', '', 0, 0, -1, 2, '', 0, null, 0, '1', 0, 'maxwidth300'); + print ''; + print $product_static->getNomUrl(1).' - '.$product_static->label; print ''; - print ''; + print ''; + $batch_static = new Productlot($db); + $res = $batch_static->fetch(0, $product_static->id, $obj->batch); + if ($res) { + print $batch_static->getNomUrl(1); + } else { + print dol_escape_htmltag($obj->batch); + } print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $valuetoshow = $obj->qty_stock; + // For inventory not yet close, we overwrite with the real value in stock now + if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { + if (isModEnabled('productbatch') && $product_static->hasbatch()) { + $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty; + } else { + $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real; + } + } + print price2num($valuetoshow, 'MS'); + print ''; + print ''; + print price($pmp_expected); + print ''; + print ''; + print price($pmp_valuation); + print ''; + print ''; + print img_picto('', 'eraser', 'class="opacitymedium"'); + print ''; + print ''; + print ''; + + + if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; + else $pmp_real = $product_static->pmp; + $pmp_valuation_real = $pmp_real * $qty_view; + print ''; + print ''; + print ''; + print ''; + print ''; + print img_picto('', 'eraser', 'class="opacitymedium"'); + print ''; + print ''; + print ''; + print ''.img_delete().''; + $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; + print ''; print ''; - print ''; - print ''; - print ''; - print '
'; - print $warehouse_static->getNomUrl(1); - print ''; - print $product_static->getNomUrl(1).' - '.$product_static->label; - print ''; - $batch_static = new Productlot($db); - $res = $batch_static->fetch(0, $product_static->id, $obj->batch); - if ($res) { - print $batch_static->getNomUrl(1); - } else { - print dol_escape_htmltag($obj->batch); - } - print ''; - $valuetoshow = $obj->qty_stock; - // For inventory not yet close, we overwrite with the real value in stock now - if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { - if (isModEnabled('productbatch') && $product_static->hasbatch()) { - $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty; - } else { - $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real; - } - } - print price2num($valuetoshow, 'MS'); - print ''; - print ''; - print price($pmp_expected); - print ''; - print ''; - print price($pmp_valuation); - print ''; - print ''; - print img_picto('', 'eraser', 'class="opacitymedium"'); - print ''; - print ''; - print ''; - - - if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; - else $pmp_real = $product_static->pmp; - $pmp_valuation_real = $pmp_real * $qty_view; - print ''; - print ''; - print ''; - print ''; - print ''; - print img_picto('', 'eraser', 'class="opacitymedium"'); - print ''; - print ''; - print ''; - print ''.img_delete().''; - $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; - print ''; + print price($pmp_expected); print ''; + print price($pmp_valuation); + print ''; + print $obj->qty_view; // qty found + print ''; + if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; + else $pmp_real = $product_static->pmp; + $pmp_valuation_real = $pmp_real * $obj->qty_view; + print price($pmp_real); + print ''; + print price($pmp_valuation_real); + print ''; + + $totalExpectedValuation += $pmp_valuation; + $totalRealValuation += $pmp_valuation_real; } else { - if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { - //PMP Expected - if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; - else $pmp_expected = $product_static->pmp; - $pmp_valuation = $pmp_expected * $valuetoshow; - print ''; - print price($pmp_expected); - print ''; - print price($pmp_valuation); - print ''; - print $obj->qty_view; // qty found - print ''; - if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; - else $pmp_real = $product_static->pmp; - $pmp_valuation_real = $pmp_real * $obj->qty_view; - print price($pmp_real); - print ''; - print price($pmp_valuation_real); - print ''; - - $totalExpectedValuation += $pmp_valuation; - $totalRealValuation += $pmp_valuation_real; - } else { - print ''; - print $obj->qty_view; // qty found - print ''; + print $obj->qty_view; // qty found print '
'.$langs->trans("Total").''.price($totalExpectedValuation).''.price($totalRealValuation).'
'; +} else { + dol_print_error($db); +} +if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + print ''; + print ''.$langs->trans("Total").''; + print ''.price($totalExpectedValuation).''; + print ''.price($totalRealValuation).''; + print ''; + print ''; +} +print ''; - print '
'; +print '
'; - if ($object->status == $object::STATUS_VALIDATED) { - print '
'; - } +if ($object->status == $object::STATUS_VALIDATED) { + print '
'; +} - print '
'; +print '
'; - // Call method to disable the button if no qty entered yet for inventory - - if ($object->status != $object::STATUS_VALIDATED || !$hasinput) { - print ''; - } - print ''; - +// Call method to disable the button if no qty entered yet for inventory +/* +if ($object->status != $object::STATUS_VALIDATED || !$hasinput) { print ''; +} +*/ + +print ''; + +print ''; +'; - if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { - ?> - - global->INVENTORY_MANAGE_REAL_PMP)) { + ?> + + Date: Sat, 1 Apr 2023 16:53:54 +0200 Subject: [PATCH 318/381] FIX - Filter status order in list --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 0d9ed8423cb..f04b6cfd501 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -898,7 +898,7 @@ if ($search_status <> '') { if ($search_status == -3) { // To bill //$sql.= ' AND c.fk_statut in (1,2,3)'; //$sql.= ' AND c.facture = 0'; // invoice not created - $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed + $sql .= ' AND (c.fk_statut IN (1,2,3))'; // validated, in process or closed } if ($search_status == -4) { // "validate and in progress" $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process From 947dadfaa80da81946869e7fd81a967a44640beb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 2 Apr 2023 08:28:56 +0200 Subject: [PATCH 319/381] Fix v18 migration script --- htdocs/install/upgrade2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 1f53780461e..fd063b40a26 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -494,7 +494,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ } // Scripts for 18.0 - $afterversionarray = explode('.', '170.9'); + $afterversionarray = explode('.', '17.0.9'); $beforeversionarray = explode('.', '18.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { migrate_contractdet_rank(); From 1d70280ec24decd9741c4a622bf82ffb5e756fc2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 2 Apr 2023 12:01:46 +0200 Subject: [PATCH 320/381] In FR, activate constant INVOICE_DISABLE_REPLACEMENT by default --- htdocs/master.inc.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 38933d291e7..a1e5220e07a 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -227,6 +227,12 @@ if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) { // For FR, default value of option to show category of operations is on by default. Decret n°2099-1299 2022-10-07 $conf->global->INVOICE_CATEGORY_OF_OPERATION = 1; } + if ($mysoc->country_code == 'FR' && !isset($conf->global->INVOICE_DISABLE_REPLACEMENT)) { + // For FR, the replacement invoice type is not allowed. + // From an accounting point of view, this creates holes in the numbering of the invoice. + // This is very problematic during a fiscal control. + $conf->global->INVOICE_DISABLE_REPLACEMENT = 1; + } if ($mysoc->localtax1_assuj || $mysoc->localtax2_assuj) { // For countries using the 2nd or 3rd tax, we disable input/edit of lines using the price including tax (because 2nb and 3rd tax not yet taken into account). From 01bcd93580bd7fed89d3a3d6899021c34c484bda Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Sun, 2 Apr 2023 12:01:48 +0200 Subject: [PATCH 321/381] FIX: #24414 --- htdocs/core/class/extrafields.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6644548d87c..a878e39674b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1083,6 +1083,11 @@ class ExtraFields if ((string) $okey == '') { continue; } + + if (($pipepos = strpos ($val, '|')) > 0) { + // Select-Field depending on other field, remove extra data from value + $val = substr ($val, 0, $pipepos); + } if ($langfile && $val) { $options[$okey] = $langs->trans($val); From 3c74a3272cfc2c72104835b7678b8c686e3de06a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 2 Apr 2023 10:07:36 +0000 Subject: [PATCH 322/381] Fixing style errors. --- htdocs/core/class/extrafields.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index a878e39674b..e2e24c15a24 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1083,10 +1083,10 @@ class ExtraFields if ((string) $okey == '') { continue; } - - if (($pipepos = strpos ($val, '|')) > 0) { + + if (($pipepos = strpos($val, '|')) > 0) { // Select-Field depending on other field, remove extra data from value - $val = substr ($val, 0, $pipepos); + $val = substr($val, 0, $pipepos); } if ($langfile && $val) { From 8b095fdec0e22aaa89edfd2b8a085750121ac0f8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 2 Apr 2023 12:57:38 +0200 Subject: [PATCH 323/381] review variable name --- .../product/stock/class/mouvementstock.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 77f0f0cf60e..8ab5ff77da4 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -112,8 +112,8 @@ class MouvementStock extends CommonObject public $inventorycode; public $batch; - public $line_id_oject_src; - public $line_id_oject_origin; + public $line_id_object_src; + public $line_id_object_origin; public $fields = array( @@ -1015,17 +1015,17 @@ class MouvementStock extends CommonObject * * @param string $origin_element Type of element * @param int $origin_id Id of element - * @param int $line_id_oject_src Id line of element Source - * @param int $line_id_oject_origin Id line of element Origin + * @param int $line_id_object_src Id line of element Source + * @param int $line_id_object_origin Id line of element Origin * * @return void */ - public function setOrigin($origin_element, $origin_id, $line_id_oject_src = 0, $line_id_oject_origin = 0) + public function setOrigin($origin_element, $origin_id, $line_id_object_src = 0, $line_id_object_origin = 0) { $this->origin_type = $origin_element; $this->origin_id = $origin_id; - $this->line_id_oject_src = $line_id_oject_src; - $this->line_id_oject_origin = $line_id_oject_origin; + $this->line_id_oject_src = $line_id_object_src; + $this->line_id_oject_origin = $line_id_object_origin; // For backward compatibility $this->origintype = $origin_element; $this->fk_origin = $origin_id; From 9ec5bd6fc7d9f41549834a9e21aca93b86a208f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Apr 2023 09:49:27 +0200 Subject: [PATCH 324/381] Prepare 17.0.1 --- ChangeLog | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3f193d9902b..07fa52ed00f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,56 @@ English Dolibarr ChangeLog ***** ChangeLog for 17.0.1 compared to 17.0.0 ***** -TODO +FIX: 17.0 PHP Warning invalid argument supplied for foreach +FIX: #[23799] - External users are not able to create events - correction +FIX: #23966 Error "Param dbt_keyfield is required but not defined +FIX: #24138 Fix box_birthdays SQL for postgres +FIX: #24201 Upload of external module fails to copy from incorrectly generated temp source dir +FIX: #24240 Dolibarr V17.0.0 PHP8 fatal error +FIX: accountancy lettering: better error management +FIX: accountancy lettering: correctly calculated number of lettering operations done +FIX: accountancy lettering: error management and prevention +FIX: accountancy lettering: prevent null results when fetching link with payments +FIX: action delete card fac rec +FIX: Add bookmark with search fields that are arrays (backport 4157263cb898f1847cfcfc22dee6007c01b13a4d) +FIX: Add missing hook on LibStatut +FIX: Add more context for selectForFormsListWhere Hook +FIX: Autofill / clear qty in inventory page +FIX: avoid php8 warnings +FIX: avoid phpunit error +FIX: can not show all csv fields (a reason for that ?) +FIX: change date on select date input when prefix is used +FIX: dol_textishtml() function +FIX: expense report accountancy: sql syntax error when performing automatic linking +FIX: Extrafields in Notes to unify with orders or invoices. +FIX: fatal error when margin enable (missing check on element), fix User::hasRight() when checking a margin right +FIX: feedbacks +FIX: FILTER_VALIDATE_EMAIL param is not a string +FIX: #24298 No error or 0.00 instead of NULL in database anymore when emptying an extrafield of type price on a propal card +FIX: full group by handle +FIX: holiday counter massaction: ErrorBadValueForParamNotAString and PHP 8 warning when no approval user right +FIX: installation superadmin creation: PHP 8 warning +FIX: invoices order on sells journal +FIX: it was not possible to update extrafields of expedition lines with batch without editing batch value +FIX: limit after order in get objects in category +FIX: method dolGetGlobalString not defined with saphir +FIX: missing column default workstation +FIX: missing drop foreign key before modify field +FIX: missing "multidir_output" for project sharing (Multicompany) +FIX: missing protection on ajax public ticket page for valid email +FIX: ODT management inverted between purchase invoice and order +FIX: PDF Espadon => display extrafields +FIX: PDF Espadon Expedition : notes and tracking number +FIX: Phpunit Rename WebsiteTest.class.php to WebsiteTest.php +FIX: project referent elements list: conf to hide tasks was flipped +FIX: Protection on agenda view for a thirdparty id that does not exist +FIX: search_project_user +FIX: societe list: regression to redirection to customer card when single result of search filters +FIX: SQL error "unknown column p.fk_soc" because ANSI-92 joins take precedence over ANSI-89 joins +FIX: task have the same entity of project +FIX: token error when closing ticket from public interface +FIX: Warning on purchase order + Property fk_commande not defined + ***** ChangeLog for 17.0.0 compared to 16.0.0 ***** From 3c00b00066e939a3a7eb06e76b0cb14fd890e040 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 3 Apr 2023 10:40:52 +0200 Subject: [PATCH 325/381] Product Stats : Fix facture rec status --- htdocs/product/stats/facturerec.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php index 9b982407825..9b18e510a78 100644 --- a/htdocs/product/stats/facturerec.php +++ b/htdocs/product/stats/facturerec.php @@ -156,7 +156,7 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).''; } elseif ($user->rights->facture->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; - $sql .= "f.titre, f.datec, f.rowid as facid,"; + $sql .= "f.titre, f.datec, f.rowid as facid, f.suspended as suspended,"; $sql .= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= ", sc.fk_soc, sc.fk_user "; @@ -251,7 +251,7 @@ if ($id > 0 || !empty($ref)) { print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datec", "", $option, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "d.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.suspended", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; if ($num > 0) { @@ -280,7 +280,7 @@ if ($id > 0 || !empty($ref)) { print dol_print_date($db->jdate($objp->datec), 'dayhour').""; print ''.$objp->qty."\n"; print ''.price($objp->total_ht)."\n"; - print ''.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5, $paiement, $objp->type).''; + print ''.$invoicestatic->LibStatut(1, $objp->suspended, 5, $paiement, $objp->type).''; print "\n"; $i++; } From 9a05c16edc615eae9acd997294f95503c44c1b0f Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 3 Apr 2023 11:50:06 +0200 Subject: [PATCH 326/381] NEW : Stock limit for alert and desired optimal stock by product and warehouse import --- htdocs/core/modules/modProduct.class.php | 25 ++++++++++++++++++++++++ htdocs/langs/en_US/stocks.lang | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 560ca3d7277..5446fa56a57 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -620,6 +620,31 @@ class modProduct extends DolibarrModules $this->import_updatekeys_array[$r] = array('p.ref'=>'Ref'); if (!empty($conf->barcode->enabled)) $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode')); //only show/allow barcode as update key if Barcode module enabled + if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { + + // Import products limit and desired stock by product and warehouse + $r++; + $this->import_code[$r] = $this->rights_class.'_stock_by_warehouse'; + $this->import_label[$r] = "ProductStockWarehouse"; // 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('pwp'=>MAIN_DB_PREFIX.'product_warehouse_properties'); + $this->import_fields_array[$r] = array('pwp.fk_product'=>"Product*", + 'pwp.fk_entrepot'=>"Warehouse*", 'pwp.seuil_stock_alerte'=>"StockLimit", + 'pwp.desiredstock'=>"DesiredStock"); + $this->import_convertvalue_array[$r] = array( + 'pwp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') + ,'pwp.fk_entrepot'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'Entrepot') + ); + $this->import_examplevalues_array[$r] = array('pwp.fk_product'=>"ref:PRODUCT_REF or id:123456", + 'pwp.fk_entrepot'=>"ref:WAREHOUSE_REF or id:123456", + 'pwp.seuil_stock_alerte'=>"100", + 'pwp.desiredstock'=>"110" + ); + $this->import_updatekeys_array[$r] = array('pwp.fk_product'=>'Product', 'pwp.fk_entrepot'=>'Warehouse'); + + } + if (!empty($conf->fournisseur->enabled)) { // Import suppliers prices (note: this code is duplicated in module Service) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 1b54e53d6de..df0420947e3 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -173,6 +173,7 @@ OptionMULTIPRICESIsOn=Option "several prices per segment" is on. It means a prod ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock correctly created ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated ProductStockWarehouseDeleted=Stock limit for alert and desired optimal stock correctly deleted +ProductStockWarehouse=Stock limit for alert and desired optimal stock by product and warehouse AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock AddStockLocationLine=Decrease quantity then click to add another warehouse for this product InventoryDate=Inventory date @@ -240,4 +241,4 @@ InventoryRealQtyHelp=Set value to 0 to reset qty
Keep field empty, or remove UpdateByScaning=Update by scaning UpdateByScaningProductBarcode=Update by scan (product barcode) UpdateByScaningLot=Update by scan (lot|serial barcode) -DisableStockChangeOfSubProduct=Deactivate the stock change for all the subproducts of this Kit during this movement. \ No newline at end of file +DisableStockChangeOfSubProduct=Deactivate the stock change for all the subproducts of this Kit during this movement. From 2f34f179b9ebf59c85112f61b6957e5b1e41c168 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Apr 2023 12:06:16 +0200 Subject: [PATCH 327/381] Debug v18 --- htdocs/core/ajax/objectonoff.php | 5 ++++- htdocs/core/lib/functions.lib.php | 8 +++++++- htdocs/core/lib/security.lib.php | 8 +++----- htdocs/core/modules/modWebhook.class.php | 6 +++--- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 9225e8dbb5e..ed670627a90 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -54,6 +54,9 @@ $format = 'int'; // Load object according to $id and $element $object = fetchObjectByElement($id, $element); +if (!is_object($object)) { + httponly_accessforbidden("Bad value for combination of parameters element/field: Object not found."); // This includes the exit. +} $object->fields[$field] = array('type' => $format, 'enabled' => 1); @@ -81,7 +84,7 @@ if (preg_match('/status$/', $field)) { } elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products restrictedArea($user, 'produit|service', $object, 'product&product', '', '', 'rowid'); } else { - httponly_accessforbidden("Bad value for combination of parameters element/field."); // This includes the exit. + httponly_accessforbidden("Bad value for combination of parameters element/field: Field not supported."); // This includes the exit. } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a16cc34fd10..d275589885d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11357,6 +11357,12 @@ function getElementProperties($element_type) $classname = 'Productlot'; $element = 'productlot'; $subelement = ''; + } elseif ($element_type == 'websitepage') { + $classpath = 'website/class'; + $classfile = 'websitepage'; + $classname = 'Websitepage'; + $module = 'website'; + $subelement = 'websitepage'; } if (empty($classfile)) { @@ -11391,7 +11397,7 @@ function getElementProperties($element_type) */ function fetchObjectByElement($element_id, $element_type, $element_ref = '') { - global $conf, $db; + global $db; $ret = 0; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 2fe9460e822..710eab4d878 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -332,7 +332,7 @@ function dolGetLdapPasswordHash($password, $type = 'md5') * This method check permission on module then call checkUserAccessToObject() for permission on object (according to entity and socid of user). * * @param User $user User to check - * @param string $features Features to check (it must be module $object->element. Can be a 'or' check with 'levela|levelb'. + * @param string $features Features to check (it must be module name or $object->element. Can be a 'or' check with 'levela|levelb'. * Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...) * This is used to check permission $user->rights->features->... * @param int|string|object $object Object or Object ID or list of Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). @@ -364,7 +364,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft"); //print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid; //print ", dbtablename=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select; - //print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."
"; + //print ", perm: ".$features."->".$feature2."=".($user->hasRight($features, $feature2, 'lire'))."
"; $parentfortableentity = ''; @@ -388,9 +388,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $features = 'adherent'; $feature2 = 'cotisation'; } - if ($features == 'websitepage') { - $features = 'website'; - $tableandshare = 'website_page'; + if ($features == 'website' && is_object($object) && $object->element == 'websitepage') { $parentfortableentity = 'fk_website@website'; } if ($features == 'project') { diff --git a/htdocs/core/modules/modWebhook.class.php b/htdocs/core/modules/modWebhook.class.php index c8ddea7dc06..e9f3e7f5baa 100644 --- a/htdocs/core/modules/modWebhook.class.php +++ b/htdocs/core/modules/modWebhook.class.php @@ -260,17 +260,17 @@ class modWebhook extends DolibarrModules // Add here entries to declare new permissions /* BEGIN MODULEBUILDER PERMISSIONS */ $this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used) - $this->rights[$r][1] = 'Read objects of Webhook'; // Permission label + $this->rights[$r][1] = 'Read Webhooks'; // Permission label $this->rights[$r][4] = 'webhook_target'; $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->webhook->webhook_target->read) $r++; $this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/Update objects of Webhook'; // Permission label + $this->rights[$r][1] = 'Create/Update Webhooks'; // Permission label $this->rights[$r][4] = 'webhook_target'; $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->webhook->webhook_target->write) $r++; $this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used) - $this->rights[$r][1] = 'Delete objects of Webhook'; // Permission label + $this->rights[$r][1] = 'Delete Webhooks'; // Permission label $this->rights[$r][4] = 'webhook_target'; $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->webhook->webhook_target->delete) $r++; From 7bf287aadf508ec61e33c7bb63eec4dc37dc6071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 3 Apr 2023 12:10:31 +0200 Subject: [PATCH 328/381] fix edit extrafields if missing mandatory value --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 00dec927f9e..5404f831a65 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -209,7 +209,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?> -trans("Totalizable"); ?>> +trans("Totalizable"); ?>> textwithpicto($langs->trans("CssOnEdit"), $langs->trans("HelpCssOnEditDesc")); ?> @@ -220,7 +220,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?> - trans("AllEntities"); ?>> + trans("AllEntities"); ?>> From 69791c8530a05095079c80814e1182644ddd7f71 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 3 Apr 2023 10:10:48 +0000 Subject: [PATCH 329/381] Fixing style errors. --- htdocs/core/modules/modProduct.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index ec5f7c78395..771871ed563 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -748,8 +748,7 @@ class modProduct extends DolibarrModules $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode')); //only show/allow barcode as update key if Barcode module enabled } - if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { - + if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { // Import products limit and desired stock by product and warehouse $r++; $this->import_code[$r] = $this->rights_class.'_stock_by_warehouse'; @@ -770,7 +769,6 @@ class modProduct extends DolibarrModules 'pwp.desiredstock'=>"110" ); $this->import_updatekeys_array[$r] = array('pwp.fk_product'=>'Product', 'pwp.fk_entrepot'=>'Warehouse'); - } if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { From cca08ee18de64d8ccc086c88c5854f8872544a95 Mon Sep 17 00:00:00 2001 From: hystepik Date: Mon, 3 Apr 2023 12:22:05 +0200 Subject: [PATCH 330/381] Fix : user group date midif to match database --- htdocs/user/class/api_users.class.php | 2 +- htdocs/user/class/usergroup.class.php | 4 ++-- htdocs/user/group/card.php | 1 + htdocs/user/group/list.php | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index bb1d9d95294..f1941b8c079 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -747,7 +747,7 @@ class Users extends DolibarrApi unset($cleanObject->clicktodial_loaded); unset($cleanObject->datec); - unset($cleanObject->datem); + unset($cleanObject->tms); unset($cleanObject->members); unset($cleanObject->note); unset($cleanObject->note_private); diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 7f237b385ad..f07975b4ea3 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -91,7 +91,7 @@ class UserGroup extends CommonObject * * @var integer */ - public $datem; + public $tms; /** * @var string Description @@ -931,7 +931,7 @@ class UserGroup extends CommonObject $this->name = 'DOLIBARR GROUP SPECIMEN'; $this->note = 'This is a note'; $this->datec = time(); - $this->datem = time(); + $this->tms = time(); // Members of this group is just me $this->members = array( diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 60c1c30e9fb..b9d16874604 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -209,6 +209,7 @@ if (empty($reshook)) { $object->name = GETPOST("nom", 'alphanohtml'); $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml'))); + $object->tms = dol_now(); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index 54117de403a..85df729d00f 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -173,7 +173,7 @@ $morecss = array(); // Build and execute select // -------------------------------------------------------------------- -$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms as datem, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions"; +$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions"; $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid"; @@ -471,7 +471,7 @@ while ($i < $imaxinloop) { if (!$i) { $totalarray['nbfield']++; } - print ''.dol_print_date($db->jdate($obj->datem), "dayhour").''; + print ''.dol_print_date($db->jdate($obj->tms), "dayhour").''; if (!$i) { $totalarray['nbfield']++; } From 9eb458d1d07750cee31be2ecdc3b8a4382912118 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 3 Apr 2023 13:32:37 +0200 Subject: [PATCH 331/381] Fix secirity access on create supplier order and invoice --- htdocs/core/lib/security.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 710eab4d878..3c9ca5e34d9 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -402,7 +402,6 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', } if ($features == 'fournisseur') { // When vendor invoice and pruchase order are into module 'fournisseur' $features = 'fournisseur'; - $feature2 = ''; if ($object->element == 'invoice_supplier') { $feature2 = 'facture'; } elseif ($object->element == 'order_supplier') { From 8364de054a1787beac72cc07c1395cdcc20db4cd Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 3 Apr 2023 14:29:46 +0200 Subject: [PATCH 332/381] FIX : regex array checks --- htdocs/core/modules/modProduct.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 5446fa56a57..eb36fd67ba8 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -632,9 +632,13 @@ class modProduct extends DolibarrModules $this->import_fields_array[$r] = array('pwp.fk_product'=>"Product*", 'pwp.fk_entrepot'=>"Warehouse*", 'pwp.seuil_stock_alerte'=>"StockLimit", 'pwp.desiredstock'=>"DesiredStock"); + $this->import_regex_array[$r] = array( + 'pwp.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', + 'pwp.fk_entrepot' => 'rowid@'.MAIN_DB_PREFIX.'entrepot', + ); $this->import_convertvalue_array[$r] = array( 'pwp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') - ,'pwp.fk_entrepot'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'Entrepot') + ,'pwp.fk_entrepot'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'Entrepot') ); $this->import_examplevalues_array[$r] = array('pwp.fk_product'=>"ref:PRODUCT_REF or id:123456", 'pwp.fk_entrepot'=>"ref:WAREHOUSE_REF or id:123456", From 0173688d0577ca9305d13fc36347528ec08698a7 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 3 Apr 2023 15:49:38 +0200 Subject: [PATCH 333/381] FIX Propagate extrafields from supplier order to reception --- htdocs/reception/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 3ee755bef37..3c2c0ba53ba 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -871,7 +871,7 @@ if ($action == 'create') { if ($objectsrc->fetch_optionals() > 0) { $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options); } - print $object->showOptionals($extrafields, 'create', $parameters); + print $recept->showOptionals($extrafields, 'create', $parameters); } // Incoterms From 002b0aa38669ef82a71230496a82b9f6787d2afb Mon Sep 17 00:00:00 2001 From: hystepik Date: Mon, 3 Apr 2023 16:03:51 +0200 Subject: [PATCH 334/381] fix : php 8.1 warnings + log warnings --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/company.lib.php | 2 +- htdocs/expedition/stats/index.php | 3 ++- htdocs/product/stock/class/productlot.class.php | 4 ++-- htdocs/product/stock/movement_list.php | 2 +- htdocs/product/stock/productlot_card.php | 3 ++- htdocs/reception/contact.php | 2 +- htdocs/reception/note.php | 2 +- htdocs/user/agenda_extsites.php | 2 +- 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 170b400b2a0..cf512d5f173 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8550,7 +8550,7 @@ class Form $tmpvalue = $value['label']; $tmpcolor = $value['color']; $tmppicto = $value['picto']; - $tmplabelhtml = $value['labelhtml']; + $tmplabelhtml = !empty($value['labelhtml']) ? $value['labelhtml'] : ''; } $newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue); $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 29b8a15564d..e2e10a8de48 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1380,7 +1380,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl // Birthday if (!empty($arrayfields['t.birthday']['checked'])) { print ''; - print dol_print_date($obj->birthday); + print dol_print_date($db->jdate($obj->birthday)); print ''; } diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index 9213e2ca849..c14d8c6d3b2 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -65,7 +65,7 @@ llxHeader(); print load_fiche_titre($langs->trans("StatisticsOfSendings"), '', 'dolly'); - +$dir = (!empty($conf->expedition->multidir_temp[$conf->entity]) ? $conf->expedition->multidir_temp[$conf->entity] : $conf->service->multidir_temp[$conf->entity]); dol_mkdir($dir); $stats = new ExpeditionStats($db, $socid, '', ($userid > 0 ? $userid : 0)); @@ -84,6 +84,7 @@ if (empty($user->rights->societe->client->voir) || $user->socid) { $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); +$fileurlnb = ''; if (!$mesg) { $px1->SetData($data); $i = $startyear; $legend = array(); diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 6818c5b8335..49945a94027 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -895,10 +895,10 @@ class Productlot extends CommonObject //$datas['divopen'] = '
'; $datas['batch'] = '
'.$langs->trans('Batch').': '.$this->batch; if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) { - $datas['eatby'] = '
'.$langs->trans('EatByDate').': '.dol_print_date($this->eatby, 'day'); + $datas['eatby'] = '
'.$langs->trans('EatByDate').': '.dol_print_date($this->db->jdate($this->eatby), 'day'); } if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - $datas['sellby'] = '
'.$langs->trans('SellByDate').': '.dol_print_date($this->sellby, 'day'); + $datas['sellby'] = '
'.$langs->trans('SellByDate').': '.dol_print_date($this->db->jdate($this->sellby), 'day'); } //$datas['divclose'] = '
'; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 422b1317672..09f1975bcb4 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1481,7 +1481,7 @@ print '
'; print ""; // Add number of product when there is a filter on period -if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) { +if (count($arrayofuniqueproduct) == 1 && !empty($year) && is_numeric($year)) { print "
"; $productidselected = 0; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index c33997010fb..0e00476455e 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -39,6 +39,7 @@ $langs->loadLangs(array('stocks', 'other', 'productbatch')); // Get parameters $id = GETPOST('id', 'int'); +$lineid = GETPOST('lineid', 'int'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); @@ -568,7 +569,7 @@ if ($action != 'presend') { $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $usercanread; // If you can read, you can build the PDF to read content $delallowed = $usercancreate; // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('product_batch', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $langs->default_lang, '', $object); + print $formfile->showdocuments('product_batch', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object); } print '
'; diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 97d6d19a4f9..92b0dd2f1e8 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -71,7 +71,7 @@ if ($origin == 'reception') { $result = restrictedArea($user, $origin, $object->id); } else { if ($origin == 'supplierorder' || $origin == 'order_supplier') { - $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); + $result = restrictedArea($user, 'fournisseur', $object, 'commande_fournisseur', 'commande'); } elseif (!$user->hasRight($origin, "lire") && !$user->hasRight($origin, "read")) { accessforbidden(); } diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index 6546e839d03..6edb752ead8 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -90,7 +90,7 @@ if ($origin == 'reception') { $result = restrictedArea($user, $origin, $object->id); } else { if ($origin == 'supplierorder' || $origin == 'order_supplier') { - $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); + $result = restrictedArea($user, 'fournisseur', $object, 'commande_fournisseur', 'commande'); } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { accessforbidden(); } diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index b6a8e11ab15..7923a4127c4 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -259,7 +259,7 @@ while ($i <= $MAXAGENDA) { print ''; //print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist); $color_value = (GETPOST("AGENDA_EXT_COLOR_".$id.'_'.$key) ?GETPOST("AGENDA_EXT_COLOR_".$id.'_'.$key) : (empty($object->conf->$color) ? 'ffffff' : $object->conf->$color)); - print $formother->selectColor($color_value, "AGENDA_EXT_COLOR_".$id.'_'.$key, 'extsitesconfig', 1, '', 'hideifnotset'); + print $formother->selectColor($color_value, "AGENDA_EXT_COLOR_".$id.'_'.$key, '', 1, '', 'hideifnotset'); print ''; print ""; $i++; From a747b069e93ec99fd3d8d63abea001c9261968e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Apr 2023 16:27:53 +0200 Subject: [PATCH 335/381] Debug v18 --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d275589885d..bdeb1994ba3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11251,7 +11251,7 @@ function getElementProperties($element_type) } elseif ($element_type == 'bank_account') { $classpath = 'compta/bank/class'; $module = 'banque'; - $classfile = 'Account'; + $classfile = 'account'; $classname = 'Account'; } elseif ($element_type == 'category') { $classpath = 'categories/class'; From 8898a1a4324e09e48c6738b35b33032dcbd918b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Apr 2023 19:51:40 +0200 Subject: [PATCH 336/381] Debug ajax tooltip --- htdocs/adherents/class/adherent.class.php | 9 +- .../adherents/class/adherent_type.class.php | 13 +- htdocs/asset/class/asset.class.php | 14 -- htdocs/bom/class/bom.class.php | 11 +- htdocs/categories/class/categorie.class.php | 10 +- htdocs/comm/action/class/actioncomm.class.php | 6 +- htdocs/comm/mailing/class/mailing.class.php | 11 +- htdocs/comm/propal/class/propal.class.php | 9 +- htdocs/commande/class/commande.class.php | 10 +- htdocs/compta/bank/class/account.class.php | 17 +- htdocs/compta/facture/class/facture.class.php | 11 +- htdocs/contact/class/contact.class.php | 9 +- htdocs/contrat/class/contrat.class.php | 20 +- htdocs/core/class/commonobject.class.php | 15 +- htdocs/core/class/timespent.class.php | 9 +- htdocs/delivery/class/delivery.class.php | 11 +- htdocs/expedition/class/expedition.class.php | 11 +- .../class/expensereport.class.php | 11 +- htdocs/fichinter/class/fichinter.class.php | 11 +- .../class/fournisseur.commande.class.php | 12 +- .../fourn/class/fournisseur.facture.class.php | 12 +- htdocs/holiday/class/holiday.class.php | 10 +- .../class/knowledgerecord.class.php | 10 +- .../template/class/myobject.class.php | 11 +- htdocs/mrp/class/mo.class.php | 11 +- .../class/opensurveysondage.class.php | 11 +- .../partnership/class/partnership.class.php | 11 +- htdocs/product/class/product.class.php | 10 +- htdocs/product/stock/class/entrepot.class.php | 10 +- .../product/stock/class/productlot.class.php | 10 +- htdocs/projet/class/project.class.php | 10 +- htdocs/projet/class/task.class.php | 11 +- htdocs/resource/class/dolresource.class.php | 11 +- htdocs/salaries/class/salary.class.php | 83 +++---- htdocs/salaries/list.php | 203 +++++++++++++----- htdocs/societe/class/societe.class.php | 10 +- htdocs/societe/class/societeaccount.class.php | 7 +- .../class/supplier_proposal.class.php | 12 +- htdocs/ticket/class/ticket.class.php | 11 +- htdocs/user/class/user.class.php | 12 +- htdocs/user/class/usergroup.class.php | 9 +- .../workstation/class/workstation.class.php | 11 +- 42 files changed, 422 insertions(+), 304 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index e06ce655c73..7f9adb32266 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2365,10 +2365,11 @@ class Adherent extends CommonObject ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.((int) $this->id); if ($option == 'subscription') { @@ -2394,7 +2395,7 @@ class Adherent extends CommonObject $label = $langs->trans("ShowUser"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 141a2264113..cfcdf81a9b9 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -749,12 +749,12 @@ class AdherentType extends CommonObject ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id); if ($option != 'nolink') { // Add param to save lastsearch_values or not @@ -766,7 +766,10 @@ class AdherentType extends CommonObject $url .= '&save_lastsearch_values=1'; } } - $linkstart = ''; + $linkstart = ''; + $linkend = ''; $result .= $linkstart; diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 8e69cb19a1a..e2d93806ca3 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -162,20 +162,6 @@ class Asset extends CommonObject */ public $oldcopy; - // /** - // * @var string Field with ID of parent key if this object has a parent - // */ - // public $fk_element = 'fk_asset'; - // /** - // * @var array List of child tables. To test if we can delete object. - // */ - // protected $childtables = array(); - // /** - // * @var array List of child tables. To know object to delete on cascade. - // * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will - // * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - // */ - // protected $childtablesoncascade = array('asset_assetdet'); /** * @var AssetDepreciationOptions Used for computed fields of depreciation options class. diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index c00b9781756..45cbfdef383 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1131,13 +1131,12 @@ class BOM extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - - $url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id; if ($option != 'nolink') { @@ -1157,7 +1156,7 @@ class BOM extends CommonObject $label = $langs->trans("ShowBillOfMaterials"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f69040b5f16..fc0246e1a02 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1657,9 +1657,11 @@ class Categorie extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); // Check contrast with background and correct text color $forced_color = 'categtextwhite'; @@ -1669,7 +1671,9 @@ class Categorie extends CommonObject } } $link = ''; + $link .= '"'.$dataparams; + $link .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $link .= ' class="'.$classfortooltip.' '.$forced_color.'">'; $linkend = ''; $picto = 'category'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 94daee3164e..5822e6dd9d2 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1746,8 +1746,8 @@ class ActionComm extends CommonObject 'nofetch' => 1, ]; $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $tooltip = ''; } //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) // $linkclose = ' style="background-color:#'.$this->type_color.'"'; @@ -1757,7 +1757,7 @@ class ActionComm extends CommonObject $label = $langs->trans("ShowAction"); $linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classname.' '.$classfortooltip.'"'; } else { $linkclose .= ' class="'.$classname.'"'; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 75bfce98496..ef83c5d1470 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -792,10 +792,11 @@ class Mailing extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/comm/mailing/card.php?id='.$this->id; @@ -816,8 +817,8 @@ class Mailing extends CommonObject $label = $langs->trans("ShowEMailing"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 09bdfb94d73..3a247a11ec2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3796,10 +3796,11 @@ class Propal extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = ''; if ($user->rights->propal->lire) { @@ -3831,7 +3832,7 @@ class Propal extends CommonObject $label = $langs->trans("Proposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2b11588b854..f707714d772 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3834,19 +3834,19 @@ class Commande extends CommonOrder $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $linkclose = ''; if (empty($notooltip) && $user->hasRight('commande', 'lire')) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Order"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; $target_value = array('_self', '_blank', '_parent', '_top'); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e8b645db7bb..4b17f3baab0 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1409,9 +1409,10 @@ class Account extends CommonObject /** * getTooltipContentArray - * @param array $params params to construct tooltip data - * @since v18 - * @return array + * + * @param array $params Params to construct tooltip data + * @since v18 + * @return array */ public function getTooltipContentArray($params) { @@ -1475,11 +1476,15 @@ class Account extends CommonObject ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $linkclose = '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">'; + $linkclose = ''; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.'">'; $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id; if ($mode == 'transactions') { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6aa633cc4da..5d69bb2b6dd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1896,10 +1896,11 @@ class Facture extends CommonInvoice $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $linkclose = ($target ? ' target="'.$target.'"' : ''); if (empty($notooltip) && $user->hasRight("facture", "read")) { @@ -1907,8 +1908,8 @@ class Facture extends CommonInvoice $label = $langs->trans("Invoice"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = 'trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id; @@ -1521,7 +1522,7 @@ class Contact extends CommonObject $label = $langs->trans("ShowContact"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 8e6c2ea0161..e05aeb678ee 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2075,19 +2075,19 @@ class Contrat extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $linkclose = ''; if (empty($notooltip) && $user->hasRight('contrat', 'lire')) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowContract"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = ' $this->element, ]; $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; } - $link = ''; + + $link = ''; $linkend = ''; $picto = 'service'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 44e2b280391..e53cc85c21f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4650,7 +4650,7 @@ abstract class CommonObject } /** - * Function to check if an object is used by others. + * Function to check if an object is used by others (by children). * Check is done into this->childtables. There is no check into llx_element_element. * * @param int $id Force id of object @@ -4671,8 +4671,8 @@ abstract class CommonObject return -1; } - $arraytoscan = $this->childtables; - // For backward compatibility, we check if array is old format array('table1', 'table2', ...) + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) + // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) $tmparray = array_keys($this->childtables); if (is_numeric($tmparray[0])) { $arraytoscan = array_flip($this->childtables); @@ -4688,7 +4688,11 @@ abstract class CommonObject if (!empty($element['parent']) && !empty($element['parentkey'])) { $sql.= ", ".$this->db->prefix().$element['parent']." as p"; } - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); + if (!empty($element['fk_element'])) { + $sql.= " WHERE c.".$element['fk_element']." = ".((int) $id); + } else { + $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); + } if (!empty($element['parent']) && !empty($element['parentkey'])) { $sql.= " AND c.".$element['parentkey']." = p.rowid"; } @@ -4702,6 +4706,7 @@ abstract class CommonObject $sql.= " AND c.entity = ".((int) $entity); } } + $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -9711,7 +9716,7 @@ abstract class CommonObject return -1; } } - } elseif (!empty($this->fk_element) && !empty($this->childtables)) { // If object has childs linked with a foreign key field, we check all child tables. + } elseif (!empty($this->childtables)) { // If object has childs linked with a foreign key field, we check all child tables. $objectisused = $this->isObjectUsed($this->id); if (!empty($objectisused)) { dol_syslog(get_class($this)."::deleteCommon Can't delete record as it has some child", LOG_WARNING); diff --git a/htdocs/core/class/timespent.class.php b/htdocs/core/class/timespent.class.php index f6ae2b45c71..0f91b53e26a 100755 --- a/htdocs/core/class/timespent.class.php +++ b/htdocs/core/class/timespent.class.php @@ -752,10 +752,11 @@ class TimeSpent extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = dol_buildpath('/timespent/timespent_card.php', 1).'?id='.$this->id; @@ -776,7 +777,7 @@ class TimeSpent extends CommonObject $label = $langs->trans("ShowTimeSpent"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 61309a1cfae..bf8f68b3bbf 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -775,10 +775,11 @@ class Delivery extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/delivery/card.php?id='.$this->id; @@ -794,7 +795,9 @@ class Delivery extends CommonObject } //} - $linkstart = ''; + $linkstart = ''; $linkend = ''; if ($withpicto) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 936e46c1053..8f024665a77 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1813,10 +1813,11 @@ class Expedition extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id; @@ -1841,8 +1842,8 @@ class Expedition extends CommonObject $label = $langs->trans("Shipment"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = 'trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); if ($option != 'nolink') { // Add param to save lastsearch_values or not @@ -1794,8 +1795,8 @@ class ExpenseReport extends CommonObject $label = $langs->trans("ShowExpenseReport"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = 'trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id; @@ -839,8 +840,8 @@ class Fichinter extends CommonObject $label = $langs->trans("ShowIntervention"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = 'trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $url = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$this->id; if ($option !== 'nolink') { @@ -962,8 +962,8 @@ class CommandeFournisseur extends CommonOrder $label = $langs->trans("ShowOrder"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = 'trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $ref = $this->ref; if (empty($ref)) { $ref = $this->id; @@ -2846,8 +2846,8 @@ class FactureFournisseur extends CommonInvoice $label = $langs->trans("ShowSupplierInvoice"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = 'getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id; @@ -1380,7 +1382,9 @@ class Holiday extends CommonObject $url .= '&save_lastsearch_values=1'; } //} - $linkstart = ''; + $linkstart = ''; $linkend = ''; $result .= $linkstart; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index d53a871a6ba..08df6d37f0f 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -778,9 +778,11 @@ class KnowledgeRecord extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?id='.$this->id; @@ -801,8 +803,8 @@ class KnowledgeRecord extends CommonObject $label = $langs->trans("ShowKnowledgeRecord"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index e1f65576cd0..0bcfa07c672 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -225,7 +225,7 @@ class MyObject extends CommonObject // /** // * @var array List of child tables. To test if we can delete object. // */ - // protected $childtables = array(); + // protected $childtables = array('mychildtable' => array('name'=>'MyObject', 'fk_element'=>'fk_myobject')); // /** // * @var array List of child tables. To know object to delete on cascade. @@ -803,10 +803,11 @@ class MyObject extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id; @@ -827,7 +828,7 @@ class MyObject extends CommonObject $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index ee30c468358..c5b1b061e54 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1180,11 +1180,12 @@ class Mo extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $url = DOL_URL_ROOT.'/mrp/mo_card.php?id='.$this->id; if ($option == 'production') { $url = DOL_URL_ROOT.'/mrp/mo_production.php?id='.$this->id; @@ -1207,8 +1208,8 @@ class Mo extends CommonObject $label = $langs->trans("ShowMo"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 9c3ced9be54..770f16b07d2 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -474,10 +474,11 @@ class Opensurveysondage extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/opensurvey/card.php?id='.$this->id; @@ -496,8 +497,8 @@ class Opensurveysondage extends CommonObject $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 63f0374f77f..8165e863c05 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -994,10 +994,11 @@ class Partnership extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/partnership/partnership_card.php?id='.$this->id; @@ -1018,8 +1019,8 @@ class Partnership extends CommonObject $label = $langs->trans("ShowPartnership"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c726ae0a8ac..f0e3f8f0b00 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5161,19 +5161,19 @@ class Product extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $linkclose = ''; if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowProduct"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="nowraponall '.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"'; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index ff239307f02..2abe2007175 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -757,12 +757,12 @@ class Entrepot extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id; if ($option != 'nolink') { @@ -782,7 +782,7 @@ class Entrepot extends CommonObject $label = $langs->trans("Warehouse"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 6818c5b8335..997b5ccba0a 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -933,12 +933,12 @@ class Productlot extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $url = DOL_URL_ROOT.'/product/stock/productlot_card.php?id='.$this->id; if ($option != 'nolink') { @@ -958,7 +958,7 @@ class Productlot extends CommonObject $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index f9e2656d1f5..b3c0c142f7a 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1331,9 +1331,11 @@ class Project extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = ''; if ($option != 'nolink') { @@ -1364,8 +1366,8 @@ class Project extends CommonObject $label = $langs->trans("ShowProject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 89a189a98c8..b8821fbd486 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -758,10 +758,11 @@ class Task extends CommonObjectLine $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option == 'withproject' ? '&withproject=1' : ''); // Add param to save lastsearch_values or not @@ -779,8 +780,8 @@ class Task extends CommonObjectLine $label = $langs->trans("ShowTask"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.' nowraponall"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.' nowraponall"'; } else { $linkclose .= ' class="nowraponall"'; } diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index a2d8863f8ed..578594538cb 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -815,10 +815,11 @@ class Dolresource extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/resource/card.php?id='.$this->id; @@ -839,8 +840,8 @@ class Dolresource extends CommonObject $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index d45e2bf00d5..4fbf69fd5ee 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -49,6 +49,19 @@ class Salary extends CommonObject public $tms; + // /** + // * @var array List of child tables. To test if we can delete object. + // */ + protected $childtables = array('payment_salary' => array('name'=>'SalaryPayment', 'fk_element'=>'fk_salary')); + + // /** + // * @var array List of child tables. To know object to delete on cascade. + // * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will + // * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object + // */ + //protected $childtablesoncascade = array('mymodule_myobjectdet'); + + /** * @var int User ID */ @@ -282,44 +295,12 @@ class Salary extends CommonObject * Delete object in database * * @param User $user User that delete + * @param bool $notrigger false=launch triggers after, true=disable triggers * @return int <0 if KO, >0 if OK */ - public function delete($user) + public function delete($user, $notrigger = 0) { - global $conf, $langs; - - $error = 0; - - // Call trigger - $result = $this->call_trigger('SALARY_DELETE', $user); - if ($result < 0) return -1; - // End call triggers - - // Delete extrafields - /*if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."salary_extrafields"; - $sql .= " WHERE fk_object = ".((int) $this->id); - - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } - }*/ - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."salary"; - $sql .= " WHERE rowid=".((int) $this->id); - - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $this->error = "Error ".$this->db->lasterror(); - return -1; - } - - return 1; + return $this->deleteCommon($user, $notrigger); } @@ -539,12 +520,12 @@ class Salary extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id; if ($option != 'nolink') { @@ -564,7 +545,7 @@ class Salary extends CommonObject $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); @@ -604,8 +585,8 @@ class Salary extends CommonObject $table = 'payment_salary'; $field = 'fk_salary'; - $sql = 'SELECT sum(amount) as amount'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$table; + $sql = "SELECT sum(amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX.$table; $sql .= " WHERE ".$field." = ".((int) $this->id); dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); @@ -764,14 +745,20 @@ class Salary extends CommonObject $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; $return .= ''; - if (property_exists($this, 'fk_user')) { - $return .= ' | '.$this->fk_user.''; - } - if (property_exists($this, 'type_payment')) { - $return .= '
'.$langs->trans("PaymentMode").' : '.$this->type_payment.''; + if (!empty($arraydata['user']) && is_object($arraydata['user'])) { + $return .= '
'.$arraydata['user']->getNomUrl(1, '', 0, 0, 16, 0, '', 'maxwidth100').''; } if (property_exists($this, 'amount')) { - $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + $return .= '
'.price($this->amount).''; + if (property_exists($this, 'type_payment') && !empty($this->type_payment)) { + $return .= ' '; + if ($langs->trans("PaymentTypeShort".$this->type_payment) != "PaymentTypeShort".$this->type_payment) { + $return .= $langs->trans("PaymentTypeShort".$this->type_payment); + } elseif ($langs->trans("PaymentType".$this->type_payment) != "PaymentType".$this->type_payment) { + $return .= $langs->trans("PaymentType".$this->type_payment); + } + $return .= ''; + } } if (method_exists($this, 'LibStatut')) { $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 50107bc477e..70c69761559 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -44,7 +44,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'alpha'); //for mode view +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) // Load variable for pagination @@ -52,9 +52,10 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -125,11 +126,11 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = (int) dol_eval($val['visible'], 1, 1, '1'); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -196,8 +197,8 @@ if (empty($reshook)) { } // Mass actions - $objectclass = 'PaymentSalary'; - $objectlabel = 'SalariesPayments'; + $objectclass = 'Salary'; + $objectlabel = 'Salaries'; $uploaddir = $conf->salaries->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -220,15 +221,34 @@ $accountstatic = new Account($db); $now = dol_now(); +$title = $langs->trans('Salaries'); //$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials"; $help_url = ''; -$title = $langs->trans('Salaries'); +$morejs = array(); +$morecss = array(); +// Build and execute select +// -------------------------------------------------------------------- $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,"; $sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment as paymenttype, "; $sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,"; $sql .= " pst.code as payment_code,"; $sql .= " SUM(ps.amount) as alreadypayed"; +// Add fields from extrafields +if (!empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); + } +} +// Add fields from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql = preg_replace('/,\s*$/', '', $sql); +//$sql .= ", COUNT(rc.rowid) as anotherfield"; + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (ps.fk_salary = s.rowid) "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON (s.fk_typepayment = pst.id) "; @@ -276,43 +296,60 @@ if ($search_status != '' && $search_status >= 0) { if ($search_type_id) { $sql .= " AND s.fk_typepayment=".((int) $search_type_id); } -$sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary, u.fk_soc, u.statut,"; +$sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,"; $sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment, s.fk_bank,"; $sql .= " ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos,"; $sql .= " pst.code"; -$sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { - $num = $nbtotalofrecords; -} else { - if ($limit) { - $sql .= $db->plimit($limit + 1, $offset); - } - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + + +// Direct jump if only one record found +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id); + exit; +} + + // Output page // -------------------------------------------------------------------- -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll $arrayofselected = is_array($toselect) ? $toselect : array(); @@ -324,7 +361,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_type_id) { $param .= '&search_type_id='.urlencode($search_type_id); @@ -362,19 +399,25 @@ if (!empty($search_date_end_to)) { // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'buildsepa'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("BuildSepa"), // TODO ); -//if ($permissiontodelete) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +if (!empty($permissiontodelete)) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); -print '
'; +print ''."\n"; if ($optioncss != '') { print ''; } @@ -383,7 +426,9 @@ print ''; print ''; print ''; +print ''; print ''; +print ''; print ''; @@ -391,21 +436,46 @@ $url = DOL_URL_ROOT.'/salaries/card.php?action=create'; if (!empty($socid)) { $url .= '&socid='.$socid; } + $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); +$newcardbutton .= dolGetButtonTitleSeparator(); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewSalary'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'salary', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); -$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields -$selectedfields = ''; -$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); +// Add code for pre mass action (confirmation or email presend form) +$topicmail = "SendSalaryRef"; +$modelmail = "salary"; +$objecttmp = new Salary($db); +$trackid = 'sal'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $moreforfilter = ''; -print '
'; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + $moreforfilter .= $hookmanager->resPrint; +} else { + $moreforfilter = $hookmanager->resPrint; +} + +if (!empty($moreforfilter)) { + print '
'; + print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''."\n"; // Fields title search @@ -413,7 +483,7 @@ print '
'; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -476,17 +546,19 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- @@ -494,27 +566,38 @@ print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "s.dateep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, "", $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre("DefaultPaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); +$totalarray['nbfield']++; if (isModEnabled("banque")) { print_liste_field_titre("DefaultBankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; } print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder); +$totalarray['nbfield']++; print_liste_field_titre('Status', $_SERVER["PHP_SELF"], "s.paye", '', $param, 'class="right"', $sortfield, $sortorder); +$totalarray['nbfield']++; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } print ''."\n"; @@ -523,7 +606,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if ($val && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } @@ -533,6 +616,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // -------------------------------------------------------------------- $i = 0; $total = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; $totalarray['val'] = array(); @@ -565,24 +649,29 @@ while ($i < $imaxinloop) { $salstatic->datesp = $obj->datesp; $salstatic->dateep = $obj->dateep; $salstatic->amount = $obj->amount; - $salstatic->fk_user = $userstatic->getNomUrl(1); $salstatic->type_payment = $obj->payment_code; if ($mode == 'kanban') { if ($i == 0) { - print ''; } } else { // Show here line of result - print ''; - + $j = 0; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if (!$i) { @@ -674,7 +763,7 @@ while ($i < $imaxinloop) { // if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; // Amount - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } @@ -683,14 +772,16 @@ while ($i < $imaxinloop) { } $totalarray['val']['totalttcfield'] += $obj->amount; - print ''; - if (!$i) $totalarray['nbfield']++; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -733,7 +824,7 @@ if ($num == 0) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; + print '
'; print '
'; } // Output Kanban - print $salstatic->getKanbanView(''); + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + } + print $salstatic->getKanbanView('', array('user' => $userstatic)); if ($i == ($imaxinloop - 1)) { print '
'; print '
'; @@ -629,8 +718,8 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } - // Type - print ''; + // Payment mode + print 'payment_code)).'">'; if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); print ''.price($obj->amount).''.price($obj->amount).''.$salstatic->LibStatut($obj->paye, 5, $obj->alreadypayed).''.$salstatic->LibStatut($obj->paye, 5, $obj->alreadypayed).'
'."\n"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8de5fbe7339..8cfc5266b0e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2820,10 +2820,12 @@ class Societe extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); + $linkstart = ''; $linkend = ''; @@ -2868,7 +2870,7 @@ class Societe extends CommonObject $label = $langs->trans("ShowCompany"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.' refurl valignmiddle"'; $target_value = array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index c5ffa20aebb..4b39515a585 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -435,15 +435,16 @@ class SocieteAccount extends CommonObject 'option' => $option, ]; $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; } + if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("WebsiteAccount"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 2cd5e28bb24..7c9de7608ec 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2540,12 +2540,12 @@ class SupplierProposal extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); - if ($option == '') { $url = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id.$get_params; } @@ -2570,8 +2570,8 @@ class SupplierProposal extends CommonObject $label = $langs->trans("ShowSupplierProposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = 'trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/ticket/card.php?id='.$this->id; @@ -1531,8 +1532,8 @@ class Ticket extends CommonObject $label = $langs->trans("ShowTicket"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 8afcd0ef985..70118961c19 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2863,10 +2863,12 @@ class User extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); + $companylink = ''; if (!empty($this->socid)) { // Add thirdparty for external users $thirdpartystatic = new Societe($this->db); @@ -2904,8 +2906,10 @@ class User extends CommonObject $label = $langs->trans("ShowUser"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams . ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } $linkstart .= $linkclose.'>'; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 7f237b385ad..135b97bcc43 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -782,10 +782,11 @@ class UserGroup extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); if ($option == 'permissions') { $url = DOL_URL_ROOT.'/user/group/perms.php?id='.$this->id; @@ -811,7 +812,7 @@ class UserGroup extends CommonObject $label = $langs->trans("ShowGroup"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 3c54d670244..4f07d48cd21 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -612,10 +612,11 @@ class Workstation extends CommonObject $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; - $dataparams = " data-params='".json_encode($params)."'"; - // $label = $langs->trans('Loading'); + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); } - $label = implode($this->getTooltipContentArray($params)); $url = dol_buildpath('/workstation/workstation_card.php', 1).'?id='.$this->id; @@ -636,8 +637,8 @@ class Workstation extends CommonObject $label = $langs->trans("ShowWorkstation"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } From a0829733bf79eab229f719e58bc74f3c06cdd315 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Apr 2023 19:58:48 +0200 Subject: [PATCH 337/381] Debug v18 --- htdocs/fourn/class/fournisseur.facture.class.php | 16 +++++++--------- htdocs/fourn/facture/list.php | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 16b9da7ba51..714de9aeebd 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3295,18 +3295,16 @@ class FactureFournisseur extends CommonInvoice $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; $return .= ''; - if (property_exists($this, 'socid')) { - $return .= ' | '.$this->socid.''; + if (!empty($arraydata['thirdparty'])) { + $return .= '
'.$arraydata['thirdparty'].''; } - if (property_exists($this, 'date_echeance') && property_exists($this, 'date')) { - if (!empty($this->date_echeance)) { - $return .= '
'.dol_print_date($this->date_echeance).''; - } else { - $return .= '
'.dol_print_date($this->date).''; - } + if (property_exists($this, 'date')) { + $return .= '
'.dol_print_date($this->date, 'day').''; } if (property_exists($this, 'total_ht')) { - $return .= '
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; + $return .= '   '.price($this->total_ht); + $return .= ' '.$langs->trans("HT"); + $return .= ''; } if (method_exists($this, 'getLibStatut')) { $alreadypaid = (empty($arraydata['alreadypaid']) ? 0 : $arraydata['alreadypaid']); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 5302d5de3b2..878cca686e8 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1513,7 +1513,7 @@ while ($i < $imaxinloop) { } } - $arraydata = array('alreadypaid' => $paiement); + $arraydata = array('alreadypaid' => $paiement, 'thirdparty' => $thirdparty->getNomUrl(1, '', 12)); print $facturestatic->getKanbanView('', $arraydata); if ($i == ($imaxinloop - 1)) { print '
'; From ee35871b134db68bf5cb2b9796d88eee995fdaa1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Apr 2023 22:53:38 +0200 Subject: [PATCH 338/381] css --- htdocs/admin/mails_senderprofile_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 38fb81c6430..dbf47365440 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -670,7 +670,7 @@ if ($num == 0) { $colspan++; } } - print ''.$langs->trans("NoRecordFound").''; + print ''.$langs->trans("NoRecordFound").''; } From 8bb8b7b423f5ad1b4d021b7489f82fd198685286 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Apr 2023 23:00:30 +0200 Subject: [PATCH 339/381] Look and feel --- htdocs/admin/mails.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 06f4dfdea85..504197fac7a 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -924,7 +924,7 @@ if ($action == 'edit') { print '
'.$langs->trans("DoTestServerAvailability").''; } } else { - print ''.$langs->trans("DoTestServerAvailability").''; + //print ''.$langs->trans("DoTestServerAvailability").''; } print ''.$langs->trans("DoTestSend").''; @@ -1028,7 +1028,7 @@ if ($action == 'edit') { print '
'; print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend")); - print dol_get_fiche_head(''); + print dol_get_fiche_head(array(), '', '', -1); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -1073,6 +1073,7 @@ if ($action == 'edit') { print dol_get_fiche_end(); // References + print '

'; print ''.$langs->trans("EMailsWillHaveMessageID").': '; print dol_escape_htmltag(''); print ''; From 7096f0c23691a8e9118667a7ea9b9e9bd593b345 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Apr 2023 23:23:51 +0200 Subject: [PATCH 340/381] Fix css --- htdocs/core/tpl/passwordforgotten.tpl.php | 6 ++++-- htdocs/core/tpl/passwordreset.tpl.php | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 27ab617636b..5b418f63541 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -238,21 +238,23 @@ if (!empty($morelogincontent)) { -'; } } else { + print ''; } ?> -

diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index e1368c0d3ee..32500cc38ab 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -117,7 +117,7 @@ if ($setnewpassword && $username && $passworduidhash) { ?> - + global->MAIN_LOGIN_BACKGROUND) ? '' : ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> @@ -278,21 +278,23 @@ if (!empty($morelogincontent)) { -'; } } else { + print ''; } ?> -

From d7dff81b8fdcc82625437682d59e01ef1d41616c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 00:52:09 +0200 Subject: [PATCH 341/381] Debug emailcollector --- .../class/emailcollector.class.php | 53 ++++++++++++++----- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 46a73e38b36..76a934d97ac 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -935,13 +935,13 @@ class EmailCollector extends CommonObject if (preg_match('/'.$regexstring.'/'.$regexoptions, $sourcestring, $regforval)) { // Overwrite param $tmpproperty $valueextracted = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null; - if (strtolower($sourcefield) == 'header') { + if (strtolower($sourcefield) == 'header') { // extract from HEADER if (preg_match('/^options_/', $tmpproperty)) { $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $this->decodeSMTPSubject($valueextracted); } else { $object->$tmpproperty = $this->decodeSMTPSubject($valueextracted); } - } else { + } else { // extract from BODY if (preg_match('/^options_/', $tmpproperty)) { $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $this->decodeSMTPSubject($valueextracted); } else { @@ -1683,8 +1683,12 @@ class EmailCollector extends CommonObject //print $messagetext; //exit; + $fromstring = ''; + $replytostring = ''; + if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { $fromstring = $overview['from']; + //$replytostring = empty($overview['reply-to']) ? '' : $overview['reply-to']; $sender = $overview['sender']; $to = $overview['to']; @@ -1695,6 +1699,7 @@ class EmailCollector extends CommonObject $subject = $overview['subject']; } else { $fromstring = $overview[0]->from; + //$replytostring = empty($overview[0]->replyto) ? '' : $overview[0]->replyto; $sender = $overview[0]->sender; $to = $overview[0]->to; @@ -1715,6 +1720,13 @@ class EmailCollector extends CommonObject $from = $fromstring; $fromtext = ''; } + if (preg_match('/^(.*)<(.*)>$/', $replytostring, $reg)) { + $replyto = $reg[2]; + $replytotext = $reg[1]; + } else { + $replyto = $replytostring; + $replytotext = ''; + } $fk_element_id = 0; $fk_element_type = ''; @@ -2011,6 +2023,7 @@ class EmailCollector extends CommonObject $idtouseforthirdparty = ''; $nametouseforthirdparty = ''; $emailtouseforthirdparty = ''; + $namealiastouseforthirdparty = ''; // $actionparam = 'param=SET:aaa' or 'param=EXTRACT:BODY:....' $arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '='); @@ -2048,16 +2061,23 @@ class EmailCollector extends CommonObject $emailtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found propertytooverwrite='.dol_escape_htmltag($propertytooverwrite); - } else { + } elseif ($propertytooverwrite == 'name') { $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found nametouseforthirdparty='.dol_escape_htmltag($nametouseforthirdparty); + } elseif ($propertytooverwrite == 'name_alias') { + $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; + + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found namealiastouseforthirdparty='.dol_escape_htmltag($namealiastouseforthirdparty); + } else { + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> We discard this, not used to search existing thirdparty'; } } else { // Regex not found $idtouseforthirdparty = null; $nametouseforthirdparty = null; $emailtouseforthirdparty = null; + $namealiastouseforthirdparty = null; $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Not found'; } @@ -2071,6 +2091,7 @@ class EmailCollector extends CommonObject } elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $reg)) { //if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1]; //else $object->$tmpproperty = $reg[1]; + // Example: id=SETIFEMPTY:123 if ($propertytooverwrite == 'id') { $idtouseforthirdparty = $reg[2]; @@ -2079,10 +2100,14 @@ class EmailCollector extends CommonObject $emailtouseforthirdparty = $reg[2]; $operationslog .= '
We set property emailtouseforthrdparty='.dol_escape_htmltag($emailtouseforthirdparty); - } else { + } elseif ($propertytooverwrite == 'name') { $nametouseforthirdparty = $reg[2]; $operationslog .= '
We set property nametouseforthirdparty='.dol_escape_htmltag($nametouseforthirdparty); + } elseif ($propertytooverwrite == 'name_alias') { + $namealiastouseforthirdparty = $reg[2]; + + $operationslog .= '
We set property namealiastouseforthirdparty='.dol_escape_htmltag($namealiastouseforthirdparty); } } else { $errorforactions++; @@ -2092,8 +2117,8 @@ class EmailCollector extends CommonObject } } - if (!$errorforactions && ($idtouseforthirdparty || $emailtouseforthirdparty || $nametouseforthirdparty)) { - $result = $thirdpartystatic->fetch($idtouseforthirdparty, $nametouseforthirdparty, '', '', '', '', '', '', '', '', $emailtouseforthirdparty); + if (!$errorforactions && ($idtouseforthirdparty || $emailtouseforthirdparty || $nametouseforthirdparty || $namealiastouseforthirdparty)) { + $result = $thirdpartystatic->fetch($idtouseforthirdparty, $nametouseforthirdparty, '', '', '', '', '', '', '', '', $emailtouseforthirdparty, $namealiastouseforthirdparty); if ($result < 0) { $errorforactions++; $this->error = 'Error when getting thirdparty with name '.$nametouseforthirdparty.' (may be 2 record exists with same name ?)'; @@ -2101,21 +2126,25 @@ class EmailCollector extends CommonObject break; } elseif ($result == 0) { if ($operation['type'] == 'loadthirdparty') { - dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." was not found"); + dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was not found"); $errorforactions++; $langs->load("errors"); - $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty); + $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty, $namealiastouseforthirdparty); $this->errors[] = $this->error; } elseif ($operation['type'] == 'loadandcreatethirdparty') { - dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." was not found. We try to create it."); + dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was not found. We try to create it."); // Create thirdparty $thirdpartystatic->name = $nametouseforthirdparty; - if ($fromtext != $nametouseforthirdparty) { - $thirdpartystatic->name_alias = $fromtext; + if (!empty($namealiastouseforthirdparty)) { + if ($namealiastouseforthirdparty != $nametouseforthirdparty) { + $thirdpartystatic->name_alias = $namealiastouseforthirdparty; + } + } else { + $thirdpartystatic->name_alias = (empty($replytostring) ? (empty($fromtext) ? '': $fromtext) : $replytostring); } - $thirdpartystatic->email = ($emailtouseforthirdparty ? $emailtouseforthirdparty : $from); + $thirdpartystatic->email = (empty($emailtouseforthirdparty) ? (empty($replyto) ? (empty($from) ? '' : $from) : $replyto) : $emailtouseforthirdparty); // Overwrite values with values extracted from source email $errorforthisaction = $this->overwritePropertiesOfObject($thirdpartystatic, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); From c4d7b15906da94888ef59bb75cef70aa08b622b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 00:57:18 +0200 Subject: [PATCH 342/381] Fix trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9d5be55baa6..1503bfbd5c4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2196,7 +2196,7 @@ LargerThan=Larger than IfTrackingIDFoundEventWillBeLinked=Note that If a tracking ID of an object is found into email, or if the email is an answer of an email aready collected and linked to an object, the created event will be automatically linked to the known related object. WithGMailYouCanCreateADedicatedPassword=With a GMail account, if you enabled the 2 steps validation, it is recommanded to create a dedicated second password for the application instead of using your own account passsword from https://myaccount.google.com/. EmailCollectorTargetDir=It may be a desired behaviour to move the email into another tag/directory when it was processed successfully. Just set name of directory here to use this feature (Do NOT use special characters in name). Note that you must also use a read/write login account. -EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database. The found (or created) thirdparty will be used for following actions that need it.
For example, if you want to create a thirdparty with a name extracted from a string 'Name: name to find' present into the body, use the sender email as email, you can set the parameter field like this:
'email=HEADER:^From:(.*);name=EXTRACT:BODY:Name:\\s([^\\s]*);client=SET:2;'
+EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database (search will be done on the defined property among 'id','name','name_alias','email'). The found (or created) thirdparty will be used for following actions that need it.
For example, if you want to create a thirdparty with a name extracted from a string 'Name: name to find' present into the body, use the sender email as email, you can set the parameter field like this:
'email=HEADER:^From:(.*);name=EXTRACT:BODY:Name:\\s([^\\s]*);client=SET:2;'
EndPointFor=End point for %s : %s DeleteEmailCollector=Delete email collector ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector? From 5ac9ca5efc230f94ad6aca93016f40137a753a60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 01:13:13 +0200 Subject: [PATCH 343/381] Fix logs --- .../emailcollector/class/emailcollector.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 76a934d97ac..d828e5d3ea0 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1495,7 +1495,7 @@ class EmailCollector extends CommonObject $emailto = $this->decodeSMTPSubject($overview[0]->to); - $operationslog .= '
Process email '.dol_escape_htmltag($iforemailloop)." - References: ".dol_escape_htmltag($headers['References'])." - Subject: ".dol_escape_htmltag($headers['Subject']); + $operationslog .= '
** Process email '.dol_escape_htmltag($iforemailloop)." - References: ".dol_escape_htmltag($headers['References'])." - Subject: ".dol_escape_htmltag($headers['Subject']); dol_syslog("** Process email ".$iforemailloop." References: ".$headers['References']." Subject: ".$headers['Subject']); @@ -2056,21 +2056,21 @@ class EmailCollector extends CommonObject if ($propertytooverwrite == 'id') { $idtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; - $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found idtouseforthirdparty='.dol_escape_htmltag($idtouseforthirdparty); + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Found idtouseforthirdparty='.dol_escape_htmltag($idtouseforthirdparty); } elseif ($propertytooverwrite == 'email') { $emailtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; - $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found propertytooverwrite='.dol_escape_htmltag($propertytooverwrite); + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Found emailtouseforthirdparty='.dol_escape_htmltag($propertytooverwrite); } elseif ($propertytooverwrite == 'name') { $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; - $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found nametouseforthirdparty='.dol_escape_htmltag($nametouseforthirdparty); + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Found nametouseforthirdparty='.dol_escape_htmltag($nametouseforthirdparty); } elseif ($propertytooverwrite == 'name_alias') { $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; - $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found namealiastouseforthirdparty='.dol_escape_htmltag($namealiastouseforthirdparty); + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Found namealiastouseforthirdparty='.dol_escape_htmltag($namealiastouseforthirdparty); } else { - $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> We discard this, not used to search existing thirdparty'; + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> We discard this, not used to search existing thirdparty'; } } else { // Regex not found @@ -2079,7 +2079,7 @@ class EmailCollector extends CommonObject $emailtouseforthirdparty = null; $namealiastouseforthirdparty = null; - $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Not found'; + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Not found'; } //var_dump($object->$tmpproperty);exit; } else { From 9e4e49bd77e7b020337e484de84e05095b13c893 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 01:16:50 +0200 Subject: [PATCH 344/381] Fix log --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index d828e5d3ea0..af3529aa9ad 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2060,7 +2060,7 @@ class EmailCollector extends CommonObject } elseif ($propertytooverwrite == 'email') { $emailtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; - $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Found emailtouseforthirdparty='.dol_escape_htmltag($propertytooverwrite); + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtoupper($sourcefield).' -> Found emailtouseforthirdparty='.dol_escape_htmltag($emailtouseforthirdparty); } elseif ($propertytooverwrite == 'name') { $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; From e1bbce7ab708c0a14fdc0a44f568fc29025462b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 01:21:10 +0200 Subject: [PATCH 345/381] css --- htdocs/admin/emailcollector_card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 23ccea552e1..28e1d4ad285 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -685,11 +685,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print '
'; - print '

'; + print '


'; // Operations - print '
'; - print ''; + print '
'; + print '
'; print ''; print ''; print ''; From b4143d3d2cc5995445ab34bf06958ed15f679955 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 01:25:22 +0200 Subject: [PATCH 346/381] Fix tooltip --- htdocs/admin/emailcollector_card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 28e1d4ad285..956a1997319 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -695,8 +695,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; $arrayoftypes = array( - 'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")), - 'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")), + 'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName").'/'.$langs->transnoentities("AliasNameShort").'/'.$langs->transnoentities("Email").'/'.$langs->transnoentities("ID")), + 'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName").'/'.$langs->transnoentities("AliasNameShort").'/'.$langs->transnoentities("Email").'/'.$langs->transnoentities("ID")), 'recordjoinpiece' => 'AttachJoinedDocumentsToObject', 'recordevent' => 'RecordEvent' ); From 39fa93486d98764fb1f21ca17c06d9f5c7f93b06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 01:56:44 +0200 Subject: [PATCH 347/381] Debug v17 --- htdocs/projet/card.php | 13 ++----------- htdocs/projet/contact.php | 38 ++++++++++++++++++-------------------- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 8e6a9fd6881..7fddc12b7c9 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1213,8 +1213,8 @@ if ($action == 'create' && $user->rights->projet->creer) { $morehtmlref = '
'; // Title $morehtmlref .= dol_escape_htmltag($object->title); - // Thirdparty $morehtmlref .= '
'; + // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'project'); } @@ -1232,7 +1232,7 @@ if ($action == 'create' && $user->rights->projet->creer) { print '
'; print '
'; - print '
'.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).'
'; + print '
'; // Usage if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { @@ -1302,15 +1302,6 @@ if ($action == 'create' && $user->rights->projet->creer) { } } print ''; - - // Opportunity Weighted Amount - /* - print ''; - */ } // Budget diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 2174a02c347..21b71b53ac9 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -240,6 +240,10 @@ if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->pr * View */ +$form = new Form($db); +$contactstatic = new Contact($db); +$userstatic = new User($db); + $title = $langs->trans('ProjectContact').' - '.$object->ref.' '.$object->name; if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans('ProjectContact'); @@ -249,18 +253,12 @@ $help_url = 'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE: llxHeader('', $title, $help_url); -$form = new Form($db); -$contactstatic = new Contact($db); -$userstatic = new User($db); -/* *************************************************************************** */ -/* */ -/* Edition and view mode */ -/* */ -/* *************************************************************************** */ - if ($id > 0 || !empty($ref)) { + /* + * View + */ if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } @@ -293,10 +291,11 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; // Title - $morehtmlref .= $object->title; + $morehtmlref .= dol_escape_htmltag($object->title); + $morehtmlref .= '
'; // Thirdparty if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { - $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref .= $object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; @@ -358,26 +357,25 @@ if ($id > 0 || !empty($ref)) { } print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $object->opp_status) { + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) { // Opportunity status print ''; // Opportunity percent - print ''; + print ''; // Opportunity Amount print ''; @@ -397,7 +395,7 @@ if ($id > 0 || !empty($ref)) { $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); - print ' - '; + print ' - '; print ($end ? $end : '?'); if ($object->hasDelay()) { print img_warning("Late"); @@ -418,7 +416,7 @@ if ($id > 0 || !empty($ref)) { // Description print ''; // Categories From 454372bb4e8a712f4c6143e4837952b8acff3fca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 02:05:05 +0200 Subject: [PATCH 348/381] Fix show description of project --- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/time.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 1f31690052f..391f02d7c8c 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -403,7 +403,7 @@ if ($projectid > 0) { // Description print ''; // Categories diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 1bdefbcc1e6..1b002ba5688 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -340,7 +340,7 @@ print '
'.$langs->trans('OpportunityWeightedAmount').''; - if (strcmp($object->opp_amount, '') && strcmp($object->opp_percent, '')) { - print ''.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).''; - } - print '
'.$langs->trans("OpportunityStatus").''; $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); if ($code) { print $langs->trans("OppStatus".$code); } - print '
'.$langs->trans("OpportunityProbability").''; + print ' / '; if (strcmp($object->opp_percent, '')) { - print price($object->opp_percent, '', $langs, 1, 0).' %'; + print price($object->opp_percent, 0, $langs, 1, 0).' %'; } - print '
'.$langs->trans("OpportunityAmount").''; if (strcmp($object->opp_amount, '')) { - print ''.price($object->opp_amount, '', $langs, 0, 0, 0, $conf->currency).''; + print ''.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).''; if (strcmp($object->opp_percent, '')) { print '       '.$langs->trans("Weighted").': '.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).''; } @@ -388,7 +386,7 @@ if ($id > 0 || !empty($ref)) { // Budget print '
'.$langs->trans("Budget").''; if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { - print ''.price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency).''; + print ''.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; } print '
'.$langs->trans("Description").''; - print nl2br($object->description); + print dol_htmlentitiesbr($object->description); print '
'.$langs->trans("Description").''; - print nl2br($project->description); + print dol_htmlentitiesbr($project->description); print '
'; // Description print ''; // Categories diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 2ba3f329ac2..f15d5f019ba 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -648,7 +648,7 @@ if ($id > 0 || !empty($ref)) { // Description print ''; // Categories diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index d97dee9a11b..b98e9298732 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1038,7 +1038,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Description print ''; // Categories From 144d061db3612c04a7b66299ad22bfdd1462f09a Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 4 Apr 2023 11:01:03 +0200 Subject: [PATCH 349/381] FIX supplier link on bank transfer line --- htdocs/compta/prelevement/line.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 6eb10ce6a1a..a7690ca51a2 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -315,7 +315,11 @@ if ($id) { print ''.$obj->ref."\n"; } - print '\n"; print '\n"; From 66f1696a9b16725765a7b401a907c16aae8377b6 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Tue, 4 Apr 2023 11:05:50 +0200 Subject: [PATCH 350/381] FIX filter missing id --- htdocs/contact/consumption.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index da00374cc2a..017cd2d64d1 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -339,7 +339,7 @@ if ($sql_select) $num = $db->num_rows($resql); - $param = "&socid=".urlencode($socid)."&type_element=".urlencode($type_element); + $param = "&socid=".urlencode($socid)."&type_element=".urlencode($type_element)."&id=".urlencode($id); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sprod_fulldescr) $param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr); From 9f8b67a6ec5ba35d642a1a02de920c68f40b8f46 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 4 Apr 2023 11:33:23 +0200 Subject: [PATCH 351/381] FIX supplier invoice status on bank transfer line --- htdocs/compta/prelevement/line.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 6eb10ce6a1a..d094a61e0b8 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -116,7 +116,13 @@ if ($action == 'confirm_rejet') { * View */ -$invoicestatic = new Facture($db); +if ($type == 'bank-transfer') { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + $invoicestatic = new FactureFournisseur($db); +} else { + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $invoicestatic = new Facture($db); +} $title = $langs->trans("WithdrawalsLine"); if ($type == 'bank-transfer') { From 71a5cac06f424b6bc436fa0dbd3acc03a1ecea9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 11:55:35 +0200 Subject: [PATCH 352/381] Doc --- htdocs/install/mysql/tables/llx_expeditiondet_batch.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql index a4bd120503d..6cedc0b5a32 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql @@ -24,6 +24,6 @@ CREATE TABLE llx_expeditiondet_batch ( sellby date DEFAULT NULL, batch varchar(128) DEFAULT NULL, qty double NOT NULL DEFAULT '0', - fk_origin_stock integer NOT NULL -- id into table llx_product_batch (may be renamed into llx_product_stock_batch in another version). TODO We should add and use instead a fk_warehouse field + fk_origin_stock integer NOT NULL -- id into table llx_product_batch (llx_product_batch may be renamed into llx_product_stock_batch in another version). TODO We should add and use instead a fk_warehouse field ) ENGINE=innodb; From 36ffcbc5da75d3451c78f4682bda4e767337294e Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 4 Apr 2023 12:26:59 +0200 Subject: [PATCH 353/381] FIX Search List Select Extrafields with condition --- htdocs/core/class/extrafields.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6644548d87c..6f346179aa8 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1084,6 +1084,9 @@ class ExtraFields continue; } + $valarray = explode('|', $val); + $val = $valarray[0]; + if ($langfile && $val) { $options[$okey] = $langs->trans($val); } else { From f9170fa31b84518bedef41cb4ab9dd7e6eb14a96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 12:59:02 +0200 Subject: [PATCH 354/381] FIX Back to cancel on reception creation --- htdocs/fourn/commande/dispatch.php | 1 + htdocs/reception/card.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f5a983ac5bb..76441dafd0e 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1069,6 +1069,7 @@ if ($id > 0 || !empty($ref)) { $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive") : $langs->trans("CreateReception"); print '
'; + print ''; print 'global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -178,7 +180,29 @@ if ($reshook < 0) { } if (empty($reshook)) { + /* + $backurlforlist = DOL_URL_ROOT.'/reception/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + */ + if ($cancel) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + $action = ''; } @@ -760,6 +784,8 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; + print ''; if (GETPOST('entrepot_id', 'int')) { print ''; } From daa2d98ff2d4e648bf37405b4c44420401662c77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 18:42:55 +0200 Subject: [PATCH 355/381] FIX Reception process loose some lines on first error. --- htdocs/fourn/js/lib_dispatch.js.php | 4 +-- htdocs/reception/card.php | 50 +++++++++++++++++------------ 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/htdocs/fourn/js/lib_dispatch.js.php b/htdocs/fourn/js/lib_dispatch.js.php index 01af2ee5d91..ff822543ddb 100644 --- a/htdocs/fourn/js/lib_dispatch.js.php +++ b/htdocs/fourn/js/lib_dispatch.js.php @@ -93,8 +93,8 @@ function addDispatchLine(index, type, mode) } console.log("qtyDispatched="+qtyDispatched+" qtyOrdered="+qtyOrdered); - if (qtyOrdered <= 1) { - window.alert("Quantity can't be split"); + if (qtyDispatched >= qtyOrdered || qtyOrdered <= 1) { + window.alert("Remain quantity to dispatch is too low to be split"); } else if (qtyDispatched < qtyOrdered) { //replace tr suffix nbr $row.html($row.html().replace(/_0_/g,"_"+nbrTrs+"_")); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index ae63200db90..944c7d5304b 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -339,16 +339,17 @@ if (empty($reshook)) { } } + // Loop lines to calculate $totalqty for ($i = 1; $i <= $num; $i++) { - $idl = "idl".$i; + $idl = "idl".$i; // id line source - $sub_qty = array(); - $subtotalqty = 0; + //$sub_qty = array(); + //$subtotalqty = 0; - $j = 0; - $batch = "batchl".$i."_0"; - $stockLocation = "ent1".$i."_0"; - $qty = "qtyl".$i; + //$j = 0; + //$batch = "batchl".$i."_0"; + //$stockLocation = "ent1".$i."_0"; + $qty = "qtyl".$i; // qty //reception line for product with no batch management and no multiple stock location if (GETPOST($qty, 'alpha') > 0) { @@ -362,6 +363,7 @@ if (empty($reshook)) { if ($totalqty > 0) { // There is at least one thing to ship for ($i = 1; $i <= $num; $i++) { + $idl = "idl".$i; // id line source $lineToTest = ''; $lineId = GETPOST($idl, 'int'); foreach ($objectsrc->lines as $linesrc) { @@ -375,26 +377,28 @@ if (empty($reshook)) { } $qty = "qtyl".$i; $comment = "comment".$i; - // EATBY <-> DLUO see productbatch.class.php - // SELLBY <-> DLC + // EATBY <-> DLUO and SELLBY <-> DLC, see productbatch.class.php $eatby = "dluo".$i; $sellby = "dlc".$i; $batch = "batch".$i; $cost_price = "cost_price".$i; - //if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS')) || (GETPOST($qty, 'int') < 0 && getDolGlobalString('RECEPTION_ALLOW_NEGATIVE_QTY'))) { - if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS)) { - $ent = "entl".$i; + //var_dump(GETPOST("productl".$i, 'int').' '.GETPOST('entl'.$i, 'int').' '.GETPOST($idl, 'int').' '.GETPOST($qty, 'int').' '.GETPOST($batch, 'alpha')); + //if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS')) || (GETPOST($qty, 'int') < 0 && getDolGlobalString('RECEPTION_ALLOW_NEGATIVE_QTY'))) { + if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS'))) { + $ent = "entl".$i; $idl = "idl".$i; $entrepot_id = is_numeric(GETPOST($ent, 'int')) ? GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int'); + /* if (!empty($lineToTest)) { $fk_product = $lineToTest->fk_product; } else { $fk_product = $linesrc->fk_product; - } + }*/ + $fk_product = GETPOST("productl".$i, 'int'); if ($entrepot_id < 0) { $entrepot_id = ''; @@ -402,6 +406,7 @@ if (empty($reshook)) { if (!($fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $entrepot_id = 0; } + $eatby = GETPOST($eatby, 'alpha'); $sellby = GETPOST($sellby, 'alpha'); $eatbydate = str_replace('/', '-', $eatby); @@ -419,7 +424,6 @@ if (empty($reshook)) { } } - // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) { @@ -941,7 +945,7 @@ if ($action == 'create') { print dol_get_fiche_end(); - // Reception lines + // Number of lines show on the reception card $numAsked = 0; /** @@ -954,7 +958,7 @@ if ($action == 'create') { foreach ($_POST as $key => $value) { // If create form is coming from the button "Create Reception" of previous page - // without batch module enabled + // without batch module enabled or product with no lot/serial $reg = array(); if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; @@ -969,10 +973,10 @@ if ($action == 'create') { $ent = "entrepot_" . $paramSuffix; $pu = "pu_" . $paramSuffix; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_" . $paramSuffix; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); + $dispatchLines[$numAsked] = array('paramSuffix'=>$paramSuffix, 'prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); } - // with batch module enabled + // with batch module enabled and product with lot/serial if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; $paramSuffix = $reg[1] . '_' . $reg[2]; @@ -990,11 +994,11 @@ if ($action == 'create') { $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$paramSuffix.'month', 'int'), GETPOST('dluo_'.$paramSuffix.'day', 'int'), GETPOST('dluo_'.$paramSuffix.'year', 'int')); $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$paramSuffix.'month', 'int'), GETPOST('dlc_'.$paramSuffix.'day', 'int'), GETPOST('dlc_'.$paramSuffix.'year', 'int')); $fk_commandefourndet = 'fk_commandefourndet_'.$paramSuffix; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + $dispatchLines[$numAsked] = array('paramSuffix'=>$paramSuffix, 'prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } // If create form is coming from same page, it means that post was sent but an error occured - if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) { + if (preg_match('/^productl([0-9]+)$/i', $key, $reg)) { $numAsked++; $paramSuffix = $reg[1]; $suffix2numAsked[$paramSuffix] = $numAsked; @@ -1116,9 +1120,13 @@ if ($action == 'create') { $product->fetch($line->fk_product); $product->load_stock('warehouseopen'); // Load all $product->stock_warehouse[idwarehouse]->detail_batch //var_dump($product->stock_warehouse[1]); + //var_dump($dispatchLines[$indiceAsked]); print '
'; } if (isModEnabled('stock')) { - print ''; + print ''; } if (isModEnabled('productbatch')) { From e5d74b2ab5a58a1b3121fcb7b77c633e65a5dd83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 19:17:34 +0200 Subject: [PATCH 357/381] Fix trans --- htdocs/reception/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index dbb435b15dd..56854244f7b 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -41,7 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; // Load translation files required by the page -$langs->loadLangs(array('companies', 'other')); +$langs->loadLangs(array('receptions', 'companies', 'other')); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm'); From b48b980a5a62c6cf502ac26c1facb9871ccf2aeb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 12:59:02 +0200 Subject: [PATCH 358/381] FIX Back to cancel on reception creation --- htdocs/fourn/commande/dispatch.php | 1 + htdocs/reception/card.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f5a983ac5bb..76441dafd0e 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1069,6 +1069,7 @@ if ($id > 0 || !empty($ref)) { $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive") : $langs->trans("CreateReception"); print '
'; + print ''; print 'global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -178,7 +180,29 @@ if ($reshook < 0) { } if (empty($reshook)) { + /* + $backurlforlist = DOL_URL_ROOT.'/reception/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + */ + if ($cancel) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + $action = ''; } @@ -760,6 +784,8 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; + print ''; if (GETPOST('entrepot_id', 'int')) { print ''; } From 3e77a6cbd43c11f69cf29266ccbfc3ae805eb552 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 18:42:55 +0200 Subject: [PATCH 359/381] FIX Reception process loose some lines on first error. --- htdocs/fourn/js/lib_dispatch.js.php | 4 +- htdocs/reception/card.php | 72 ++++++++++++++++++----------- 2 files changed, 48 insertions(+), 28 deletions(-) diff --git a/htdocs/fourn/js/lib_dispatch.js.php b/htdocs/fourn/js/lib_dispatch.js.php index 01af2ee5d91..ff822543ddb 100644 --- a/htdocs/fourn/js/lib_dispatch.js.php +++ b/htdocs/fourn/js/lib_dispatch.js.php @@ -93,8 +93,8 @@ function addDispatchLine(index, type, mode) } console.log("qtyDispatched="+qtyDispatched+" qtyOrdered="+qtyOrdered); - if (qtyOrdered <= 1) { - window.alert("Quantity can't be split"); + if (qtyDispatched >= qtyOrdered || qtyOrdered <= 1) { + window.alert("Remain quantity to dispatch is too low to be split"); } else if (qtyDispatched < qtyOrdered) { //replace tr suffix nbr $row.html($row.html().replace(/_0_/g,"_"+nbrTrs+"_")); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index f28b51a7a97..13f2a280629 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -339,16 +339,17 @@ if (empty($reshook)) { } } + // Loop lines to calculate $totalqty for ($i = 1; $i <= $num; $i++) { - $idl = "idl".$i; + $idl = "idl".$i; // id line source - $sub_qty = array(); - $subtotalqty = 0; + //$sub_qty = array(); + //$subtotalqty = 0; - $j = 0; - $batch = "batchl".$i."_0"; - $stockLocation = "ent1".$i."_0"; - $qty = "qtyl".$i; + //$j = 0; + //$batch = "batchl".$i."_0"; + //$stockLocation = "ent1".$i."_0"; + $qty = "qtyl".$i; // qty //reception line for product with no batch management and no multiple stock location if (GETPOST($qty, 'alpha') > 0) { @@ -362,6 +363,7 @@ if (empty($reshook)) { if ($totalqty > 0) { // There is at least one thing to ship for ($i = 1; $i <= $num; $i++) { + $idl = "idl".$i; // id line source $lineToTest = ''; $lineId = GETPOST($idl, 'int'); foreach ($objectsrc->lines as $linesrc) { @@ -375,26 +377,28 @@ if (empty($reshook)) { } $qty = "qtyl".$i; $comment = "comment".$i; - // EATBY <-> DLUO see productbatch.class.php - // SELLBY <-> DLC + // EATBY <-> DLUO and SELLBY <-> DLC, see productbatch.class.php $eatby = "dluo".$i; $sellby = "dlc".$i; $batch = "batch".$i; $cost_price = "cost_price".$i; - //if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS')) || (GETPOST($qty, 'int') < 0 && getDolGlobalString('RECEPTION_ALLOW_NEGATIVE_QTY'))) { - if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS)) { - $ent = "entl".$i; + //var_dump(GETPOST("productl".$i, 'int').' '.GETPOST('entl'.$i, 'int').' '.GETPOST($idl, 'int').' '.GETPOST($qty, 'int').' '.GETPOST($batch, 'alpha')); + //if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS')) || (GETPOST($qty, 'int') < 0 && getDolGlobalString('RECEPTION_ALLOW_NEGATIVE_QTY'))) { + if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS'))) { + $ent = "entl".$i; $idl = "idl".$i; $entrepot_id = is_numeric(GETPOST($ent, 'int')) ? GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int'); + /* if (!empty($lineToTest)) { $fk_product = $lineToTest->fk_product; } else { $fk_product = $linesrc->fk_product; - } + }*/ + $fk_product = GETPOST("productl".$i, 'int'); if ($entrepot_id < 0) { $entrepot_id = ''; @@ -402,6 +406,7 @@ if (empty($reshook)) { if (!($fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $entrepot_id = 0; } + $eatby = GETPOST($eatby, 'alpha'); $sellby = GETPOST($sellby, 'alpha'); $eatbydate = str_replace('/', '-', $eatby); @@ -419,7 +424,6 @@ if (empty($reshook)) { } } - // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) { @@ -941,7 +945,7 @@ if ($action == 'create') { print dol_get_fiche_end(); - // Reception lines + // Number of lines show on the reception card $numAsked = 0; /** @@ -954,7 +958,7 @@ if ($action == 'create') { foreach ($_POST as $key => $value) { // If create form is coming from the button "Create Reception" of previous page - // without batch module enabled + // without batch module enabled or product with no lot/serial $reg = array(); if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; @@ -969,10 +973,10 @@ if ($action == 'create') { $ent = "entrepot_" . $paramSuffix; $pu = "pu_" . $paramSuffix; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_" . $paramSuffix; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); + $dispatchLines[$numAsked] = array('paramSuffix'=>$paramSuffix, 'prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); } - // with batch module enabled + // with batch module enabled and product with lot/serial if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; $paramSuffix = $reg[1] . '_' . $reg[2]; @@ -990,11 +994,11 @@ if ($action == 'create') { $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$paramSuffix.'month', 'int'), GETPOST('dluo_'.$paramSuffix.'day', 'int'), GETPOST('dluo_'.$paramSuffix.'year', 'int')); $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$paramSuffix.'month', 'int'), GETPOST('dlc_'.$paramSuffix.'day', 'int'), GETPOST('dlc_'.$paramSuffix.'year', 'int')); $fk_commandefourndet = 'fk_commandefourndet_'.$paramSuffix; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + $dispatchLines[$numAsked] = array('paramSuffix'=>$paramSuffix, 'prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } // If create form is coming from same page, it means that post was sent but an error occured - if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) { + if (preg_match('/^productl([0-9]+)$/i', $key, $reg)) { $numAsked++; $paramSuffix = $reg[1]; $suffix2numAsked[$paramSuffix] = $numAsked; @@ -1116,9 +1120,13 @@ if ($action == 'create') { $product->fetch($line->fk_product); $product->load_stock('warehouseopen'); // Load all $product->stock_warehouse[idwarehouse]->detail_batch //var_dump($product->stock_warehouse[1]); + //var_dump($dispatchLines[$indiceAsked]); print '
'; } if (isModEnabled('stock')) { - print ''; + print ''; } if (isModEnabled('productbatch')) { From 165d958a6dc7babd7cdbf6bf8547477b49f9ffec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 19:17:34 +0200 Subject: [PATCH 361/381] Fix trans --- htdocs/reception/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index dbb435b15dd..56854244f7b 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -41,7 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; // Load translation files required by the page -$langs->loadLangs(array('companies', 'other')); +$langs->loadLangs(array('receptions', 'companies', 'other')); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm'); From b9bee0a0e3f30b4ad7fa271a6620ebc067a102cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 19:45:52 +0200 Subject: [PATCH 362/381] css --- htdocs/fourn/commande/dispatch.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 76441dafd0e..50508f171df 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -486,6 +486,7 @@ if ($action == 'updateline' && $permissiontoreceive) { } } + /* * View */ @@ -616,6 +617,10 @@ if ($id > 0 || !empty($ref)) { print '
'.$langs->trans("OrderStatusNotReadyToDispatch").''; } + + print '
'; + + if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT || $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) { @@ -731,7 +736,7 @@ if ($id > 0 || !empty($ref)) { print '
'; print ''; print ' '; + print '
'.img_picto($langs->trans("Reset"), 'eraser', 'class="pictofixedwidth opacitymedium"').$langs->trans("Reset").''; print ''; if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { From 301de5b3df25dc15174846e5bc6fd5d599c6afbe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 20:12:59 +0200 Subject: [PATCH 363/381] Upgrade to JQuery 3.6.4 - Remove patches required by 3.6.0 --- COPYRIGHT | 2 +- htdocs/core/js/lib_head.js.php | 17 -- htdocs/includes/jquery/js/jquery.js | 284 +++++++++++++++--------- htdocs/includes/jquery/js/jquery.min.js | 4 +- 4 files changed, 187 insertions(+), 120 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index 7be728f8948..93f4a43fee1 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -51,7 +51,7 @@ JS libraries: Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea. ChartJS 3.7.1 MIT License Yes JS library for graph CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG -jQuery 3.6.0 MIT License Yes JS library +jQuery 3.6.4 MIT License Yes JS library jQuery UI 1.13.2 GPL and MIT License Yes JS library plugin UI jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 8c4d958abac..d721ec78873 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1292,21 +1292,4 @@ $(document).ready(function() { }); -/* - * Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection" - * see: https://github.com/select2/select2/issues/5993 - * see: https://github.com/jquery/jquery/issues/4382 - * - * TODO: Recheck with the select2 GH issue and remove once this is fixed on their side - */ -$(document).on('select2:open', () => { - console.log("Execute the focus (click on combo or use space when on component"); - let allFound = document.querySelectorAll('.select2-container--open .select2-search__field'); - $(this).one('mouseup keyup',()=>{ - setTimeout(()=>{ - allFound[allFound.length - 1].focus(); - },0); - }); -}); - // End of lib_head.js.php diff --git a/htdocs/includes/jquery/js/jquery.js b/htdocs/includes/jquery/js/jquery.js index fc6c299b73e..7f35c11bdf3 100644 --- a/htdocs/includes/jquery/js/jquery.js +++ b/htdocs/includes/jquery/js/jquery.js @@ -1,5 +1,5 @@ /*! - * jQuery JavaScript Library v3.6.0 + * jQuery JavaScript Library v3.6.4 * https://jquery.com/ * * Includes Sizzle.js @@ -9,7 +9,7 @@ * Released under the MIT license * https://jquery.org/license * - * Date: 2021-03-02T17:08Z + * Date: 2023-03-08T15:28Z */ ( function( global, factory ) { @@ -23,7 +23,7 @@ // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. + // See ticket trac-14549 for more info. module.exports = global.document ? factory( global, true ) : function( w ) { @@ -151,7 +151,7 @@ function toType( obj ) { var - version = "3.6.0", + version = "3.6.4", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -522,14 +522,14 @@ function isArrayLike( obj ) { } var Sizzle = /*! - * Sizzle CSS Selector Engine v2.3.6 + * Sizzle CSS Selector Engine v2.3.10 * https://sizzlejs.com/ * * Copyright JS Foundation and other contributors * Released under the MIT license * https://js.foundation/ * - * Date: 2021-02-16 + * Date: 2023-02-14 */ ( function( window ) { var i, @@ -633,7 +633,7 @@ var i, whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + + rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rdescend = new RegExp( whitespace + "|>" ), @@ -850,7 +850,7 @@ function Sizzle( selector, context, results, seed ) { // as such selectors are not recognized by querySelectorAll. // Thanks to Andrew Dupont for this technique. if ( nodeType === 1 && - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { + ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { // Expand context for sibling selectors newContext = rsibling.test( selector ) && testContext( context.parentNode ) || @@ -1174,6 +1174,24 @@ setDocument = Sizzle.setDocument = function( node ) { !el.querySelectorAll( ":scope fieldset div" ).length; } ); + // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ + // Make sure the the `:has()` argument is parsed unforgivingly. + // We include `*` in the test to detect buggy implementations that are + // _selectively_ forgiving (specifically when the list includes at least + // one valid selector). + // Note that we treat complete lack of support for `:has()` as if it were + // spec-compliant support, which is fine because use of `:has()` in such + // environments will fail in the qSA path and fall back to jQuery traversal + // anyway. + support.cssHas = assert( function() { + try { + document.querySelector( ":has(*,:jqfake)" ); + return false; + } catch ( e ) { + return true; + } + } ); + /* Attributes ---------------------------------------------------------------------- */ @@ -1440,6 +1458,17 @@ setDocument = Sizzle.setDocument = function( node ) { } ); } + if ( !support.cssHas ) { + + // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ + // Our regular `try-catch` mechanism fails to detect natively-unsupported + // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) + // in browsers that parse the `:has()` argument as a forgiving selector list. + // https://drafts.csswg.org/selectors/#relational now requires the argument + // to be parsed unforgivingly, but browsers have not yet fully adjusted. + rbuggyQSA.push( ":has" ); + } + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); @@ -1452,7 +1481,14 @@ setDocument = Sizzle.setDocument = function( node ) { // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, + + // Support: IE <9 only + // IE doesn't have `contains` on `document` so we need to check for + // `documentElement` presence. + // We need to fall back to `a` when `documentElement` is missing + // as `ownerDocument` of elements within `
'.$langs->trans("Description").''; -print nl2br($object->description); +print dol_htmlentitiesbr($object->description); print '
'.$langs->trans("Description").''; - print nl2br($object->description); + print dol_htmlentitiesbr($object->description); print '
'.$langs->trans("Description").''; - print nl2br($projectstatic->description); + print dol_htmlentitiesbr($projectstatic->description); print '
'; + if ($type == 'bank-transfer') { + print ''; + } else { + print ''; + } print img_object($langs->trans("ShowCompany"), "company").' '.$obj->name."'.price($obj->total_ttc)."'; print ''; // ancre pour retourner sur la ligne + + print ''; + if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice print ''; @@ -1979,7 +1987,7 @@ if ($action == 'create') { print ''; print ''; $detail = $langs->trans("NA"); - if ($lines[$i]->product->status_batch && $lines[$i]->fk_product > 0) { + if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; $productlot = new Productlot($db); $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch); From bf21547322a4f718fbc3d8b299002d51d0a7cd23 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 19:03:17 +0200 Subject: [PATCH 356/381] Fix label --- htdocs/reception/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 944c7d5304b..2bfede4b28b 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1723,7 +1723,7 @@ if ($action == 'create') { print $langs->trans("QtyReceived").' - '; } if (isModEnabled('stock')) { - print $langs->trans("WarehouseSource").' - '; + print $langs->trans("WarehouseTarget").' - '; } if (isModEnabled('productbatch')) { print $langs->trans("Batch"); @@ -1743,7 +1743,7 @@ if ($action == 'create') { print ''.$langs->trans("QtyReceived").''.$langs->trans("WarehouseSource").''.$langs->trans("WarehouseTarget").''; print ''; // ancre pour retourner sur la ligne + + print ''; + if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice print ''; @@ -1977,12 +1985,24 @@ if ($action == 'create') { if (isModEnabled('productbatch')) { if (isset($lines[$i]->batch)) { print ''; - print ''; - $detail = ''; - if ($lines[$i]->product->status_batch) { - $detail .= $langs->trans("Batch").': '.$lines[$i]->batch; - if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($lines[$i]->sellby, "day"); + print ''; + $detail = $langs->trans("NA"); + if ($lines[$i]->product->status_batch > 0 && $lines[$i]->fk_product > 0) { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; + $productlot = new Productlot($db); + $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch); + if ($reslot > 0) { + $detail = $productlot->getNomUrl(1); + } else { + // lot is not created and info is only in reception lines + $batchinfo = $langs->trans("Batch").': '.$lines[$i]->batch; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $batchinfo .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($lines[$i]->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $batchinfo .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($lines[$i]->eatby, "day"); + } + $detail = $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $batchinfo); } if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($lines[$i]->eatby, "day"); From 02d4b130b973e9e2e1b1ccdaa14d02f1e90e3cfb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2023 19:03:17 +0200 Subject: [PATCH 360/381] Fix label --- htdocs/reception/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 13f2a280629..84a45822245 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1723,7 +1723,7 @@ if ($action == 'create') { print $langs->trans("QtyReceived").' - '; } if (isModEnabled('stock')) { - print $langs->trans("WarehouseSource").' - '; + print $langs->trans("WarehouseTarget").' - '; } if (isModEnabled('productbatch')) { print $langs->trans("Batch"); @@ -1743,7 +1743,7 @@ if ($action == 'create') { print ''.$langs->trans("QtyReceived").''.$langs->trans("WarehouseSource").''.$langs->trans("WarehouseTarget").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyDispatchedShort").''.$langs->trans("QtyToDispatchShort"); - print '
'.$langs->trans("Reset").'