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

(-)a/C4/Members/AttributeTypes.pm (-14 / +44 lines)
Lines 37-42 C4::Members::AttributeTypes - mananage extended patron attribute types Link Here
37
  $attr_type->repeatable($repeatable);
37
  $attr_type->repeatable($repeatable);
38
  $attr_type->unique_id($unique_id);
38
  $attr_type->unique_id($unique_id);
39
  $attr_type->opac_display($opac_display);
39
  $attr_type->opac_display($opac_display);
40
  $attr_type->opac_editable($opac_editable);
40
  $attr_type->staff_searchable($staff_searchable);
41
  $attr_type->staff_searchable($staff_searchable);
41
  $attr_type->authorised_value_category($authorised_value_category);
42
  $attr_type->authorised_value_category($authorised_value_category);
42
  $attr_type->store();
43
  $attr_type->store();
Lines 122-127 sub new { Link Here
122
    $self->{'repeatable'} = 0;
123
    $self->{'repeatable'} = 0;
123
    $self->{'unique_id'} = 0;
124
    $self->{'unique_id'} = 0;
124
    $self->{'opac_display'} = 0;
125
    $self->{'opac_display'} = 0;
126
    $self->{'opac_editable'} = 0;
125
    $self->{'staff_searchable'} = 0;
127
    $self->{'staff_searchable'} = 0;
126
    $self->{'display_checkout'} = 0;
128
    $self->{'display_checkout'} = 0;
127
    $self->{'authorised_value_category'} = '';
129
    $self->{'authorised_value_category'} = '';
Lines 163-168 sub fetch { Link Here
163
    $self->{'repeatable'}                = $row->{'repeatable'};
165
    $self->{'repeatable'}                = $row->{'repeatable'};
164
    $self->{'unique_id'}                 = $row->{'unique_id'};
166
    $self->{'unique_id'}                 = $row->{'unique_id'};
165
    $self->{'opac_display'}              = $row->{'opac_display'};
167
    $self->{'opac_display'}              = $row->{'opac_display'};
168
    $self->{'opac_editable'}             = $row->{'opac_editable'};
166
    $self->{'staff_searchable'}          = $row->{'staff_searchable'};
169
    $self->{'staff_searchable'}          = $row->{'staff_searchable'};
167
    $self->{'display_checkout'}          = $row->{'display_checkout'};
170
    $self->{'display_checkout'}          = $row->{'display_checkout'};
168
    $self->{'authorised_value_category'} = $row->{'authorised_value_category'};
171
    $self->{'authorised_value_category'} = $row->{'authorised_value_category'};
Lines 203-208 sub store { Link Here
203
                                         repeatable = ?,
206
                                         repeatable = ?,
204
                                         unique_id = ?,
207
                                         unique_id = ?,
205
                                         opac_display = ?,
208
                                         opac_display = ?,
209
                                         opac_editable = ?,
206
                                         staff_searchable = ?,
210
                                         staff_searchable = ?,
207
                                         authorised_value_category = ?,
211
                                         authorised_value_category = ?,
208
                                         display_checkout = ?,
212
                                         display_checkout = ?,
Lines 211-232 sub store { Link Here
211
                                     WHERE code = ?");
215
                                     WHERE code = ?");
212
    } else {
216
    } else {
213
        $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types 
217
        $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types 
214
                                        (description, repeatable, unique_id, opac_display,
218
                                        ( description,
215
                                         staff_searchable, authorised_value_category, display_checkout, category_code, class, code)
219
                                          repeatable,
216
                                        VALUES (?, ?, ?, ?,
220
                                          unique_id,
217
                                                ?, ?, ?, ?, ?, ?)");
221
                                          opac_display,
222
                                          opac_editable,
223
                                          staff_searchable,
224
                                          authorised_value_category,
225
                                          display_checkout,
226
                                          category_code,
227
                                          class,
228
                                          code
229
                                        )
230
                                        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
218
    }
231
    }
232
219
    $sth->execute(
233
    $sth->execute(
220
        $self->{description},
234
        $self->{'description'},
221
        $self->{repeatable},
235
        $self->{'repeatable'},
222
        $self->{unique_id},
236
        $self->{'unique_id'},
223
        $self->{opac_display},
237
        $self->{'opac_display'},
224
        $self->{staff_searchable},
238
        $self->{'opac_editable'},
225
        $self->{authorised_value_category},
239
        $self->{'staff_searchable'} || 0,
226
        $self->{display_checkout},
240
        $self->{'authorised_value_category'},
227
        $self->{category_code} || undef,
241
        $self->{'display_checkout'},
228
        $self->{class},
242
        $self->{'category_code'} || undef,
229
        $self->{code},
243
        $self->{'class'},
244
        $self->{'code'}
230
    );
245
    );
231
246
232
    if ( defined $$self{branches} ) {
247
    if ( defined $$self{branches} ) {
Lines 335-340 sub opac_display { Link Here
335
    @_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
350
    @_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
336
}
351
}
337
352
353
=head2 opac_editable
354
355
  my $opac_editable = $attr_type->opac_editable();
356
  $attr_type->opac_editable($opac_editable);
357
358
Accessor.  The C<$opac_editable> argument
359
is interpreted as a Perl boolean.
360
361
=cut
362
363
sub opac_editable {
364
    my $self = shift;
365
    @_ ? $self->{'opac_editable'} = ((shift) ? 1 : 0) : $self->{'opac_editable'};
366
}
367
338
=head2 staff_searchable
368
=head2 staff_searchable
339
369
340
  my $staff_searchable = $attr_type->staff_searchable();
370
  my $staff_searchable = $attr_type->staff_searchable();
(-)a/admin/patron-attr-types.pl (-8 / +17 lines)
Lines 40-53 our $input = new CGI; Link Here
40
my $op = $input->param('op') || '';
40
my $op = $input->param('op') || '';
41
41
42
42
43
our ($template, $loggedinuser, $cookie)
43
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
44
    = get_template_and_user({template_name => "admin/patron-attr-types.tt",
44
    {   template_name   => "admin/patron-attr-types.tt",
45
                 query => $input,
45
        query           => $input,
46
                 type => "intranet",
46
        type            => "intranet",
47
                 authnotrequired => 0,
47
        authnotrequired => 0,
48
                 flagsrequired => {parameters => 'parameters_remaining_permissions'},
48
        flagsrequired => { parameters => 'parameters_remaining_permissions' }
49
                 debug => 1,
49
    }
50
                 });
50
);
51
51
52
52
$template->param(script_name => $script_name);
53
$template->param(script_name => $script_name);
53
54
Lines 118-123 sub error_add_attribute_type_form { Link Here
118
    if ($input->param('opac_display')) {
119
    if ($input->param('opac_display')) {
119
        $template->param(opac_display_checked => 1);
120
        $template->param(opac_display_checked => 1);
120
    }
121
    }
122
    if ($input->param('opac_editable')) {
123
        $template->param(opac_editable_checked => 1);
124
    }
121
    if ($input->param('staff_searchable')) {
125
    if ($input->param('staff_searchable')) {
122
        $template->param(staff_searchable_checked => 1);
126
        $template->param(staff_searchable_checked => 1);
123
    }
127
    }
Lines 162-167 sub add_update_attribute_type { Link Here
162
166
163
    my $opac_display = $input->param('opac_display');
167
    my $opac_display = $input->param('opac_display');
164
    $attr_type->opac_display($opac_display);
168
    $attr_type->opac_display($opac_display);
169
    my $opac_editable = $input->param('opac_editable');
170
    $attr_type->opac_editable($opac_editable);
165
    my $staff_searchable = $input->param('staff_searchable');
171
    my $staff_searchable = $input->param('staff_searchable');
166
    $attr_type->staff_searchable($staff_searchable);
172
    $attr_type->staff_searchable($staff_searchable);
167
    my $authorised_value_category = $input->param('authorised_value_category');
173
    my $authorised_value_category = $input->param('authorised_value_category');
Lines 242-247 sub edit_attribute_type_form { Link Here
242
    if ($attr_type->opac_display()) {
248
    if ($attr_type->opac_display()) {
243
        $template->param(opac_display_checked => 1);
249
        $template->param(opac_display_checked => 1);
244
    }
250
    }
251
    if ($attr_type->opac_editable()) {
252
        $template->param(opac_editable_checked => 1);
253
    }
245
    if ($attr_type->staff_searchable()) {
254
    if ($attr_type->staff_searchable()) {
246
        $template->param(staff_searchable_checked => 1);
255
        $template->param(staff_searchable_checked => 1);
247
    }
256
    }
(-)a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css (+4 lines)
Lines 701-706 fieldset.action, div.action { Link Here
701
  width: auto;
701
  width: auto;
702
}
702
}
703
703
704
fieldset.rows li[aria-disabled="true"] {
705
    color: #999;
706
}
707
704
div.rows+div.rows {
708
div.rows+div.rows {
705
    margin-top : .6em;
709
    margin-top : .6em;
706
}
710
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-1 / +16 lines)
Lines 20-25 $(document).ready(function() { Link Here
20
    if ( $("#branches option:selected").length < 1 ) {
20
    if ( $("#branches option:selected").length < 1 ) {
21
        $("#branches option:first").attr("selected", "selected");
21
        $("#branches option:first").attr("selected", "selected");
22
    }
22
    }
23
24
    $("#opac_display").change( function() {
25
        if ( this.checked ) {
26
            $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
27
        } else {
28
            $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
29
        }
30
    } ).change();
23
} );
31
} );
24
//]]>
32
//]]>
25
</script>
33
</script>
Lines 123-128 $(document).ready(function() { Link Here
123
          [% END %]
131
          [% END %]
124
            <span>Check to display this attribute on a patron's details page in the OPAC.</span>
132
            <span>Check to display this attribute on a patron's details page in the OPAC.</span>
125
       </li>
133
       </li>
134
       <li><label for="opac_editable">Editable in OPAC: </label>
135
          [% IF ( opac_editable_checked ) %]
136
            <input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
137
          [% ELSE %]
138
            <input type="checkbox" id="opac_editable" name="opac_editable" />
139
          [% END %]
140
            <span>Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above, does not work with <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=PatronSelfRegistrationVerifyByEmail" target="_blank">PatronSelfRegistrationVerifyByEmail</a>.)</span>
141
       </li>
126
       <li><label for="staff_searchable">Searchable: </label>
142
       <li><label for="staff_searchable">Searchable: </label>
127
          [% IF ( staff_searchable_checked ) %]
143
          [% IF ( staff_searchable_checked ) %]
128
            <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
144
            <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
129
- 

Return to bug 13757