View | Details | Raw Unified | Return to bug 7241
Collapse All | Expand All

(-)a/C4/Biblio.pm (-3 / +3 lines)
Lines 274-280 sub AddBiblio { Link Here
274
    # now add the record
274
    # now add the record
275
    ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save;
275
    ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save;
276
276
277
    logaction( "CATALOGUING", "ADD", $biblionumber, "biblio" ) if C4::Context->preference("CataloguingLog");
277
    logaction( "CATALOGUING", "ADD", $biblionumber, "", "BIBLIO" ) if C4::Context->preference("CataloguingLog");
278
    return ( $biblionumber, $biblioitemnumber );
278
    return ( $biblionumber, $biblioitemnumber );
279
}
279
}
280
280
Lines 304-310 sub ModBiblio { Link Here
304
304
305
    if ( C4::Context->preference("CataloguingLog") ) {
305
    if ( C4::Context->preference("CataloguingLog") ) {
306
        my $newrecord = GetMarcBiblio($biblionumber);
306
        my $newrecord = GetMarcBiblio($biblionumber);
307
        logaction( "CATALOGUING", "MODIFY", $biblionumber, "BEFORE=>" . $newrecord->as_formatted );
307
        logaction( "CATALOGUING", "MODIFY", $biblionumber, "BEFORE=>" . $newrecord->as_formatted, "BIBLIO" );
308
    }
308
    }
309
309
310
    # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to
310
    # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to
Lines 452-458 sub DelBiblio { Link Here
452
    # from being generated by _koha_delete_biblioitems
452
    # from being generated by _koha_delete_biblioitems
453
    $error = _koha_delete_biblio( $dbh, $biblionumber );
453
    $error = _koha_delete_biblio( $dbh, $biblionumber );
454
454
455
    logaction( "CATALOGUING", "DELETE", $biblionumber, "" ) if C4::Context->preference("CataloguingLog");
455
    logaction( "CATALOGUING", "DELETE", $biblionumber, "", "BIBLIO" ) if C4::Context->preference("CataloguingLog");
456
456
457
    return;
457
    return;
458
}
458
}
(-)a/C4/Circulation.pm (-2 / +2 lines)
Lines 1071-1077 sub AddIssue { Link Here
1071
        }
1071
        }
1072
    }
1072
    }
1073
1073
1074
    logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $biblio->{'biblionumber'})
1074
    logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $item->{'itemnumber'})
1075
        if C4::Context->preference("IssueLog");
1075
        if C4::Context->preference("IssueLog");
1076
  }
1076
  }
1077
  return ($datedue);	# not necessarily the same as when it came in!
1077
  return ($datedue);	# not necessarily the same as when it came in!
Lines 1640-1646 sub AddReturn { Link Here
1640
        });
1640
        });
1641
    }
1641
    }
1642
    
1642
    
1643
    logaction("CIRCULATION", "RETURN", $borrowernumber, $item->{'biblionumber'})
1643
    logaction("CIRCULATION", "RETURN", $borrowernumber, $item->{'itemnumber'})
1644
        if C4::Context->preference("ReturnLog");
1644
        if C4::Context->preference("ReturnLog");
1645
    
1645
    
1646
    # FIXME: make this comment intelligible.
1646
    # FIXME: make this comment intelligible.
(-)a/C4/Items.pm (-4 / +4 lines)
Lines 270-276 sub AddItem { Link Here
270
270
271
    ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef );
271
    ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef );
272
   
272
   
273
    logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
273
    logaction("CATALOGUING", "ADD", $itemnumber, Dumper($item), "ITEM") if C4::Context->preference("CataloguingLog");
274
    
274
    
275
    return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber);
275
    return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber);
276
}
276
}
Lines 362-368 sub AddItemBatchFromMarc { Link Here
362
        push @itemnumbers, $itemnumber; # FIXME not checking error
362
        push @itemnumbers, $itemnumber; # FIXME not checking error
363
        $item->{'itemnumber'} = $itemnumber;
363
        $item->{'itemnumber'} = $itemnumber;
364
364
365
        logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); 
