';
// Preview
if (empty($useinecm))
{
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/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 5826e248b13..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;
}
/**
@@ -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++;
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/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();
diff --git a/htdocs/langs/en_US/commissions.lang b/htdocs/langs/en_US/commissions.lang
index c7690318142..776f4d0c1a1 100644
--- a/htdocs/langs/en_US/commissions.lang
+++ b/htdocs/langs/en_US/commissions.lang
@@ -38,4 +38,7 @@ CommercialAgent=Commercial agent
StartDate=Start date
EndDate=End date
-Launch=Start
\ No newline at end of file
+Launch=Start
+
+AgentContactType=Contact type used for commissioning
+AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents
\ No newline at end of file
diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang
index 09775869a45..41203847ba5 100644
--- a/htdocs/langs/en_US/margins.lang
+++ b/htdocs/langs/en_US/margins.lang
@@ -46,4 +46,7 @@ MargeNette=Net margin
MARGIN_TYPE_DETAILS=Raw margin : Selling price - Buying price Net margin : Selling price - Cost price
BuyingCost=Cost price
-UnitCharges=Unit charges
\ No newline at end of file
+UnitCharges=Unit charges
+
+AgentContactType=Contact type used for commissioning
+AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/commissions.lang b/htdocs/langs/fr_FR/commissions.lang
index 2ae2aef2332..5fb83f32320 100644
--- a/htdocs/langs/fr_FR/commissions.lang
+++ b/htdocs/langs/fr_FR/commissions.lang
@@ -1,6 +1,7 @@
# Dolibarr language file - fr_FR - commissions
CHARSET=UTF-8
+Module60000Desc=Gestion des commissions
commissionsSetup=Paramétrage de la gestion des commissions
ProductCommissionRate=Taux de commissionnement sur les produits
@@ -37,4 +38,7 @@ CommercialAgent=Agent commercial
StartDate=Date de début
EndDate=Date de fin
-Launch=Démarrer
\ No newline at end of file
+Launch=Démarrer
+
+AgentContactType=Type de contact commissionné
+AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/margins.lang b/htdocs/langs/fr_FR/margins.lang
index a08df30498d..02dfedbbe9a 100644
--- a/htdocs/langs/fr_FR/margins.lang
+++ b/htdocs/langs/fr_FR/margins.lang
@@ -1,6 +1,8 @@
# Dolibarr language file - fr_FR - margins
CHARSET=UTF-8
+Module59000Name=Marges
+Module59000Desc=Gestion des marges commerciales
Margin=Marge
Margins=Marges
TotalMargin=Marge totale
@@ -45,3 +47,6 @@ MARGIN_TYPE_DETAILS=Marge brute : Prix de vente HT - Prix d'achat HT Marge n
BuyingCost=Coût de revient
UnitCharges=Charge unitaire
+
+AgentContactType=Type de contact commissionné
+AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux
\ No newline at end of file
diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php
index f04cda7f072..c6efdf832f1 100644
--- a/htdocs/margin/admin/margin.php
+++ b/htdocs/margin/admin/margin.php
@@ -25,8 +25,11 @@ include '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
+require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
$langs->load("admin");
+$langs->load("bills");
$langs->load("margins");
if (! $user->admin) accessforbidden();
@@ -91,6 +94,18 @@ if ($action == 'typemarges')
}
}
+if ($action == 'contact')
+{
+ if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
+ {
+ $conf->global->AGENT_CONTACT_TYPE = $_POST['AGENT_CONTACT_TYPE'];
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+}
+
/*
* View
*/
@@ -246,6 +261,25 @@ print '
';
diff --git a/htdocs/user/index.php b/htdocs/user/index.php
index b97f8809e9c..f63156c6ce6 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,12 @@ 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.
+ if (is_object($mc))
+ {
+ $mc->getInfo($obj->entity);
+ print $mc->label;
+ }
}
}
else if ($obj->ldap_sid)