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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +51 lines)
Lines 325-331 Link Here
325
        <legend>Guarantor information</legend>
325
        <legend>Guarantor information</legend>
326
326
327
        <span id="guarantor_relationships">
327
        <span id="guarantor_relationships">
328
            [% FOREACH r IN relationships %]
328
        [% IF (!relationships) %]
329
            <li id="contact-details">
330
                <span class="label">Patron #:</span>
331
                [% IF guarantorid %]
332
                    [% IF logged_in_user.can_see_patron_infos( guarantor ) %]
333
                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorid | uri %]" target="blank">[% guarantorid | html %]</a>
334
                    [% ELSE %]
335
                        [% guarantorid | html %]
336
                    [% END %]
337
                    <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value="[% guarantorid | html %]" />
338
                [% END %]
339
           </li>
340
           [% UNLESS nocontactname %]
341
           <li>
342
                <label for="contactname">Surname: </label>
343
                [% IF ( guarantorid ) %]
344
                    <span>[% contactname | html %]</span>
345
                    <input name="contactname" id="contactname" type="hidden" size="20" value="[% contactname | html %]" />
346
                [% ELSE %]
347
                    <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
348
                [% END %]
349
           </li>
350
           [% END %]
351
           [% UNLESS nocontactfirstname %]
352
           <li>
353
                <label for="contactfirstname">First name: </label>
354
                [% IF ( guarantorid ) %]
355
                    <span>[% contactfirstname | html %]</span>
356
                    <input name="contactfirstname" id="contactfirstname" type="hidden" size="20" value="[% contactfirstname | html %]" />
357
                [% ELSE %]
358
                    <input name="contactfirstname" id="contactfirstname" type="text" size="20" value="[% contactfirstname | html %]" />
359
                [% END %]
360
           </li>
361
           [% END %]
362
           [% IF ( relshiploop ) %]
363
           <li>
364
                <label for="relationship">Relationship: </label>
365
                <select name="relationship" id="relationship" >
366
                [% FOREACH relshiploo IN relshiploop %]
367
                    [% IF ( relshiploo.selected ) %]
368
                        <option value="[% relshiploo.relationship | html %]" selected="selected" >[% relshiploo.relationship | html %]</option>
369
                    [% ELSE %]
370
                        <option value="[% relshiploo.relationship | html %]">[% relshiploo.relationship | html %]</option>
371
                    [% END %]
372
                [% END %]
373
                </select>
374
           </li>
375
           [% END %]
376
        [% ELSE %]
377
           [% FOREACH r IN relationships %]
329
                <fieldset class="rows">
378
                <fieldset class="rows">
330
                    <ol>
379
                    <ol>
331
                        [% IF category_type == 'I' %]
380
                        [% IF category_type == 'I' %]
Lines 370-375 Link Here
370
                    </ol>
419
                    </ol>
371
                </fieldset>
420
                </fieldset>
372
            [% END # END relationships foreach %]
421
            [% END # END relationships foreach %]
422
        [% END %]
373
        </span>
423
        </span>
374
424
375
        <fieldset class="rows guarantor" id="guarantor_template">
425
        <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