mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #21262
[Bug 1381811] A change has been merged
Reviewed: https://reviews.mahara.org/3819
Committed: http://gitorious.org/mahara/mahara/commit/1f779bdd6486b802eca218ee750dc0077283535c
Submitter: Aaron Wells (aaronw@xxxxxxxxxxxxxxx)
Branch: master
commit 1f779bdd6486b802eca218ee750dc0077283535c
Author: Aaron Wells <aaronw@xxxxxxxxxxxxxxx>
Date: Thu Oct 16 13:39:27 2014 +1300
Make Collection::save() play well with existing collections & non-null
columns
Bug 1381811: Collection::save() would create a new (empty) collection by
passing 0 as the id to the Collection constructor, even if the supplied
$data included an "id" field. Since the id was not supplied to the
constructor, it does not pull the collection's current data from the
database.
It would then call Collection->commit(), which would notice the "id"
field and do an update instead of an insert into the database. But due to
the way the Collection class is written, it would try to populate every
field of the collection table, rather than just those supplied in $data.
This means that all the database fields not supplied in $data, would
attempt to be filled with NULL. This threw an error because of the new
collection.submittedstatus NOT-NULL column.
Change-Id: I6a2927892459bd25d51bd58de1bd3e3584df0793
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1381811
Title:
Error when copying collection or editing collection title/description
Status in Mahara ePortfolio:
Fix Committed
Status in Mahara 1.10 series:
Fix Committed
Status in Mahara 1.11 series:
Fix Committed
Bug description:
Mahara 1.10rc1
Editing a collection's title or description produces an error.
1. Create a collection
2. Save it
3. Click the "Edit title and description" link for that collection
4. Click "save"
Copying of a collection produces the same error. Tested in Portfolio
and groups.
1. Create a collection.
2. Copy the collection. Error (see below shows up). Collection is created though.
---------------
[WAR] 49 (lib/adodb/adodb-exceptions.inc.php:43) Array to string conversion
Call stack (most recent first):
log_message("Array to string conversion", 8, true, true, "/var/www/html/maharatest/htdocs/lib/adodb/adodb-ex...", 43) at /var/www/html/maharatest/htdocs/lib/errors.php:439
error(8, "Array to string conversion", "/var/www/html/maharatest/htdocs/lib/adodb/adodb-ex...", 43, array(size 7)) at /var/www/html/maharatest/htdocs/lib/adodb/adodb-exceptions.inc.php:43
ADODB_Exception->__construct("postgres7", "adodb_throw", -1, "ERROR: null value in column "submittedstatus" vio...", "UPDATE "collection" SET "owner" = ? , "ctime" = ? ...", array(size 13), object(ADODB_postgres7)) at /var/www/html/maharatest/htdocs/lib/adodb/adodb-exceptions.inc.php:78
adodb_throw("postgres7", "adodb_throw", -1, "ERROR: null value in column "submittedstatus" vio...", "UPDATE "collection" SET "owner" = ? , "ctime" = ? ...", array(size 13), object(ADODB_postgres7)) at /var/www/html/maharatest/htdocs/lib/adodb/adodb.inc.php:257
ADODB_TransMonitor("postgres7", "EXECUTE", -1, "ERROR: null value in column "submittedstatus" vio...", "UPDATE "collection" SET "owner" = ? , "ctime" = ? ...", array(size 13), object(ADODB_postgres7)) at /var/www/html/maharatest/htdocs/lib/adodb/adodb.inc.php:1074
ADOConnection->_Execute("UPDATE "collection" SET "owner" = ? , "ctime" = ? ...", array(size 13)) at /var/www/html/maharatest/htdocs/lib/adodb/adodb.inc.php:1045
ADOConnection->Execute("UPDATE "collection" SET "owner" = ? , "ctime" = ? ...", array(size 13)) at /var/www/html/maharatest/htdocs/lib/dml.php:1256
update_record("collection", object(stdClass), "id") at /var/www/html/maharatest/htdocs/lib/collection.php:163
Collection->commit() at /var/www/html/maharatest/htdocs/lib/collection.php:100
Collection::save(array(size 8)) at /var/www/html/maharatest/htdocs/collection/edit.php:130
submit(object(Pieform), array(size 8)) at Unknown:0
call_user_func_array("submit", array(size 2)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:527
Pieform->__construct(array(size 5)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:162
Pieform::process(array(size 5)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:71
pieform(array(size 5)) at /var/www/html/maharatest/htdocs/collection/edit.php:113
[WAR] 49 (lib/errors.php:745) Failed to get a recordset: postgres7 error: [-1: ERROR: null value in column "submittedstatus" violates not-null constraint] in adodb_throw(UPDATE "collection" SET "owner" = ? , "ctime" = ? , "mtime" = ? , "name" = ? , "description" = ? , "navigation" = ? , "submittedgroup" = ? , "submittedhost" = ? , "submittedtime" = ? , "submittedstatus" = ? , "group" = ? , "institution" = ? WHERE "id" = ? , Array)
Command was: UPDATE "collection" SET "owner" = ? , "ctime" = ? , "mtime" = ? , "name" = ? , "description" = ? , "navigation" = ? , "submittedgroup" = ? , "submittedhost" = ? , "submittedtime" = ? , "submittedstatus" = ? , "group" = ? , "institution" = ? WHERE "id" = ? and values was (1,2014-10-16 12:20:51,2014-10-16 12:20:51,Testing,,1,,,,,,,3)
Call stack (most recent first):
log_message("Failed to get a recordset: postgres7 error: [-1: E...", 8, true, true) at /var/www/html/maharatest/htdocs/lib/errors.php:95
log_warn("Failed to get a recordset: postgres7 error: [-1: E...") at /var/www/html/maharatest/htdocs/lib/errors.php:745
SQLException->__construct("Failed to get a recordset: postgres7 error: [-1: E...") at /var/www/html/maharatest/htdocs/lib/dml.php:1260
update_record("collection", object(stdClass), "id") at /var/www/html/maharatest/htdocs/lib/collection.php:163
Collection->commit() at /var/www/html/maharatest/htdocs/lib/collection.php:100
Collection::save(array(size 8)) at /var/www/html/maharatest/htdocs/collection/edit.php:130
submit(object(Pieform), array(size 8)) at Unknown:0
call_user_func_array("submit", array(size 2)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:527
Pieform->__construct(array(size 5)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:162
Pieform::process(array(size 5)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:71
pieform(array(size 5)) at /var/www/html/maharatest/htdocs/collection/edit.php:113
[WAR] 49 (lib/dml.php:1260) Failed to get a recordset: postgres7 error: [-1: ERROR: null value in column "submittedstatus" violates not-null constraint] in adodb_throw(UPDATE "collection" SET "owner" = ? , "ctime" = ? , "mtime" = ? , "name" = ? , "description" = ? , "navigation" = ? , "submittedgroup" = ? , "submittedhost" = ? , "submittedtime" = ? , "submittedstatus" = ? , "group" = ? , "institution" = ? WHERE "id" = ? , Array)
Command was: UPDATE "collection" SET "owner" = ? , "ctime" = ? , "mtime" = ? , "name" = ? , "description" = ? , "navigation" = ? , "submittedgroup" = ? , "submittedhost" = ? , "submittedtime" = ? , "submittedstatus" = ? , "group" = ? , "institution" = ? WHERE "id" = ? and values was (1,2014-10-16 12:20:51,2014-10-16 12:20:51,Testing,,1,,,,,,,3)
Call stack (most recent first):
update_record("collection", object(stdClass), "id") at /var/www/html/maharatest/htdocs/lib/collection.php:163
Collection->commit() at /var/www/html/maharatest/htdocs/lib/collection.php:100
Collection::save(array(size 8)) at /var/www/html/maharatest/htdocs/collection/edit.php:130
submit(object(Pieform), array(size 8)) at Unknown:0
call_user_func_array("submit", array(size 2)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:527
Pieform->__construct(array(size 5)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:162
Pieform::process(array(size 5)) at /var/www/html/maharatest/htdocs/lib/pieforms/pieform.php:71
pieform(array(size 5)) at /var/www/html/maharatest/htdocs/collection/edit.php:113
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1381811/+subscriptions
References