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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/create.inc (-209 / +201 lines)
Lines 1-217 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE raw %]
2
[% SET koha_version = Koha.Version %]
3
[% SET koha_version = Koha.Version %]
3
[% cwd = whole.cwd %]
4
[% PROCESS "ill/backends/Standard/shared/form_input_helpers.inc" %]
4
[% PROCESS "${cwd}/shared-includes/form_input_helpers.inc" %]
5
[% IF whole.error %]
5
[% IF whole.error %]
6
[% IF whole.status == 'missing_identifier' %]
6
    [% IF whole.status == 'missing_identifier' %]
7
<p><em>Please note:</em> Mandatory field Identifier is missing.</p>
7
        <p><em>Please note:</em> Mandatory field Identifier is missing.</p>
8
[% ELSIF whole.status == 'missing_branch' %]
8
    [% ELSIF whole.status == 'missing_branch' %]
9
<p><em>Please note:</em> Library is a mandatory field.</p>
9
        <p><em>Please note:</em> Library is a mandatory field.</p>
10
[% ELSIF whole.status == 'invalid_borrower' %]
10
    [% ELSIF whole.status == 'invalid_borrower' %]
11
<p><em>Please note:</em> The patron details you entered are invalid.</p>
11
        <p><em>Please note:</em> The patron details you entered are invalid.</p>
12
[% ELSIF whole.status == 'invalid_branch' %]
12
    [% ELSIF whole.status == 'invalid_branch' %]
13
<p><em>Please note:</em> The library you chose is invalid.</p>
13
        <p><em>Please note:</em> The library you chose is invalid.</p>
14
[% ELSE %]
14
    [% ELSE %]
15
<p>Unhandled error</p>
15
        <p>Unhandled error</p>
16
[% END %]
16
    [% END %]
17
[% END %]
17
[% END %]
18
18
19
[% IF whole.stage == "form" %]
19
[% IF whole.stage == "form" %]
20
<h2>Create an ILL request</h2>
20
    <h2>Create an ILL request</h2>
21
<form id="create_form" method="POST" action="">
21
    <form id="create_form" method="POST" action="">
22
  [% INCLUDE 'csrf-token.inc' %]
22
        [% INCLUDE 'csrf-token.inc' %]
23
  <fieldset class="rows">
23
        <fieldset class="rows">
24
    <legend>General details</legend>
24
            <legend>General details</legend>
25
    <ol id="general-standard-fields">
25
            <ol id="general-standard-fields">
26
      <li>
26
                <li>
27
        <label class="required" for="type">Type:</label>
27
                    <label class="required" for="type">Type:</label>
28
        <select name="type" id="type">
28
                    <select name="type" id="type">
29
          <option value=""/>
29
                        <option value="" />
30
          [% IF whole.value.other.type.lower == "book" %]
30
                        [% IF whole.value.other.type.lower == "book" %]
31
          <option value="book" selected="selected">Book</option>
31
                            <option value="book" selected="selected">Book</option>
32
          [% ELSE %]
32
                        [% ELSE %]
33
          <option value="book">Book</option>
33
                            <option value="book">Book</option>
34
          [% END %]
34
                        [% END %]
35
          [% IF whole.value.other.type.lower == "chapter" %]
35
                        [% IF whole.value.other.type.lower == "chapter" %]
36
          <option value="chapter" selected="selected">Chapter</option>
36
                            <option value="chapter" selected="selected">Chapter</option>
37
          [% ELSE %]
37
                        [% ELSE %]
38
          <option value="chapter">Chapter</option>
38
                            <option value="chapter">Chapter</option>
39
          [% END %]
39
                        [% END %]
40
          [% IF whole.value.other.type.lower == "journal" %]
40
                        [% IF whole.value.other.type.lower == "journal" %]
41
          <option value="journal" selected="selected">Journal</option>
41
                            <option value="journal" selected="selected">Journal</option>
42
          [% ELSE %]
42
                        [% ELSE %]
43
          <option value="journal">Journal</option>
43
                            <option value="journal">Journal</option>
44
          [% END %]
44
                        [% END %]
45
          [% IF whole.value.other.type.lower == "article" %]
45
                        [% IF whole.value.other.type.lower == "article" %]
46
          <option value="article" selected="selected">Journal article</option>
46
                            <option value="article" selected="selected">Journal article</option>
47
          [% ELSE %]
47
                        [% ELSE %]
48
          <option value="article">Journal article</option>
48
                            <option value="article">Journal article</option>
49
          [% END %]
49
                        [% END %]
50
          [% IF whole.value.other.type.lower == "thesis" %]
50
                        [% IF whole.value.other.type.lower == "thesis" %]
51
          <option value="thesis" selected="selected">Thesis</option>
51
                            <option value="thesis" selected="selected">Thesis</option>
52
          [% ELSE %]
52
                        [% ELSE %]
53
          <option value="thesis">Thesis</option>
53
                            <option value="thesis">Thesis</option>
54
          [% END %]
54
                        [% END %]
55
          [% IF whole.value.other.type.lower == "conference" %]
55
                        [% IF whole.value.other.type.lower == "conference" %]
56
          <option value="conference" selected="selected">Conference</option>
