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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-8 / +7 lines)
Lines 242-248 legend:hover { Link Here
242
                            [% END %]
242
                            [% END %]
243
                            <!--    field always hidden in different form (1,2,3) -->
243
                            <!--    field always hidden in different form (1,2,3) -->
244
                            <input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField | html %]" />
244
                            <input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField | html %]" />
245
                            <input type="hidden" name="category_type" value="[% category_type | html %]" />
246
                            <input type="hidden" name="updtype" value="[% updtype | html %]" />
245
                            <input type="hidden" name="updtype" value="[% updtype | html %]" />
247
                            <input type="hidden" name="destination" value="[% destination | html %]" />
246
                            <input type="hidden" name="destination" value="[% destination | html %]" />
248
                            <input type="hidden" name="check_member" value="[% check_member | html %]" />
247
                            <input type="hidden" name="check_member" value="[% check_member | html %]" />
Lines 269-277 legend:hover { Link Here
269
                            [% IF ( step_1 ) %]
268
                            [% IF ( step_1 ) %]
270
                                [% UNLESS notitle && nosurname && nofirstname && nomiddle_name && nodateofbirth && noinitials && noothernames &&nosex %]
269
                                [% UNLESS notitle && nosurname && nofirstname && nomiddle_name && nodateofbirth && noinitials && noothernames &&nosex %]
271
                                    <fieldset class="rows" id="memberentry_identity">
270
                                    <fieldset class="rows" id="memberentry_identity">
272
                                        <legend id="identity_lgd">[% IF ( I ) %]<span>Organization</span> [% ELSE %]<span>Patron</span> [% END %]<span>identity</span></legend>
271
                                        <legend id="identity_lgd">[% IF ( patron_category.category_type == 'I' ) %]<span>Organization</span> [% ELSE %]<span>Patron</span> [% END %]<span>identity</span></legend>
273
                                        <ol>
272
                                        <ol>
274
                                            [% UNLESS ( I ) %]
273
                                            [% UNLESS ( patron_category.category_type == 'I' ) %]
275
                                                [% UNLESS notitle %]
274
                                                [% UNLESS notitle %]
276
                                                    [% IF Koha.Preference('BorrowersTitles') %]
275
                                                    [% IF Koha.Preference('BorrowersTitles') %]
277
                                                        <li>
276
                                                        <li>
Lines 301-307 legend:hover { Link Here
301
300
302
                                            [% UNLESS nosurname %]
301
                                            [% UNLESS nosurname %]
303
                                                <li>
302
                                                <li>
304
                                                    [% IF ( I ) %]
303
                                                    [% IF ( patron_category.category_type == 'I' ) %]
305
                                                        <label for="surname" class="required">
304
                                                        <label for="surname" class="required">
306
                                                            Name:
305
                                                            Name:
307
                                                        </label>
306
                                                        </label>
Lines 325-331 legend:hover { Link Here
325
                                                </li>
324
                                                </li>
326
                                            [% END # /UNLESS nosurname %]
325
                                            [% END # /UNLESS nosurname %]
327
326
328
                                            [% UNLESS ( I ) %]
327
                                            [% UNLESS ( patron_category.category_type == 'I' ) %]
329
                                                [% UNLESS nofirstname %]
328
                                                [% UNLESS nofirstname %]
330
                                                    <li>
329
                                                    <li>
331
                                                        [% IF ( mandatoryfirstname ) %]
330
                                                        [% IF ( mandatoryfirstname ) %]
Lines 404-414 legend:hover { Link Here
404
                                                    [% IF ( mandatoryothernames ) %]
403
                                                    [% IF ( mandatoryothernames ) %]
405
                                                        <span class="required">Required</span>
404
                                                        <span class="required">Required</span>
406
                                                    [% END %]
405
                                                    [% END %]
407
                                                    [% IF ( I ) %]<input type="hidden" name="sex" value="N" />[% END %]
406
                                                    [% IF ( patron_category.category_type == 'I' ) %]<input type="hidden" name="sex" value="N" />[% END %]
408
                                                </li>
407
                                                </li>
409
                                            [% END #/UNLESS noothernames %]
408
                                            [% END #/UNLESS noothernames %]
410
409
411
                                            [% UNLESS ( I ) %]
410
                                            [% UNLESS ( patron_category.category_type == 'I' ) %]
412
                                                [% UNLESS nosex %]
411
                                                [% UNLESS nosex %]
413
                                                    <li class="radio">
412
                                                    <li class="radio">
414
                                                        [% UNLESS ( opduplicate ) %]
413
                                                        [% UNLESS ( opduplicate ) %]
Lines 455-461 legend:hover { Link Here
455
                                                [% FOREACH r IN relationships %]
454
                                                [% FOREACH r IN relationships %]
456
                                                    <fieldset>
455
                                                    <fieldset>
457
                                                        <ol>
456
                                                        <ol>
458
                                                            [% IF category_type == 'I' %]
457
                                                            [% IF patron_category.category_type == 'I' %]
459
                                                                <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
458
                                                                <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
460
                                                                    <span class="label">Organization:</span>
459
                                                                    <span class="label">Organization:</span>
461
                                                                    [% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %]
460
                                                                    [% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %]
(-)a/members/memberentry.pl (-16 / +4 lines)
Lines 172-188 if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { Link Here
172
    }
172
    }
173
173
174
    $borrower_data = $patron->unblessed;
174
    $borrower_data = $patron->unblessed;
175
    $borrower_data->{category_type} = $patron->category->category_type;
176
}
175
}
177
176
178
my $categorycode  = $input->param('categorycode') || $borrower_data->{'categorycode'};
177
my $categorycode  = $input->param('categorycode') || $borrower_data->{'categorycode'};
179
my $category_type = $input->param('category_type') || '';
180
181
my $category = Koha::Patron::Categories->find($categorycode);
178
my $category = Koha::Patron::Categories->find($categorycode);
182
$category_type ||= $category && $category->category_type;
183
184
$category_type="A" unless $category_type; # FIXME we should display a error message instead of a 500 error !
185
186
$template->param( patron_category => $category );
179
$template->param( patron_category => $category );
187
180
188
# if a add or modify is requested => check validity of data.
181
# if a add or modify is requested => check validity of data.
Lines 212-218 if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) Link Here
212
    }
205
    }
213
206
214
    # check permission to modify login info.
207
    # check permission to modify login info.
215
    if (ref($borrower_data) && ($borrower_data->{'category_type'} eq 'S') && ! (C4::Auth::haspermission($userenv->{'id'},{'staffaccess'=>1})) )  {
208
    if (ref($borrower_data) && ($category->category_type eq 'S') && ! (C4::Auth::haspermission($userenv->{'id'},{'staffaccess'=>1})) )  {
216
        $NoUpdateLogin = 1;
209
        $NoUpdateLogin = 1;
217
    }
210
    }
218
}
211
}
Lines 222-228 if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) Link Here
222
    my @keys_to_delete = (
215
    my @keys_to_delete = (
223
        qr/^(borrowernumber|date_renewed|debarred|debarredcomment|flags|privacy|updated_on|lastseen|login_attempts|overdrive_auth_token|anonymized)$/, # Bug 28935
216
        qr/^(borrowernumber|date_renewed|debarred|debarredcomment|flags|privacy|updated_on|lastseen|login_attempts|overdrive_auth_token|anonymized)$/, # Bug 28935
224
        qr/^BorrowerMandatoryField$/,
217
        qr/^BorrowerMandatoryField$/,
225
        qr/^category_type$/,
226
        qr/^check_member$/,
218
        qr/^check_member$/,
227
        qr/^destination$/,
219
        qr/^destination$/,
228
        qr/^nodouble$/,
220
        qr/^nodouble$/,
Lines 297-310 $newdata{'lang'} = $input->param('lang') if defined($input->param('lang')) Link Here
297
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) {
289
if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) {
298
    my $fake_patron = Koha::Patron->new;
290
    my $fake_patron = Koha::Patron->new;
299
    $fake_patron->userid($patron->userid) if $patron; # editing
291
    $fake_patron->userid($patron->userid) if $patron; # editing
300
    if ( ( defined $newdata{'firstname'} || $category_type eq 'I' ) && ( defined $newdata{'surname'} ) ) {
292
    if ( ( defined $newdata{'firstname'} || $category->category_type eq 'I' ) && ( defined $newdata{'surname'} ) ) {
301
        # Full page edit, firstname and surname input zones are present
293
        # Full page edit, firstname and surname input zones are present
302
        $fake_patron->firstname($newdata{firstname});
294
        $fake_patron->firstname($newdata{firstname});
303
        $fake_patron->surname($newdata{surname});
295
        $fake_patron->surname($newdata{surname});
304
        $fake_patron->generate_userid;
296
        $fake_patron->generate_userid;
305
        $newdata{'userid'} = $fake_patron->userid;
297
        $newdata{'userid'} = $fake_patron->userid;
306
    }
298
    }
307
    elsif ( ( defined $data{'firstname'} || $category_type eq 'I' ) && ( defined $data{'surname'} ) ) {
299
    elsif ( ( defined $data{'firstname'} || $category->category_type eq 'I' ) && ( defined $data{'surname'} ) ) {
308
        # Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used
300
        # Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used
309
        # Still, if the userid field is erased, we can create a new userid with available firstname and surname
301
        # Still, if the userid field is erased, we can create a new userid with available firstname and surname
310
        # FIXME clean thiscode newdata vs data is very confusing
302
        # FIXME clean thiscode newdata vs data is very confusing
Lines 738-744 if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { Link Here
738
    $userbranch = C4::Context->userenv->{'branch'};
730
    $userbranch = C4::Context->userenv->{'branch'};
739
}
731
}
740
732
741
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category_type eq 'C' ) )) {
733
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category->category_type eq 'C' ) )) {
742
    $userbranch = $data{'branchcode'};
734
    $userbranch = $data{'branchcode'};
743
}
735
}
744
$template->param( userbranch => $userbranch );
736
$template->param( userbranch => $userbranch );
Lines 809-816 $template->param( step => $step ) if $step; # associate with step to know wh Link Here
809
801
810
$template->param(
802
$template->param(
811
  BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
803
  BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript
812
  category_type => $category_type,#to know the category type of the borrower
813
  "$category_type"  => 1,# associate with step to know where u are
814
  destination   => $destination,#to know where u come from and where u must go in redirect
804
  destination   => $destination,#to know where u come from and where u must go in redirect
815
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
805
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
816
  "op$op"   => 1);
806
  "op$op"   => 1);
Lines 822-828 $template->param( Link Here
822
  relshiploop => \@relshipdata,
812
  relshiploop => \@relshipdata,
823
  btitle=> $default_borrowertitle,
813
  btitle=> $default_borrowertitle,
824
  flagloop  => \@flagdata,
814
  flagloop  => \@flagdata,
825
  category_type =>$category_type,
826
  modify          => $modify,
815
  modify          => $modify,
827
  nok     => $nok,#flag to know if an error
816
  nok     => $nok,#flag to know if an error
828
  NoUpdateLogin =>  $NoUpdateLogin,
817
  NoUpdateLogin =>  $NoUpdateLogin,
829
- 

Return to bug 30874