Lines 26-31
use C4::Suggestions;
Link Here
|
26 |
use C4::Biblio; |
26 |
use C4::Biblio; |
27 |
use C4::Contract; |
27 |
use C4::Contract; |
28 |
use C4::Debug; |
28 |
use C4::Debug; |
|
|
29 |
use C4::Log qw(logaction); |
29 |
use C4::Templates qw(gettemplate); |
30 |
use C4::Templates qw(gettemplate); |
30 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
31 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
31 |
use Koha::Acquisition::Baskets; |
32 |
use Koha::Acquisition::Baskets; |
Lines 203-208
sub NewBasket {
Link Here
|
203 |
$basketbooksellernote ||= q{}; |
204 |
$basketbooksellernote ||= q{}; |
204 |
ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote, |
205 |
ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote, |
205 |
$basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items ); |
206 |
$basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items ); |
|
|
207 |
|
208 |
# Log the basket creation |
209 |
if (C4::Context->preference("AcqLog")) { |
210 |
logaction('ACQUISITIONS', 'ADD_BASKET', $basket); |
211 |
} |
212 |
|
206 |
return $basket; |
213 |
return $basket; |
207 |
} |
214 |
} |
208 |
|
215 |
|
Lines 217-223
close a basket (becomes unmodifiable, except for receives)
Link Here
|
217 |
=cut |
224 |
=cut |
218 |
|
225 |
|
219 |
sub CloseBasket { |
226 |
sub CloseBasket { |
220 |
my ($basketno) = @_; |
227 |
my ($basketno, $user, $edi_approval) = @_; |
221 |
my $dbh = C4::Context->dbh; |
228 |
my $dbh = C4::Context->dbh; |
222 |
$dbh->do('UPDATE aqbasket SET closedate=now() WHERE basketno=?', {}, $basketno ); |
229 |
$dbh->do('UPDATE aqbasket SET closedate=now() WHERE basketno=?', {}, $basketno ); |
223 |
|
230 |
|
Lines 225-230
sub CloseBasket {
Link Here
|
225 |
q{UPDATE aqorders SET orderstatus = 'ordered' WHERE basketno = ? AND orderstatus NOT IN ( 'complete', 'cancelled')}, |
232 |
q{UPDATE aqorders SET orderstatus = 'ordered' WHERE basketno = ? AND orderstatus NOT IN ( 'complete', 'cancelled')}, |
226 |
{}, $basketno |
233 |
{}, $basketno |
227 |
); |
234 |
); |
|
|
235 |
|
236 |
# Log the closure |
237 |
if (C4::Context->preference("AcqLog")) { |
238 |
my $action = $edi_approval ? 'APPROVE_BASKET' : 'CLOSE_BASKET'; |
239 |
my $infos = $user ? sprintf("%010d", $user) : undef; |
240 |
logaction( |
241 |
'ACQUISITIONS', |
242 |
$action, |
243 |
$basketno, |
244 |
$infos |
245 |
); |
246 |
} |
247 |
|
228 |
return; |
248 |
return; |
229 |
} |
249 |
} |
230 |
|
250 |
|
Lines 548-553
sub ModBasket {
Link Here
|
548 |
my $sth = $dbh->prepare($query); |
568 |
my $sth = $dbh->prepare($query); |
549 |
$sth->execute(@params); |
569 |
$sth->execute(@params); |
550 |
|
570 |
|
|
|
571 |
# Log the basket update |
572 |
if (C4::Context->preference("AcqLog")) { |
573 |
my $infos = $basketinfo->{borrowernumber} ? |
574 |
sprintf("%010d", $basketinfo->{borrowernumber}) : |
575 |
undef; |
576 |
logaction( |
577 |
'ACQUISITIONS', |
578 |
'MODIFY_BASKET', |
579 |
$basketinfo->{'basketno'}, |
580 |
$infos |
581 |
); |
582 |
} |
583 |
|
551 |
return; |
584 |
return; |
552 |
} |
585 |
} |
553 |
|
586 |
|
Lines 587-593
case the AcqCreateItem syspref takes precedence).
Link Here
|
587 |
=cut |
620 |
=cut |
588 |
|
621 |
|
589 |
sub ModBasketHeader { |
622 |
sub ModBasketHeader { |
590 |
my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items) = @_; |
623 |
my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items, $borrowernumber) = @_; |
591 |
|
624 |
|
592 |
$is_standing ||= 0; |
625 |
$is_standing ||= 0; |
593 |
my $query = qq{ |
626 |
my $query = qq{ |
Lines 605-610
sub ModBasketHeader {
Link Here
|
605 |
my $sth2 = $dbh->prepare($query2); |
638 |
my $sth2 = $dbh->prepare($query2); |
606 |
$sth2->execute($contractnumber,$basketno); |
639 |
$sth2->execute($contractnumber,$basketno); |
607 |
} |
640 |
} |
|
|
641 |
|
608 |
return; |
642 |
return; |
609 |
} |
643 |
} |
610 |
|
644 |
|