Merge remote-tracking branch 'origin/3.9' into 4.0

Conflicts:
	htdocs/commande/list.php
	htdocs/core/class/commonobject.class.php
	htdocs/core/class/extrafields.class.php
	htdocs/resource/class/resource.class.php
This commit is contained in:
Laurent Destailleur 2016-08-17 16:55:39 +02:00
commit fead7967f2
4 changed files with 17 additions and 15 deletions

View File

@ -592,9 +592,10 @@ abstract class CommonObject
}
if(! empty($id_type_contact)) {
$datecreate = dol_now();
$this->db->begin();
$datecreate = dol_now();
$this->db->begin();
// Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";

View File

@ -58,11 +58,12 @@ class ExtraFields
var $attribute_perms;
// Array to store permission to check
var $attribute_list;
// Array to store if extra field is hidden
var $attribute_hidden; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
var $error;
var $errno;
var $attribute_hidden;
public static $type2label=array(
'varchar'=>'String',
@ -120,7 +121,7 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @return int <=0 if KO, >0 if OK
*/
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0, $ishidden=0)
@ -248,7 +249,7 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @return int <=0 if KO, >0 if OK
*/
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0)
@ -396,7 +397,7 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @return int >0 if OK, <=0 if KO
*/
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='',$ishidden=0)
@ -491,7 +492,7 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @return int <=0 if KO, >0 if OK
*/
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0)
@ -1177,7 +1178,7 @@ class ExtraFields
$params=$this->attribute_param[$key];
$perms=$this->attribute_perms[$key];
$list=$this->attribute_list[$key];
$hidden=$this->attribute_hidden[$key];
$hidden=$this->attribute_hidden[$key]; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
$showsize=0;
if ($type == 'date')

View File

@ -1099,7 +1099,7 @@ class DoliDBPgsql extends DoliDB
*/
function DDLDropField($table,$field_name)
{
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
$sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
dol_syslog($sql,LOG_DEBUG);
if (! $this->query($sql))
{

View File

@ -339,7 +339,7 @@ class Dolresource extends CommonObject
if ($this->db->query($sql))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
$sql.= " WHERE element_type='resource' AND resource_id ='".$this->db->escape($rowid)."'";
$sql.= " WHERE element_type='resource' AND resource_id = ".$this->db->escape($rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($this->db->query($sql))
{
@ -393,7 +393,7 @@ class Dolresource extends CommonObject
}
}
}
$sql.= " GROUP BY t.rowid, t.entity, t.ref, t.description, t.fk_code_type_resource, t.tms, ty.label";
//$sql.= " GROUP BY t.rowid, t.entity, t.ref, t.description, t.fk_code_type_resource, t.tms, ty.label";
$sql.= $this->db->order($sortfield,$sortorder);
$this->num_all = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -473,7 +473,7 @@ class Dolresource extends CommonObject
}
}
}
$sql.= " GROUP BY t.rowid, ty.label";
//$sql.= " GROUP BY t.rowid, ty.label";
$sql.= $this->db->order($sortfield,$sortorder);
if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
@ -559,7 +559,7 @@ class Dolresource extends CommonObject
}
}
}
$sql.= " GROUP BY t.resource_id";
//$sql.= " GROUP BY t.resource_id";
$sql.= $this->db->order($sortfield,$sortorder);
if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
@ -770,7 +770,7 @@ class Dolresource extends CommonObject
// Links beetween objects are stored in this table
$sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory';
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_resources';
$sql.= " WHERE element_id='".$element_id."' AND element_type='".$element."'";
$sql.= " WHERE element_id=".$element_id." AND element_type='".$this->db->escape($element)."'";
if($resource_type)
$sql.=" AND resource_type LIKE '%".$resource_type."%'";
$sql .= ' ORDER BY resource_type';