Lines 1-203
Link Here
|
|
|
1 |
[% USE Koha %] |
1 |
[% USE KohaDates %] |
2 |
[% USE KohaDates %] |
|
|
3 |
[% SET footerjs = 1 %] |
2 |
[% INCLUDE 'doc-head-open.inc' %] |
4 |
[% INCLUDE 'doc-head-open.inc' %] |
3 |
[% USE Koha %] |
|
|
4 |
<title>Koha › Acquisitions › Basket [% basketno %] › [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</title> |
5 |
<title>Koha › Acquisitions › Basket [% basketno %] › [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</title> |
5 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
|
|
|
7 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script> |
8 |
[% INCLUDE 'additem.js.inc' %] |
9 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/additem_[% KOHA_VERSION %].js"></script> |
10 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/cataloging_[% KOHA_VERSION %].js"></script> |
11 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/prevent_submit_[% KOHA_VERSION %].js"></script> |
12 |
<script type="text/javascript"> |
13 |
//<![CDATA[ |
14 |
actTotal = ""; |
15 |
|
16 |
function Check(ff) { |
17 |
[% IF (AcqCreateItemOrdering) %] |
18 |
// Remove last itemblock if it is not in items_list |
19 |
var lastitemblock = $("#outeritemblock > div:last"); |
20 |
var tobedeleted = true; |
21 |
var listitems = $("#items_list tr"); |
22 |
$(listitems).each(function(){ |
23 |
if($(this).attr('idblock') == $(lastitemblock).attr('id')){ |
24 |
tobedeleted = false; |
25 |
} |
26 |
}); |
27 |
if(tobedeleted){ |
28 |
$(lastitemblock).remove(); |
29 |
} |
30 |
[% END %] |
31 |
|
32 |
var ok=0; |
33 |
var _alertString= _("Form not submitted because of the following problem(s)")+"\n"; |
34 |
|
35 |
_alertString +="-------------------------------------------------------------------\n\n"; |
36 |
|
37 |
if ( isNull(ff.title,1) && isNull(ff.entertitle,1) ){ |
38 |
ok=1; |
39 |
_alertString += "\n- " + _("Title cannot be empty"); |
40 |
} |
41 |
|
42 |
if(isNull(ff.budget_id,1)){ |
43 |
ok=1; |
44 |
_alertString += "\n- "+ _("You must select a fund"); |
45 |
} |
46 |
|
47 |
if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){ |
48 |
ok=1; |
49 |
_alertString += "\n- " + _("Quantity must be greater than '0'"); |
50 |
} |
51 |
|
52 |
if (!(isNum(ff.listprice,0))){ |
53 |
ok=1; |
54 |
_alertString += "\n- " + _("Vendor price must be a number"); |
55 |
} |
56 |
|
57 |
if (!(isNum(ff.total,0))){ |
58 |
ok=1; |
59 |
_alertString += "\n- " + _("Total must be a number"); |
60 |
} |
61 |
|
62 |
if (totalExceedsBudget(ff.budget_id.value, ff.total.value ) ) { |
63 |
ok=1; |
64 |
_alertString += "\n- " + _("Order total (%s) exceeds budget available (%s)").format(ff.total.value, actTotal); |
65 |
} |
66 |
|
67 |
if ( ff.field_value ) { |
68 |
var empty_item_mandatory = CheckMandatorySubfields(ff); |
69 |
if (empty_item_mandatory > 0) { |
70 |
ok = 1; |
71 |
_alertString += |
72 |
"\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory); |
73 |
} |
74 |
|
75 |
} |
76 |
|
77 |
if (ok) { |
78 |
alert(_alertString); |
79 |
[% IF (AcqCreateItemOrdering) %] |
80 |
if(tobedeleted) { |
81 |
$(lastitemblock).appendTo('#outeritemblock'); |
82 |
} |
83 |
[% END %] |
84 |
return false; |
85 |
} |
86 |
|
87 |
[% IF (AcqCreateItemOrdering) %] |
88 |
if(check_additem('[% UniqueItemFields %]') == false) { |
89 |
alert(_("Duplicate values detected. Please correct the errors and resubmit.") ); |
90 |
if(tobedeleted) { |
91 |
$(lastitemblock).appendTo('#outeritemblock'); |
92 |
} |
93 |
return false; |
94 |
} |
95 |
[% END %] |
96 |
} |
97 |
|
98 |
$(document).ready(function() |
99 |
{ |
100 |
[% IF AcqCreateItemOrdering and not basket.is_standing %] |
101 |
cloneItemBlock(0, '[% UniqueItemFields %]'); |
102 |
[% END %] |
103 |
|
104 |
[% IF ( suggestionid ) %]updateCosts();[% END %] |
105 |
$("#quantity").change(function() { |
106 |
updateCosts(); |
107 |
}); |
108 |
|
109 |
//We apply the fonction only for modify option |
110 |
[% IF ( quantityrec ) %] |
111 |
[% IF ( acqcreate ) %] |
112 |
$('#quantity').blur(function() |
113 |
{ |
114 |
// if user decreases the quantity |
115 |
if($(this).val() < [% quantityrec %]) |
116 |
{ |
117 |
alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog")); |
118 |
return true; |
119 |
} |
120 |
else |
121 |
{ |
122 |
// if user increases the quantity |
123 |
alert(_("You can't add a new item, please create a new order line")); |
124 |
// and we replace the original value |
125 |
$(this).val([% quantityrec %]) |
126 |
updateCosts(); // blur is invoked after change which updated values |
127 |
return false; |
128 |
} |
129 |
}); |
130 |
[% END %] |
131 |
[% END %] |
132 |
|
133 |
//keep a copy of all budgets before removing the inactives |
134 |
disabledBudgetsCopy = $('#budget_id').html(); |
135 |
$('#budget_id .b_inactive').remove(); |
136 |
|
137 |
$('#showallbudgets').click(function() { |
138 |
if ($(this).is(":checked")) { |
139 |
$('#budget_id').html(disabledBudgetsCopy); //Puts back all the funds |
140 |
} |
141 |
else { |
142 |
$('#budget_id .b_inactive').remove(); |
143 |
} |
144 |
}); |
145 |
|
146 |
$("#budget_id").change(function(){ |
147 |
var destination_sort1 = $(this).parents('fieldset.rows').find('input[name="sort1"]'); |
148 |
var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat'); |
149 |
var sort1 = $(destination_sort1).val() || ""; |
150 |
if ( destination_sort1.length < 1 ) { |
151 |
destination_sort1 = $(this).parents('fieldset.rows').find('select[name="sort1"]'); |
152 |
} |
153 |
var destination_sort2 = $(this).parents('fieldset.rows').find('input[name="sort2"]'); |
154 |
var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat'); |
155 |
var sort2 = $(destination_sort2).val() || ""; |
156 |
if ( destination_sort2.length < 1 ) { |
157 |
destination_sort2 = $(this).parents('fieldset.rows').find('select[name="sort2"]'); |
158 |
} |
159 |
getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 ); |
160 |
getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 ); |
161 |
}); |
162 |
$("#budget_id").change(); |
163 |
}); |
164 |
|
165 |
function UserSearchPopup(f) { |
166 |
window.open( |
167 |
"/cgi-bin/koha/acqui/add_user_search.pl", |
168 |
'UserSearchPopup', |
169 |
'width=740, height=450, scrollbars=yes, toolbar=no,' |
170 |
); |
171 |
} |
172 |
|
173 |
function add_user(borrowernumber, borrowername) { |
174 |
var ids = $("#users_ids").val(); |
175 |
if(ids.length > 0) { |
176 |
ids = ids.split(':'); |
177 |
} else { |
178 |
ids = new Array; |
179 |
} |
180 |
if (ids.indexOf(borrowernumber) < 0) { |
181 |
ids.push(borrowernumber); |
182 |
$("#users_ids").val(ids.join(':')); |
183 |
var li = '<li id="user_'+borrowernumber+'">'+borrowername |
184 |
+ ' [<a style="cursor:pointer" onclick="del_user('+borrowernumber+');">' |
185 |
+ _("Delete user") + '</a>]</li>'; |
186 |
$("#users_names").append(li); |
187 |
return 0; |
188 |
} |
189 |
return -1; |
190 |
} |
191 |
|
192 |
function del_user(borrowernumber) { |
193 |
$("#user_"+borrowernumber).remove(); |
194 |
var ids = $("#users_ids").val().split(':'); |
195 |
ids.splice(ids.indexOf(borrowernumber.toString()), 1); |
196 |
$("#users_ids").val(ids.join(':')); |
197 |
} |
198 |
//]]> |
199 |
</script> |
200 |
</head> |
7 |
</head> |
|
|
8 |
|
201 |
<body id="acq_neworderempty" class="acq"> |
9 |
<body id="acq_neworderempty" class="acq"> |
202 |
|
10 |
|
203 |
[% INCLUDE 'header.inc' %] |
11 |
[% INCLUDE 'header.inc' %] |
Lines 679-682
$(document).ready(function()
Link Here
|
679 |
[% INCLUDE 'acquisitions-menu.inc' %] |
487 |
[% INCLUDE 'acquisitions-menu.inc' %] |
680 |
</div> |
488 |
</div> |
681 |
</div> |
489 |
</div> |
|
|
490 |
|
491 |
[% MACRO jsinclude BLOCK %] |
492 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script> |
493 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script> |
494 |
[% INCLUDE 'additem.js.inc' %] |
495 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/additem_[% KOHA_VERSION %].js"></script> |
496 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/cataloging_[% KOHA_VERSION %].js"></script> |
497 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/prevent_submit_[% KOHA_VERSION %].js"></script> |
498 |
<script type="text/javascript"> |
499 |
actTotal = ""; |
500 |
|
501 |
function Check(ff) { |
502 |
[% IF (AcqCreateItemOrdering) %] |
503 |
// Remove last itemblock if it is not in items_list |
504 |
var lastitemblock = $("#outeritemblock > div:last"); |
505 |
var tobedeleted = true; |
506 |
var listitems = $("#items_list tr"); |
507 |
$(listitems).each(function(){ |
508 |
if($(this).attr('idblock') == $(lastitemblock).attr('id')){ |
509 |
tobedeleted = false; |
510 |
} |
511 |
}); |
512 |
if(tobedeleted){ |
513 |
$(lastitemblock).remove(); |
514 |
} |
515 |
[% END %] |
516 |
|
517 |
var ok=0; |
518 |
var _alertString= _("Form not submitted because of the following problem(s)")+"\n"; |
519 |
|
520 |
_alertString +="-------------------------------------------------------------------\n\n"; |
521 |
|
522 |
if ( isNull(ff.title,1) && isNull(ff.entertitle,1) ){ |
523 |
ok=1; |
524 |
_alertString += "\n- " + _("Title cannot be empty"); |
525 |
} |
526 |
|
527 |
if(isNull(ff.budget_id,1)){ |
528 |
ok=1; |
529 |
_alertString += "\n- "+ _("You must select a fund"); |
530 |
} |
531 |
|
532 |
if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){ |
533 |
ok=1; |
534 |
_alertString += "\n- " + _("Quantity must be greater than '0'"); |
535 |
} |
536 |
|
537 |
if (!(isNum(ff.listprice,0))){ |
538 |
ok=1; |
539 |
_alertString += "\n- " + _("Vendor price must be a number"); |
540 |
} |
541 |
|
542 |
if (!(isNum(ff.total,0))){ |
543 |
ok=1; |
544 |
_alertString += "\n- " + _("Total must be a number"); |
545 |
} |
546 |
|
547 |
if (totalExceedsBudget(ff.budget_id.value, ff.total.value ) ) { |
548 |
ok=1; |
549 |
_alertString += "\n- " + _("Order total (%s) exceeds budget available (%s)").format(ff.total.value, actTotal); |
550 |
} |
551 |
|
552 |
if ( ff.field_value ) { |
553 |
var empty_item_mandatory = CheckMandatorySubfields(ff); |
554 |
if (empty_item_mandatory > 0) { |
555 |
ok = 1; |
556 |
_alertString += |
557 |
"\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory); |
558 |
} |
559 |
|
560 |
} |
561 |
|
562 |
if (ok) { |
563 |
alert(_alertString); |
564 |
[% IF (AcqCreateItemOrdering) %] |
565 |
if(tobedeleted) { |
566 |
$(lastitemblock).appendTo('#outeritemblock'); |
567 |
} |
568 |
[% END %] |
569 |
return false; |
570 |
} |
571 |
|
572 |
[% IF (AcqCreateItemOrdering) %] |
573 |
if(check_additem('[% UniqueItemFields %]') == false) { |
574 |
alert(_("Duplicate values detected. Please correct the errors and resubmit.") ); |
575 |
if(tobedeleted) { |
576 |
$(lastitemblock).appendTo('#outeritemblock'); |
577 |
} |
578 |
return false; |
579 |
} |
580 |
[% END %] |
581 |
} |
582 |
|
583 |
$(document).ready(function(){ |
584 |
[% IF AcqCreateItemOrdering and not basket.is_standing %] |
585 |
cloneItemBlock(0, '[% UniqueItemFields %]'); |
586 |
[% END %] |
587 |
|
588 |
[% IF ( suggestionid ) %]updateCosts();[% END %] |
589 |
$("#quantity").change(function() { |
590 |
updateCosts(); |
591 |
}); |
592 |
|
593 |
//We apply the fonction only for modify option |
594 |
[% IF ( quantityrec ) %] |
595 |
[% IF ( acqcreate ) %] |
596 |
$('#quantity').blur(function(){ |
597 |
// if user decreases the quantity |
598 |
if($(this).val() < [% quantityrec %]){ |
599 |
alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog")); |
600 |
return true; |
601 |
} else { |
602 |
// if user increases the quantity |
603 |
alert(_("You can't add a new item, please create a new order line")); |
604 |
// and we replace the original value |
605 |
$(this).val([% quantityrec %]) |
606 |
updateCosts(); // blur is invoked after change which updated values |
607 |
return false; |
608 |
} |
609 |
}); |
610 |
[% END %] |
611 |
[% END %] |
612 |
|
613 |
//keep a copy of all budgets before removing the inactives |
614 |
disabledBudgetsCopy = $('#budget_id').html(); |
615 |
$('#budget_id .b_inactive').remove(); |
616 |
|
617 |
$('#showallbudgets').click(function() { |
618 |
if ($(this).is(":checked")) { |
619 |
$('#budget_id').html(disabledBudgetsCopy); //Puts back all the funds |
620 |
} |
621 |
else { |
622 |
$('#budget_id .b_inactive').remove(); |
623 |
} |
624 |
}); |
625 |
|
626 |
$("#budget_id").change(function(){ |
627 |
var destination_sort1 = $(this).parents('fieldset.rows').find('input[name="sort1"]'); |
628 |
var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat'); |
629 |
var sort1 = $(destination_sort1).val() || ""; |
630 |
if ( destination_sort1.length < 1 ) { |
631 |
destination_sort1 = $(this).parents('fieldset.rows').find('select[name="sort1"]'); |
632 |
} |
633 |
var destination_sort2 = $(this).parents('fieldset.rows').find('input[name="sort2"]'); |
634 |
var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat'); |
635 |
var sort2 = $(destination_sort2).val() || ""; |
636 |
if ( destination_sort2.length < 1 ) { |
637 |
destination_sort2 = $(this).parents('fieldset.rows').find('select[name="sort2"]'); |
638 |
} |
639 |
getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 ); |
640 |
getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 ); |
641 |
}); |
642 |
$("#budget_id").change(); |
643 |
}); |
644 |
|
645 |
function UserSearchPopup(f) { |
646 |
window.open( |
647 |
"/cgi-bin/koha/acqui/add_user_search.pl", |
648 |
'UserSearchPopup', |
649 |
'width=740, height=450, scrollbars=yes, toolbar=no,' |
650 |
); |
651 |
} |
652 |
|
653 |
function add_user(borrowernumber, borrowername) { |
654 |
var ids = $("#users_ids").val(); |
655 |
if(ids.length > 0) { |
656 |
ids = ids.split(':'); |
657 |
} else { |
658 |
ids = new Array; |
659 |
} |
660 |
if (ids.indexOf(borrowernumber) < 0) { |
661 |
ids.push(borrowernumber); |
662 |
$("#users_ids").val(ids.join(':')); |
663 |
var li = '<li id="user_'+borrowernumber+'">'+borrowername |
664 |
+ ' [<a style="cursor:pointer" onclick="del_user('+borrowernumber+');">' |
665 |
+ _("Delete user") + '</a>]</li>'; |
666 |
$("#users_names").append(li); |
667 |
return 0; |
668 |
} |
669 |
return -1; |
670 |
} |
671 |
|
672 |
function del_user(borrowernumber) { |
673 |
$("#user_"+borrowernumber).remove(); |
674 |
var ids = $("#users_ids").val().split(':'); |
675 |
ids.splice(ids.indexOf(borrowernumber.toString()), 1); |
676 |
$("#users_ids").val(ids.join(':')); |
677 |
} |
678 |
</script> |
679 |
[% END %] |
680 |
|
682 |
[% INCLUDE 'intranet-bottom.inc' %] |
681 |
[% INCLUDE 'intranet-bottom.inc' %] |