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

(-)a/C4/Members/AttributeTypes.pm (-4 / +28 lines)
Lines 40-45 my @attribute_types = C4::Members::AttributeTypes::GetAttributeTypes(); Link Here
40
my $attr_type = C4::Members::AttributeTypes->new($code, $description);
40
my $attr_type = C4::Members::AttributeTypes->new($code, $description);
41
$attr_type->code($code);
41
$attr_type->code($code);
42
$attr_type->description($description);
42
$attr_type->description($description);
43
$attr_type->mandatory($mandatory);
43
$attr_type->repeatable($repeatable);
44
$attr_type->repeatable($repeatable);
44
$attr_type->unique_id($unique_id);
45
$attr_type->unique_id($unique_id);
45
$attr_type->opac_display($opac_display);
46
$attr_type->opac_display($opac_display);
Lines 108-113 sub new { Link Here
108
109
109
    $self->{'code'} = shift;
110
    $self->{'code'} = shift;
110
    $self->{'description'} = shift;
111
    $self->{'description'} = shift;
112
    $self->{'mandatory'} = 0;
111
    $self->{'repeatable'} = 0;
113
    $self->{'repeatable'} = 0;
112
    $self->{'unique_id'} = 0;
114
    $self->{'unique_id'} = 0;
113
    $self->{'opac_display'} = 0;
115
    $self->{'opac_display'} = 0;
Lines 146-151 sub fetch { Link Here
146
148
147
    $self->{'code'}                      = $row->{'code'};
149
    $self->{'code'}                      = $row->{'code'};
148
    $self->{'description'}               = $row->{'description'};
150
    $self->{'description'}               = $row->{'description'};
151
    $self->{'mandatory'}                 = $row->{'mandatory'};
149
    $self->{'repeatable'}                = $row->{'repeatable'};
152
    $self->{'repeatable'}                = $row->{'repeatable'};
150
    $self->{'unique_id'}                 = $row->{'unique_id'};
153
    $self->{'unique_id'}                 = $row->{'unique_id'};
151
    $self->{'opac_display'}              = $row->{'opac_display'};
154
    $self->{'opac_display'}              = $row->{'opac_display'};
Lines 185-198 sub store { Link Here
185
                                         opac_display = ?,
188
                                         opac_display = ?,
186
                                         password_allowed = ?,
189
                                         password_allowed = ?,
187
                                         staff_searchable = ?,
190
                                         staff_searchable = ?,
188
                                         authorised_value_category = ?
191
                                         authorised_value_category = ?,
192
                                         mandatory = ?
189
                                     WHERE code = ?");
193
                                     WHERE code = ?");
190
    } else {
194
    } else {
191
        $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types 
195
        $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types 
192
                                        (description, repeatable, unique_id, opac_display, password_allowed,
196
                                        (description, repeatable, unique_id, opac_display, password_allowed,
193
                                         staff_searchable, authorised_value_category, code)
197
                                         staff_searchable, authorised_value_category, mandatory, code)
194
                                        VALUES (?, ?, ?, ?, ?,
198
                                        VALUES (?, ?, ?, ?, ?,
195
                                                ?, ?, ?)");
199
                                                ?, ?, ?, ? )");
196
    }
200
    }
197
    $sth->bind_param(1, $self->{'description'});
201
    $sth->bind_param(1, $self->{'description'});
198
    $sth->bind_param(2, $self->{'repeatable'});
202
    $sth->bind_param(2, $self->{'repeatable'});
Lines 201-207 sub store { Link Here
201
    $sth->bind_param(5, $self->{'password_allowed'});
205
    $sth->bind_param(5, $self->{'password_allowed'});
202
    $sth->bind_param(6, $self->{'staff_searchable'});
206
    $sth->bind_param(6, $self->{'staff_searchable'});
203
    $sth->bind_param(7, $self->{'authorised_value_category'});
207
    $sth->bind_param(7, $self->{'authorised_value_category'});
204
    $sth->bind_param(8, $self->{'code'});
208
    $sth->bind_param(8, $self->{'mandatory'});    
209
    $sth->bind_param(9, $self->{'code'});
205
    $sth->execute;
210
    $sth->execute;
206
211
207
}
212
}
Lines 243-248 sub description { Link Here
243
    @_ ? $self->{'description'} = shift : $self->{'description'};
248
    @_ ? $self->{'description'} = shift : $self->{'description'};
244
}
249
}
245
250
251
=head2 mandatory
252
253
=over 4
254
255
my $mandatory = $attr_type->mandatory();
256
$attr_type->mandatory($mandatory);
257
258
=back
259
260
Accessor.  The C<$mandatory> argument
261
is interpreted as a Perl boolean.
262
263
=cut
264
265
sub mandatory {
266
    my $self = shift;
267
    @_ ? $self->{'mandatory'} = ((shift) ? 1 : 0) : $self->{'mandatory'};
268
}
269
246
=head2 repeatable
270
=head2 repeatable
247
271
248
=over 4
272
=over 4
(-)a/admin/patron-attr-types.pl (-1 / +10 lines)
Lines 89-94 sub error_add_attribute_type_form { Link Here
89
89
90
    $template->param(description => $input->param('description'));
90
    $template->param(description => $input->param('description'));
91
91
92
    if ($input->param('mandatory')) {
93
        $template->param(mandatory_checked => 'checked="checked"');
94
    }
92
    if ($input->param('repeatable')) {
95
    if ($input->param('repeatable')) {
93
        $template->param(repeatable_checked => 'checked="checked"');
96
        $template->param(repeatable_checked => 'checked="checked"');
94
    }
97
    }
Lines 137-142 sub add_update_attribute_type { Link Here
137
        $attr_type->unique_id($unique_id);
140
        $attr_type->unique_id($unique_id);
138
    }
141
    }
