mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
MDL-61880 core: don't clear issuer fields not present in form data
In cases where we have an id, load the persistent and then set new data before saving. This ensures we don't delete fields which are missing in the form data.
This commit is contained in:
parent
52d523fa9c
commit
b76ac53c9d
@ -327,7 +327,10 @@ class api {
|
||||
*/
|
||||
protected static function create_or_update_issuer($data, bool $create): issuer {
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
$issuer = new issuer(0, $data);
|
||||
$issuer = new issuer($data->id ?? 0, $data);
|
||||
if (!empty($data->id)) {
|
||||
$issuer->set_many((array)$data);
|
||||
}
|
||||
|
||||
// Will throw exceptions on validation failures.
|
||||
if ($create) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user