Skip to content

Commit

Permalink
Fix "statusses" typo throughout, including table name
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdunn committed Aug 1, 2011
1 parent f6fe951 commit 0e9bdbf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
20 changes: 17 additions & 3 deletions extension.driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function about()
'name' => 'Giel Berkers',
'website' => 'http://www.gielberkers.com',
'email' => 'info@gielberkers.com'),
'description' => 'Store the status and hold a history of previous statusses.'
'description' => 'Store the status and hold a history of previous statuses.'
);
}

Expand All @@ -37,7 +37,7 @@ public function initialiseHead($context)
public function uninstall()
{
Symphony::Database()->query("DROP TABLE `tbl_fields_status`");
Symphony::Database()->query("DROP TABLE `tbl_fields_status_statusses`");
Symphony::Database()->query("DROP TABLE `tbl_fields_status_statuses`");
}

public function install()
Expand All @@ -50,7 +50,7 @@ public function install()
PRIMARY KEY (`id`),
UNIQUE KEY `field_id` (`field_id`)
)");
Symphony::Database()->query("CREATE TABLE `tbl_fields_status_statusses` (
Symphony::Database()->query("CREATE TABLE `tbl_fields_status_statuses` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`entry_id` int(11) unsigned NOT NULL,
Expand All @@ -60,4 +60,18 @@ public function install()
PRIMARY KEY (`id`)
)");
}

public function update()
{
try{
if(version_compare($previousVersion, '0.2', '<')){
Symphony::Database()->query(
"RENAME `tbl_fields_status_statusses` TO `tbl_fields_status_statuses`"
);
}
}
catch(Exception $e){

}
}
}
14 changes: 7 additions & 7 deletions fields/field.status.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function displaySettingsPanel(&$wrapper, $errors = null) {
$options = array();
$fieldname = 'fields'.$fieldnamePrefix.'['.$this->get('element_name').']'.$fieldnamePostfix;

$label = Widget::Label(__('Statusses'));
$label = Widget::Label(__('Statuses'));
$input = Widget::Input('fields['.$this->get('sortorder').'][options]', General::sanitize($this->get('options')));
$label->appendChild($input);
$wrapper->appendChild($label);
Expand Down Expand Up @@ -121,7 +121,7 @@ function displayPublishPanel(&$wrapper, $data=NULL, $flagWithError=NULL, $fieldn

if($entry_id != false)
{
$results = Symphony::Database()->fetch('SELECT `date`, `status`, `valid_until` FROM `tbl_fields_status_statusses` WHERE `field_id` = '.$fieldId.' AND `entry_id` = '.$entry_id.' ORDER BY `date`, `id`;');
$results = Symphony::Database()->fetch('SELECT `date`, `status`, `valid_until` FROM `tbl_fields_status_statuses` WHERE `field_id` = '.$fieldId.' AND `entry_id` = '.$entry_id.' ORDER BY `date`, `id`;');
foreach($results as $result)
{
$row = new XMLElement('tr');
Expand Down Expand Up @@ -206,7 +206,7 @@ public function processRawFieldData($data, &$status, $simulate=false, $entry_id=
// Don't insert if there is no entry_id:
if($entry_id != null)
{
Symphony::Database()->query('INSERT INTO `tbl_fields_status_statusses`
Symphony::Database()->query('INSERT INTO `tbl_fields_status_statuses`
(`field_id`, `entry_id`, `date`, `status`, `valid_until`) VALUES
('.$fieldId.', '.$entryId.', \''.$dateNow.'\', \''.$statusStr.'\', '.$dateUntil.');');
}
Expand All @@ -220,7 +220,7 @@ public function processRawFieldData($data, &$status, $simulate=false, $entry_id=
{
// There can only be a value returned if there is an entry_id:
return array(
'value' => Symphony::Database()->fetchVar('status', 0, 'SELECT `status` FROM `tbl_fields_status_statusses` WHERE `field_id` = '.$fieldId.' AND `entry_id` = '.$entryId.' ORDER BY `date` DESC, `id` DESC;')
'value' => Symphony::Database()->fetchVar('status', 0, 'SELECT `status` FROM `tbl_fields_status_statuses` WHERE `field_id` = '.$fieldId.' AND `entry_id` = '.$entryId.' ORDER BY `date` DESC, `id` DESC;')
);
} else {
// Is this the right way to do this?
Expand All @@ -238,7 +238,7 @@ public function appendFormattedElement(&$wrapper, $data, $encode = false) {
$attributes = $wrapper->getAttributes();
$entryId = $attributes['id'];
$fieldId = $this->get('id');
$results = Symphony::Database()->fetch('SELECT `date`, `status`, `valid_until` FROM `tbl_fields_status_statusses` WHERE `field_id` = '.$fieldId.' AND `entry_id` = '.$entryId.' ORDER BY `date`, `id`;');
$results = Symphony::Database()->fetch('SELECT `date`, `status`, `valid_until` FROM `tbl_fields_status_statuses` WHERE `field_id` = '.$fieldId.' AND `entry_id` = '.$entryId.' ORDER BY `date`, `id`;');
foreach($results as $result)
{
$status = new XMLElement('status', General::sanitize($result['status']), array('date'=>$result['date']));
Expand All @@ -251,11 +251,11 @@ public function appendFormattedElement(&$wrapper, $data, $encode = false) {
}


// Delete the entry and the associated statusses:
// Delete the entry and the associated statuses:
public function entryDataCleanup($entry_id, $data=NULL)
{
$this->Database->delete('tbl_entries_data_' . $this->get('id'), " `entry_id` = '$entry_id' ");
$this->Database->delete('tbl_fields_status_statusses', ' `entry_id` = '.$entry_id);
$this->Database->delete('tbl_fields_status_statuses', ' `entry_id` = '.$entry_id);
return true;
}

Expand Down
16 changes: 7 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Status Field #
# Status Field

Version: 0.1
Release date: 2010-10-21
Author: Giel Berkers
Website: http://www.gielberkers.com
E-mail: info@gielberkers.com
* Version: 0.1
* Release date: 2010-10-21
* Author: Giel Berkers
* Website: http://www.gielberkers.com
* E-mail: info@gielberkers.com

Store the status and hold a history of previous statusses.

The field also has an additional option to set a 'valid until'-date.
Store the status and hold a history of previous statuses. The field also has an additional option to set a 'Valid Until' date.

0 comments on commit 0e9bdbf

Please sign in to comment.