From 3c4dfba99e51cb3543b4fc7d9c4896123ac1efea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 May 2014 12:32:19 +0200 Subject: [PATCH 1/9] Fix: Filter on status --- htdocs/user/index.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/user/index.php b/htdocs/user/index.php index baa704509cc..d859b25a9fa 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -42,7 +42,6 @@ if ($user->societe_id > 0) $sall=GETPOST('sall','alpha'); $search_user=GETPOST('search_user','alpha'); $search_statut=GETPOST('search_statut','alpha'); -if ($search_statut=='') $search_statut=1; // always display activ customer first $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); @@ -82,14 +81,14 @@ if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf } else { - $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; + $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; } if (! empty($socid)) $sql.= " AND u.fk_societe = ".$socid; if (! empty($search_user)) { $sql.= " AND (u.login LIKE '%".$db->escape($search_user)."%' OR u.lastname LIKE '%".$db->escape($search_user)."%' OR u.firstname LIKE '%".$db->escape($search_user)."%')"; } -if ($search_statut!='') +if ($search_statut != '' && $search_statut >= 0) { $sql.= " AND (u.statut=".$search_statut.")"; } @@ -103,8 +102,10 @@ if ($result) $i = 0; print '
'."\n"; - - $param="search_user=$search_user&sall=$sall"; + + $param="search_user=".$search_user."&sall=".$sall; + $param.="&search_statut=".$search_statut; + print ''; print ''; print_liste_field_titre($langs->trans("Login"),"index.php","u.login",$param,"","",$sortfield,$sortorder); @@ -116,19 +117,20 @@ if ($result) print_liste_field_titre($langs->trans("Status"),"index.php","u.statut",$param,"",'align="center"',$sortfield,$sortorder); print ''; print "\n"; - + //SearchBar print ''; print ''; + // Status print ''; - + print ''; - + print "\n"; $var=True; while ($i < $num) From 449678d687636b882369cafb69657fb0b5dbfc6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 May 2014 12:43:07 +0200 Subject: [PATCH 2/9] Fix: get_full_tree must follow same filter rule thant list of users --- htdocs/user/class/user.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 62e7f792d66..f62467e0a67 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2235,8 +2235,14 @@ class User extends CommonObject // Init $this->users array $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; - + if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->multicompany->transverse_mode) || (! empty($user->admin) && empty($user->entity)))) + { + $sql.= " WHERE u.entity IS NOT NULL"; + } + else + { + $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; + } dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) From efd9337c9f2dfca4fbe34ee067e1d24a2a663ff1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 May 2014 12:55:00 +0200 Subject: [PATCH 3/9] Fix: Hierarchy view with multicompany --- htdocs/user/class/user.class.php | 5 ++++- htdocs/user/hierarchy.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f62467e0a67..00bf221d339 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2227,13 +2227,15 @@ class User extends CommonObject */ function get_full_tree($markafterid=0) { + global $conf,$user; + $this->users = array(); // Init this->parentof that is array(id_son=>id_parent, ...) $this->load_parentof(); // Init $this->users array - $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates + $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut, u.entity"; // Distinct reduce pb with old tables with duplicates $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->multicompany->transverse_mode) || (! empty($user->admin) && empty($user->entity)))) { @@ -2257,6 +2259,7 @@ class User extends CommonObject $this->users[$obj->rowid]['lastname'] = $obj->lastname; $this->users[$obj->rowid]['login'] = $obj->login; $this->users[$obj->rowid]['statut'] = $obj->statut; + $this->users[$obj->rowid]['entity'] = $obj->entity; $i++; } } diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 0f2ccff204d..28ce9e61be3 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -78,7 +78,7 @@ foreach($fulltree as $key => $val) $userstatic->firstname=$val['firstname']; $userstatic->lastname=$val['name']; $userstatic->statut=$val['statut']; - $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].')'; + $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].(empty($conf->multicompany->enabled)?'':' - '.$langs->trans("Instance").' '.$val['entity']).')'; $data[] = array( 'rowid'=>$val['rowid'], From 4a96fd0d77bfd61a1b1b74db6879cfead96771ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 May 2014 13:08:01 +0200 Subject: [PATCH 4/9] Fix: No error once multicompany module has been removed. --- htdocs/user/fiche.php | 28 ++++++++++++++++------------ htdocs/user/home.php | 36 ++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 85c6e815642..32a4e9d25ec 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1300,19 +1300,23 @@ else } // Multicompany - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + // TODO This should be done with hook formObjectOption + if (is_object($mc)) { - print '\n"; + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print '\n"; + } } // Other attributes diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 3f43e40e43a..28eade2859f 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -148,26 +148,30 @@ if ($resql) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } - else if (! empty($conf->multicompany->enabled)) - { - if ($obj->admin && ! $obj->entity) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($obj->entity); - print $mc->label; - } - } - else if ($obj->ldap_sid) - { - print $langs->trans("DomainUser"); - } else { print $langs->trans("InternalUser"); } + if ($obj->ldap_sid) + { + print ' ('.$langs->trans("DomainUser").')'; + } + // TODO This should be done with a hook + if (is_object($mc)) + { + if (! empty($conf->multicompany->enabled)) + { + if ($obj->admin && ! $obj->entity) + { + print ' ('.$langs->trans("AllEntities").')'; + } + else + { + $mc->getInfo($obj->entity); + print ' ('.$mc->label.')'; + } + } + } print ''; print ''; print '"; + $documenturl = DOL_URL_ROOT.'/document.php'; + if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->DOL_URL_ROOT_DOCUMENT_PHP; + // Show file name with link to download $out.= '
 
 '; - print $form->selectarray('search_statut', array('0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); print ''; print ''; print '