56
                            <option value="conference" selected="selected">Conference</option>
57
          [% ELSE %]
57
                        [% ELSE %]
58
          <option value="conference">Conference</option>
58
                            <option value="conference">Conference</option>
59
          [% END %]
59
                        [% END %]
60
          [% IF whole.value.other.type.lower == "dvd" %]
60
                        [% IF whole.value.other.type.lower == "dvd" %]
61
          <option value="dvd" selected="selected">DVD</option>
61
                            <option value="dvd" selected="selected">DVD</option>
62
          [% ELSE %]
62
                        [% ELSE %]
63
          <option value="dvd">DVD</option>
63
                            <option value="dvd">DVD</option>
64
          [% END %]
64
                        [% END %]
65
          [% IF whole.value.other.type.lower == "other" %]
65
                        [% IF whole.value.other.type.lower == "other" %]
66
          <option value="other" selected="selected">Other</option>
66
                            <option value="other" selected="selected">Other</option>
67
          [% ELSE %]
67
                        [% ELSE %]
68
          <option value="other">Other</option>
68
                            <option value="other">Other</option>
69
          [% END %]
69
                        [% END %]
70
          [% IF whole.value.other.type.lower == "resource" %]
70
                        [% IF whole.value.other.type.lower == "resource" %]
71
          <option value="resource" selected="selected">Generic resource</option>
71
                            <option value="resource" selected="selected">Generic resource</option>
72
          [% ELSE %]
72
                        [% ELSE %]
73
          <option value="resource">Generic resource</option>
73
                            <option value="resource">Generic resource</option>
74
          [% END %]
74
                        [% END %]
75
        </select>
75
                    </select>
76
      </li>
76
                </li>
77
    </ol>
77
            </ol>
78
  </fieldset>
78
        </fieldset>
79
  [% type = whole.value.other.type %]
79
        [% type = whole.value.other.type %]
80
  [% IF type %]
80
        [% IF type %]
81
      [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %]
81
            [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %]
82
  [% END %]
82
        [% END %]
83
  [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %]
83
        [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %]
84
  <fieldset class="rows">
84
        <fieldset class="rows">
85
    <legend>Patron options</legend>
85
            <legend>Patron options</legend>
86
    <ol>
86
            <ol>
87
      <li>
87
                <li>
88
        <label class="required" for="cardnumber">
88
                    <label class="required" for="cardnumber"> Card number, username or surname: </label>
89
          Card number, username or surname:
89
                    <input type="text" name="cardnumber" id="cardnumber" autocomplete="off" type="text" value="[% whole.value.other.cardnumber | html %]" />
90
        </label>
90
                    <span class="required">Required</span>
91
        <input type="text" name="cardnumber" id="cardnumber" autocomplete="off" type="text" value="[% whole.value.other.cardnumber | html %]" />
91
                </li>
92
        <span class="required">Required</span>
92
                <li>
93
      </li>
93
                    <label class="required" for="branchcode">Destination library:</label>
94
      <li>
94
                    <select id="branchcode" name="branchcode">
95
        <label class="required" for="branchcode">Destination library:</label>
95
                        <option value="" />
96
        <select id="branchcode" name="branchcode">
96
                        [% FOREACH branch IN branches %]
97
          <option value="" />
97
                            [% IF branch.branchcode == whole.value.other.branchcode %]
98
          [% FOREACH branch IN branches %]
98
                                <option value="[% branch.branchcode | html %]" selected="selected">[% branch.branchname | html %]</option>
99
            [% IF branch.branchcode == whole.value.other.branchcode %]
99
                            [% ELSE %]
100
              <option value="[% branch.branchcode | html %]" selected="selected">
100
                                <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
101
            [% ELSE %]
101
                            [% END %]
102
              <option value="[% branch.branchcode | html %]">
102
                        [% END %]
103
            [% END %]
103
                    </select>
104
              [% branch.branchname | html %]
104
                    <span class="required">Required</span>
105
            </option>
105
                </li>
106
          [% END %]
106
            </ol>
107
        </select>
107
        </fieldset>
108
        <span class="required">Required</span>
108
        <fieldset class="action">
109
      </li>
109
            <input id="ill-submit" class="btn btn-primary" type="submit" value="Create" disabled />
110
    </ol>
110
            <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a>
111
  </fieldset>
111
        </fieldset>
112
  <fieldset class="action">
112
        <input type="hidden" name="method" value="create" />
113
    <input id="ill-submit" class="btn btn-primary" type="submit" value="Create" disabled />
113
        <input type="hidden" name="stage" value="form" />
114
    <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a>
114
        <input type="hidden" name="backend" value="Standard" />
115
  </fieldset>
115
    </form>
116
  <input type="hidden" name="method" value="create" />
116
    [% BLOCK backend_jsinclude %]
117
  <input type="hidden" name="stage" value="form" />
117
        <script>
118
  <input type="hidden" name="backend" value="Standard" />
118
            // <![CDATA[]
119
</form>
119
            var core = [ [% whole.core | $raw %] ];
120
[% BLOCK backend_jsinclude %]
120
            [% INCLUDE "ill/backends/Standard/shared/shared.js" %]
121
<script>
121
            // Require a username and branch selection
