Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1388 → Rev 1389

/asterisk-stats/trunk/TODO
1,2 → 1,0
* transactions (telbook person save & delete)
* check input (telbook)
* validate input (telbook)
/asterisk-stats/trunk/includes/db/postgresql.php
94,5 → 94,17
}
return NULL;
}
 
function begin_transaction() {
$this->query("begin");
}
 
function commit_transaction() {
$this->query("commit");
}
 
function rollback_transaction() {
$this->query("rollback");
}
}
?>
/asterisk-stats/trunk/telbook_update.php
5,8 → 5,10
 
if(array_key_exists('delete', $_POST)) {
$id = $_POST['id'];
$db->begin_transaction();
$db->query_params("delete from telbook_entries where entry_person=$1", array($id));
$db->query_params("delete from telbook_persons where person_id=$1", array($id));
$db->commit_transaction();
 
header("Location: telbook_list.php");
$g_display->add_text('Information deleted successfully');
17,6 → 19,8
$person_comment = $_POST['person_comment'];
$person_category = ($_POST['person_category'] == '' ? NULL : $_POST['person_category']);
 
$db->begin_transaction();
 
if($id) {
$db->query_params("update telbook_persons set"
. " person_name=$2, person_comment=$3, person_category=$4"
52,6 → 56,8
}
}
 
$db->commit_transaction();
 
header("Location: telbook_list.php");
$g_display->add_text('Information saved successfully');
}