|
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 |
- |
|
|