122
    // <![CDATA[]
122
            document.addEventListener('DOMContentLoaded', function(){
123
    [% INCLUDE "${cwd}/shared-includes/shared.js" %]
123
              let cardnumber_input = '#create_form #cardnumber';
124
    // Require a username and branch selection
124
              let branchcode_input = '#create_form #branchcode';
125
    document.addEventListener('DOMContentLoaded', function(){
125
              updateCreateButtonStatus();
126
      let cardnumber_input = '#create_form #cardnumber';
126
              $(cardnumber_input + ',' + branchcode_input).change(function() {
127
      let branchcode_input = '#create_form #branchcode';
127
                  updateCreateButtonStatus();
128
      updateCreateButtonStatus();
128
              });
129
      $(cardnumber_input + ',' + branchcode_input).change(function() {
129
              function updateCreateButtonStatus(){
130
          updateCreateButtonStatus();
130
                var comp = [cardnumber_input,branchcode_input].filter(function(id) {
131
      });
131
                    return $(id).val().length > 0;
132
      function updateCreateButtonStatus(){
132
                });
133
        var comp = [cardnumber_input,branchcode_input].filter(function(id) {
133
                $('#ill-submit').attr('disabled', comp.length < 2);
134
            return $(id).val().length > 0;
134
              }
135
        });
135
              /* Maintain patron autocomplete compatibility across versions */
136
        $('#ill-submit').attr('disabled', comp.length < 2);
136
              [% IF koha_version.major <= 22 && koha_version.minor < 11 %]
137
      }
137
              $('#create_form #cardnumber').autocomplete({
138
      /* Maintain patron autocomplete compatibility across versions */
138
                  source: "/cgi-bin/koha/circ/ysearch.pl",
139
      [% IF koha_version.major <= 22 && koha_version.minor < 11 %]
139
                  minLength: 3,
140
      $('#create_form #cardnumber').autocomplete({
140
                  select: function( event, ui ) {
141
          source: "/cgi-bin/koha/circ/ysearch.pl",
141
                      var field = ui.item.cardnumber;
142
          minLength: 3,
142
                      $('#create_form #cardnumber').val(field)
143
          select: function( event, ui ) {
143
                      return false;
144
              var field = ui.item.cardnumber;
144
                  }
145
              $('#create_form #cardnumber').val(field)
145
              })
146
              return false;
146
              .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
147
          }
147
                  return $( "<li></li>" )
148
      })
148
                  .data( "ui-autocomplete-item", item )
149
      .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
149
                  .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
150
          return $( "<li></li>" )
150
                  .appendTo( ul );
151
          .data( "ui-autocomplete-item", item )
151
              };
152
          .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
152
              [% ELSE %]
153
          .appendTo( ul );
153
              patron_autocomplete(
154
      };
154
                $('#create_form #cardnumber'),
155
      [% ELSE %]
155
                {
156
      patron_autocomplete(
156
                  'on-select-callback': function( event, ui ) {
157
        $('#create_form #cardnumber'),
157
                    $("#create_form #cardnumber").val( ui.item.cardnumber );
158
        {
158
                    return false;
159
          'on-select-callback': function( event, ui ) {
159
                  }
160
            $("#create_form #cardnumber").val( ui.item.cardnumber );
160
                }
161
            return false;
161
              );
162
          }
162
              [% END %]
163
        }
163
            });
164
      );
164
            // ]]>
165
      [% END %]
165
        </script>
166
    });
167
    // ]]>
168
</script>
169
[% END %]
170
171
[% ELSIF whole.stage == "borrowers" %]
172
<!-- We need to clarify the borrower that has been requested. -->
173
<h2>Borrower selection</h2>
174
<form method="POST" action="">
175
  [% FOREACH prop IN whole.value.other.keys %]
176
    [% IF prop != 'custom_key' &&  prop != 'custom_value' && prop != 'cardnumber' %]
177
    <input type="hidden" name="[% prop | html %]" value="[% whole.value.other.$prop | html %]">
178
    [% END %]
179
  [% END %]
180
  [% keys = whole.value.other.custom_key.split('\0') %]
181
  [% values = whole.value.other.custom_value.split('\0') %]
182
  [% i = 0 %]
183
  [% FOREACH key IN keys %]
184
    <input type="hidden" name="custom_key" value="[% key | html %]">
185
    <input type="hidden" name="custom_value" value="[% values.$i | html %]">
186
  [% i = i + 1 %]
187
  [% END %]
188
  <fieldset class="rows">
189
    <legend>Available borrowers for surname [% surname | html %]</legend>
190
    [% FOREACH opt IN whole.value %]
191
    [% IF opt.key == "brw" %]
192
    <ol>
193
      <li>
194
        <label class="required" for="brw">Borrower</label>
195
        <select name="cardnumber" id="cardnumber">
196
          <option value=""></option>
197
          [% FOREACH brw IN opt.value %]
198
          <option value="[% brw.cardnumber | html %]">
199
            [% brw.firstname | html %] [% brw.surname | html %] ([% brw.cardnumber | html %])
200
          </option>
201
          [% END %]
202
        </select>
203
      </li>
204
    </ol>
205
    [% END %]
