Throw an error and return if if the book is marked readonly.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20154 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2011-01-23 17:35:31 +00:00
parent 978908404a
commit 05530a33c3

View File

@ -603,6 +603,12 @@ gnc_sql_commit_edit( GncSqlBackend *be, QofInstance *inst )
g_return_if_fail( be != NULL );
g_return_if_fail( inst != NULL );
if ( qof_book_is_readonly( be->primary_book ) )
{
qof_backend_set_error( (QofBackend*)be, ERR_BACKEND_READONLY );
(void)gnc_sql_connection_rollback_transaction( be->conn );
return;
}
/* During initial load where objects are being created, don't commit
anything, but do mark the object as clean. */
if ( be->loading )
@ -647,7 +653,7 @@ gnc_sql_commit_edit( GncSqlBackend *be, QofInstance *inst )
be_data.inst = inst;
be_data.is_ok = TRUE;
/* Set/update the application version in the database */
if (gnc_sql_get_table_version( be, "Gnucash") != gnc_version )
if ( gnc_sql_get_table_version( be, "Gnucash") != gnc_version )
gnc_sql_set_table_version( be, "Gnucash", gnc_version );
qof_object_foreach_backend( GNC_SQL_BACKEND, commit_cb, &be_data );