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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+50 lines)
Lines 372-377 Link Here
372
                                            <legend>Guarantor information</legend>
372
                                            <legend>Guarantor information</legend>
373
373
374
                                            <span id="guarantor_relationships">
374
                                            <span id="guarantor_relationships">
375
                                            [% IF (!relationships) %]
376
                                                <li id="contact-details">
377
                                                    <span class="label">Patron #:</span>
378
                                                    [% IF guarantorid %]
379
                                                          [% IF logged_in_user.can_see_patron_infos( guarantor ) %]
380
                                                              <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorid | uri %]" target="blank">[% guarantorid | html %]</a>
381
                                                          [% ELSE %]
382
                                                              [% guarantorid | html %]
383
                                                       [% END %]
384
                                                       <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value="[% guarantorid | html %]" />
385
                                                    [% END %]
386
                                                </li>
387
                                                [% UNLESS nocontactname %]
388
                                                <li>
389
                                                    <label for="contactname">Surname: </label>
390
                                                    [% IF ( guarantorid ) %]
391
                                                          <span>[% contactname | html %]</span>
392
                                                          <input name="contactname" id="contactname" type="hidden" size="20" value="[% contactname | html %]" />
393
                                                    [% ELSE %]
394
                                                          <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
395
                                                    [% END %]
396
                                                </li>
397
                                                [% END %]
398
                                                [% UNLESS nocontactfirstname %]
399
                                                <li>
400
                                                    <label for="contactfirstname">First name: </label>
401
                                                    [% IF ( guarantorid ) %]
402
                                                          <span>[% contactfirstname | html %]</span>
403
                                                          <input name="contactfirstname" id="contactfirstname" type="hidden" size="20" value="[% contactfirstname | html %]" />
404
                                                    [% ELSE %]
405
                                                          <input name="contactfirstname" id="contactfirstname" type="text" size="20" value="[% contactfirstname | html %]" />
406
                                                    [% END %]
407
                                                </li>
408
                                               [% END %]
409
                                               [% IF ( relshiploop ) %]
410
                                               <li>
411
                                                    <label for="relationship">Relationship: </label>
412
                                                    <select name="relationship" id="relationship" >
413
                                                    [% FOREACH relshiploo IN relshiploop %]
414
                                                          [% IF ( relshiploo.selected ) %]
415
                                                              <option value="[% relshiploo.relationship | html %]" selected="selected" >[% relshiploo.relationship | html %]</option>
416
                                                          [% ELSE %]
417
                                                              <option value="[% relshiploo.relationship | html %]">[% relshiploo.relationship | html %]</option>
418
                                                          [% END %]
419
                                                    [% END %]
420
                                                    </select>
421
                                               </li>
422
                                               [% END %]
423
                                            [% ELSE %]
375
                                                [% FOREACH r IN relationships %]
424
                                                [% FOREACH r IN relationships %]
376
                                                    <fieldset class="rows">
425
                                                    <fieldset class="rows">
377
                                                        <ol>
426
                                                        <ol>
Lines 417-422 Link Here
417
                                                        </ol>
466
                                                        </ol>
418
                                                    </fieldset>
467
                                                    </fieldset>
419
                                                [% END # END relationships foreach %]
468
                                                [% END # END relationships foreach %]
469
                                            [% END %]
420
                                            </span> <!-- #/guarantor_relationships -->
470
                                            </span> <!-- #/guarantor_relationships -->
421
471
422
                                            <fieldset class="rows guarantor" id="guarantor_template">
472
                                            <fieldset class="rows guarantor" id="guarantor_template">
(-)a/members/memberentry.pl (-15 / +43 lines)
Lines 83-88 if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) { Link Here
83
    $template->param( sms_providers => \@providers );
83
    $template->param( sms_providers => \@providers );
84
}
84
}
85
85
86
my $guarantorid    = $input->param('guarantor_id');
86
my $actionType     = $input->param('actionType') || '';
87
my $actionType     = $input->param('actionType') || '';
87
my $modify         = $input->param('modify');
88
my $modify         = $input->param('modify');
88
my $delete         = $input->param('delete');
89
my $delete         = $input->param('delete');
Lines 98-123 $nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate'); # FIXME hack to rep Link Here
98
                                     # isn't a duplicate.  Marking FIXME because this
99
                                     # isn't a duplicate.  Marking FIXME because this
