Bug 15835

Summary: Koha::Object does not save changes
Product: Koha Reporter: Srdjan Jankovic <srdjan>
Component: Architecture, internals, and plumbingAssignee: Galen Charlton <gmcharlt>
Status: CLOSED INVALID QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, julian.maurice, kyle, veron
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Crowdfunding committed: 0
Crowdfunding contact: Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Srdjan Jankovic 2016-02-17 07:06:56 UTC
$object->set({column => $val})->store does not work.
DB trace:
BEGIN WORK
COMMIT

On the other hand, $object->_result()->update({column => $val}) does work.
DB trace:
BEGIN WORK
UPDATE borrowers SET overdrive_auth_token = ? WHERE ( borrowernumber = ? ): XXX, YYY
COMMIT
Comment 1 Jonathan Druart 2016-02-17 10:15:36 UTC
Srdjan, what did you try exactly?

I have tried the following:

  use Modern::Perl;
  use Koha::Borrowers;
  my $p = Koha::Borrowers->find(10);
  $p->set({firstname => 'my new firstname', surname => 'my new surname' })->store;

then

  MariaDB [koha]> select firstname, surname from borrowers where borrowernumber=10;

And I got my updated values.
Comment 2 Srdjan Jankovic 2016-02-18 01:03:07 UTC
Well I cannot make it happen now myself. Who knows what was going on...