From bf008c7640dca084597a7cd8b077021a8fd30386 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 06:43:58 +0200 Subject: [PATCH 01/11] Fix: optimizing --- htdocs/core/tpl/admin_extrafields.tpl.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/admin_extrafields.tpl.php b/htdocs/core/tpl/admin_extrafields.tpl.php index 2291d9afc6c..9cecc48cc2d 100644 --- a/htdocs/core/tpl/admin_extrafields.tpl.php +++ b/htdocs/core/tpl/admin_extrafields.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2012 Regis Houssin * * 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 @@ -21,14 +22,17 @@ jQuery(document).ready(function() { function init_typeoffields() { - if (jQuery("#type").val() == 'date') { jQuery("#size").val(''); jQuery("#size").attr('disabled','disabled'); } - else if (jQuery("#type").val() == 'datetime') { jQuery("#size").val(''); jQuery("#size").attr('disabled','disabled'); } - else if (jQuery("#type").val() == 'double') { jQuery("#size").val('24,8'); jQuery("#size").removeAttr('disabled'); } - else if (jQuery("#type").val() == 'int') { jQuery("#size").val('10'); jQuery("#size").removeAttr('disabled'); } - else if (jQuery("#type").val() == 'text') { jQuery("#size").val('2000'); jQuery("#size").removeAttr('disabled'); } - else if (jQuery("#type").val() == 'varchar') { jQuery("#size").val('255'); jQuery("#size").removeAttr('disabled'); } - else if (jQuery("#type").val() == '') { jQuery("#size").val(''); jQuery("#size").attr('disabled','disabled'); } - else jQuery("#size").attr('disabled','disabled'); + var type = jQuery("#type").val(); + var size = jQuery("#size"); + + if (type == 'date') { size.val('').attr('disabled','disabled'); } + else if (type == 'datetime') { size.val('').attr('disabled','disabled'); } + else if (type == 'double') { size.val('24,8').removeAttr('disabled'); } + else if (type == 'int') { size.val('10').removeAttr('disabled'); } + else if (type == 'text') { size.val('2000').removeAttr('disabled'); } + else if (type == 'varchar') { size.val('255').removeAttr('disabled'); } + else if (type == '') { size.val('').attr('disabled','disabled'); } + else size.attr('disabled','disabled'); } init_typeoffields(); jQuery("#type").change(function() { From 10b122578edda89ce84a2e337b3c16eec469c00c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 06:52:33 +0200 Subject: [PATCH 02/11] FIXME: $deja_regle not use in proposal? --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 19b06b32b2b..859e59154fc 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -147,7 +147,7 @@ class pdf_azur extends ModelePDFPropales { $object->fetch_thirdparty(); - $deja_regle = ""; + $deja_regle = ""; // FIXME not use in proposal? // Definition of $dir and $file if ($object->specimen) @@ -395,7 +395,7 @@ class pdf_azur extends ModelePDFPropales // Affiche zone versements if ($deja_regle) { - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); + $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); // FIXME not use in proposal? } // Pied de page @@ -793,8 +793,8 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0,0,0); - $resteapayer = $object->total_ttc - $deja_regle; - if ($object->paye) $resteapayer=0; + $resteapayer = $object->total_ttc - $deja_regle; // FIXME not use in proposal? + if (! empty($object->paye)) $resteapayer=0; // FIXME not use in proposal? if ($deja_regle > 0) { @@ -806,6 +806,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); + // FIXME not use in proposal? if ($object->close_code == 'discount_vat') { $index++; From 80eceab230f0e327810d624bc6f767d27cd6d432 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 07:15:38 +0200 Subject: [PATCH 03/11] Fix: restore broken features --- .../modules/commande/doc/pdf_einstein.modules.php | 12 +++++++----- .../core/modules/facture/doc/pdf_crabe.modules.php | 2 ++ htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 061a00cdc67..a39c4a5a4a6 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -227,7 +227,7 @@ class pdf_einstein extends ModelePDFCommandes $tab_top = 90; - $tab_top_newpage = 10; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; $tab_height_newpage = 150; @@ -277,10 +277,10 @@ class pdf_einstein extends ModelePDFCommandes $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. -// We suppose that a too long description is moved completely on next page -if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; -} + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut @@ -355,6 +355,7 @@ if ($pageposafter > $pageposbefore) { $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { @@ -371,6 +372,7 @@ if ($pageposafter > $pageposbefore) { $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 610c97a930b..bbb503b7aa2 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -357,6 +357,7 @@ class pdf_crabe extends ModelePDFFactures $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { @@ -373,6 +374,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 859e59154fc..6a479426012 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -355,6 +355,7 @@ class pdf_azur extends ModelePDFPropales $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { @@ -371,6 +372,7 @@ class pdf_azur extends ModelePDFPropales $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager); } } From 16ad953d102fd9e153a80f7de67c1420b5f5bf16 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 08:13:29 +0200 Subject: [PATCH 04/11] Fix: best practice --- htdocs/core/tpl/admin_extrafields.tpl.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/admin_extrafields.tpl.php b/htdocs/core/tpl/admin_extrafields.tpl.php index 9cecc48cc2d..73750892cc2 100644 --- a/htdocs/core/tpl/admin_extrafields.tpl.php +++ b/htdocs/core/tpl/admin_extrafields.tpl.php @@ -20,23 +20,20 @@ From d25e8fc58469bda6f1694b7356768796130ae480 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 17 Sep 2012 11:18:20 +0200 Subject: [PATCH 05/11] missing translation --- htdocs/expedition/shipment.php | 2 +- htdocs/langs/en_US/stocks.lang | 2 ++ htdocs/langs/fr_FR/stocks.lang | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 976d6c3660a..78499e209d6 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -631,7 +631,7 @@ if ($id > 0 || ! empty($ref)) print $formproduct->selectWarehouses(-1,'entrepot_id','',1); if (count($formproduct->cache_warehouses) <= 0) { - print '   No warehouse defined, add one'; + print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").''; } print ''; } diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 1654d4bb197..83e04ff5148 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -8,6 +8,8 @@ MenuNewWarehouse=New warehouse WarehouseOpened=Warehouse opened WarehouseClosed=Warehouse closed WarehouseSource=Source warehouse +WarehouseSourceNotDefined=No warehouse defined, +AddOne=Add one WarehouseTarget=Target warehouse ValidateSending=Delete sending CancelSending=Cancel sending diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index 6549d8a4afc..c00ac2b4b13 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -8,6 +8,8 @@ MenuNewWarehouse=Nouvel entrepôt WarehouseOpened=Entrepôt ouvert WarehouseClosed=Entrepôt fermé WarehouseSource=Entrepôt source +WarehouseSourceNotDefined=Aucun entrepôt défini, +AddOne=En ajouter un WarehouseTarget=Entrepôt cible ValidateSending=Valider expédition CancelSending=Annuler expédition From ef4831d119ca096fd7e86befe3016dddc53925c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Sep 2012 11:46:50 +0200 Subject: [PATCH 06/11] Solved FIXME. I keep the code but commented, to keep source the more similar as possible than invoices. --- .../modules/propale/doc/pdf_azur.modules.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 6a479426012..e4bed7e2883 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -147,7 +147,7 @@ class pdf_azur extends ModelePDFPropales { $object->fetch_thirdparty(); - $deja_regle = ""; // FIXME not use in proposal? + // $deja_regle = 0; // Definition of $dir and $file if ($object->specimen) @@ -395,10 +395,12 @@ class pdf_azur extends ModelePDFPropales $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); // Affiche zone versements + /* if ($deja_regle) { - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); // FIXME not use in proposal? + $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } + */ // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); @@ -795,9 +797,11 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0,0,0); - $resteapayer = $object->total_ttc - $deja_regle; // FIXME not use in proposal? - if (! empty($object->paye)) $resteapayer=0; // FIXME not use in proposal? - + /* + $resteapayer = $object->total_ttc - $deja_regle; + if (! empty($object->paye)) $resteapayer=0; + */ + if ($deja_regle > 0) { $index++; @@ -808,7 +812,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0); - // FIXME not use in proposal? + /* if ($object->close_code == 'discount_vat') { $index++; @@ -822,6 +826,7 @@ class pdf_azur extends ModelePDFPropales $resteapayer=0; } + */ $index++; $pdf->SetTextColor(0,0,60); From 7167edb244ad394a4ff3195a93e761956146b418 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Sep 2012 16:00:41 +0200 Subject: [PATCH 07/11] Fix: Comment to avoid bug --- htdocs/user/index.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 4d85ff977b1..b97f8809e9c 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -138,8 +138,9 @@ if ($result) } else { - $mc->getInfo($obj->entity); - print $mc->label; + // FIXME Should add here a hook. Disabled for the moment because $mc is not defined. + //$mc->getInfo($obj->entity); + //print $mc->label; } } else if ($obj->ldap_sid) @@ -172,7 +173,7 @@ else dol_print_error($db); } -$db->close(); - llxFooter(); + +$db->close(); ?> From c42cf7ce7888450b87c116f232332249680a7e11 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 16:16:48 +0200 Subject: [PATCH 08/11] Fix: broken features --- htdocs/user/index.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/user/index.php b/htdocs/user/index.php index b97f8809e9c..9ac5afd50aa 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -81,9 +81,9 @@ else if (!empty($socid)) $sql.= " AND u.fk_societe = ".$socid; if ($search_user) { - $sql.= " AND (u.login like '%".$search_user."%' OR u.name like '%".$search_user."%' OR u.firstname like '%".$search_user."%')"; + $sql.= " AND (u.login LIKE '%".$search_user."%' OR u.name LIKE '%".$search_user."%' OR u.firstname LIKE '%".$search_user."%')"; } -if ($sall) $sql.= " AND (u.login like '%".$db->escape($sall)."%' OR u.name like '%".$db->escape($sall)."%' OR u.firstname like '%".$db->escape($sall)."%' OR u.email like '%".$db->escape($sall)."%' OR u.note like '%".$db->escape($sall)."%')"; +if ($sall) $sql.= " AND (u.login LIKE '%".$db->escape($sall)."%' OR u.name LIKE '%".$db->escape($sall)."%' OR u.firstname LIKE '%".$db->escape($sall)."%' OR u.email LIKE '%".$db->escape($sall)."%' OR u.note LIKE '%".$db->escape($sall)."%')"; $sql.=$db->order($sortfield,$sortorder); $result = $db->query($sql); @@ -130,6 +130,7 @@ if ($result) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } + // Multicompany enabled else if (! empty($conf->multicompany->enabled)) { if (! $obj->entity) @@ -138,9 +139,10 @@ if ($result) } else { - // FIXME Should add here a hook. Disabled for the moment because $mc is not defined. - //$mc->getInfo($obj->entity); - //print $mc->label; + // $mc is defined in conf.class.php if multicompany enabled. + // remove constante MAIN_MODULE_MULTICOMPANY if you have an error. + $mc->getInfo($obj->entity); + print $mc->label; } } else if ($obj->ldap_sid) From dc7100677a027fa58e385b6448e35b683160d95d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 16:28:37 +0200 Subject: [PATCH 09/11] Fix: avoid warning if no object --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5826e248b13..3483635c944 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4003,7 +4003,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= if (verifCond($values[4])) { if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[5]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[5]), 1); $head[$h][1] = $langs->trans($values[2]); $head[$h][2] = str_replace('+','',$values[1]); $h++; @@ -4013,7 +4013,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= { if ($values[0] != $type) continue; if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[4]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[4]), 1); $head[$h][1] = $langs->trans($values[2]); $head[$h][2] = str_replace('+','',$values[1]); $h++; @@ -4022,7 +4022,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= { if ($values[0] != $type) continue; if ($values[2]) $langs->load($values[2]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', (! empty($object->id)?$object->id:''), $values[3]), 1); $head[$h][1] = $langs->trans($values[1]); $head[$h][2] = 'tab'.$values[1]; $h++; From 58ae3b9372c73c6235accdd3b33c3393ba69e810 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 19:32:45 +0200 Subject: [PATCH 10/11] Fix: possibility to disable hook --- htdocs/core/lib/files.lib.php | 51 ++++++++++++++++-------------- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/societe/soc.php | 2 +- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b020febd3b0..31fc5073fbe 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -47,25 +47,16 @@ function dol_basename($pathfile) * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only + * @param int $nohook Disable all hooks * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file') */ -function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0) +function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=false) { global $db, $hookmanager; global $object; dol_syslog("files.lib.php::dol_dir_list path=".$path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter)); - if (! is_object($hookmanager)) - { - if (! class_exists('HookManager')) { - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array - require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($db); - } - } - $hookmanager->initHooks(array('fileslib')); - $loaddate=($mode==1||$mode==2)?true:false; $loadsize=($mode==1||$mode==3)?true:false; @@ -73,23 +64,35 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil $path=preg_replace('/([\\/]+)$/i','',$path); $newpath=dol_osencode($path); - $parameters=array( - 'path' => $newpath, - 'types'=> $types, - 'recursive' => $recursive, - 'filter' => $filter, - 'excludefilter' => $excludefilter, - 'sortcriteria' => $sortcriteria, - 'sortorder' => $sortorder, - 'loaddate' => $loaddate, - 'loadsize' => $loadsize - ); - $reshook=$hookmanager->executeHooks('getNodesList', $parameters, $object); + if (! $nohook) { + if (! is_object($hookmanager)) + { + if (! class_exists('HookManager')) { + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array + require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($db); + } + } + $hookmanager->initHooks(array('fileslib')); + + $parameters=array( + 'path' => $newpath, + 'types'=> $types, + 'recursive' => $recursive, + 'filter' => $filter, + 'excludefilter' => $excludefilter, + 'sortcriteria' => $sortcriteria, + 'sortorder' => $sortorder, + 'loaddate' => $loaddate, + 'loadsize' => $loadsize + ); + $reshook=$hookmanager->executeHooks('getNodesList', $parameters, $object); + } // $reshook may contain returns stacked by other modules // $reshook is always empty with an array for can not lose returns stacked with other modules // $hookmanager->resArray may contain array stacked by other modules - if (! empty($hookmanager->resArray)) // forced to use $hookmanager->resArray even if $hookmanager->resArray['nodes'] is empty + if (! $nohook && ! empty($hookmanager->resArray)) // forced to use $hookmanager->resArray even if $hookmanager->resArray['nodes'] is empty { return $hookmanager->resArray['nodes']; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index c63360a07ad..38456afc255 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1230,7 +1230,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt','','name',SORT_ASC,0,true); // Disable hook for the moment if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 3c26f9af46d..2a5650aad91 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1817,7 +1817,7 @@ else $var=true; - $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); + $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang,$hookmanager); print ''; print ''; From 8bab5fdadd77dadabd02bd68a38b06e9f91c1df0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Sep 2012 19:33:44 +0200 Subject: [PATCH 11/11] Fix: convert line delimiters --- htdocs/core/lib/functions.lib.php | 6 +++--- .../modules/commande/doc/pdf_einstein.modules.php | 6 +++--- .../doc/pdf_expedition_rouget.modules.php | 6 +++--- .../core/modules/facture/doc/pdf_crabe.modules.php | 2 +- .../modules/fichinter/doc/pdf_soleil.modules.php | 14 +++++++------- .../modules/livraison/pdf/pdf_sirocco.modules.php | 6 +++--- .../modules/livraison/pdf/pdf_typhon.modules.php | 6 +++--- .../core/modules/propale/doc/pdf_azur.modules.php | 6 +++--- .../societe/doc/doc_generic_odt.modules.php | 2 +- .../supplier_invoice/pdf/pdf_canelle.modules.php | 6 +++--- .../supplier_order/pdf/pdf_muscadet.modules.php | 6 +++--- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3483635c944..1a4aa60a012 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3419,10 +3419,10 @@ function dol_textishtml($msg,$option=0) function dol_concatdesc($text1,$text2,$forxml=false) { $ret=''; - $ret.= (! dol_textishtml($text1) && dol_textishtml($text2))?dol_nl2br($text1, 0, $forxml):$text1; - $ret.= (! empty($text1) && ! empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2))?($forxml?"
\n":"
\n") : "\n") : ""; + $ret.= (! dol_textishtml($text1) && dol_textishtml($text2))?dol_nl2br($text1, 0, $forxml):$text1; + $ret.= (! empty($text1) && ! empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2))?($forxml?"
\n":"
\n") : "\n") : ""; $ret.= (dol_textishtml($text1) && ! dol_textishtml($text2))?dol_nl2br($text2, 0, $forxml):$text2; - return $ret; + return $ret; } /** diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index a39c4a5a4a6..082339490a2 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -261,9 +261,9 @@ class pdf_einstein extends ModelePDFCommandes for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php index 4a28d6d257c..01888689100 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php @@ -226,9 +226,9 @@ class pdf_expedition_rouget extends ModelePdfExpedition for ($i = 0; $i < $num; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index bbb503b7aa2..08ef7ae767c 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -264,7 +264,7 @@ class pdf_crabe extends ModelePDFFactures for ($i = 0; $i < $nblignes; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index d5d05aac1c3..fd3f1242bf3 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -177,7 +177,7 @@ class pdf_soleil extends ModelePDFFicheinter $this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetTextColor(0,0,0); + $pdf->SetTextColor(0,0,0); $tab_top = 90; $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); @@ -245,9 +245,9 @@ class pdf_soleil extends ModelePDFFicheinter if ($valide > 0 || $object->specimen) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); @@ -257,7 +257,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); - $nexY = $pdf->GetY(); + $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); @@ -394,8 +394,8 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetXY(20,230); $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); - $pdf->SetXY(20,235); - $pdf->MultiCell(80,25, '', 1); + $pdf->SetXY(20,235); + $pdf->MultiCell(80,25, '', 1); $pdf->SetXY(110,230); $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); diff --git a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php index ca1d1a937d1..81d13e8cee5 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php @@ -183,9 +183,9 @@ class pdf_sirocco extends ModelePDFDeliveryOrder for ($i = 0 ; $i < $nblines ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 9cc0de35648..b9cfc5ea909 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -240,9 +240,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder for ($i = 0 ; $i < $nblines ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot-50); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index e4bed7e2883..d7e4cd7e538 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -262,9 +262,9 @@ class pdf_azur extends ModelePDFPropales for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 7eeddd1f856..058cd1ffab8 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -109,7 +109,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt','','name',SORT_ASC,0,true); // Disable hook for the moment if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 75cd1c17385..01649837213 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -259,9 +259,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index a0fe3c05aea..bdd23c5b1da 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -271,9 +271,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders for ($i = 0 ; $i < $nblignes ; $i++) { $curY = $nexY; - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage - - $pdf->setTopMargin($tab_top_newpage); + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage();