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

(-)a/acqui/finishreceive.pl (+5 lines)
Lines 33-38 use C4::Items; Link Here
33
use C4::Search;
33
use C4::Search;
34
34
35
use Koha::Acquisition::Bookseller;
35
use Koha::Acquisition::Bookseller;
36
use Koha::DateUtils;
36
37
37
use List::MoreUtils qw/any/;
38
use List::MoreUtils qw/any/;
38
39
Lines 61-66 my $bookfund = $input->param("bookfund"); Link Here
61
my $order            = GetOrder($ordernumber);
62
my $order            = GetOrder($ordernumber);
62
my $new_ordernumber  = $ordernumber;
63
my $new_ordernumber  = $ordernumber;
63
64
65
$datereceived = eval { output_pref( { dt => dt_from_string( $datereceived) , dateonly => 1, dateformat => 'iso' } ); };
66
$datereceived = output_pref( { dt => dt_from_string( $datereceived) , dateonly => 1, dateformat => 'iso' } )
67
    if (! $datereceived );
68
64
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
69
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
65
if ($quantityrec > $origquantityrec ) {
70
if ($quantityrec > $origquantityrec ) {
66
    my @received_items = ();
71
    my @received_items = ();
(-)a/acqui/histsearch.pl (-12 / +11 lines)
Lines 55-64 use CGI qw ( -utf8 ); Link Here
55
use C4::Auth;    # get_template_and_user
55
use C4::Auth;    # get_template_and_user
56
use C4::Output;
56
use C4::Output;
57
use C4::Acquisition;
57
use C4::Acquisition;
58
use C4::Dates;
59
use C4::Debug;
58
use C4::Debug;
60
use C4::Branch;
59
use C4::Branch;
61
use C4::Koha;
60
use C4::Koha;
61
use Koha::DateUtils;
62
62
63
my $input = new CGI;
63
my $input = new CGI;
64
my $title                   = $input->param( 'title');
64
my $title                   = $input->param( 'title');
Lines 67-77 my $isbn = $input->param('isbn'); Link Here
67
my $name                    = $input->param( 'name' );
67
my $name                    = $input->param( 'name' );
68
my $ean                     = $input->param('ean');
68
my $ean                     = $input->param('ean');
69
my $basket                  = $input->param( 'basket' );
69
my $basket                  = $input->param( 'basket' );
70
my $basketgroupname             = $input->param('basketgroupname');
70
my $basketgroupname         = $input->param('basketgroupname');
71
my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' );
71
my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' );
72
my $do_search               = $input->param('do_search') || 0;
72
my $do_search               = $input->param('do_search') || 0;
73
my $from_placed_on          = C4::Dates->new($input->param('from'));
73
my $from_placed_on          = eval { dt_from_string( $input->param('from') ) } || dt_from_string;
74
my $to_placed_on            = C4::Dates->new($input->param('to'));
74
my $to_placed_on            = eval { dt_from_string( $input->param('to') ) } || dt_from_string;
75
my $budget                  = $input->param( 'budget' );
75
my $budget                  = $input->param( 'budget' );
76
my $orderstatus             = $input->param( 'orderstatus' );
76
my $orderstatus             = $input->param( 'orderstatus' );
77
my $ordernumber             = $input->param( 'ordernumber' );
77
my $ordernumber             = $input->param( 'ordernumber' );
Lines 79-87 my $search_children_too = $input->param( 'search_children_too' ); Link Here
79
my @created_by              = $input->param('created_by');
79
my @created_by              = $input->param('created_by');
80
80
81
if ( not $input->param('from') ) {
81
if ( not $input->param('from') ) {
82
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
82
    # Subtract one year if param was not defined
83
    # We would use a function like Add_Delta_YM(-1, 0, 0);
83
    $from_placed_on->subtract(years => 1);
84
    $$from_placed_on{dmy_arrayref}[5] -= 1;
85
}
84
}
86
85
87
my $dbh = C4::Context->dbh;
86
my $dbh = C4::Context->dbh;
Lines 98-107 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
98
97
99
my ( $from_iso, $to_iso, $d );
98
my ( $from_iso, $to_iso, $d );
100
if ( $d = $input->param('from') ) {
99
if ( $d = $input->param('from') ) {
101
    $from_iso = C4::Dates->new($d)->output('iso');
100
    $from_iso = output_pref( { dt => $from_placed_on, dateformat => 'iso',  dateonly => 1 } );
102
}
101
}
103
if ( $d = $input->param('iso') ) {
102
if ( $d = $input->param('to') ) {
104
    $to_iso = C4::Dates->new($d)->output('iso');
103
    $to_iso = output_pref( { dt => $to_placed_on, dateformat => 'iso',  dateonly => 1 } );
105
}
104
}
106
105
107
my $order_loop;
106
my $order_loop;
Lines 126-133 if ($do_search) { Link Here
126
    );
125
    );
127
}
126
}
128
127
129
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
128
my $from_date = output_pref( { dt => $from_placed_on, dateformat => 'iso',  dateonly => 1 } );
130
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
129
my $to_date = output_pref( { dt => $to_placed_on, dateformat => 'iso',  dateonly => 1 } );
131
130
132
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
131
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
133
my $bp_loop = $budgetperiods;
132
my $bp_loop = $budgetperiods;
(-)a/acqui/invoice.pl (-4 / +17 lines)
Lines 37-42 use C4::Budgets; Link Here
37
37
38
use Koha::Acquisition::Bookseller;
38
use Koha::Acquisition::Bookseller;
39
use Koha::Misc::Files;
39
use Koha::Misc::Files;
40
use Koha::DateUtils;
40
41
41
my $input = new CGI;
42
my $input = new CGI;
42
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
43
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
Lines 76-89 elsif ( $op && $op eq 'reopen' ) { Link Here
76
    }