166
    [% END %]
206
    [% END %]
167
[% ELSIF whole.stage == "borrowers" %]
207
  </fieldset>
168
    <!-- We need to clarify the borrower that has been requested. -->
208
  <fieldset class="action">
169
    <h2>Borrower selection</h2>
209
    <input type="submit" value="Select"/>
170
    <form method="POST" action="">
210
    <a class="cancel" href=[% parent | url %]>Cancel</a>
171
        [% FOREACH prop IN whole.value.other.keys %]
211
  </fieldset>
172
            [% IF prop != 'custom_key' &&  prop != 'custom_value' && prop != 'cardnumber' %]
212
</form>
173
                <input type="hidden" name="[% prop | html %]" value="[% whole.value.other.$prop | html %]" />
213
174
            [% END %]
175
        [% END %]
176
        [% keys = whole.value.other.custom_key.split('\0') %]
177
        [% values = whole.value.other.custom_value.split('\0') %]
178
        [% i = 0 %]
179
        [% FOREACH key IN keys %]
180
            <input type="hidden" name="custom_key" value="[% key | html %]" />
181
            <input type="hidden" name="custom_value" value="[% values.$i | html %]" />
182
            [% i = i + 1 %]
183
        [% END %]
184
        <fieldset class="rows">
185
            <legend>Available borrowers for surname [% surname | html %]</legend>
186
            [% FOREACH opt IN whole.value %]
187
                [% IF opt.key == "brw" %]
188
                    <ol>
189
                        <li>
190
                            <label class="required" for="brw">Borrower</label>
191
                            <select name="cardnumber" id="cardnumber">
192
                                <option value=""></option>
193
                                [% FOREACH brw IN opt.value %]
194
                                    <option value="[% brw.cardnumber | html %]"> [% brw.firstname | html %] [% brw.surname | html %] ([% brw.cardnumber | html %]) </option>
195
                                [% END %]
196
                            </select>
197
                        </li>
198
                    </ol>
199
                [% END %]
200
            [% END %]
201
        </fieldset>
202
        <fieldset class="action">
203
            <input type="submit" value="Select" />
204
            <a class="cancel" href="[% parent | url %]">Cancel</a>
205
        </fieldset>
206
    </form>
214
[% ELSE %]
207
[% ELSE %]
215
<p>Unknown stage.  This should not have happened.
208
    <p>Unknown stage. This should not have happened. </p>
216
209
[% END %]
217
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/edititem.inc (-5 / +6 lines)
Lines 1-5 Link Here
1
[% cwd = whole.cwd %]
1
[% USE raw %]
2
[% PROCESS "${cwd}/shared-includes/form_input_helpers.inc" %]
2
[% PROCESS "ill/backends/Standard/shared/form_input_helpers.inc" %]
3
[% IF whole.error %]
3
[% IF whole.error %]
4
    [% IF whole.status == 'missing_type' %]
4
    [% IF whole.status == 'missing_type' %]
5
        <p><em>Please note:</em> Mandatory field 'type' is missing.</p>
5
        <p><em>Please note:</em> Mandatory field 'type' is missing.</p>
Lines 70-78 Link Here
70
        </fieldset>
70
        </fieldset>
71
        [% type = whole.value.other.type %]
71
        [% type = whole.value.other.type %]
72
        [% IF type %]
72
        [% IF type %]
73
            [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %]
73
            [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %]
74
        [% END %]
74
        [% END %]
75
        [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %]
75
        [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %]
76
        <fieldset class="action">
76
        <fieldset class="action">
77
            <input id="ill-submit" class="btn btn-primary" type="submit" value="Update" />
77
            <input id="ill-submit" class="btn btn-primary" type="submit" value="Update" />
78
            <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a>
78
            <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a>
Lines 84-91 Link Here
84
    </form>
84
    </form>
85
    [% BLOCK backend_jsinclude %]
85
    [% BLOCK backend_jsinclude %]
86
        <script>
86
        <script>
87
            var core = [ [% whole.core | $raw %] ];
87
            // <![CDATA[]
88
            // <![CDATA[]
88
            [% INCLUDE "${cwd}/shared-includes/shared.js" %]
89
            [% INCLUDE "ill/backends/Standard/shared/shared.js" %]
89
            // ]]>
90
            // ]]>
90
        </script>
91
        </script>
91
    [% END %]
92
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/form_input_helpers.inc (-52 lines)
Lines 1-52 Link Here
1
[% BLOCK ill_text_input_field %]
2
    <li>
3
        <label for="[% id | html %]">[% label | html %]:</label>
4
        [% IF opac %]
5
            <input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html%]" value="[% value | html %]" />
6
        [% ELSE %]
7
            <input type="text" name="[% id | html %]" id="[% id | html%]" value="[% value | html %]" />
8
        [% END %]
9
        [% IF required %]
10
            <div class="required_label required">Required</div>
11
        [% END %]
12
        [% SET required = 0 %]
13
    </li>
14
[% END %]
15
16
[% BLOCK ill_select_field %]
17
    <li>
18
        <label for="[% id | html %]">[% label | html %]:</label>
19
        [% IF opac %]
20
            <select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]">
21
        [% ELSE %]
22
            <select name="[% id | html %]" id="[% id | html %]">
23
        [% END %]
24
            [% content | $raw %]
25
        </select>
26
        [% IF required %]
27
            <div class="required_label required">Required</div>
28
        [% END %]
29
        [% SET required = 0 %]
30
    </li>
31
[% END %]
32
33
[% BLOCK book_text_input_fields %]
34
  [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %]
35
  [% PROCESS ill_text_input_field id = 'author' label = t('Author') value = whole.value.other.author %]
36
  [% PROCESS ill_text_input_field id = 'editor' label = t('Editor') value = whole.value.other.editor %]
37
  [% PROCESS ill_text_input_field id = 'publisher' label = t('Publisher') value = whole.value.other.publisher %]
38
  [% PROCESS ill_text_input_field id = 'published_place' label = t('Place of publication') value = whole.value.other.published_place %]
39
  [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %]
40
  [% PROCESS ill_text_input_field id = 'part_edition' label = t('Part / Edition') value = whole.value.other.part_edition %]
41
  [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %]
42
  [% PROCESS ill_text_input_field id = 'isbn' label = t('ISBN') value = whole.value.other.isbn %]
43
  [% PROCESS ill_text_input_field id = 'doi' label = t('DOI') value = whole.value.other.doi %]
44
[% END %]
45
46
[% BLOCK journal_text_input_fields %]
47
  [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %]
48
  [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %]
49
  [% PROCESS ill_text_input_field id = 'issue' label = t('Issue number') value = whole.value.other.issue %]
50
  [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %]
51
  [% PROCESS ill_text_input_field id = 'issn' label = t('ISSN') value = whole.value.other.issn %]
52
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/shared.js (-44 lines)
Lines 1-44 Link Here
1
var core = [ [% whole.core %] ];
2
var opac = [% opac || 0 %];
3
document.addEventListener('DOMContentLoaded', function() {
4
    $('#add-new-fields').click(function(e) {
5
        e.preventDefault();
6
        var row = '<li class="form-horizontal">' +
7
            '<input type="text" class="custom-name ' +
8
            ( opac ? 'form-control input-fluid custom-field-input' : '') +
9
            '" name="custom_key" placeholder="'+__('key')+'">' +
10
            ' ' +
11
            '<input type="text" id="custom-value" name="custom_value" class="' +
12
            ( opac ? 'form-control input-fluid custom-field-input' : '') +'" placeholder="'+__('value')+'"> ' +
13
            '<button type="button" class="btn btn-danger btn-sm ' +
14
            'delete-new-field">' +
15
            '<span class="fa fa-trash-can"></span> ' +
16
            __('Delete') +
17
            '</button></li>';
18
        $('#standard-fields').append(row);
19
    });
20
    $('#standard-fields').on('click', '.delete-new-field',
21
        function(event) {
22
            event.preventDefault();
23
            $(event.target).parent().remove();
24
        }
25
    );
26
    $('#type').change(function() {
27
        $('#create_form').prepend(
28
            '<input type="hidden" name="change_type" value="1" />'
29
        );
30
        $('#create_form').submit();
31
    });
32
    $('#standard-fields').on('keyup', '.custom-name', function() {
33
        var val = $(this).val();
34
        if (core.indexOf(val.toLowerCase()) > -1) {
35
            $('#custom-warning').text(__("The name '%s' is not permitted").format(val)).show();
36
            $('#ill-submit').attr('disabled', true);
37
            $('#add-new-fields').attr('disabled', true);
38
        } else {
39
            $('#custom-warning').hide();
40
            $('#ill-submit').attr('disabled', false);
41
            $('#add-new-fields').attr('disabled', false);
42
        }
43
    });
44
});
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/migrate.inc (-4 / +5 lines)
Lines 1-3 Link Here
1
[% USE raw %]
1
[% IF whole.error %]
2
[% IF whole.error %]
2
    [% IF whole.status == 'missing_identifier' %]
3
    [% IF whole.status == 'missing_identifier' %]
3
        <p><em>Please note:</em> Mandatory field Identifier is missing.</p>
4
        <p><em>Please note:</em> Mandatory field Identifier is missing.</p>
Lines 74-85 Link Here
74
                </li>
75
                </li>
75
            </ol>
76
            </ol>
76
        </fieldset>
77
        </fieldset>
77
        [% cwd = whole.cwd %]
78
        [% type = whole.value.other.type %]
78
        [% type = whole.value.other.type %]
79
        [% IF type %]
79
        [% IF type %]
80
            [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %]
80
            [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %]
81
        [% END %]
81
        [% END %]
82
        [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %]
82
        [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %]
83
        <fieldset class="rows">
83
        <fieldset class="rows">
84
            <legend>Patron options</legend>
84
            <legend>Patron options</legend>
85
            <ol>
85
            <ol>
Lines 107-114 Link Here
107
    </form>
107
    </form>
108
    [% BLOCK backend_jsinclude %]
108
    [% BLOCK backend_jsinclude %]
109
        <script>
109
        <script>
110
            var core = [ [% whole.core | $raw %] ];
110
            // <![CDATA[]
111
            // <![CDATA[]
