|
Lines 19-25
package C4::Acquisition;
Link Here
|
| 19 |
|
19 |
|
| 20 |
|
20 |
|
| 21 |
use Modern::Perl; |
21 |
use Modern::Perl; |
| 22 |
use JSON qw(to_json); |
|
|
| 23 |
use Carp; |
22 |
use Carp; |
| 24 |
use C4::Context; |
23 |
use C4::Context; |
| 25 |
use C4::Debug; |
24 |
use C4::Debug; |
|
Lines 207-226
sub NewBasket {
Link Here
|
| 207 |
$basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items ); |
206 |
$basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items ); |
| 208 |
|
207 |
|
| 209 |
# Log the basket creation |
208 |
# Log the basket creation |
| 210 |
# We need the creation timestamp, so need to get the newly created basket |
209 |
if (C4::Context->preference("AcqLog")) { |
| 211 |
my $new_basket = GetBasket($basket); |
210 |
logaction('ACQUISITIONS', 'ADD_BASKET', $basket); |
| 212 |
my $bookseller = Koha::Acquisition::Booksellers->find( |
211 |
} |
| 213 |
$new_basket->{booksellerid} |
|
|
| 214 |
); |
| 215 |
my $patron = Koha::Patrons->find( $authorisedby ); |
| 216 |
my $infos = { |
| 217 |
basketno => $basket, |
| 218 |
basketname => $new_basket->{basketname}, |
| 219 |
creationdate => $new_basket->{creationdate}, |
| 220 |
vendorname => $bookseller->name, |
| 221 |
created_by => $patron->firstname . ' ' . $patron->surname |
| 222 |
}; |
| 223 |
logaction('ACQUISITIONS', 'ADD', $basket, to_json($infos)); |
| 224 |
|
212 |
|
| 225 |
return $basket; |
213 |
return $basket; |
| 226 |
} |
214 |
} |
|
Lines 246-276
q{UPDATE aqorders SET orderstatus = 'ordered' WHERE basketno = ? AND orderstatus
Link Here
|
| 246 |
); |
234 |
); |
| 247 |
|
235 |
|
| 248 |
# Log the closure |
236 |
# Log the closure |
| 249 |
my $basket = GetBasket($basketno); |
237 |
if (C4::Context->preference("AcqLog")) { |
| 250 |
my $bookseller = Koha::Acquisition::Booksellers->find( |
238 |
my $action = $edi_approval ? 'APPROVE_BASKET' : 'CLOSE_BASKET'; |
| 251 |
$basket->{booksellerid} |
239 |
my $infos = $user ? sprintf("%010d", $user) : undef; |
| 252 |
); |
240 |
logaction( |
| 253 |
my ($day, $mon, $year) = (localtime->mday, localtime->mon, localtime->year); |
241 |
'ACQUISITIONS', |
| 254 |
$mon = sprintf '%02d', $mon + 1; |
242 |
$action, |
| 255 |
$day = sprintf '%02d', $day; |
243 |
$basketno, |
| 256 |
$year += 1900; |
244 |
$infos |
| 257 |
my $action = $edi_approval ? 'APPROVE_BASKET' : 'CLOSE_BASKET'; |
245 |
); |
| 258 |
my $infos = { |
246 |
} |
| 259 |
basketno => $basketno, |
|
|
| 260 |
basketname => $basket->{basketname}, |
| 261 |
closeddate => "$year-$mon-$day", |
| 262 |
vendorname => $bookseller->name, |
| 263 |
}; |
| 264 |
if ($user) { |
| 265 |
my $patron = Koha::Patrons->find( $user ); |
| 266 |
$infos->{closed_by} = $patron->firstname . ' ' . $patron->surname |
| 267 |
} |
| 268 |
logaction( |
| 269 |
'ACQUISITIONS', |
| 270 |
$action, |
| 271 |
$basketno, |
| 272 |
to_json($infos) |
| 273 |
); |
| 274 |
|
247 |
|
| 275 |
return; |
248 |
return; |
| 276 |
} |
249 |
} |
|
Lines 596-625
sub ModBasket {
Link Here
|
| 596 |
$sth->execute(@params); |
569 |
$sth->execute(@params); |
| 597 |
|
570 |
|
| 598 |
# Log the basket update |
571 |
# Log the basket update |
| 599 |
my $edited_basket = GetBasket($basketinfo->{'basketno'}); |
572 |
if (C4::Context->preference("AcqLog")) { |
| 600 |
my $bookseller = Koha::Acquisition::Booksellers->find( |
573 |
my $infos = $basketinfo->{borrowernumber} ? |
| 601 |
$edited_basket->{booksellerid} |
574 |
sprintf("%010d", $basketinfo->{borrowernumber}) : |
| 602 |
); |
575 |
undef; |
| 603 |
my ($day, $mon, $year) = (localtime->mday, localtime->mon, localtime->year); |
576 |
logaction( |
| 604 |
$mon = sprintf '%02d', $mon + 1; |
577 |
'ACQUISITIONS', |
| 605 |
$day = sprintf '%02d', $day; |
578 |
'MODIFY_BASKET', |
| 606 |
$year += 1900; |
579 |
$basketinfo->{'basketno'}, |
| 607 |
my $infos = { |
580 |
$infos |
| 608 |
basketno => $basketinfo->{'basketno'}, |
581 |
); |
| 609 |
basketname => $edited_basket->{basketname}, |
582 |
} |
| 610 |
updatedate => "$year-$mon-$day", |
|
|
| 611 |
vendorname => $bookseller->name, |
| 612 |
}; |
| 613 |
if ($basketinfo->{borrowernumber}) { |
| 614 |
my $patron = Koha::Patrons->find( $basketinfo->{borrowernumber} ); |
| 615 |
$infos->{edited_by} = $patron->firstname . ' ' . $patron->surname; |
| 616 |
} |
| 617 |
logaction( |
| 618 |
'ACQUISITIONS', |
| 619 |
'MODIFY', |
| 620 |
$basketinfo->{'basketno'}, |
| 621 |
to_json($infos) |
| 622 |
); |
| 623 |
|
583 |
|
| 624 |
return; |
584 |
return; |
| 625 |
} |
585 |
} |
|
Lines 679-702
sub ModBasketHeader {
Link Here
|
| 679 |
$sth2->execute($contractnumber,$basketno); |
639 |
$sth2->execute($contractnumber,$basketno); |
| 680 |
} |
640 |
} |
| 681 |
|
641 |
|
| 682 |
# Log the basket update |
|
|
| 683 |
my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid); |
| 684 |
my ($day, $mon, $year) = (localtime->mday, localtime->mon, localtime->year); |
| 685 |
$mon = sprintf '%02d', $mon + 1; |
| 686 |
$day = sprintf '%02d', $day; |
| 687 |
$year += 1900; |
| 688 |
my $infos = { |
| 689 |
basketno => $basketno, |
| 690 |
basketname => $basketname, |
| 691 |
updatedate => "$year-$mon-$day", |
| 692 |
vendorname => $bookseller->name, |
| 693 |
}; |
| 694 |
if ($borrowernumber) { |
| 695 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
| 696 |
$infos->{edited_by} = $patron->firstname . ' ' . $patron->surname; |
| 697 |
} |
| 698 |
logaction('ACQUISITIONS', 'MODIFY', $basketno, to_json($infos)); |
| 699 |
|
| 700 |
return; |
642 |
return; |
| 701 |
} |
643 |
} |
| 702 |
|
644 |
|