description => $description,
note => $processingfeenote,
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
+ interface => C4::Context->interface,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
type => 'processing',
item_id => $itemnumber,
description => $description,
note => undef,
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
+ interface => C4::Context->interface,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
type => 'lost_item',
item_id => $itemnumber,
{ amount => $credit_total,
description => 'Item Returned ' . $item_id,
type => 'lost_item_return',
+ interface => C4::Context->interface,
library_id => $branchcode
}
);
note => undef,
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
+ interface => C4::Context->interface,
type => 'rent',
item_id => $checkout->itemnumber,
issue_id => $checkout->issue_id,
my $patron = Koha::Patrons->find({ cardnumber => $operation->{cardnumber} });
- $patron->account->pay({ amount => $operation->{amount}, library_id => $operation->{branchcode} });
+ $patron->account->pay(
+ {
+ amount => $operation->{amount},
+ library_id => $operation->{branchcode},
+ interface => 'koc'
+ }
+ );
return "Success.";
}
=item logaction
- &logaction($modulename, $actionname, $objectnumber, $infos);
+ &logaction($modulename, $actionname, $objectnumber, $infos, $interface);
Adds a record into action_logs table to report the different changes upon the database.
Each log entry includes the number of the user currently logged in. For batch
if ( $data ) {
if ( $data->{'amount'} != $amount ) {
- my $accountline = Koha::Account::Lines->find( $data->{accountlines_id} );
- $accountline->adjust({ amount => $amount, type => 'fine_update' });
+ my $accountline =
+ Koha::Account::Lines->find( $data->{accountlines_id} );
+ $accountline->adjust(
+ {
+ amount => $amount,
+ type => 'fine_update',
+ interface => C4::Context->interface
+ }
+ );
}
} else {
if ( $amount ) { # Don't add new fines with an amount of 0
description => $desc,
note => undef,
user_id => undef,
- library_id => undef,
+ interface => C4::Context->interface,
+ library_id => undef, #FIXME: Should we grab the checkout or circ-control branch here perhaps?
type => 'fine',
item_id => $itemnum,
issue_id => $issue_id,
note => undef,
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
+ interface => C4::Context->interface,
sip => undef,
invoice_type => undef,
type => 'reserve',
if ( $fee ) {
$account->pay(
{
- amount => $amt,
- sip => $sip_type,
- type => $type,
- lines => [$fee],
+ amount => $amt,
+ sip => $sip_type,
+ type => $type,
+ lines => [$fee],
+ interface => C4::Context->interface
}
);
return 1;
else {
$account->pay(
{
- amount => $amt,
- sip => $sip_type,
- type => $type,
+ amount => $amt,
+ sip => $sip_type,
+ type => $type,
+ interface => C4::Context->interface
}
);
return 1;
use Socket qw(:DEFAULT :crlf);
require UNIVERSAL::require;
+use C4::Context;
use C4::SIP::Sip::Constants qw(:all);
use C4::SIP::Sip::Configuration;
use C4::SIP::Sip::Checksum qw(checksum verify_cksum);
# A script with no MAIN namespace?
# A module that takes command line args?
+# Set interface to 'sip'
+C4::Context->interface('sip');
+
my %transports = (
RAW => \&raw_transport,
telnet => \&telnet_transport,
my $patron = Koha::Patrons->find( $self->{patron_id} );
my $manager_id = $userenv ? $userenv->{number} : 0;
+ my $interface = $params ? ( $params->{interface} || C4::Context->interface ) : C4::Context->interface;
my @fines_paid; # List of account lines paid on with this payment
manager_id => $manager_id,
note => $note,
}
- )
+ ),
+ $interface
);
push( @fines_paid, $fine->id );
}
manager_id => $manager_id,
note => $note,
}
- )
+ ),
+ $interface
);
push( @fines_paid, $fine->id );
}
payment_type => $payment_type,
amountoutstanding => 0 - $balance_remaining,
manager_id => $manager_id,
+ interface => $interface,
branchcode => $library_id,
note => $note,
}
accountlines_paid => \@fines_paid,
manager_id => $manager_id,
}
- )
+ ),
+ $interface
);
}
description => $description,
note => $note,
user_id => $user_id,
+ interface => $interface,
library_id => $library_id,
sip => $sip,
payment_type => $payment_type,
my $description = $params->{description} // q{};
my $note = $params->{note} // q{};
my $user_id = $params->{user_id};
+ my $interface = $params->{interface};
my $library_id = $params->{library_id};
my $sip = $params->{sip};
my $payment_type = $params->{payment_type};
payment_type => $payment_type,
note => $note,
manager_id => $user_id,
+ interface => $interface,
branchcode => $library_id,
itemnumber => $item_id,
}
manager_id => $user_id,
branchcode => $library_id,
}
- )
+ ),
+ $interface
);
}
}
description => $description,
note => $note,
user_id => $user_id,
+ interface => $interface,
library_id => $library_id,
type => $debit_type,
item_id => $item_id,
my $description = $params->{description} // q{};
my $note = $params->{note} // q{};
my $user_id = $params->{user_id};
+ my $interface = $params->{interface};
my $library_id = $params->{library_id};
my $type = $params->{type};
my $item_id = $params->{item_id};
payment_type => undef,
note => $note,
manager_id => $user_id,
+ interface => $interface,
itemnumber => $item_id,
issue_id => $issue_id,
branchcode => $library_id,
itemnumber => $item_id,
manager_id => $user_id,
}
- )
+ ),
+ $interface
);
}
}
$account_line->adjust(
{
- amount => $amount,
- type => $update_type,
+ amount => $amount,
+ type => $update_type,
+ interface => $interface
}
);
my $amount = $params->{amount};
my $update_type = $params->{type};
+ my $interface = $params->{interface};
unless ( exists($Koha::Account::Line::allowed_update->{$update_type}) ) {
Koha::Exceptions::Account::UnrecognisedType->throw(
amount => $new_outstanding * -1,
description => 'Overpayment refund',
type => 'credit',
+ interface => $interface,
( $update_type eq 'fine_update' ? ( item_id => $self->itemnumber ) : ()),
}
);
Koha::Account->new( { patron_id => $self->borrowernumber } );
$account->add_debit(
{
- amount => $charge,
- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
+ amount => $charge,
+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
+ interface => C4::Context->interface,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
- type => 'hold_expired',
- item_id => $self->itemnumber
+ type => 'hold_expired',
+ item_id => $self->itemnumber
}
);
}
if ( $enrolment_fee && $enrolment_fee > 0 ) {
$self->account->add_debit(
{
- amount => $enrolment_fee,
- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
+ amount => $enrolment_fee,
+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
+ interface => C4::Context->interface,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
- type => 'account'
+ type => 'account'
}
);
}
description => $description,
note => $note,
user_id => $user->id,
+ interface => 'api',
library_id => $library_id
}
);
--- /dev/null
+$DBversion = 'XXX'; # will be replaced by the RM
+if ( CheckVersion($DBversion) ) {
+
+ if ( !column_exists( 'accountlines', 'interface' ) ) {
+ $dbh->do(
+ qq{
+ ALTER TABLE `accountlines`
+ ADD
+ `interface` varchar(16)
+ AFTER
+ `manager_id`;
+ }
+ );
+ }
+
+ $dbh->do(qq{
+ UPDATE
+ `accountlines`
+ SET
+ interface = 'opac'
+ WHERE
+ borrowernumber = manager_id;
+ });
+
+ $dbh->do(qq{
+ UPDATE
+ `accountlines`
+ SET
+ interface = 'cron'
+ WHERE
+ manager_id IS NULL
+ AND
+ branchcode IS NULL;
+ });
+
+ $dbh->do(qq{
+ UPDATE
+ `accountlines`
+ SET
+ interface = 'intranet'
+ WHERE
+ interface IS NULL;
+ });
+
+ $dbh->do(qq{
+ ALTER TABLE `accountlines`
+ MODIFY COLUMN `interface` varchar(16) NOT NULL;
+ });
+
+ SetVersion($DBversion);
+ print "Upgrade to $DBversion done (Bug 22600 - Add interface to accountlines)\n";
+}
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`note` MEDIUMTEXT NULL default NULL,
`manager_id` int(11) NULL DEFAULT NULL,
+ `interface` VARCHAR(16) NOT NULL,
`branchcode` VARCHAR( 10 ) NULL DEFAULT NULL, -- the branchcode of the library where a payment was made, a manual invoice created, etc.
PRIMARY KEY (`accountlines_id`),
KEY `acctsborridx` (`borrowernumber`),
library_id => $library_id,
note => $note,
type => $type,
- user_id => $logged_in_user->id
+ user_id => $logged_in_user->id,
+ interface => C4::Context->interface
});
if ( C4::Context->preference('AccountAutoReconcile') ) {
lines => [ scalar Koha::Account::Lines->find($accountlines_id) ],
type => 'writeoff',
note => $payment_note,
+ interface => C4::Context->interface,
library_id => $branch,
}
);
lines => [ scalar Koha::Account::Lines->find($accountlines_id) ],
type => 'writeoff',
note => $payment_note,
+ interface => C4::Context->interface,
library_id => $branch,
}
);
amount => $total_paid,
library_id => $branch,
note => $payment_note,
+ interface => C4::Context->interface,
payment_type => $payment_type,
}
);
amount => $total_paid,
lines => \@lines,
note => $note,
+ interface => C4::Context->interface,
payment_type => $payment_type,
}
);
amount => $total_paid,
note => $note,
payment_type => $payment_type,
+ interface => C4::Context->interface
}
);
}
my $patron = Koha::Patrons->find( { cardnumber => $cardnumber } );
Koha::Account->new( { patron_id => $patron->id } )
- ->pay( { amount => $amount } );
+ ->pay( { amount => $amount, interface => C4::Context->interface } );
push @output,
{
{
amount => $amount,
lines => \@lines,
- note => 'PayPal'
+ note => 'PayPal',
+ interface => C4::Context->interface
}
);
}