#!/usr/bin/perl #script to do a borrower enquiry/bring up borrower details etc #written 20/12/99 by chris@katipo.co.nz # Copyright 2000-2002 Katipo Communications # Copyright 2013 BibLibre # # This file is part of Koha. # # Koha is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # Koha is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Koha; if not, see <http://www.gnu.org/licenses>. use CGI; use C4::Auth; use C4::Output; use C4::Items; use C4::Context; use LWP::Simple; #use XML::Simple; use XML::Parser; use Data::Dumper; use C4::Members; #use LWP::UserAgent; use C4::Branch qw(GetBranches); use utf8; my $input = new CGI; my $remoteip= $input->remote_host(); my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "members/addfromsisi.tt" +, query => $input, type => "intranet", authnotrequired => 0, flagsrequired => {borrowers => 1}, }); my $rfid= $input->param('rfid'); my $op= $input->param('op'); # request my $ua = LWP::UserAgent->new; my $response = $ua->get("https://***************/studentservic +e/service.asmx/give_to_koha_byStudentCard?cardNR=$rfid&ip=$remoteip") +; my $xml=$response->content; my $xs = new XML::Simple(keeproot =>0,searchpath => ".",forcea +rray => 1,); my $ref = $xs->XMLin($xml); my $firstname=${$ref->{firstname}}[0]; my $lastname=${$ref->{lastname}}[0]; my $sisiid=${$ref->{sisiid}}[0]; my $school=${$ref->{school}}[0]; my $program=${$ref->{program}}[0]; my $registerNr=${$ref->{registerNr}}[0]; my $userStatus=${$ref->{userStatus}}[0]; my $usertype=${$ref->{usertype}}[0]; my $photo=${$ref->{photo}}[0]; my $branch=${$ref->{abbrevm}}[0]; my $op= $input->param('op'); # save when op= "save" my %newdata; if($op eq "save"){ %newdata =("cardnumber"=>"$rfid", "surname"=>"$lastname", "firstname"=>"$firstname", "initials"=>"$registerNr", "address"=>"$program", "userid"=>"$sisiid", "categorycode"=>'ST', "branchcode"=>'EZS', "password"=>'aaaaaaa' ); my $borrowernumber=&AddMember(%newdata); #PutPatronImage('aaaaaaaaa', 'image/jpeg', $imgfile); if (defined $borrowernumber) { my $q = new CGI; print $q->redirect(-uri=>"moremember.pl?borrowernumber +=$borrowernumber"); } }# save end $template->param( rfid=>$rfid, photo=>$photo, firstname=>$firstname, lastname=>$lastname, sisiid=>$sisiid, school=>$branch, program=>$program, registerNr=>$registerNr, userStatus=>$userStatus, usertype=>$usertype, remoteip=>$remoteip, op=>$op, res=> $imgfile, ); output_html_with_http_headers $input, $cookie, $template->output;
In reply to Re^4: {KOHA}Parse XML and assign to variables.
by scolife
in thread {KOHA}Parse XML and assign to variables.
by scolife
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |