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

(-)a/C4/Items.pm (-1 / +7 lines)
Lines 1068-1079 sub GetItemsForInventory { Link Here
1068
    my $size         = $parameters->{'size'}         // '';
1068
    my $size         = $parameters->{'size'}         // '';
1069
    my $statushash   = $parameters->{'statushash'}   // '';
1069
    my $statushash   = $parameters->{'statushash'}   // '';
1070
    my $interface    = $parameters->{'interface'}    // '';
1070
    my $interface    = $parameters->{'interface'}    // '';
1071
    my $ccode        = $parameters->{'ccode'}        // '';
1071
1072
1072
    my $dbh = C4::Context->dbh;
1073
    my $dbh = C4::Context->dbh;
1073
    my ( @bind_params, @where_strings );
1074
    my ( @bind_params, @where_strings );
1074
1075
1075
    my $select_columns = q{
1076
    my $select_columns = q{
1076
        SELECT items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber
1077
        SELECT items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, ccode
1077
    };
1078
    };
1078
    my $select_count = q{SELECT COUNT(*)};
1079
    my $select_count = q{SELECT COUNT(*)};
1079
    my $query = q{
1080
    my $query = q{
Lines 1090-1095 sub GetItemsForInventory { Link Here
1090
        }
1091
        }
1091
    }
1092
    }
1092
1093
1094
    if ($ccode){
1095
        push @where_strings, 'ccode = ?';
1096
        push @bind_params, $ccode;
1097
    }