77
    }
77
}
78
}
78
elsif ( $op && $op eq 'mod' ) {
79
elsif ( $op && $op eq 'mod' ) {
79
    my $shipmentdate       = $input->param('shipmentdate');
80
80
    my $billingdate        = $input->param('billingdate');
81
    my $shipmentcost       = $input->param('shipmentcost');
81
    my $shipmentcost       = $input->param('shipmentcost');
82
    my $shipment_budget_id = $input->param('shipment_budget_id');
82
    my $shipment_budget_id = $input->param('shipment_budget_id');
83
    my $shipmentdate       = '';
84
    my $billingdate        = '';
85
86
    if ( $input->param('shipmentdate') ) {
87
        $shipmentdate = eval { dt_from_string( $input->param('shipmentdate') ) };
88
        $shipmentdate = output_pref( { dt => $shipmentdate, dateformat => 'iso',  dateonly => 1 } ) if ( $shipmentdate );
89
    }
90
91
    if ( $input->param('billingdate') ) {
92
        $billingdate = eval { dt_from_string( $input->param('billingdate') ) };
93
        $billingdate = output_pref( { dt => $billingdate, dateformat => 'iso',  dateonly => 1 } ) if ( $billingdate );
94
    }
95
83
    ModInvoice(
96
    ModInvoice(
84
        invoiceid             => $invoiceid,
97
        invoiceid             => $invoiceid,
85
        shipmentdate          => C4::Dates->new($shipmentdate)->output("iso"),
98
        shipmentdate          => $shipmentdate,
86
        billingdate           => C4::Dates->new($billingdate)->output("iso"),
99
        billingdate           => $billingdate,
87
        shipmentcost          => $shipmentcost,
100
        shipmentcost          => $shipmentcost,
88
        shipmentcost_budgetid => $shipment_budget_id
101
        shipmentcost_budgetid => $shipment_budget_id
89
    );
102
    );
(-)a/acqui/invoices.pl (-4 / +26 lines)
Lines 36-41 use C4::Output; Link Here
36
use C4::Acquisition qw/GetInvoices/;
36
use C4::Acquisition qw/GetInvoices/;
37
use C4::Branch qw/GetBranches/;
37
use C4::Branch qw/GetBranches/;
38
use C4::Budgets;
38
use C4::Budgets;
39
use Koha::DateUtils;
39
40
40
my $input = CGI->new;
41
my $input = CGI->new;
41
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
42
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
Lines 65-74 my $op = $input->param('op'); Link Here
65
66
66
my $invoices = [];
67
my $invoices = [];
67
if ( $op and $op eq 'do_search' ) {
68
if ( $op and $op eq 'do_search' ) {
68
    my $shipmentdatefrom_iso = C4::Dates->new($shipmentdatefrom)->output('iso');
69
69
    my $shipmentdateto_iso   = C4::Dates->new($shipmentdateto)->output('iso');
70
    my $shipmentdatefrom_iso = '';
70
    my $billingdatefrom_iso  = C4::Dates->new($billingdatefrom)->output('iso');
71
    if ( $shipmentdatefrom ) {
71
    my $billingdateto_iso    = C4::Dates->new($billingdateto)->output('iso');
72
        $shipmentdatefrom_iso = eval { dt_from_string( $shipmentdatefrom ) };
73
        $shipmentdatefrom_iso = output_pref( { dt => $shipmentdatefrom_iso, dateformat => 'iso',  dateonly => 1 } ) if ( $shipmentdatefrom_iso );
74
    }
75
76
    my $shipmentdateto_iso = '';
77
    if ( $shipmentdateto ) {
78
        $shipmentdateto_iso = eval { dt_from_string( $shipmentdateto) };
79
        $shipmentdateto_iso = output_pref( { dt => $shipmentdateto_iso, dateformat => 'iso',  dateonly => 1 } ) if ( $shipmentdateto_iso );
80
    }
81
82
    my $billingdatefrom_iso = '';
83
    if ( $billingdatefrom ) {
84
        $billingdatefrom_iso = eval { dt_from_string( $billingdatefrom) };
85
        $billingdatefrom_iso = output_pref( { dt => $billingdatefrom_iso, dateformat => 'iso',  dateonly => 1 } ) if ( $billingdatefrom_iso );
86
    }
87
88
    my $billingdateto_iso = '';
89
    if ( $billingdateto ) {
90
        $billingdateto_iso = eval { dt_from_string( $billingdateto) };
91
        $billingdateto_iso = output_pref( { dt => $billingdateto_iso, dateformat => 'iso',  dateonly => 1 } ) if ( $billingdateto_iso );
92
    }
93
72
    @{$invoices} = GetInvoices(
94
    @{$invoices} = GetInvoices(
73
        invoicenumber    => $invoicenumber,
95
        invoicenumber    => $invoicenumber,
74
        supplierid       => $supplierid,
96
        supplierid       => $supplierid,
(-)a/acqui/orderreceive.pl (-2 / +6 lines)
Lines 74-81 use C4::Items; Link Here
74
use C4::Biblio;
74
use C4::Biblio;
75
use C4::Suggestions;
75
use C4::Suggestions;
76
76
77
use Koha::Acquisition::Bookseller;
77
use Koha::DateUtils;
78
use Koha::DateUtils qw( dt_from_string );
79
78
80
my $input      = new CGI;
79
my $input      = new CGI;
81
80
Lines 194-199 my $budget = GetBudget( $order->{budget_id} ); Link Here
194
193
195
my $datereceived = $order->{datereceived} ? dt_from_string( $order->{datereceived} ) : dt_from_string;
194
my $datereceived = $order->{datereceived} ? dt_from_string( $order->{datereceived} ) : dt_from_string;
196
195
196
my $orderentrydate =  eval{ dt_from_string( $order->{entrydate} ); };
197
$orderentrydate = output_pref( { dt => $orderentrydate, dateonly => 1 } ) if ( $orderentrydate );
198
197
$template->param(
199
$template->param(
198
    AcqCreateItem         => $AcqCreateItem,
200
    AcqCreateItem         => $AcqCreateItem,
199
    count                 => 1,
201
    count                 => 1,
Lines 203-208 $template->param( Link Here
203
    booksellerid          => $order->{'booksellerid'},
205
    booksellerid          => $order->{'booksellerid'},
204
    freight               => $freight,
206
    freight               => $freight,
205
    name                  => $bookseller->{'name'},
207
    name                  => $bookseller->{'name'},
208
    date                  => $orderentrydate,
206
    title                 => $order->{'title'},
209
    title                 => $order->{'title'},
207
    author                => $order->{'author'},
210
    author                => $order->{'author'},
208
    copyrightdate         => $order->{'copyrightdate'},
211
    copyrightdate         => $order->{'copyrightdate'},
Lines 219-224 $template->param( Link Here
219
    invoiceid             => $invoice->{invoiceid},
222
    invoiceid             => $invoice->{invoiceid},
220
    invoice               => $invoice->{invoicenumber},
223
    invoice               => $invoice->{invoicenumber},
221
    datereceived          => $datereceived,
224
    datereceived          => $datereceived,
225
    datereceived_iso      => output_pref( { dt => $datereceived, dateonly => 1, dateformat => 'iso' } ),
222
    order_internalnote    => $order->{order_internalnote},
226
    order_internalnote    => $order->{order_internalnote},
223
    order_vendornote      => $order->{order_vendornote},
227
    order_vendornote      => $order->{order_vendornote},
224
    suggestionid          => $suggestion->{suggestionid},
228
    suggestionid          => $suggestion->{suggestionid},
(-)a/acqui/parcel.pl (-6 / +5 lines)
Lines 64-73 use C4::Biblio; Link Here
64
use C4::Items;
64
use C4::Items;
65
use CGI qw ( -utf8 );
65
use CGI qw ( -utf8 );
66
use C4::Output;
66
use C4::Output;
67
use C4::Dates qw/format_date format_date_in_iso/;
68
use C4::Suggestions;
67
use C4::Suggestions;
69
use C4::Reserves qw/GetReservesFromBiblionumber/;
68
use C4::Reserves qw/GetReservesFromBiblionumber/;
70
69
use Koha::DateUtils;
71
use Koha::Acquisition::Bookseller;
70
use Koha::Acquisition::Bookseller;
72
71
73
use JSON;
72
use JSON;
Lines 112-118 unless( $invoiceid and $invoice->{invoiceid} ) { Link Here
112
my $booksellerid = $invoice->{booksellerid};
111
my $booksellerid = $invoice->{booksellerid};
113
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
112
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
114
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
113
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
115
my $datereceived = C4::Dates->new();
114
my $datereceived = dt_from_string;
116
115
117
my @orders        = @{ $invoice->{orders} };
116
my @orders        = @{ $invoice->{orders} };
118
my $countlines    = scalar @orders;
117
my $countlines    = scalar @orders;
Lines 282-290 $template->param( Link Here
282
    invoiceid             => $invoice->{invoiceid},
281
    invoiceid             => $invoice->{invoiceid},
283
    invoice               => $invoice->{invoicenumber},
282
    invoice               => $invoice->{invoicenumber},
284
    invoiceclosedate      => $invoice->{closedate},
283
    invoiceclosedate      => $invoice->{closedate},
285
    datereceived          => $datereceived->output('iso'),
284
    datereceived          => eval { output_pref( { dt => $datereceived, dateonly => 1, dateformat =>'iso' } ) },
286
    invoicedatereceived   => $datereceived->output('iso'),
285
    invoicedatereceived   => eval { output_pref( { dt => $datereceived, dateonly => 1, dateformat =>'iso' } ) },
287
    formatteddatereceived => $datereceived->output(),
286
    formatteddatereceived => eval { output_pref( { dt => $datereceived, dateonly => 1 } ) },
288
    name                  => $bookseller->{'name'},
287
    name                  => $bookseller->{'name'},
289
    booksellerid          => $bookseller->{id},
288
    booksellerid          => $bookseller->{id},
290
    loop_received         => \@loop_received,
289
    loop_received         => \@loop_received,
(-)a/acqui/parcels.pl (-5 / +6 lines)
Lines 103-110 my $invoicenumber = $input->param('invoice'); Link Here
103
my $shipmentdate = $input->param('shipmentdate');
103
my $shipmentdate = $input->param('shipmentdate');
104
my $shipmentcost = $input->param('shipmentcost');
104
my $shipmentcost = $input->param('shipmentcost');
105
my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid');
105
my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid');
106
if($shipmentdate) {
106
if ( $shipmentdate ) {
107
    $shipmentdate = C4::Dates->new($shipmentdate)->output('iso');
107
    $shipmentdate = eval { dt_from_string ( $shipmentdate ) };
108
    $shipmentdate = output_pref( { dt => $shipmentdate, dateonly => 1, dateformat => 'iso' } ) if ( $shipmentdate );
108
}
109
}
109
110
110
if ( $op and $op eq 'new' ) {
111
if ( $op and $op eq 'new' ) {
Lines 145-152 my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); Link Here
145
my @parcels = GetInvoices(
146
my @parcels = GetInvoices(
146
    supplierid => $booksellerid,
147
    supplierid => $booksellerid,
147
    invoicenumber => $code,
148
    invoicenumber => $code,
148
    ( $datefrom ? ( shipmentdatefrom => output_pref({ dt => dt_from_string($datefrom), dateformat => 'iso' }) ) : () ),
149
    ( $datefrom ? ( eval { shipmentdatefrom => output_pref({ dt => dt_from_string($datefrom), dateformat => 'iso' }); } ) : () ),
149
    ( $dateto   ? ( shipmentdateto   => output_pref({ dt => dt_from_string($dateto),   dateformat => 'iso' }) )    : () ),
150
    ( $dateto   ? ( eval { shipmentdateto   => output_pref({ dt => dt_from_string($dateto),   dateformat => 'iso' }); } )    : () ),
150
    order_by => $order
151
    order_by => $order
151
);
152
);
152
my $count_parcels = @parcels;
153
my $count_parcels = @parcels;
Lines 206-212 $template->param( Link Here
206
    dateto                   => $dateto,
207
    dateto                   => $dateto,
207
    resultsperpage           => $resultsperpage,
208
    resultsperpage           => $resultsperpage,
208
    name                     => $bookseller->{'name'},
209
    name                     => $bookseller->{'name'},
209
    shipmentdate_today       => C4::Dates->new()->output(),
210
    shipmentdate_today       => output_pref( { dt => dt_from_string, dateonly =>1 } ),
210
    booksellerid             => $booksellerid,
211
    booksellerid             => $booksellerid,
211
    GST                      => C4::Context->preference('gist'),
212
    GST                      => C4::Context->preference('gist'),
212
    budgets                  => $budget_loop,
213
    budgets                  => $budget_loop,
(-)a/acqui/transferorder.pl (-2 lines)
Lines 27-33 use C4::Output; Link Here
27
use C4::Context;
27
use C4::Context;
28
use C4::Acquisition;
28
use C4::Acquisition;
29
use C4::Members;
29
use C4::Members;
30
use C4::Dates qw/format_date_in_iso/;
31
use Date::Calc qw/Today/;
30
use Date::Calc qw/Today/;
32
31
33
my $input = new CGI;
32
my $input = new CGI;
34
- 

Return to bug 14946