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 231-236 $(document).ready(function(){ Link Here
231
    <input type="hidden" name="location" value="[% location %]" />
247
    <input type="hidden" name="location" value="[% location %]" />
232
    <input type="hidden" name="branchcode" value="[% branchcode %]" />
248
    <input type="hidden" name="branchcode" value="[% branchcode %]" />
233
    <input type="hidden" name="datelastseen" value="[% datelastseen %]" />
249
    <input type="hidden" name="datelastseen" value="[% datelastseen %]" />
250
    <input type="hidden" name="ccode" value="[% ccode %]" />
234
251
235
    [% UNLESS compareinv2barcd %]
252
    [% UNLESS compareinv2barcd %]
236
      <div><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div>
253
      <div><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div>
Lines 242-247 $(document).ready(function(){ Link Here
242
            [% UNLESS compareinv2barcd %]<th>Seen</th>[% END %]
259
            [% UNLESS compareinv2barcd %]<th>Seen</th>[% END %]
243
            <th>Barcode</th>
260
            <th>Barcode</th>
244
            <th>Library</th>
261
            <th>Library</th>
262
            <th>Collection code</th>
245
            <th>Title</th>
263
            <th>Title</th>
246
            <th>Status</th>
264
            <th>Status</th>
247
            <th>Lost</th>
265
            <th>Lost</th>
Lines 267-272 $(document).ready(function(){ Link Here
267
                [% result.location | html %] [% IF ( result.itemcallnumber ) %][[% result.itemcallnumber | html %]][% ELSE %][% END %]
285
                [% result.location | html %] [% IF ( result.itemcallnumber ) %][[% result.itemcallnumber | html %]][% ELSE %][% END %]
268
            </td>
286
            </td>
269
            <td>
287
            <td>
288
            [% result.ccode | html %]
289
            </td>
290
            <td>
270
            <p><a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% result.biblionumber %]" class="openWin">[% result.title | html %]</a></p><p>[% result.author | html %]</p>
291
            <p><a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% result.biblionumber %]" class="openWin">[% result.title | html %]</a></p><p>[% result.author | html %]</p>
271
            </td>
292
            </td>
272
            <td>
293
            <td>
(-)a/tools/inventory.pl (-5 / +23 lines)
Lines 52-57 my $branchcode = $input->param('branchcode') || ''; Link Here
52
my $branch     = $input->param('branch');
52
my $branch     = $input->param('branch');
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 $ccode = $input->param('ccode');
55
56
56
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
57
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
57
    {   template_name   => "tools/inventory.tt",
58
    {   template_name   => "tools/inventory.tt",
Lines 79-84 my $authorisedvalue_categories = ''; Link Here
79
my $frameworks = getframeworks();
80
my $frameworks = getframeworks();
80
$frameworks->{''} = {frameworkcode => ''}; # Add the default framework
81
$frameworks->{''} = {frameworkcode => ''}; # Add the default framework
81
82
83
my @collections = ();
84
my @collection_codes = ();
85
82
for my $fwk (keys %$frameworks){
86
for my $fwk (keys %$frameworks){
83
  my $fwkcode = $frameworks->{$fwk}->{'frameworkcode'};
87
  my $fwkcode = $frameworks->{$fwk}->{'frameworkcode'};
84
  my $authcode = GetAuthValCode('items.location', $fwkcode);
88
  my $authcode = GetAuthValCode('items.location', $fwkcode);
Lines 90-96 for my $fwk (keys %$frameworks){ Link Here
90
      }
94
      }
91
      push @authorised_value_list,@$data;
95
      push @authorised_value_list,@$data;
92
    }
96
    }
97
    
98
    my $collection_authorised_value = C4::Koha::GetAuthValCode("items.ccode", $fwkcode);
99
    if ($collection_authorised_value && (! grep { $collection_authorised_value eq $_ } @collection_codes) ) {
100
        #Add authorised value category to array
101
        push (@collection_codes,$collection_authorised_value);
102
        my $collection_values = C4::Koha::GetAuthorisedValues($collection_authorised_value);
103
        if (ref $collection_values eq 'ARRAY' && @$collection_values){
104
            #Add authorised values to array
105
            push(@collections,@$collection_values);
106
        }
107
    }
93
}
108
}
109
$template->param( ccode_list => \@collections );
94
110
95
my $statuses = [];
111
my $statuses = [];
96
for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.damaged/){
112
for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.damaged/){
Lines 138-144 $template->param( Link Here
138
    branch                   => $branch,
154
    branch                   => $branch,
139
    datelastseen             => $datelastseen,
155
    datelastseen             => $datelastseen,
140
    compareinv2barcd         => $compareinv2barcd,
156
    compareinv2barcd         => $compareinv2barcd,
141
    notforloanlist           => $notforloanlist
157
    notforloanlist           => $notforloanlist,
158
    ccode                    => $ccode,
142
);
159
);
143
160
144
my @notforloans;
161
my @notforloans;
Lines 253-261 if ( $markseen or $op ) { Link Here
253
      size         => undef,
270
      size         => undef,
254
      statushash   => $staton,
271
      statushash   => $staton,
255
      interface    => 'staff',
272
      interface    => 'staff',
273
      ccode        => $ccode,
256
    } );
274
    } );
257
275
258
    # For the items that may be marked as "wrong place", we only check the location (callnumbers, location and branch)
276
    # For the items that may be marked as "wrong place", we only check the location (callnumbers, location, ccode and branch)
259
    ($wrongplacelist, $totalrecords) = GetItemsForInventory( {
277
    ($wrongplacelist, $totalrecords) = GetItemsForInventory( {
260
      minlocation  => $minlocation,
278
      minlocation  => $minlocation,
261
      maxlocation  => $maxlocation,
279
      maxlocation  => $maxlocation,
Lines 269-274 if ( $markseen or $op ) { Link Here
269
      size         => undef,
287
      size         => undef,
270
      statushash   => undef,
288
      statushash   => undef,
271
      interface    => 'staff',
289
      interface    => 'staff',
290
      ccode        => $ccode,
272
    } );
291
    } );
273
292
274
}
293
}
Lines 382-388 if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ Link Here
382
    my @translated_keys;
401
    my @translated_keys;
383
    for my $key (qw / biblioitems.title    biblio.author
402
    for my $key (qw / biblioitems.title    biblio.author
384
                      items.barcode        items.itemnumber
403
                      items.barcode        items.itemnumber
385
                      items.homebranch     items.location
404
                      items.homebranch     items.location   items.ccode
386
                      items.itemcallnumber items.notforloan
405
                      items.itemcallnumber items.notforloan
387
                      items.itemlost       items.damaged
406
                      items.itemlost       items.damaged
388
                      items.withdrawn      items.stocknumber
407
                      items.withdrawn      items.stocknumber
Lines 394-400 if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ Link Here
394
    $csv->combine(@translated_keys);
413
    $csv->combine(@translated_keys);
395
    print $csv->string, "\n";
414
    print $csv->string, "\n";
396
415
397
    my @keys = qw / title author barcode itemnumber homebranch location itemcallnumber notforloan lost damaged withdrawn stocknumber /;
416
    my @keys = qw / title author barcode itemnumber homebranch location ccode itemcallnumber notforloan lost damaged withdrawn stocknumber /;
398
    for my $item ( @results ) {
417
    for my $item ( @results ) {
399
        my @line;
418
        my @line;
400
        for my $key (@keys) {
419
        for my $key (@keys) {
401
- 

Return to bug 14393