Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 13.0
Conflicts: htdocs/accountancy/class/accountancyexport.class.php htdocs/commande/class/commandestats.class.php htdocs/user/class/usergroup.class.php
This commit is contained in:
commit
6f1c49abcc
@ -559,9 +559,9 @@ class AccountancyExport
|
||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||
|
||||
// Force date format : %d%m%y
|
||||
if (!empty($data->date_echeance)) {
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // Format must be ddmmyy
|
||||
if (!empty($data->date_lim_reglement)) {
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_lim_reglement, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_lim_reglement, '%d%m%y'); // Format must be ddmmyy
|
||||
} else {
|
||||
$Tab['date_echeance'] = '000000';
|
||||
}
|
||||
@ -657,9 +657,9 @@ class AccountancyExport
|
||||
|
||||
$Tab['code_stat'] = str_repeat(' ', 4);
|
||||
|
||||
if (!empty($data->date_echeance)) {
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%Y');
|
||||
if (!empty($data->date_lim_reglement)) {
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_lim_reglement, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_lim_reglement, '%d%m%Y');
|
||||
} else {
|
||||
$Tab['date_echeance'] = dol_print_date($data->doc_date, '%d%m%Y');
|
||||
}
|
||||
|
||||
@ -44,7 +44,10 @@ class CommandeStats extends Stats
|
||||
public $userid;
|
||||
|
||||
public $from;
|
||||
public $from_line;
|
||||
public $field;
|
||||
public $field_line;
|
||||
public $categ_link;
|
||||
public $where;
|
||||
public $join;
|
||||
|
||||
@ -78,6 +81,7 @@ class CommandeStats extends Stats
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
//$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
$this->categ_link = MAIN_DB_PREFIX.'categorie_societe';
|
||||
} elseif ($mode == 'supplier')
|
||||
{
|
||||
$object = new CommandeFournisseur($this->db);
|
||||
@ -86,11 +90,14 @@ class CommandeStats extends Stats
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
//$this->where .= " c.fk_statut > 2"; // Only approved & ordered
|
||||
$this->categ_link = MAIN_DB_PREFIX.'categorie_fournisseur';
|
||||
}
|
||||
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
$this->where .= ($this->where ? ' AND ' : '').'c.entity IN ('.getEntity('commande').')';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where .= " AND c.fk_soc = ".$this->socid;
|
||||
@ -100,14 +107,14 @@ class CommandeStats extends Stats
|
||||
if ($typentid)
|
||||
{
|
||||
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = c.fk_soc';
|
||||
$this->where .= ' AND s.fk_typent = '.$typentid;
|
||||
$this->where .= ' AND s.fk_typent = '.((int) $typentid);
|
||||
}
|
||||
|
||||
if ($categid)
|
||||
{
|
||||
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cats ON cats.fk_soc = c.fk_soc';
|
||||
$this->join .= ' LEFT JOIN '.$this->categ_link.' as cats ON cats.fk_soc = c.fk_soc';
|
||||
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cat.rowid = cats.fk_categorie';
|
||||
$this->where .= ' AND cat.rowid = '.$categid;
|
||||
$this->where .= ' AND cat.rowid = '.((int) $categid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -119,6 +119,52 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$newparent = $object->_load_ldap_dn($info, 1);
|
||||
|
||||
$result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent);
|
||||
|
||||
if ($result > 0 && !empty($object->context['newgroupid'])) { // We are in context of adding a new group to user
|
||||
$usergroup = new Usergroup($this->db);
|
||||
|
||||
$usergroup->fetch($object->context['newgroupid']);
|
||||
|
||||
$oldinfo = $usergroup->_load_ldap_info();
|
||||
$olddn = $usergroup->_load_ldap_dn($oldinfo);
|
||||
|
||||
// Verify if entry exist
|
||||
$container = $usergroup->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
$info = $usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call)
|
||||
$dn = $usergroup->_load_ldap_dn($info);
|
||||
|
||||
$result = $ldap->update($dn, $info, $user, $olddn);
|
||||
}
|
||||
|
||||
if ($result > 0 && !empty($object->context['oldgroupid'])) { // We are in context of removing a group from user
|
||||
$usergroup = new Usergroup($this->db);
|
||||
|
||||
$usergroup->fetch($object->context['oldgroupid']);
|
||||
|
||||
$oldinfo = $usergroup->_load_ldap_info();
|
||||
$olddn = $usergroup->_load_ldap_dn($oldinfo);
|
||||
|
||||
// Verify if entry exist
|
||||
$container = $usergroup->_load_ldap_dn($oldinfo, 1);
|
||||
$search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")";
|
||||
$records = $ldap->search($container, $search);
|
||||
if (count($records) && $records['count'] == 0)
|
||||
{
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
$info = $usergroup->_load_ldap_info(); // Contains all members, except the old one (remove already done before trigger call)
|
||||
$dn = $usergroup->_load_ldap_dn($info);
|
||||
|
||||
$result = $ldap->update($dn, $info, $user, $olddn);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user