Add Business field to schema

This commit is contained in:
Romain Neutron
2012-03-20 21:31:15 +01:00
parent 7a82a72e30
commit b9366c3823
2 changed files with 40 additions and 3 deletions

View File

@@ -98,6 +98,11 @@ class databox_field implements cache_cacheableInterface
*/ */
protected $thumbtitle; protected $thumbtitle;
/**
*
* @var boolean
*/
protected $Business;
protected $renamed = false; protected $renamed = false;
/** /**
@@ -157,7 +162,7 @@ class databox_field implements cache_cacheableInterface
$sql = "SELECT `thumbtitle`, `separator` $sql = "SELECT `thumbtitle`, `separator`
, `dces_element`, `tbranch`, `type`, `report`, `multi`, `required` , `dces_element`, `tbranch`, `type`, `report`, `multi`, `required`
, `readonly`, `indexable`, `name`, `src` , `readonly`, `indexable`, `name`, `src`, `business`
, `VocabularyControlType`, `RestrictToVocabularyControl` , `VocabularyControlType`, `RestrictToVocabularyControl`
FROM metadatas_structure WHERE id=:id"; FROM metadatas_structure WHERE id=:id";
@@ -173,6 +178,7 @@ class databox_field implements cache_cacheableInterface
$this->readonly = !!$row['readonly']; $this->readonly = !!$row['readonly'];
$this->required = !!$row['required']; $this->required = !!$row['required'];
$this->multi = !!$row['multi']; $this->multi = !!$row['multi'];
$this->Business = !!$row['business'];
$this->report = !!$row['report']; $this->report = !!$row['report'];
$this->type = $row['type'] ? : self::TYPE_STRING; $this->type = $row['type'] ? : self::TYPE_STRING;
$this->tbranch = $row['tbranch']; $this->tbranch = $row['tbranch'];
@@ -229,6 +235,15 @@ class databox_field implements cache_cacheableInterface
return $this->VocabularyRestriction; return $this->VocabularyRestriction;
} }
/**
*
* @return boolean
*/
public function isBusiness()
{
return $this->Business;
}
/** /**
* *
* @param databox $databox * @param databox $databox
@@ -327,6 +342,7 @@ class databox_field implements cache_cacheableInterface
`required` = :required, `required` = :required,
`separator` = :separator, `separator` = :separator,
`multi` = :multi, `multi` = :multi,
`business` = :business,
`report` = :report, `report` = :report,
`type` = :type, `type` = :type,
`tbranch` = :tbranch, `tbranch` = :tbranch,
@@ -343,6 +359,7 @@ class databox_field implements cache_cacheableInterface
':required' => $this->required ? '1' : '0', ':required' => $this->required ? '1' : '0',
':separator' => $this->separator, ':separator' => $this->separator,
':multi' => $this->multi ? '1' : '0', ':multi' => $this->multi ? '1' : '0',
':business' => $this->Business ? '1' : '0',
':report' => $this->report ? '1' : '0', ':report' => $this->report ? '1' : '0',
':type' => $this->type, ':type' => $this->type,
':tbranch' => $this->tbranch, ':tbranch' => $this->tbranch,
@@ -535,6 +552,18 @@ class databox_field implements cache_cacheableInterface
return $this; return $this;
} }
/**
*
* @param boolean $boolean
* @return databox_field
*/
public function set_business($boolean)
{
$this->Business = !!$boolean;
return $this;
}
/** /**
* *
* @param boolean $bool * @param boolean $bool
@@ -811,11 +840,11 @@ class databox_field implements cache_cacheableInterface
$sql = "INSERT INTO metadatas_structure $sql = "INSERT INTO metadatas_structure
(`id`, `name`, `src`, `readonly`, `indexable`, `type`, `tbranch`, (`id`, `name`, `src`, `readonly`, `indexable`, `type`, `tbranch`,
`thumbtitle`, `multi`, `thumbtitle`, `multi`, `business`,
`report`, `sorter`) `report`, `sorter`)
VALUES (null, :name, '', 0, 1, 'text', '', VALUES (null, :name, '', 0, 1, 'text', '',
null, 0, null, 0,
1, :sorter)"; 0, 1, :sorter)";
$stmt = $databox->get_connection()->prepare($sql); $stmt = $databox->get_connection()->prepare($sql);
$stmt->execute(array(':name' => self::generateName($name), ':sorter' => $sorter)); $stmt->execute(array(':name' => self::generateName($name), ':sorter' => $sorter));

View File

@@ -5111,6 +5111,14 @@
<default></default> <default></default>
<comment></comment> <comment></comment>
</field> </field>
<field>
<name>business</name>
<type>int(1) unsigned</type>
<null></null>
<extra></extra>
<default></default>
<comment></comment>
</field>
<field> <field>
<name>indexable</name> <name>indexable</name>
<type>int(1) unsigned</type> <type>int(1) unsigned</type>