139
142
143
    my $mandatory = $input->param('mandatory');
144
    $attr_type->mandatory($mandatory);
145
    warn "Mand: $mandatory";
140
    my $opac_display = $input->param('opac_display');
146
    my $opac_display = $input->param('opac_display');
141
    $attr_type->opac_display($opac_display);
147
    $attr_type->opac_display($opac_display);
142
    my $staff_searchable = $input->param('staff_searchable');
148
    my $staff_searchable = $input->param('staff_searchable');
Lines 202-208 sub edit_attribute_type_form { Link Here
202
208
203
    $template->param(code => $code);
209
    $template->param(code => $code);
204
    $template->param(description => $attr_type->description());
210
    $template->param(description => $attr_type->description());
205
211
warn "Attr->mand: " . $attr_type->mandatory();
212
    if ($attr_type->mandatory()) {
213
        $template->param(mandatory_checked => 'checked="checked"');
214
    }
206
    if ($attr_type->repeatable()) {
215
    if ($attr_type->repeatable()) {
207
        $template->param(repeatable_checked => 'checked="checked"');
216
        $template->param(repeatable_checked => 'checked="checked"');
208
    }
217
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (+7 lines)
Lines 325-330 span.problem { Link Here
325
	line-height : 1.7em;
325
	line-height : 1.7em;
326
}
326
}
327
327
328
328
fieldset {
329
fieldset {
329
	border : 2px solid #EEEEEE;
330
	border : 2px solid #EEEEEE;
330
	margin : 1em 1em 1em 0;
331
	margin : 1em 1em 1em 0;
Lines 392-397 div#reserves,div#checkouts { Link Here
392
	padding : 1em;
393
	padding : 1em;
393
}
394
}
394
395
396
span.renewals-disabled {
397
	color : #990000;
398
	font-weight : bold;
399
}
400
401
395
.tip {
402
.tip {
396
	font-size: 93%;
403
	font-size: 93%;
397
	color : Gray;
404
	color : Gray;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tmpl (+5 lines)
Lines 103-108 this feature on.</div> Link Here
103
           <input type="text" id="description" name="description" size="50" maxlength="250" 
103
           <input type="text" id="description" name="description" size="50" maxlength="250" 
104
                  value="<!-- TMPL_VAR name="description" escape="HTML" -->" />
104
                  value="<!-- TMPL_VAR name="description" escape="HTML" -->" />
105
       </li>
105
       </li>
106
       <li><label for="mandatory">Mandatory: </label>
107
            <input type="checkbox" id="mandatory" name="mandatory" <!-- TMPL_VAR name="mandatory_checked" --> />
108
            <span>Check to make this field required when creating or updating patron records.</span>
109
       </li>
110
106
       <li><label for="repeatable">Repeatable: </label>
111
       <li><label for="repeatable">Repeatable: </label>
107
            <input type="checkbox" id="repeatable" name="repeatable" <!-- TMPL_VAR name="repeatable_checked" --> <!-- TMPL_VAR name="repeatable_disabled" --> />
112
            <input type="checkbox" id="repeatable" name="repeatable" <!-- TMPL_VAR name="repeatable_checked" --> <!-- TMPL_VAR name="repeatable_disabled" --> />
108
            <span>Check to let a patron record have multiple values of this attribute.  
113
            <span>Check to let a patron record have multiple values of this attribute.  
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl (-4 / +10 lines)
Lines 135-143 Link Here
135
			<!-- TMPL_IF NAME="ERROR_short_password" -->
135
			<!-- TMPL_IF NAME="ERROR_short_password" -->
136
				<li id="ERROR_short_password">Password must be at least <!-- TMPL_VAR NAME="minPasswordLength" --> characters long.</li>
136
				<li id="ERROR_short_password">Password must be at least <!-- TMPL_VAR NAME="minPasswordLength" --> characters long.</li>
137
			<!-- /TMPL_IF -->
137
			<!-- /TMPL_IF -->
138
            <!-- TMPL_IF NAME="ERROR_extended_unique_id_failed" -->
138
                        <!-- TMPL_IF NAME="ERROR_extended_unique_id_failed" -->
139
                <li id="ERROR_extended_unique_id_failed">The attribute value 
139
                                <li id="ERROR_extended_unique_id_failed">The attribute value 
140
                    <!-- TMPL_VAR NAME="ERROR_extended_unique_id_failed" --> is already is use by another patron record.</li>
140
                                <!-- TMPL_VAR NAME="ERROR_extended_unique_id_failed" --> is already is use by another patron record.</li>
141
			<!-- /TMPL_IF -->
142
                        <!-- TMPL_IF NAME="ERROR_extended_mandatory" -->
143
                                <li id="ERROR_extended_mandatory">The additional attribute <!-- TMPL_VAR NAME="ERROR_extended_mandatory" --> is required.</li>
141
			<!-- /TMPL_IF -->
144
			<!-- /TMPL_IF -->
142
			</ul>
145
			</ul>
143
		</div>
146
		</div>
Lines 936-944 Link Here
936
        </tr>
939
        </tr>
937
        <!-- TMPL_LOOP NAME='patron_attributes' -->
940
        <!-- TMPL_LOOP NAME='patron_attributes' -->
938
        <tr>
941
        <tr>
939
            <td><!-- TMPL_VAR NAME="code" --> (<!-- TMPL_VAR NAME="description" -->)
942
            <td><span <!-- TMPL_IF NAME="mandatory" -->class="required"<!-- /TMPL_IF -->><!-- TMPL_VAR NAME="code" --> (<!-- TMPL_VAR NAME="description" -->)</span>
940
            </td>
943
            </td>
941
            <td>
944
            <td>
945
                <input type="hidden" id="<!-- TMPL_VAR NAME="form_id" -->_mandatory" name="<!-- TMPL_VAR NAME="form_id" -->_mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->" />
946
                <input type="hidden" id="<!-- TMPL_VAR NAME="form_id" -->_description" name="<!-- TMPL_VAR NAME="form_id" -->_description" value="<!-- TMPL_VAR NAME="description" ESCAPE="HTML" -->" />
942
                <input type="hidden" id="<!-- TMPL_VAR NAME="form_id" -->_code" name="<!-- TMPL_VAR NAME="form_id" -->_code" value="<!-- TMPL_VAR NAME="code" ESCAPE="HTML" -->" />
947
                <input type="hidden" id="<!-- TMPL_VAR NAME="form_id" -->_code" name="<!-- TMPL_VAR NAME="form_id" -->_code" value="<!-- TMPL_VAR NAME="code" ESCAPE="HTML" -->" />
943
                <!-- TMPL_IF NAME="use_dropdown" -->
948
                <!-- TMPL_IF NAME="use_dropdown" -->
944
                    <select id="<!-- TMPL_VAR NAME="form_id" -->" name="<!-- TMPL_VAR NAME="form_id" -->">
949
                    <select id="<!-- TMPL_VAR NAME="form_id" -->" name="<!-- TMPL_VAR NAME="form_id" -->">
Lines 963-968 Link Here
963
                    (Password: <input type="password" maxlength="64" value="<!-- TMPL_VAR NAME="password" -->"
968
                    (Password: <input type="password" maxlength="64" value="<!-- TMPL_VAR NAME="password" -->"
964
                           id="<!-- TMPL_VAR NAME="form_id" -->_password" name="<!-- TMPL_VAR NAME="form_id" -->_password" />)
969
                           id="<!-- TMPL_VAR NAME="form_id" -->_password" name="<!-- TMPL_VAR NAME="form_id" -->_password" />)
965
                <!-- /TMPL_IF -->
970
                <!-- /TMPL_IF -->
971
		<!-- TMPL_IF NAME="mandatory" --><span class="required">Required</span><!-- /TMPL_IF -->
966
            </td>
972
            </td>
967
            <td>
973
            <td>
968
                <a href="#" onclick="clear_entry(this); return false;">Clear</a>
974
                <a href="#" onclick="clear_entry(this); return false;">Clear</a>
(-)a/members/memberentry.pl (-3 / +8 lines)
Lines 269-274 if ($op eq 'save' || $op eq 'insert'){ Link Here
269
            push @errors, "ERROR_extended_unique_id_failed";
269
            push @errors, "ERROR_extended_unique_id_failed";
270
            $template->param(ERROR_extended_unique_id_failed => "$attr->{code}/$attr->{value}");
270
            $template->param(ERROR_extended_unique_id_failed => "$attr->{code}/$attr->{value}");
271
        }
271
        }
272
        if ( $attr->{mandatory} && !$attr->{value} ) {
273
            push @errors, "ERROR_extended_mandatory";
274
            $template->param(ERROR_extended_mandatory => "$attr->{code} ($attr->{description})");
275
        }
272
    }
276
    }
