Fix repeated logs and fetch
This commit is contained in:
parent
ff1adb3934
commit
e8b139d1c6
@ -120,7 +120,7 @@ class ActionComm extends CommonObject
|
|||||||
* Object user that create action
|
* Object user that create action
|
||||||
* @var User
|
* @var User
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see authorid
|
* @see $authorid
|
||||||
*/
|
*/
|
||||||
public $author;
|
public $author;
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ class ActionComm extends CommonObject
|
|||||||
* Object user that modified action
|
* Object user that modified action
|
||||||
* @var User
|
* @var User
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see usermodid
|
* @see $usermodid
|
||||||
*/
|
*/
|
||||||
public $usermod;
|
public $usermod;
|
||||||
|
|
||||||
@ -1010,7 +1010,7 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all objects with filters.
|
* Load all objects with filters.
|
||||||
* WARNING: This make a fetch on all records instead of making one request with a join.
|
* @TODO WARNING: This make a fetch on all records instead of making one request with a join.
|
||||||
*
|
*
|
||||||
* @param DoliDb $db Database handler
|
* @param DoliDb $db Database handler
|
||||||
* @param int $socid Filter by thirdparty
|
* @param int $socid Filter by thirdparty
|
||||||
@ -1020,7 +1020,7 @@ class ActionComm extends CommonObject
|
|||||||
* @param string $sortfield Sort on this field
|
* @param string $sortfield Sort on this field
|
||||||
* @param string $sortorder ASC or DESC
|
* @param string $sortorder ASC or DESC
|
||||||
* @param string $limit Limit number of answers
|
* @param string $limit Limit number of answers
|
||||||
* @return array or string Error string if KO, array with actions if OK
|
* @return array|string Error string if KO, array with actions if OK
|
||||||
*/
|
*/
|
||||||
public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
|
public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
|
||||||
{
|
{
|
||||||
@ -1028,6 +1028,8 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
$resarray=array();
|
$resarray=array();
|
||||||
|
|
||||||
|
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
||||||
|
|
||||||
$sql = "SELECT a.id";
|
$sql = "SELECT a.id";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||||
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
|
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||||
@ -1041,7 +1043,6 @@ class ActionComm extends CommonObject
|
|||||||
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
||||||
$sql.=$db->plimit($limit, 0);
|
$sql.=$db->plimit($limit, 0);
|
||||||
|
|
||||||
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -1285,7 +1286,7 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||||
|
|
||||||
if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id))
|
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
|
||||||
$option = 'nolink';
|
$option = 'nolink';
|
||||||
|
|
||||||
$label = $this->label;
|
$label = $this->label;
|
||||||
|
|||||||
@ -497,8 +497,9 @@ class DiscountAbsolute
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::getAvailableDiscounts discount_type=".$discount_type, LOG_DEBUG);
|
||||||
|
|
||||||
$sql = "SELECT SUM(rc.amount_ttc) as amount";
|
$sql = "SELECT SUM(rc.amount_ttc) as amount";
|
||||||
//$sql = "SELECT rc.amount_ttc as amount";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||||
$sql.= " WHERE rc.entity = " . $conf->entity;
|
$sql.= " WHERE rc.entity = " . $conf->entity;
|
||||||
$sql.= " AND rc.discount_type=".intval($discount_type);
|
$sql.= " AND rc.discount_type=".intval($discount_type);
|
||||||
@ -512,7 +513,6 @@ class DiscountAbsolute
|
|||||||
if ($filter) $sql.=' AND ('.$filter.')';
|
if ($filter) $sql.=' AND ('.$filter.')';
|
||||||
if ($maxvalue) $sql.=' AND rc.amount_ttc <= '.price2num($maxvalue);
|
if ($maxvalue) $sql.=' AND rc.amount_ttc <= '.price2num($maxvalue);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getAvailableDiscounts", LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -213,8 +213,6 @@ class FormActions
|
|||||||
|
|
||||||
$page=0; $param='';
|
$page=0; $param='';
|
||||||
|
|
||||||
$total = 0;
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="centpercent noborder'.($morecss?' '.$morecss:'').'">';
|
print '<table class="centpercent noborder'.($morecss?' '.$morecss:'').'">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -227,10 +225,10 @@ class FormActions
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
$userstatic = new User($this->db);
|
if (is_array($listofactions) && count($listofactions))
|
||||||
|
|
||||||
if (count($listofactions))
|
|
||||||
{
|
{
|
||||||
|
$cacheusers=array();
|
||||||
|
|
||||||
$cursorevent = 0;
|
$cursorevent = 0;
|
||||||
foreach($listofactions as $action)
|
foreach($listofactions as $action)
|
||||||
{
|
{
|
||||||
@ -246,8 +244,20 @@ class FormActions
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
if (! empty($action->userownerid))
|
if (! empty($action->userownerid))
|
||||||
{
|
{
|
||||||
$userstatic->fetch($action->userownerid); // TODO Introduce a cache on users fetched
|
if (is_object($cacheusers[$action->userownerid]))
|
||||||
print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
|
{
|
||||||
|
$tmpuser = $cacheusers[$action->userownerid];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tmpuser = new User($this->db);
|
||||||
|
$tmpuser->fetch($action->userownerid);
|
||||||
|
$cacheusers[$action->userownerid] = $tmpuser;
|
||||||
|
}
|
||||||
|
if ($tmpuser->id > 0)
|
||||||
|
{
|
||||||
|
print $tmpuser->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Type
|
// Type
|
||||||
@ -284,10 +294,7 @@ class FormActions
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
if (! empty($action->author->id))
|
|
||||||
{
|
|
||||||
print $action->getLibStatut(3);
|
print $action->getLibStatut(3);
|
||||||
}
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -184,6 +184,8 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::getNextValue mode=".$mode, LOG_DEBUG);
|
||||||
|
|
||||||
if ($invoice->type == 2) $prefix=$this->prefixcreditnote;
|
if ($invoice->type == 2) $prefix=$this->prefixcreditnote;
|
||||||
elseif ($invoice->type == 3) $prefix=$this->prefixdeposit;
|
elseif ($invoice->type == 3) $prefix=$this->prefixdeposit;
|
||||||
else $prefix=$this->prefixinvoice;
|
else $prefix=$this->prefixinvoice;
|
||||||
@ -195,7 +197,6 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
|
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
@ -219,7 +220,6 @@ class mod_facture_terre extends ModeleNumRefFactures
|
|||||||
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
|
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
|
||||||
$sql.= " ORDER BY ref DESC";
|
$sql.= " ORDER BY ref DESC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user