Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.9' into 4.0
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/commande/list.php
	htdocs/core/class/commonobject.class.php
	htdocs/core/class/extrafields.class.php
	htdocs/resource/class/resource.class.php
  • Loading branch information
eldy committed Aug 17, 2016
2 parents 88afc4a + 7e8b8e9 commit fead796
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
5 changes: 3 additions & 2 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -592,9 +592,10 @@ function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger
}

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";
Expand Down
15 changes: 8 additions & 7 deletions htdocs/core/class/extrafields.class.php
Expand Up @@ -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',
Expand Down Expand Up @@ -120,7 +121,7 @@ function __construct($db)
* @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)
Expand Down Expand Up @@ -248,7 +249,7 @@ private function create($attrname, $type='varchar', $length=255, $elementtype='m
* @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)
Expand Down Expand Up @@ -396,7 +397,7 @@ private function delete_label($attrname, $elementtype='member')
* @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)
Expand Down Expand Up @@ -491,7 +492,7 @@ function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=
* @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)
Expand Down Expand Up @@ -1177,7 +1178,7 @@ function showOutputField($key,$value,$moreparam='')
$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')
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/db/pgsql.class.php
Expand Up @@ -1099,7 +1099,7 @@ function DDLUpdateField($table,$field_name,$field_desc)
*/
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))
{
Expand Down
10 changes: 5 additions & 5 deletions htdocs/resource/class/dolresource.class.php
Expand Up @@ -339,7 +339,7 @@ function delete($rowid, $notrigger=0)
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))
{
Expand Down Expand Up @@ -393,7 +393,7 @@ function fetch_all($sortorder, $sortfield, $limit, $offset, $filter='')
}
}
}
$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))
Expand Down Expand Up @@ -473,7 +473,7 @@ function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter=''
}
}
}
$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);
Expand Down Expand Up @@ -559,7 +559,7 @@ function fetch_all_used($sortorder, $sortfield, $limit, $offset=1, $filter='')
}
}
}
$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);
Expand Down Expand Up @@ -770,7 +770,7 @@ function getElementResources($element,$element_id,$resource_type='')
// 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';
Expand Down

0 comments on commit fead796

Please sign in to comment.