273
  }
277
  }
274
}
278
}
Lines 663-674 sub parse_extended_patron_attributes { Link Here
663
    my %dups = ();
667
    my %dups = ();
664
    foreach my $key (@patron_attr) {
668
    foreach my $key (@patron_attr) {
665
        my $value = $input->param($key);
669
        my $value = $input->param($key);
666
        next unless defined($value) and $value ne '';
667
        my $password = $input->param("${key}_password");
670
        my $password = $input->param("${key}_password");
668
        my $code     = $input->param("${key}_code");
671
        my $code     = $input->param("${key}_code");
672
        my $mandatory   = $input->param("${key}_mandatory");
673
        my $description = $input->param("${key}_description");
669
        next if exists $dups{$code}->{$value};
674
        next if exists $dups{$code}->{$value};
670
        $dups{$code}->{$value} = 1;
675
        $dups{$code}->{$value} = 1;
671
        push @attr, { code => $code, value => $value, password => $password };
676
        push @attr, { code => $code, value => $value, password => $password, mandatory => $mandatory, description => $description };
672
    }
677
    }
673
    return \@attr;
678
    return \@attr;
674
}
679
}
Lines 697-702 sub patron_attributes_form { Link Here
697
        my $entry = {
702
        my $entry = {
698
            code              => $attr_type->code(),
703
            code              => $attr_type->code(),
699
            description       => $attr_type->description(),
704
            description       => $attr_type->description(),
705
            mandatory         => $attr_type->mandatory(),
700
            repeatable        => $attr_type->repeatable(),
706
            repeatable        => $attr_type->repeatable(),
701
            password_allowed  => $attr_type->password_allowed(),
707
            password_allowed  => $attr_type->password_allowed(),
702
            category          => $attr_type->authorised_value_category(),
708
            category          => $attr_type->authorised_value_category(),
703
- 

Return to bug 4030