'.$langs->trans("Entity").''; - if ($object->admin && ! $object->entity) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($object->entity); - print $mc->label; - } - print "
'.$langs->trans("Entity").''; + if ($object->admin && ! $object->entity) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($object->entity); + print $mc->label; + } + print "
'.dol_print_date($db->jdate($obj->datec),'dayhour').''; From 6b6261a80313c3f75798ef82bd6699d9dab23ec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 May 2014 13:34:51 +0200 Subject: [PATCH 5/9] Fix: Use last name and not name. --- htdocs/user/hierarchy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 28ce9e61be3..ff6545ada32 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -76,7 +76,7 @@ foreach($fulltree as $key => $val) $userstatic->id=$val['id']; $userstatic->ref=$val['label']; $userstatic->firstname=$val['firstname']; - $userstatic->lastname=$val['name']; + $userstatic->lastname=$val['lastname']; $userstatic->statut=$val['statut']; $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].(empty($conf->multicompany->enabled)?'':' - '.$langs->trans("Instance").' '.$val['entity']).')'; From 4c11e3720363610e47a5ff15555690031002ce80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 3 Jun 2014 15:45:03 +0200 Subject: [PATCH 6/9] Fix: [ bug #1434 ] Muscadet supplier order document model linked objects overlap the text --- ChangeLog | 1 + htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2e0ea3bcc99..101e70ca8b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,7 @@ Fix: [ bug #1388 ] Wrong date when invoicing several orders. Fix: [ bug #1411 ] Unable to set an expedition note if invoices module is not enabled. Fix: [ bug #1407 ] Rouget pdf overlapped when using tracking number and public notes. Fix: [ bug #1405 ] Rouget PDF expedition incorrect when two expeditions under the same commande +Fix: [ bug #1434 ] Muscadet supplier order document model linked objects overlap the text ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. 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 1666805d2d4..f48c6bc31a4 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -991,7 +991,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R'); } - $posy+=2; + $posy+=5; $pdf->SetTextColor(0,0,60); // Show list of linked objects From 03ca7e6b631258e01162b5fc29a6de2af22b1901 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Jun 2014 22:42:49 +0200 Subject: [PATCH 7/9] Fix: Missing global --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5317d49c23c..0beba50ccbd 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -257,7 +257,7 @@ class FormFile */ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='') { - global $langs,$conf,$hookmanager; + global $langs,$conf,$user,$hookmanager; global $bc; // filedir = $conf->...->dir_ouput."/".get_exdir(id) From c45aace9b97154ee9fc0010748150a8279c61bec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Jun 2014 23:30:20 +0200 Subject: [PATCH 8/9] Add easy fix to solve pb of links for some modules. --- htdocs/core/class/html.formfile.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 0beba50ccbd..1eadc4f427a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -554,9 +554,12 @@ class FormFile $out.= "
'; - $out.= ' Date: Fri, 6 Jun 2014 11:57:45 +0200 Subject: [PATCH 9/9] Fix: Pb with pagebreak when adding image --- htdocs/core/lib/pdf.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index d8723334328..6f7a57bebc1 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -435,7 +435,9 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height) // Add a background image on document if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) { + $pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, 0, 0, 0, $page_height); + $pdf->SetAutoPageBreak(1,0); // Restore pagebreak } }