365
        logaction("CATALOGUING", "ADD", $itemnumber, Dumper($item), "ITEM") if C4::Context->preference("CataloguingLog"); 
366
366
367
        my $new_item_marc = _marc_from_item_hash($item, $frameworkcode, $unlinked_item_subfields);
367
        my $new_item_marc = _marc_from_item_hash($item, $frameworkcode, $unlinked_item_subfields);
368
        $item_field->replace_with($new_item_marc->field($itemtag));
368
        $item_field->replace_with($new_item_marc->field($itemtag));
Lines 521-527 sub ModItem { Link Here
521
    # item status is possible
521
    # item status is possible
522
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
522
    ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef );
523
523
524
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog");
524
    logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item), "ITEM") if C4::Context->preference("CataloguingLog");
525
}
525
}
526
526
527
=head2 ModItemTransfer
527
=head2 ModItemTransfer
Lines 590-596 sub DelItem { Link Here
590
    # This last update statement makes that the timestamp column in deleteditems is updated too. If you remove these lines, please add a line to update the timestamp separately. See Bugzilla report 7146 and Biblio.pm (DelBiblio).
590
    # This last update statement makes that the timestamp column in deleteditems is updated too. If you remove these lines, please add a line to update the timestamp separately. See Bugzilla report 7146 and Biblio.pm (DelBiblio).
591
591
592
    #search item field code
592
    #search item field code
593
    logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
593
    logaction("CATALOGUING", "DELETE", $itemnumber, "", "ITEM") if C4::Context->preference("CataloguingLog");
594
}
594
}
595
595
596
=head2 CheckItemPreSave
596
=head2 CheckItemPreSave
(-)a/C4/Log.pm (-3 / +3 lines)
Lines 66-72 number is set to 0, which is the same as the superlibrarian's number. Link Here
66
66
67
#'
67
#'
68
sub logaction {
68
sub logaction {
69
    my ($modulename, $actionname, $objectnumber, $infos)=@_;
69
    my ($modulename, $actionname, $objectnumber, $infos, $objectinfo)=@_;
70
70
71
    # Get ID of logged in user.  if called from a batch job,
71
    # Get ID of logged in user.  if called from a batch job,
72
    # no user session exists and C4::Context->userenv() returns
72
    # no user session exists and C4::Context->userenv() returns
Lines 75-82 sub logaction { Link Here
75
    my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : 0;
75
    my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : 0;
76
76
77
    my $dbh = C4::Context->dbh;
77
    my $dbh = C4::Context->dbh;
78
    my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)");
78
    my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info,objectinfo) values (now(),?,?,?,?,?,?)");
79
    $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos);
79
    $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos,$objectinfo);
80
    $sth->finish;
80
    $sth->finish;
81
}
81
}
82
82
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2392-2397 CREATE TABLE `action_logs` ( Link Here
2392
  `module` text,
2392
  `module` text,
2393
  `action` text,
2393
  `action` text,
2394
  `object` int(11) default NULL,
2394
  `object` int(11) default NULL,
2395
  `objectinfo` text,
2395
  `info` text,
2396
  `info` text,
2396
  PRIMARY KEY (`action_id`),
2397
  PRIMARY KEY (`action_id`),
2397
  KEY  (`timestamp`,`user`)
2398
  KEY  (`timestamp`,`user`)
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +7 lines)
Lines 4585-4590 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4585
    SetVersion($DBversion);
4585
    SetVersion($DBversion);
4586
}
4586
}
4587
4587
4588
$DBversion = "XXX";
4589
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4590
    $dbh->do("ALTER TABLE  `action_logs` ADD  `objectinfo` TEXT NULL AFTER  `object`");
4591
    print "Upgrade to $DBversion done (Add objectinfo column to action_logs)\n";
4592
    SetVersion($DBversion);
4593
}
4594
4588
=head1 FUNCTIONS
4595
=head1 FUNCTIONS
4589
4596
4590
=head2 DropAllForeignKeys($table)
4597
=head2 DropAllForeignKeys($table)
4591
- 

Return to bug 7241