111
            [% INCLUDE "${cwd}/shared-includes/shared.js" %]
112
            [% INCLUDE "ill/backends/Standard/shared/shared.js" %]
112
            // ]]>
113
            // ]]>
113
        </script>
114
        </script>
114
    [% END %]
115
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/form_input_helpers.inc (+56 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% BLOCK ill_text_input_field %]
3
    <li>
4
        <label for="[% id | html %]">[% label | html %]:</label>
5
        [% IF opac %]
6
            <input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" />
7
        [% ELSE %]
8
            <input type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" />
9
        [% END %]
10
        [% IF required %]
11
            <div class="required_label required">Required</div>
12
        [% END %]
13
        [% SET required = 0 %]
14
    </li>
15
[% END %]
16
17
[% BLOCK ill_select_field %]
18
    <li>
19
        <label for="[% id | html %]">[% label | html %]:</label>
20
        [% IF opac %]
21
            <select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]"
22
                >[% content | $raw %]</select
23
            >
24
        [% ELSE %]
25
            <select name="[% id | html %]" id="[% id | html %]"
26
                >[% content | $raw %]</select
27
            >
28
        [% END %]
29
30
        [% IF required %]
31
            <div class="required_label required">Required</div>
32
        [% END %]
33
        [% SET required = 0 %]
34
    </li>
35
[% END %]
36
37
[% BLOCK book_text_input_fields %]
38
    [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %]
39
    [% PROCESS ill_text_input_field id = 'author' label = t('Author') value = whole.value.other.author %]
40
    [% PROCESS ill_text_input_field id = 'editor' label = t('Editor') value = whole.value.other.editor %]
41
    [% PROCESS ill_text_input_field id = 'publisher' label = t('Publisher') value = whole.value.other.publisher %]
42
    [% PROCESS ill_text_input_field id = 'published_place' label = t('Place of publication') value = whole.value.other.published_place %]
43
    [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %]
44
    [% PROCESS ill_text_input_field id = 'part_edition' label = t('Part / Edition') value = whole.value.other.part_edition %]
45
    [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %]
46
    [% PROCESS ill_text_input_field id = 'isbn' label = t('ISBN') value = whole.value.other.isbn %]
47
    [% PROCESS ill_text_input_field id = 'doi' label = t('DOI') value = whole.value.other.doi %]
48
[% END %]
49
50
[% BLOCK journal_text_input_fields %]
51
    [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %]
52
    [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %]
53
    [% PROCESS ill_text_input_field id = 'issue' label = t('Issue number') value = whole.value.other.issue %]
54
    [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %]
55
    [% PROCESS ill_text_input_field id = 'issn' label = t('ISSN') value = whole.value.other.issn %]
56
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/shared.js (+46 lines)
Line 0 Link Here
1
document.addEventListener("DOMContentLoaded", function () {
2
    $("#add-new-fields").click(function (e) {
3
        e.preventDefault();
4
        var row =
5
            '<li class="form-horizontal">' +
6
            '<input type="text" class="custom-name ' +
7
            '" name="custom_key" placeholder="' +
8
            __("key") +
9
            '">' +
10
            " " +
11
            '<input type="text" id="custom-value" name="custom_value" class="' +
12
            '" placeholder="' +
13
            __("value") +
14
            '"> ' +
15
            '<button type="button" class="btn btn-danger btn-sm ' +
16
            'delete-new-field">' +
17
            '<span class="fa fa-trash-can"></span> ' +
18
            __("Delete") +
19
            "</button></li>";
20
        $("#standard-fields").append(row);
21
    });
22
    $("#standard-fields").on("click", ".delete-new-field", function (event) {
23
        event.preventDefault();
24
        $(event.target).parent().remove();
25
    });
26
    $("#type").change(function () {
27
        $("#create_form").prepend(
28
            '<input type="hidden" name="change_type" value="1" />'
29
        );
30
        $("#create_form").submit();
31
    });
32
    $("#standard-fields").on("keyup", ".custom-name", function () {
33
        var val = $(this).val();
34
        if (core.indexOf(val.toLowerCase()) > -1) {
35
            $("#custom-warning")
36
                .text(__("The name '%s' is not permitted").format(val))
37
                .show();
38
            $("#ill-submit").attr("disabled", true);
39
            $("#add-new-fields").attr("disabled", true);
40
        } else {
41
            $("#custom-warning").hide();
42
            $("#ill-submit").attr("disabled", false);
43
            $("#add-new-fields").attr("disabled", false);
44
        }
45
    });
46
});
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/create.inc (-5 / +5 lines)
Lines 1-7 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% PROCESS 'i18n.inc' %]
2
[% PROCESS 'i18n.inc' %]
3
[% cwd = whole.cwd %]
3
[% PROCESS "ill/backends/Standard/shared/form_input_helpers.inc" %]
4
[% PROCESS "${cwd}/shared-includes/form_input_helpers.inc" %]
5
[% IF whole.error %]
4
[% IF whole.error %]
6
    [% IF whole.status == 'missing_identifier' %]
5
    [% IF whole.status == 'missing_identifier' %]
7
        <div class="alert alert-warning"> <strong>Please note:</strong> Mandatory field Identifier is missing. </div>