1098
1093
    if ($minlocation) {
1099
    if ($minlocation) {
1094
        push @where_strings, 'itemcallnumber >= ?';
1100
        push @where_strings, 'itemcallnumber >= ?';
1095
        push @bind_params, $minlocation;
1101
        push @bind_params, $minlocation;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt (+21 lines)
Lines 14-19 function checkForm() { Link Here
14
        if ( !(
14
        if ( !(
15
            $('#branchloop').val()   ||
15
            $('#branchloop').val()   ||
16
            $('#locationloop').val() ||
16
            $('#locationloop').val() ||
17
            $('#ccodeloop').val() ||
17
            $('#minlocation').val()  ||
18
            $('#minlocation').val()  ||
18
            $('#maxlocation').val()  ||
19
            $('#maxlocation').val()  ||
19
            $('#statuses input:checked').length
20
            $('#statuses input:checked').length
Lines 162-167 $(document).ready(function(){ Link Here
162
        [% END %]
163
        [% END %]
163
        </select>        </li>
164
        </select>        </li>
164
        [% END %]
165
        [% END %]
166
        [% IF ( ccode_list ) %]
167
        <li>
168
            <label for="ccode">Collection code: </label>
169
            <select id="ccodeloop" name="ccode">
170
                    <option value="">Filter collection code</option>
171
                [% FOREACH ccode_value IN ccode_list %]
172
                    [% IF (ccode == ccode_value) %]
173
                        <option value="[% ccode_value.authorised_value %]" selected="selected">[% ccode_value.lib %]</option>
174
                    [% ELSE %]
175
                        <option value="[% ccode_value.authorised_value %]">[% ccode_value.lib %]</option>
176
                    [% END %]
177
                [% END %]
178
            </select>
179
        </li>
180
        [% END %]
165
        <li>
181
        <li>
166
            <label for="minlocation">Item callnumber between: </label>
182
            <label for="minlocation">Item callnumber between: </label>
167
                <input type="text" name="minlocation" id="minlocation" value="[% minlocation %]" /> (items.itemcallnumber)  </li>
183
                <input type="text" name="minlocation" id="minlocation" value="[% minlocation %]" /> (items.itemcallnumber)  </li>
Lines 235-240 $(document).ready(function(){ Link Here
235
    <input type="hidden" name="location" value="[% location %]" />
251
    <input type="hidden" name="location" value="[% location %]" />
236
    <input type="hidden" name="branchcode" value="[% branchcode %]" />
252
    <input type="hidden" name="branchcode" value="[% branchcode %]" />
237
    <input type="hidden" name="datelastseen" value="[% datelastseen %]" />
253
    <input type="hidden" name="datelastseen" value="[% datelastseen %]" />
254
    <input type="hidden" name="ccode" value="[% ccode %]" />
238
255
239
    [% UNLESS compareinv2barcd %]
256
    [% UNLESS compareinv2barcd %]
240
      <div><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div>
257
      <div><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div>
Lines 246-251 $(document).ready(function(){ Link Here
246
            [% UNLESS compareinv2barcd %]<th>Seen</th>[% END %]
263
            [% UNLESS compareinv2barcd %]<th>Seen</th>[% END %]
247
            <th>Barcode</th>
264
            <th>Barcode</th>
248
            <th>Library</th>
265
            <th>Library</th>
266
            [% IF ( ccode_list ) %]<th>Collection code</th>[% END %]
249
            <th>Title</th>
267
            <th>Title</th>
250
            <th>Status</th>
268
            <th>Status</th>
251
            <th>Lost</th>
269
            <th>Lost</th>
Lines 271-276 $(document).ready(function(){ Link Here
271
                [% result.location | html %] [% IF ( result.itemcallnumber ) %][[% result.itemcallnumber | html %]][% ELSE %][% END %]
289
                [% result.location | html %] [% IF ( result.itemcallnumber ) %][[% result.itemcallnumber | html %]][% ELSE %][% END %]
272
            </td>
290
            </td>
273
            <td>
291
            <td>
292
            [% IF ( ccode_list ) %][% result.ccode | html %][% END %]
293
            </td>
294
            <td>
274
            <p><a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% result.biblionumber %]" class="openWin">[% result.title | html %]</a></p><p>[% result.author | html %]</p>
295
            <p><a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% result.biblionumber %]" class="openWin">[% result.title | html %]</a></p><p>[% result.author | html %]</p>
275
            </td>
296
            </td>
276
            <td>
297
            <td>
(-)a/tools/inventory.pl (-5 / +23 lines)
Lines 53-58 my $branch = $input->param('branch'); Link Here
53
my $op         = $input->param('op');
53
my $op         = $input->param('op');
54
my $compareinv2barcd = $input->param('compareinv2barcd');
54
my $compareinv2barcd = $input->param('compareinv2barcd');
55
my $dont_checkin = $input->param('dont_checkin');
55
my $dont_checkin = $input->param('dont_checkin');
56
my $ccode = $input->param('ccode');
56
57
57
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
58
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
58
    {   template_name   => "tools/inventory.tt",
59
    {   template_name   => "tools/inventory.tt",
Lines 80-85 my $authorisedvalue_categories = ''; Link Here
80
my $frameworks = getframeworks();
81
my $frameworks = getframeworks();
81
$frameworks->{''} = {frameworkcode => ''}; # Add the default framework
82
$frameworks->{''} = {frameworkcode => ''}; # Add the default framework
82
83
84
my @collections = ();
85
my @collection_codes = ();
86
83
for my $fwk (keys %$frameworks){
87
for my $fwk (keys %$frameworks){
84
  my $fwkcode = $frameworks->{$fwk}->{'frameworkcode'};
88
  my $fwkcode = $frameworks->{$fwk}->{'frameworkcode'};
85
  my $authcode = GetAuthValCode('items.location', $fwkcode);
89
  my $authcode = GetAuthValCode('items.location', $fwkcode);
Lines 91-97 for my $fwk (keys %$frameworks){ Link Here
91
      }
95
      }
92
      push @authorised_value_list,@$data;
96
      push @authorised_value_list,@$data;
93
    }
97
    }
98
99
    my $collection_authorised_value = C4::Koha::GetAuthValCode("items.ccode", $fwkcode);
100
    if ($collection_authorised_value && (! grep { $collection_authorised_value eq $_ } @collection_codes) ) {
101
        #Add authorised value category to array
102
        push (@collection_codes,$collection_authorised_value);
103
        my $collection_values = C4::Koha::GetAuthorisedValues($collection_authorised_value);
104
        if (ref $collection_values eq 'ARRAY' && @$collection_values){
105
            #Add authorised values to array
106
            push(@collections,@$collection_values);
107
        }
108
    }
94
}
109
}
110
$template->param( ccode_list => \@collections );
95
111
96
my $statuses = [];
112
my $statuses = [];
97
for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.damaged/){
113
for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.damaged/){
Lines 139-145 $template->param( Link Here
139
    branch                   => $branch,
155
    branch                   => $branch,
140
    datelastseen             => $datelastseen,
156
    datelastseen             => $datelastseen,
141
    compareinv2barcd         => $compareinv2barcd,
157
    compareinv2barcd         => $compareinv2barcd,
142
    notforloanlist           => $notforloanlist
158
    notforloanlist           => $notforloanlist,
159
    ccode                    => $ccode,
143
);
160
);
144
161
145
my @notforloans;
162
my @notforloans;
Lines 256-264 if ( $markseen or $op ) { Link Here
256
      size         => undef,
273
      size         => undef,
257
      statushash   => $staton,
274
      statushash   => $staton,
258
      interface    => 'staff',
275
      interface    => 'staff',
276
      ccode        => $ccode,
259
    } );
277
    } );
260
278
261
    # For the items that may be marked as "wrong place", we only check the location (callnumbers, location and branch)
279
    # For the items that may be marked as "wrong place", we only check the location (callnumbers, location, ccode and branch)
262
    ($wrongplacelist, $totalrecords) = GetItemsForInventory( {
280
    ($wrongplacelist, $totalrecords) = GetItemsForInventory( {
263
      minlocation  => $minlocation,
281
      minlocation  => $minlocation,
264
      maxlocation  => $maxlocation,
282
      maxlocation  => $maxlocation,
Lines 272-277 if ( $markseen or $op ) { Link Here
272
      size         => undef,
290
      size         => undef,
273
      statushash   => undef,
291
      statushash   => undef,
274
      interface    => 'staff',
292
      interface    => 'staff',
293
      ccode        => $ccode,
275
    } );
294
    } );
276
295
277
}
296
}
Lines 385-391 if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ Link Here
385
    my @translated_keys;
404
    my @translated_keys;
386
    for my $key (qw / biblioitems.title    biblio.author
405
    for my $key (qw / biblioitems.title    biblio.author
387
                      items.barcode        items.itemnumber
406
                      items.barcode        items.itemnumber
388
                      items.homebranch     items.location
407
                      items.homebranch     items.location   items.ccode
389
                      items.itemcallnumber items.notforloan
408
                      items.itemcallnumber items.notforloan
390
                      items.itemlost       items.damaged
409
                      items.itemlost       items.damaged
391
                      items.withdrawn      items.stocknumber
410
                      items.withdrawn      items.stocknumber
Lines 397-403 if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ Link Here
397
    $csv->combine(@translated_keys);
416
    $csv->combine(@translated_keys);
398
    print $csv->string, "\n";
417
    print $csv->string, "\n";
399
418
400
    my @keys = qw / title author barcode itemnumber homebranch location itemcallnumber notforloan lost damaged withdrawn stocknumber /;
419
    my @keys = qw / title author barcode itemnumber homebranch location ccode itemcallnumber notforloan lost damaged withdrawn stocknumber /;
401
    for my $item ( @results ) {
420
    for my $item ( @results ) {
402
        my @line;
421
        my @line;
403
        for my $key (@keys) {
422
        for my $key (@keys) {
404
- 

Return to bug 14393