Bug 15348: (follow-up) Fix calendar widget, translateability, etc

Also add functionality to edit the estimated delivery date from a closed
basket.

Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Aleisha Amohia 2022-07-15 14:10:47 +12:00 committed by Tomas Cohen Arazi
parent 897429e713
commit fe981989ca
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
5 changed files with 59 additions and 17 deletions

View file

@ -33,10 +33,10 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Acquisition qw( GetOrder GetBasket );
use C4::Acquisition qw( GetOrder GetBasket ModOrder );
use Koha::Acquisition::Booksellers;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string );
my $input = CGI->new;
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {

View file

@ -596,7 +596,14 @@
[% IF Koha.Preference('EDIFACT') && ediaccount %]
<td>[% books_loo.suppliers_report | html %]</td>
[% END %]
<td>[% books_loo.estimated_delivery_date | $KohaDates %]</td>
<td class="actions">
[% books_loo.estimated_delivery_date | $KohaDates %]
[% IF CAN_user_acquisition_order_manage %]
<a class="edit_delivery_date" href="/cgi-bin/koha/acqui/moddeliverydate.pl?ordernumber=[% books_loo.ordernumber | html %]" title="Edit delivery date" data-ordernumber="[% books_loo.ordernumber | html %]">
<i class="fa fa-pencil"></i> Edit
</a>
</td>
[% END %]
[% IF ( active ) %]
[% UNLESS ( closedate ) %]
<td>
@ -839,12 +846,37 @@
</div>
</div>
<!-- Modal for editing estimated delivery date -->
<div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
<div class="modal-dialog" role="document">
<form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
</div>
<div class="modal-body">
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% books_loo.estimated_delivery_date | $KohaDates %]"/>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
<input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
<input type="hidden" name="op" value="save" />
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default">Save</button>
<button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
</div>
</div>
</form>
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
[% Asset.js("lib/hc-sticky.js") | $raw %]
[% Asset.js("js/acq.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
<script>
function updateColumnsVisibility(visible) {
if ( visible ) {
@ -936,7 +968,7 @@
$("#set_basket_group").show();
});
$(".modal").on("shown.bs.modal", function(){
$("#addtoBasket").on("shown.bs.modal", function(){
var basket = $(this).data("basketno");
var legend = _("Add order to basket %s").format(basket);
$(this).find("h4").text( legend );
@ -1019,6 +1051,24 @@
$("#select_managing_library").on("change", function(){
$(this).parent().submit();
});
$(".edit_delivery_date").on("click", function(e) {
e.preventDefault();
var ordernumber = $(this).data("ordernumber");
var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
var date_text = $( "#delivery_date_" + ordernumber ).html();
$("#dateEditor .modal-title").text(modalTitle);
$("#date_ordernumber").val(ordernumber);
$("#estimated_delivery_date").html( date_text );
$("#dateEditor").modal("show");
});
$("#dateEditor").on('hidden.bs.modal', function (e) {
$("#dateEditorLabel").html("");
$("#dateEditor .modal-title").text("");
$("#estimated_delivery_date").html( "" );
$("#date_ordernumber").val("");
});
});
function UserSearchPopup(f) {

View file

@ -305,7 +305,7 @@
<h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
</div>
<div class="modal-body">
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | $KohaDates %]"/>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
<input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
<input type="hidden" name="op" value="save" />
@ -387,7 +387,7 @@
e.preventDefault();
var ordernumber = $(this).data("ordernumber");
var note_type = $(this).data("note_type");
var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
var modalTitle = _("%s (order number %s)").format($(this).attr("title"), ordernumber);
var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
$("#noteEditor .modal-title").text(modalTitle);
$("#notes_ordernumber").val( ordernumber );
@ -405,8 +405,6 @@
$("#type").val("");
});
$("#estimated_delivery_date").datepicker();
$(".edit_delivery_date").on("click", function(e) {
e.preventDefault();
var ordernumber = $(this).data("ordernumber");

View file

@ -1,3 +1,4 @@
[% USE KohaDates %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Change estimated delivery date &rsaquo; Acquisitions &rsaquo; Koha</title>
@ -35,7 +36,7 @@
<form action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
<fieldset class="brief">
<label for="estimated_delivery_date">Estimated delivery date:</label>
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr flatpickr-input noEnterSubmit" value="[% estimated_delivery_date | html %]"/>
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | $KohaDates %]"/>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</fieldset>
<input type="hidden" name="referrer" value="[% referrer | html %]" />
@ -51,11 +52,6 @@
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
<script>
$(document).ready(function(){
$("#estimated_delivery_date").datepicker();
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]

View file

@ -483,7 +483,7 @@
</li>
<li>
<label for="estimated_delivery_date">Estimated delivery date: </label>
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr flatpickr-input noEnterSubmit" value="[% estimated_delivery_date | html %]"/>
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | $KohaDates %]"/>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
@ -686,8 +686,6 @@
getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
});
$("#budget_id").change();
$("#estimated_delivery_date").datepicker();
});
function UserSearchPopup(f) {