6
        <div class="alert alert-warning"> <strong>Please note:</strong> Mandatory field Identifier is missing. </div>
Lines 102-110 Link Here
102
        </fieldset>
101
        </fieldset>
103
        [% type = whole.value.other.type %]
102
        [% type = whole.value.other.type %]
104
        [% IF type %]
103
        [% IF type %]
105
            [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %]
104
            [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %]
106
        [% END %]
105
        [% END %]
107
        [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %]
106
        [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %]
108
        [% IF whole.value.other.type && unauthenticated_ill && !logged_in_user %]
107
        [% IF whole.value.other.type && unauthenticated_ill && !logged_in_user %]
109
            <fieldset class="rows" id="illrequest_captcha">
108
            <fieldset class="rows" id="illrequest_captcha">
110
                <legend>Verification</legend>
109
                <legend>Verification</legend>
Lines 134-141 Link Here
134
[% END %]
133
[% END %]
135
[% BLOCK backend_jsinclude %]
134
[% BLOCK backend_jsinclude %]
136
    <script>
135
    <script>
136
        var core = [ [% whole.core | $raw %] ];
137
        // <![CDATA[]
137
        // <![CDATA[]
138
        [% INCLUDE "${cwd}/shared-includes/shared.js" %]
138
        [% INCLUDE "ill/backends/Standard/shared/shared.js" %]
139
        // ]]>
139
        // ]]>
140
    </script>
140
    </script>
141
[% END %]
141
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/form_input_helpers.inc (-52 lines)
Lines 1-52 Link Here
1
[% BLOCK ill_text_input_field %]
2
    <li>
3
        <label for="[% id | html %]">[% label | html %]:</label>
4
        [% IF opac %]
5
            <input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html%]" value="[% value | html %]" />
6
        [% ELSE %]
7
            <input type="text" name="[% id | html %]" id="[% id | html%]" value="[% value | html %]" />
8
        [% END %]
9
        [% IF required %]
10
            <div class="required_label required">Required</div>
11
        [% END %]
12
        [% SET required = 0 %]
13
    </li>
14
[% END %]
15
16
[% BLOCK ill_select_field %]
17
    <li>
18
        <label for="[% id | html %]">[% label | html %]:</label>
19
        [% IF opac %]
20
            <select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]">
21
        [% ELSE %]
22
            <select name="[% id | html %]" id="[% id | html %]">
23
        [% END %]
24
            [% content | $raw %]
25
        </select>
26
        [% IF required %]
27
            <div class="required_label required">Required</div>
28
        [% END %]
29
        [% SET required = 0 %]
30
    </li>
31
[% END %]
32
33
[% BLOCK book_text_input_fields %]
34
  [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %]
35
  [% PROCESS ill_text_input_field id = 'author' label = t('Author') value = whole.value.other.author %]
36
  [% PROCESS ill_text_input_field id = 'editor' label = t('Editor') value = whole.value.other.editor %]
37
  [% PROCESS ill_text_input_field id = 'publisher' label = t('Publisher') value = whole.value.other.publisher %]
38
  [% PROCESS ill_text_input_field id = 'published_place' label = t('Place of publication') value = whole.value.other.published_place %]
39
  [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %]
40
  [% PROCESS ill_text_input_field id = 'part_edition' label = t('Part / Edition') value = whole.value.other.part_edition %]
41
  [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %]
42
  [% PROCESS ill_text_input_field id = 'isbn' label = t('ISBN') value = whole.value.other.isbn %]
43
  [% PROCESS ill_text_input_field id = 'doi' label = t('DOI') value = whole.value.other.doi %]
44
[% END %]
45
46
[% BLOCK journal_text_input_fields %]
47
  [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %]
48
  [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %]
49
  [% PROCESS ill_text_input_field id = 'issue' label = t('Issue number') value = whole.value.other.issue %]
50
  [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %]
51
  [% PROCESS ill_text_input_field id = 'issn' label = t('ISSN') value = whole.value.other.issn %]
52
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/shared.js (-44 lines)
Lines 1-44 Link Here
1
var core = [ [% whole.core %] ];
2
var opac = [% opac || 0 %];
3
document.addEventListener('DOMContentLoaded', function() {
4
    $('#add-new-fields').click(function(e) {
5
        e.preventDefault();
6
        var row = '<li class="form-horizontal">' +
7
            '<input type="text" class="custom-name ' +
8
            ( opac ? 'form-control input-fluid custom-field-input' : '') +
9
            '" name="custom_key" placeholder="'+__('key')+'">' +
10
            ' ' +
11
            '<input type="text" id="custom-value" name="custom_value" class="' +
12
            ( opac ? 'form-control input-fluid custom-field-input' : '') +'" placeholder="'+__('value')+'"> ' +
13
            '<button type="button" class="btn btn-danger btn-sm ' +
14
            'delete-new-field">' +
15
            '<span class="fa fa-trash-can"></span> ' +
16
            __('Delete') +
17
            '</button></li>';
18
        $('#standard-fields').append(row);
19
    });
20
    $('#standard-fields').on('click', '.delete-new-field',
21
        function(event) {
22
            event.preventDefault();
23
            $(event.target).parent().remove();
24
        }
25
    );
26
    $('#type').change(function() {
27
        $('#create_form').prepend(
28
            '<input type="hidden" name="change_type" value="1" />'
29
        );
30
        $('#create_form').submit();
31
    });
32
    $('#standard-fields').on('keyup', '.custom-name', function() {
33
        var val = $(this).val();
34
        if (core.indexOf(val.toLowerCase()) > -1) {
35
            $('#custom-warning').text(__("The name '%s' is not permitted").format(val)).show();
36
            $('#ill-submit').attr('disabled', true);
37
            $('#add-new-fields').attr('disabled', true);
38
        } else {
39
            $('#custom-warning').hide();
40
            $('#ill-submit').attr('disabled', false);
41
            $('#add-new-fields').attr('disabled', false);
42
        }
43
    });
44
});
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/form_input_helpers.inc (+56 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% BLOCK ill_text_input_field %]
3
    <li>