99
                                     # script needs to be refactored.
100
                                     # script needs to be refactored.
100
my $nok           = $input->param('nok');
101
my $nok           = $input->param('nok');
102
my $guarantorinfo = $input->param('guarantorinfo');
101
my $step          = $input->param('step') || 0;
103
my $step          = $input->param('step') || 0;
102
my @errors;
104
my @errors;
103
my $borrower_data;
105
my $borrower_data;
104
my $NoUpdateLogin;
106
my $NoUpdateLogin;
105
my $userenv = C4::Context->userenv;
107
my $userenv = C4::Context->userenv;
106
108
107
## Deal with guarantor stuff
108
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
109
110
my $guarantor_id = $input->param('guarantor_id');
111
my $guarantor = undef;
112
$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id;
113
$template->param( guarantor => $guarantor );
114
115
my @delete_guarantor = $input->multi_param('delete_guarantor');
116
foreach my $id ( @delete_guarantor ) {
117
    my $r = Koha::Patron::Relationships->find( $id );
118
    $r->delete() if $r;
119
}
120
121
## Deal with debarments
109
## Deal with debarments
122
$template->param(
110
$template->param(
123
    debarments => scalar GetDebarments( { borrowernumber => $borrowernumber } ) );
111
    debarments => scalar GetDebarments( { borrowernumber => $borrowernumber } ) );
Lines 248-253 if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) Link Here
248
    }
236
    }
249
}
237
}
250
238
239
240
241
## Deal with guarantor stuff
242
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
243
my $guarantor_id = $input->param('guarantor_id');
244
my $guarantor = undef;
245
$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id;
246
$template->param( guarantor => $guarantor );
247
248
# Pre-fill guarantor fields if adding a guarantee to guarantor record using 'Add guarantee' button
249
# in this case the guarantee patron record does not already exist
250
251
if (!$patron) {
252
    if ( $guarantorid ) {
253
       if (my $guarantor = Koha::Patrons->find( $guarantorid )) {
254
           my $guarantordata = $guarantor->unblessed;
255
           $categorycode = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C';
256
           $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'};
257
           $newdata{'contactfirstname'}= $guarantordata->{'firstname'};
258
           $newdata{'contactname'}     = $guarantordata->{'surname'};
259
           $newdata{'contacttitle'}    = $guarantordata->{'title'};
260
           if ( $op eq 'add' ) {
261
             foreach (qw(streetnumber address streettype address2
262
               zipcode country city state phone phonepro mobile fax email emailpro branchcode
263
               B_streetnumber B_streettype B_address B_address2
264
               B_city B_state B_zipcode B_country B_email B_phone)) {
265
                    $newdata{$_} = $guarantordata->{$_};
266
             }
267
           }
268
       }
269
    }
270
}
271
272
my @delete_guarantor = $input->multi_param('delete_guarantor');
273
foreach my $id ( @delete_guarantor ) {
274
    my $r = Koha::Patron::Relationships->find( $id );
275
    $r->delete() if $r;
276
}
277
251
# Test uniqueness of surname, firstname and dateofbirth
278
# Test uniqueness of surname, firstname and dateofbirth
252
if ( ( $op eq 'insert' ) and !$nodouble ) {
279
if ( ( $op eq 'insert' ) and !$nodouble ) {
253
    my $conditions;
280
    my $conditions;
Lines 784-794 $template->param( Link Here
784
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
811
  check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
785
  "op$op"   => 1);
812
  "op$op"   => 1);
786
813
814
$guarantorid = $borrower_data->{'guarantorid'} || $guarantorid;
787
$template->param(
815
$template->param(
788
  patron => $patron ? $patron : \%newdata, # Used by address include templates now
816
  patron => $patron ? $patron : \%newdata, # Used by address include templates now
789
  nodouble  => $nodouble,
817
  nodouble  => $nodouble,
790
  borrowernumber  => $borrowernumber, #register number
818
  borrowernumber  => $borrowernumber, #register number
791
  relshiploop => \@relshipdata,
819
  relshiploop => \@relshipdata,
820
  guarantorid => $guarantorid,
792
  btitle=> $default_borrowertitle,
821
  btitle=> $default_borrowertitle,
793
  flagloop  => \@flagdata,
822
  flagloop  => \@flagdata,
794
  category_type =>$category_type,
823
  category_type =>$category_type,
795
- 

Return to bug 23808