CC-2318 Edit Metadata of Live shows doesn't work
form is not taking care that a track number should be an integer, default empty string cannot be set for integer, rejected by database.
This commit is contained in:
parent
6a181a4e9a
commit
765897600d
2 changed files with 16 additions and 15 deletions
|
@ -43,9 +43,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array('NotEmpty')
|
||||||
'NotEmpty',
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add album field
|
// Add album field
|
||||||
|
@ -55,11 +53,12 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add mood field
|
// Add track number field
|
||||||
$this->addElement('text', 'track_number', array(
|
$this->addElement('text', 'track_number', array(
|
||||||
'label' => 'Track:',
|
'label' => 'Track:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array('Int')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add genre field
|
// Add genre field
|
||||||
|
|
|
@ -546,12 +546,14 @@ class StoredFile {
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($p_values as $category => $value) {
|
foreach ($p_values as $category => $value) {
|
||||||
|
if (isset($value) && ($value != '')) {
|
||||||
$escapedValue = pg_escape_string($value);
|
$escapedValue = pg_escape_string($value);
|
||||||
$columnName = $category;
|
$columnName = $category;
|
||||||
if (!is_null($columnName)) {
|
if (!is_null($columnName)) {
|
||||||
$data[] = "$columnName='$escapedValue'";
|
$data[] = "$columnName='$escapedValue'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data = join(",", $data);
|
$data = join(",", $data);
|
||||||
$sql = "UPDATE ".$CC_CONFIG["filesTable"]
|
$sql = "UPDATE ".$CC_CONFIG["filesTable"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue