FIX #7146
This commit is contained in:
parent
c434f72d31
commit
43f6eab2ea
@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
|||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$attrname=GETPOST('attrname', 'alpha');
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
$elementtype='categories'; //Must be the $element of the class that manage extrafield
|
$elementtype='categorie'; //Must be the $element of the class that manage extrafield
|
||||||
|
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class Categorie extends CommonObject
|
|||||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||||
|
|
||||||
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
||||||
const TYPE_PROJECT = 6;
|
const TYPE_PROJECT = 6; // TODO Replace this value with 'project'
|
||||||
const TYPE_BANK_LINE = 'bank_line';
|
const TYPE_BANK_LINE = 'bank_line';
|
||||||
public $picto = 'category';
|
public $picto = 'category';
|
||||||
|
|
||||||
|
|||||||
@ -4169,6 +4169,9 @@ abstract class CommonObject
|
|||||||
$optionsArray = $extrafields->attributes[$this->table_element]['label'];
|
$optionsArray = $extrafields->attributes[$this->table_element]['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table_element = $this->table_element;
|
||||||
|
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
|
||||||
|
|
||||||
// Request to get complementary values
|
// Request to get complementary values
|
||||||
if (count($optionsArray) > 0)
|
if (count($optionsArray) > 0)
|
||||||
{
|
{
|
||||||
@ -4180,7 +4183,7 @@ abstract class CommonObject
|
|||||||
$sql.= ", ".$name;
|
$sql.= ", ".$name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$table_element."_extrafields";
|
||||||
$sql.= " WHERE fk_object = ".$rowid;
|
$sql.= " WHERE fk_object = ".$rowid;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG);
|
||||||
@ -4335,11 +4338,14 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
|
$table_element = $this->table_element;
|
||||||
|
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
|
||||||
|
|
||||||
|
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id;
|
||||||
dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG);
|
||||||
$this->db->query($sql_del);
|
$this->db->query($sql_del);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$table_element."_extrafields (fk_object";
|
||||||
foreach($new_array_options as $key => $value)
|
foreach($new_array_options as $key => $value)
|
||||||
{
|
{
|
||||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||||
|
|||||||
@ -197,6 +197,7 @@ class ExtraFields
|
|||||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||||
|
|
||||||
$table=$elementtype.'_extrafields';
|
$table=$elementtype.'_extrafields';
|
||||||
|
if ($elementtype == 'categorie') $table='categories_extrafields';
|
||||||
|
|
||||||
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
|
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
|
||||||
{
|
{
|
||||||
@ -350,6 +351,7 @@ class ExtraFields
|
|||||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||||
|
|
||||||
$table=$elementtype.'_extrafields';
|
$table=$elementtype.'_extrafields';
|
||||||
|
if ($elementtype == 'categorie') $table='categories_extrafields';
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -460,6 +462,7 @@ class ExtraFields
|
|||||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||||
|
|
||||||
$table=$elementtype.'_extrafields';
|
$table=$elementtype.'_extrafields';
|
||||||
|
if ($elementtype == 'categorie') $table='categories_extrafields';
|
||||||
|
|
||||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -519,6 +519,9 @@ ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pa
|
|||||||
ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid);
|
ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid);
|
||||||
|
|
||||||
|
|
||||||
|
UPDATE llx_extrafields set elementtype='categorie' where elementtype='categories';
|
||||||
|
|
||||||
|
|
||||||
-- For new module blockedlog
|
-- For new module blockedlog
|
||||||
|
|
||||||
CREATE TABLE llx_blockedlog
|
CREATE TABLE llx_blockedlog
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user