Lines 27-32
use C4::Suggestions;
Link Here
|
27 |
use C4::Biblio; |
27 |
use C4::Biblio; |
28 |
use C4::Contract; |
28 |
use C4::Contract; |
29 |
use C4::Debug; |
29 |
use C4::Debug; |
|
|
30 |
use C4::Log qw(logaction); |
30 |
use C4::Templates qw(gettemplate); |
31 |
use C4::Templates qw(gettemplate); |
31 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
32 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
32 |
use Koha::Acquisition::Baskets; |
33 |
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 522-527
sub ModBasket {
Link Here
|
522 |
my $sth = $dbh->prepare($query); |
542 |
my $sth = $dbh->prepare($query); |
523 |
$sth->execute(@params); |
543 |
$sth->execute(@params); |
524 |
|
544 |
|
|
|
545 |
# Log the basket update |
546 |
if (C4::Context->preference("AcqLog")) { |
547 |
my $infos = $basketinfo->{borrowernumber} ? |
548 |
sprintf("%010d", $basketinfo->{borrowernumber}) : |
549 |
undef; |
550 |
logaction( |
551 |
'ACQUISITIONS', |
552 |
'MODIFY_BASKET', |
553 |
$basketinfo->{'basketno'}, |
554 |
$infos |
555 |
); |
556 |
} |
557 |
|
525 |
return; |
558 |
return; |
526 |
} |
559 |
} |
527 |
|
560 |
|
Lines 561-567
case the AcqCreateItem syspref takes precedence).
Link Here
|
561 |
=cut |
594 |
=cut |
562 |
|
595 |
|
563 |
sub ModBasketHeader { |
596 |
sub ModBasketHeader { |
564 |
my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items) = @_; |
597 |
my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items, $borrowernumber) = @_; |
565 |
|
598 |
|
566 |
$is_standing ||= 0; |
599 |
$is_standing ||= 0; |
567 |
my $query = qq{ |
600 |
my $query = qq{ |
Lines 579-584
sub ModBasketHeader {
Link Here
|
579 |
my $sth2 = $dbh->prepare($query2); |
612 |
my $sth2 = $dbh->prepare($query2); |
580 |
$sth2->execute($contractnumber,$basketno); |
613 |
$sth2->execute($contractnumber,$basketno); |
581 |
} |
614 |
} |
|
|
615 |
|
582 |
return; |
616 |
return; |
583 |
} |
617 |
} |
584 |
|
618 |
|