4
        <label for="[% id | html %]">[% label | html %]:</label>
5
        [% IF opac %]
6
            <input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" />
7
        [% ELSE %]
8
            <input type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" />
9
        [% END %]
10
        [% IF required %]
11
            <div class="required_label required">Required</div>
12
        [% END %]
13
        [% SET required = 0 %]
14
    </li>
15
[% END %]
16
17
[% BLOCK ill_select_field %]
18
    <li>
19
        <label for="[% id | html %]">[% label | html %]:</label>
20
        [% IF opac %]
21
            <select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]"
22
                >[% content | $raw %]</select
23
            >
24
        [% ELSE %]
25
            <select name="[% id | html %]" id="[% id | html %]"
26
                >[% content | $raw %]</select
27
            >
28
        [% END %]
29
30
        [% IF required %]
31
            <div class="required_label required">Required</div>
32
        [% END %]
33
        [% SET required = 0 %]
34
    </li>
35
[% END %]
36
37
[% BLOCK book_text_input_fields %]
38
    [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %]
39
    [% PROCESS ill_text_input_field id = 'author' label = t('Author') value = whole.value.other.author %]
40
    [% PROCESS ill_text_input_field id = 'editor' label = t('Editor') value = whole.value.other.editor %]
41
    [% PROCESS ill_text_input_field id = 'publisher' label = t('Publisher') value = whole.value.other.publisher %]
42
    [% PROCESS ill_text_input_field id = 'published_place' label = t('Place of publication') value = whole.value.other.published_place %]
43
    [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %]
44
    [% PROCESS ill_text_input_field id = 'part_edition' label = t('Part / Edition') value = whole.value.other.part_edition %]
45
    [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %]
46
    [% PROCESS ill_text_input_field id = 'isbn' label = t('ISBN') value = whole.value.other.isbn %]
47
    [% PROCESS ill_text_input_field id = 'doi' label = t('DOI') value = whole.value.other.doi %]
48
[% END %]
49
50
[% BLOCK journal_text_input_fields %]
51
    [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %]
52
    [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %]
53
    [% PROCESS ill_text_input_field id = 'issue' label = t('Issue number') value = whole.value.other.issue %]
54
    [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %]
55
    [% PROCESS ill_text_input_field id = 'issn' label = t('ISSN') value = whole.value.other.issn %]
56
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/shared.js (-1 / +48 lines)
Line 0 Link Here
0
- 
1
document.addEventListener("DOMContentLoaded", function () {
2
    $("#add-new-fields").click(function (e) {
3
        e.preventDefault();
4
        var row =
5
            '<li class="form-horizontal">' +
6
            '<input type="text" class="custom-name ' +
7
            "form-control input-fluid custom-field-input" +
8
            '" name="custom_key" placeholder="' +
9
            __("key") +
10
            '">' +
11
            " " +
12
            '<input type="text" id="custom-value" name="custom_value" class="' +
13
            "form-control input-fluid custom-field-input" +
14
            '" placeholder="' +
15
            __("value") +
16
            '"> ' +
17
            '<button type="button" class="btn btn-danger btn-sm ' +
18
            'delete-new-field">' +
19
            '<span class="fa fa-trash-can"></span> ' +
20
            __("Delete") +
21
            "</button></li>";
22
        $("#standard-fields").append(row);
23
    });
24
    $("#standard-fields").on("click", ".delete-new-field", function (event) {
25
        event.preventDefault();
26
        $(event.target).parent().remove();
27
    });
28
    $("#type").change(function () {
29
        $("#create_form").prepend(
30
            '<input type="hidden" name="change_type" value="1" />'
31
        );
32
        $("#create_form").submit();
33
    });
34
    $("#standard-fields").on("keyup", ".custom-name", function () {
35
        var val = $(this).val();
36
        if (core.indexOf(val.toLowerCase()) > -1) {
37
            $("#custom-warning")
38
                .text(__("The name '%s' is not permitted").format(val))
39
                .show();
40
            $("#ill-submit").attr("disabled", true);
41
            $("#add-new-fields").attr("disabled", true);
42
        } else {
43
            $("#custom-warning").hide();
44
            $("#ill-submit").attr("disabled", false);
45
            $("#add-new-fields").attr("disabled", false);
46
        }
47
    });
48
});

Return to bug 38340