diff --git a/ChangeLog b/ChangeLog
index 836f3f77594..6691ddb2007 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -191,6 +191,8 @@ Dolibarr better:
***** ChangeLog for 3.6.3 compared to 3.6.2 *****
- Fix: ref_ext was not saved when recording a customer order from web service
+- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
+- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php
index 671c24880bc..ecf49c01201 100644
--- a/htdocs/admin/agenda_xcal.php
+++ b/htdocs/admin/agenda_xcal.php
@@ -171,7 +171,7 @@ $message.='
';
print $message;
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'
';
-$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'
';
+//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'
';
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'
';
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'
';
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index aaa1949d7dd..7c0d7fdbf9c 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -348,18 +348,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
';
$commande->type=0;
$nextval=$module->getNextValue($mysoc,$commande);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
- $htmltooltip.=''.$langs->trans("NextValue").': ';
- if ($nextval)
- {
- $htmltooltip.=$nextval.'
';
- }
- else
- {
- $htmltooltip.=$langs->trans($module->error).'
';
- }
- }
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
+ $htmltooltip.=''.$langs->trans("NextValue").': ';
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
+ $htmltooltip.=$nextval.'
';
+ } else {
+ $htmltooltip.=$langs->trans($module->error).'
';
+ }
+ }
print '
';
print $form->textwithpicto('',$htmltooltip,1,0);
diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php
index 817ac84d768..45d79f01ae5 100644
--- a/htdocs/admin/contract.php
+++ b/htdocs/admin/contract.php
@@ -299,18 +299,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
$nextval=$module->getNextValue($mysoc,$contract);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
- $htmltooltip.=''.$langs->trans("NextValue").': ';
- if ($nextval)
- {
- $htmltooltip.=$nextval.' ';
- }
- else
- {
- $htmltooltip.=$langs->trans($module->error).' ';
- }
- }
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
+ $htmltooltip.=''.$langs->trans("NextValue").': ';
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
+ $htmltooltip.=$nextval.' ';
+ } else {
+ $htmltooltip.=$langs->trans($module->error).' ';
+ }
+ }
print ' | ';
print $form->textwithpicto('',$htmltooltip,1,0);
diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php
index 2efdfdd56ba..933f9a87d18 100644
--- a/htdocs/admin/expedition.php
+++ b/htdocs/admin/expedition.php
@@ -324,18 +324,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
$nextval=$module->getNextValue($mysoc,$expedition);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
- $htmltooltip.=''.$langs->trans("NextValue").': ';
- if ($nextval)
- {
- $htmltooltip.=$nextval.' ';
- }
- else
- {
- $htmltooltip.=$langs->trans($module->error).' ';
- }
- }
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
+ $htmltooltip.=''.$langs->trans("NextValue").': ';
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
+ $htmltooltip.=$nextval.' ';
+ } else {
+ $htmltooltip.=$langs->trans($module->error).' ';
+ }
+ }
print ' | ';
print $form->textwithpicto('',$htmltooltip,1,0);
diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index a7692655a0a..298c0beddf5 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -393,61 +393,53 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$facture);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=$langs->trans("NextValueForInvoices").': ';
- if ($nextval)
- {
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.' ';
- }
- else
- {
+ } else {
$htmltooltip.=$langs->trans($module->error).' ';
}
}
// Example for remplacement
$facture->type=1;
$nextval=$module->getNextValue($mysoc,$facture);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
- $htmltooltip.=$langs->trans("NextValueForReplacements").': ';
- if ($nextval)
- {
- $htmltooltip.=$nextval.' ';
- }
- else
- {
- $htmltooltip.=$langs->trans($module->error).' ';
- }
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
+ $htmltooltip.=$langs->trans("NextValueForReplacements").': ';
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
+ $htmltooltip.=$nextval.' ';
+ } else {
+ $htmltooltip.=$langs->trans($module->error).' ';
+ }
}
// Example for credit invoice
$facture->type=2;
$nextval=$module->getNextValue($mysoc,$facture);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=$langs->trans("NextValueForCreditNotes").': ';
- if ($nextval)
- {
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.' ';
- }
- else
- {
+ } else {
$htmltooltip.=$langs->trans($module->error).' ';
}
}
// Example for deposit invoice
$facture->type=3;
$nextval=$module->getNextValue($mysoc,$facture);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=$langs->trans("NextValueForDeposit").': ';
- if ($nextval)
- {
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval;
- }
- else
- {
+ } else {
$htmltooltip.=$langs->trans($module->error);
}
}
diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php
index dad5f484a4d..8965b225cfb 100644
--- a/htdocs/admin/fichinter.php
+++ b/htdocs/admin/fichinter.php
@@ -4,7 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio
* Copyright (C) 2004 Benoit Mortier
* Copyright (C) 2005-2014 Regis Houssin
- * Copyright (C) 2008 Raphael Bertrand (Resultic)
+ * Copyright (C) 2008 Raphael Bertrand (Resultic)
* Copyright (C) 2011-2013 Juanjo Menent
* Copyright (C) 2011-2013 Philippe Grand
*
@@ -328,10 +328,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
$nextval=$module->getNextValue($mysoc,$ficheinter);
- if ($nextval != $langs->trans("NotAvailable"))
- {
- $htmltooltip.=''.$langs->trans("NextValue").': '.$nextval;
- }
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
+ $htmltooltip.=''.$langs->trans("NextValue").': ';
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
+ $htmltooltip.=$nextval.' ';
+ } else {
+ $htmltooltip.=$langs->trans($module->error).' ';
+ }
+ }
print '';
print $form->textwithpicto('',$htmltooltip,1,0);
print ' | ';
diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php
index b591aa79c08..69f5d30b09a 100644
--- a/htdocs/admin/livraison.php
+++ b/htdocs/admin/livraison.php
@@ -309,15 +309,13 @@ foreach ($dirmodels as $reldir)
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
$nextval=$module->getNextValue($mysoc,$livraison);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';
- if ($nextval)
- {
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.' ';
- }
- else
- {
+ } else {
$htmltooltip.=$langs->trans($module->error).' ';
}
}
diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php
index 01f32740036..30ae7e71ab3 100644
--- a/htdocs/admin/propal.php
+++ b/htdocs/admin/propal.php
@@ -344,18 +344,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
$propal->type=0;
$nextval=$module->getNextValue($mysoc,$propal);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
- $htmltooltip.=''.$langs->trans("NextValue").': ';
- if ($nextval)
- {
- $htmltooltip.=$nextval.' ';
- }
- else
- {
- $htmltooltip.=$langs->trans($module->error).' ';
- }
- }
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
+ $htmltooltip.=''.$langs->trans("NextValue").': ';
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
+ $htmltooltip.=$nextval.' ';
+ } else {
+ $htmltooltip.=$langs->trans($module->error).' ';
+ }
+ }
print '';
print $form->textwithpicto('',$htmltooltip,1,0);
diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php
index 2f48eb2be79..19b5e89b0dd 100644
--- a/htdocs/admin/supplier_invoice.php
+++ b/htdocs/admin/supplier_invoice.php
@@ -278,15 +278,13 @@ foreach ($dirmodels as $reldir)
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
$nextval=$module->getNextValue($mysoc,$invoice);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';
- if ($nextval)
- {
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.' ';
- }
- else
- {
+ } else {
$htmltooltip.=$langs->trans($module->error).' ';
}
}
diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php
index 2d4be98f34a..24e1682eb18 100644
--- a/htdocs/admin/supplier_order.php
+++ b/htdocs/admin/supplier_order.php
@@ -279,15 +279,13 @@ foreach ($dirmodels as $reldir)
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
$nextval=$module->getNextValue($mysoc,$commande);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';
- if ($nextval)
- {
+ if ($nextval) {
+ if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.' ';
- }
- else
- {
+ } else {
$htmltooltip.=$langs->trans($module->error).' ';
}
}
diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index e9e11b656b9..a77751fcb29 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -278,7 +278,7 @@ if ($socid)
// Address
print ' | | '.$langs->trans('Address').' | ';
- print dol_print_address($soc->address,'gmap','thirdparty',$object->id);
+ print dol_print_address($soc->address,'gmap','thirdparty',$soc->id);
print ' | ';
// Zip / Town
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 5f1cb8f7c28..fb7195fdd68 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -141,6 +141,9 @@ class ActionComm extends CommonObject
$userownerid=$this->userownerid;
$userdoneid=$this->userdoneid;
+ // Be sure assigned user array is not empty.
+ if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$userownerid);
+
if (! $this->type_id || ! $this->type_code)
{
$key=empty($this->type_id)?$this->type_code:$this->type_id;
@@ -973,7 +976,7 @@ class ActionComm extends CommonObject
$sql.= " a.label, a.code, a.note, a.fk_action as type_id,";
$sql.= " a.fk_soc,";
$sql.= " a.fk_user_author, a.fk_user_mod,";
- $sql.= " a.fk_user_action, a.fk_user_done,";
+ $sql.= " a.fk_user_action,";
$sql.= " a.fk_contact, a.percent as percentage,";
$sql.= " a.fk_element, a.elementtype,";
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
@@ -981,9 +984,11 @@ class ActionComm extends CommonObject
$sql.= " s.nom as socname,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
- $sql.= " WHERE a.fk_action=c.id";
+ // We must filter on assignement table
+ if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
+ $sql.= " WHERE a.fk_action=c.id";
$sql.= " AND a.entity = ".$conf->entity;
foreach ($filters as $key => $value)
{
@@ -993,17 +998,8 @@ class ActionComm extends CommonObject
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
- if ($key == 'login')
- {
- $login=$value;
- $userforfilter=new User($this->db);
- $result=$userforfilter->fetch('',$value);
- $sql.= " AND (";
- $sql.= " a.fk_user_author = ".$userforfilter->id;
- $sql.= " OR a.fk_user_action = ".$userforfilter->id;
- $sql.= " OR a.fk_user_done = ".$userforfilter->id;
- $sql.= ")";
- }
+ // We must filter on assignement table
+ if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($key == 'logina')
{
$logina=$value;
@@ -1011,19 +1007,12 @@ class ActionComm extends CommonObject
$result=$userforfilter->fetch('',$value);
$sql.= " AND a.fk_user_author = ".$userforfilter->id;
}
- if ($key == 'logint')
+ if ($key == 'logint' || $key == 'login')
{
$logint=$value;
$userforfilter=new User($this->db);
$result=$userforfilter->fetch('',$value);
- $sql.= " AND a.fk_user_action = ".$userforfilter->id;
- }
- if ($key == 'logind')
- {
- $logind=$value;
- $userforfilter=new User($this->db);
- $result=$userforfilter->fetch('',$value);
- $sql.= " AND a.fk_user_done = ".$userforfilter->id;
+ $sql.= " AND ar.fk_element = ".$userforfilter->id;
}
}
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 4630d486ebf..7820de113b7 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -40,9 +40,7 @@ if (! empty($conf->projet->enabled)) {
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter=GETPOST("filter",'',3);
-$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
-$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
$usergroup = GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@@ -72,9 +70,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden();
if (! $user->rights->agenda->allactions->read) $canedit=0;
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
{
- $filtera=$user->id;
$filtert=$user->id;
- $filterd=$user->id;
}
$action=GETPOST('action','alpha');
@@ -283,9 +279,7 @@ $param='';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
if ($filter) $param.="&filter=".$filter;
-if ($filtera) $param.="&filtera=".$filtera;
if ($filtert) $param.="&filtert=".$filtert;
-if ($filterd) $param.="&filterd=".$filterd;
if ($socid) $param.="&socid=".$socid;
if ($showbirthday) $param.="&showbirthday=1";
if ($pid) $param.="&projectid=".$pid;
@@ -340,7 +334,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
$head = calendars_prepare_head($paramnoaction);
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
-print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
+print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
dol_fiche_end();
$showextcals=$listofextcals;
@@ -405,27 +399,29 @@ print_fiche_titre($s,$link.' '.$nav, '');
// Get event in an array
$eventarray=array();
-$sql = 'SELECT a.id,a.label,';
+$sql = 'SELECT ';
+if ($usergroup > 0) $sql.=" DISTINCT";
+$sql.= ' a.id, a.label,';
$sql.= ' a.datep,';
$sql.= ' a.datep2,';
-$sql.= ' a.datea,';
-$sql.= ' a.datea2,';
$sql.= ' a.percent,';
-$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
+$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact,';
$sql.= ' ca.code as type_code, ca.libelle as type_label';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
-if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
+// We must filter on assignement table
+if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
+if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
$sql.= ' WHERE a.fk_action = ca.id';
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
-// FIXME: We must filter on assignement table
-if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action";
+// We must filter on assignement table
+if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($action == 'show_day')
{
$sql.= " AND (";
@@ -459,14 +455,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
-// FIXME: We must filter on assignement table
-if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
+// We must filter on assignement table
+if ($filtert > 0 || $usergroup > 0)
{
$sql.= " AND (";
- if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera;
- if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert;
- if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
- if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
+ if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
+ if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")";
}
// Sort on date
@@ -1094,7 +1088,7 @@ $db->close();
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
{
global $user, $conf, $langs;
- global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
+ global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form
global $theme_datacolor;
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
@@ -1383,7 +1377,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
{
print ''.img_picto("all","1downarrow_selected.png").' ...';
print ' +'.(count($eventarray[$daykey])-$maxprint);
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index a53628e3d31..b8c913df271 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
+$langs->load("users");
$langs->load("companies");
$langs->load("agenda");
$langs->load("commercial");
@@ -52,9 +53,7 @@ if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $s
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
$filter=GETPOST("filter",'',3);
-$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
-$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3);
$usergroup = GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@@ -94,9 +93,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden();
if (! $user->rights->agenda->allactions->read) $canedit=0;
if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permission to see all, we show only affected to me
{
- $filtera=$user->id;
$filtert=$user->id;
- $filterd=$user->id;
}
// Purge search criteria
@@ -133,15 +130,14 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
*/
$form=new Form($db);
+$userstatic=new User($db);
$nav='';
$nav.=' |