GallusMax / open-source-self-check

An OpenSource Selfcheck system that is FAST, intuitive and - Free Software! Enhancements against the code from code.google.com/p/open-source-self-check
GNU General Public License v3.0
6 stars 4 forks source link

Configure AO institution ID? #16

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
When doing a CKO, the permenant location is correct, but our states are based 
on institution id AO since we have floating collections.  I haven't found a way 
to configure that.  We would love to be able to have a single instance of SC 
running on a LAMP server, that could determine the CKO location based on IP 
ranges.  We have 20 locations with multiple self check machines at each location

What is the expected output? What do you see instead?
CKO location is always set to the default WCPL location rather than the actual 
location of the CKO.

What version of the product are you using? On what operating system?
1.2 currently we are running it on Ubuntu server 10.04.  I also have it running 
on WAMP on a Windows XP machine with the same result.

Please provide any additional information below.

Original issue reported on code.google.com by ash...@gmail.com on 18 May 2012 at 8:28

GoogleCodeExporter commented 8 years ago
A little tricky. Let me think about this one.

Original comment by kirkenda...@gmail.com on 22 May 2012 at 3:50

GoogleCodeExporter commented 8 years ago
Can you give me some examples of the ip ranges you'd be working with?

Original comment by kirkenda...@gmail.com on 22 May 2012 at 3:53

GoogleCodeExporter commented 8 years ago
Sure, but right now, even manually setting the location in the config.php does 
not change the CKO location.  I will email you our IP scheme

Original comment by ash...@gmail.com on 22 May 2012 at 4:06

GoogleCodeExporter commented 8 years ago
Library IP Scheme
   Library New Name Admin Subnet Public Subnet       Express Library -
Fayetteville St. 10.2.19.0 10.135.128.0 Olivia Raney 10.7.2.0
10.135.129.0 Athens
Dr. Lib 10.130.130.0 10.135.130.0 Cameron Village Lib. (Clark Ave)
10.130.131.0 10.135.131.0 Cary Lib. 10.130.132.0 10.135.132.0 Duraleigh Rd
Library 10.130.133.0 10.135.133.0 East Regional Library 10.130.134.0
10.135.134.0 Eva Perry Lib. 10.130.135.0 10.135.135.0 Fuquay Library
10.130.136.0 10.135.136.0 Greenroad Lib. 10.130.137.0 10.135.137.0 Holly
Springs Library 10.130.138.0 10.135.138.0 Leesville Library 10.130.139.0
10.135.139.0 North Reg. Lib. 10.130.140.0 10.135.140.0 RB Harrison Library
10.130.141.0 10.135.141.0 SE Regional Lib. 10.130.142.0 10.135.142.0 Southgate
Branch Lib. 10.130.143.0 10.135.143.0 Wake Forest Library 10.130.144.0
10.135.144.0 Wendell Library 10.130.145.0 10.135.145.0 West Regional
Library  10.130.146.0 10.135.146.0 Zebulon Lib. 10.130.147.0 10.135.147.0

Original comment by ash...@gmail.com on 22 May 2012 at 4:08

GoogleCodeExporter commented 8 years ago
For starters, it looks like there's a mistake in includes/sip2.php - line 137 
should be deleted or commented out as it overrides any custom location set 
during checkout.
so replace that line with this...

//$this->_addVarOption('AO',$this->AO);

Original comment by ericmelton1@gmail.com on 22 May 2012 at 4:14

GoogleCodeExporter commented 8 years ago
Ahh, yes now CKO location is working on a local config level.

Original comment by ash...@gmail.com on 22 May 2012 at 5:59

GoogleCodeExporter commented 8 years ago
So from the perspective of the server running the self-check does each place 
have a single ip or a range? Sorry, I can't tell from the list of IPs you sent.

Original comment by ericmelton1@gmail.com on 23 May 2012 at 2:54

GoogleCodeExporter commented 8 years ago
Each Library has a range, so:

ELF  subnet 10.135.28.0
ORL  subnet 10.135.129.0

etc.

Original comment by ash...@gmail.com on 23 May 2012 at 5:16

GoogleCodeExporter commented 8 years ago
I don't do networking stuff so excuse my ignorance... so does this mean that 
ELF, for example, might have ips ranging from 10.135.28.0 to 10.13.28.999?

Original comment by ericmelton1@gmail.com on 23 May 2012 at 6:20

GoogleCodeExporter commented 8 years ago
did you get this...

I don't do networking stuff so excuse my ignorance... so does this mean that 
ELF, for example, might have ips ranging from 10.135.28.0 to 10.13.28.999?

Original comment by ericmelton1@gmail.com on 4 Jun 2012 at 8:01

GoogleCodeExporter commented 8 years ago
Sorry, I did get this.  We have a bit of code in our VuFind install that is
determining what IP a request is coming from.  I am going to ask our
developer if he can modify that code to work in this case.  I will keep
this thread updated as work progresses.

Thanks so much.

Original comment by ash...@gmail.com on 5 Jun 2012 at 1:41

GoogleCodeExporter commented 8 years ago
php has a built-in function to find the requstor IP ($_SERVER['REMOTE_ADDR']). 
I can probably build you something to plug-in to config.php to set the location 
(AO) by ip. I just wondered if each location you listed was a single IP or a 
range and if it's a range does this mean that ELF, for example, might have ips 
ranging from 10.135.28.0 to 10.13.28.999?

Original comment by ericmelton1@gmail.com on 5 Jun 2012 at 2:15

GoogleCodeExporter commented 8 years ago
I believe it would be 10.135.28.0 to 10.135.28.255...

Original comment by ash...@gmail.com on 5 Jun 2012 at 2:19

GoogleCodeExporter commented 8 years ago
You can try plugging this at the end of config.php. This assumes that each 
location has a range of whatever is listed to .255 (e.g.  Express Library -
Fayetteville St. would have a range of 10.135.28.0 to 10.135.28.255)

$location['Express - Fayetteville St']='10.135.128.0';
$location['Olivia Raney']='10.135.129.0';
$location['Athens Dr']='110.135.130.0';
$location['Cameron Village (Clark Ave)']='10.135.131.0';
$location['Cary']='10.135.132.0';
$location['Duraleigh Rd']='10.135.133.0';
$location['East Regional']='10.135.134.0';
$location['Eva Perry']='10.135.135.0';
$location['Fuquay ']='10.135.136.0';
$location['Greenroad']='10.135.137.0';
$location['Holly Springs']='10.135.138.0';
$location['Leesville']='10.135.139.0';
$location['North Reg']='10.135.140.0';
$location['RB Harrison']='10.135.141.0';
$location['SE Regional']='10.135.142.0';
$location['Southgate Branch']='10.135.143.0';
$location['Wake Forest ']='10.135.144.0';
$location['Wendell']='10.135.145.0';
$location['West Regional']='10.135.146.0';
$location['Zebulon']='10.135.147.0';

foreach ($location as $key=>$val){
    $ip_start=$val;
    $ip_end=substr($ip_start,0,-1).'255';
    if(ip2long($ip_start)<=ip2long($_SERVER['REMOTE_ADDR']) && ip2long($ip_end)>=ip2long($_SERVER['REMOTE_ADDR'])){
        $sc_location=$key;
        break;
    }
} 

Original comment by ericmelton1@gmail.com on 5 Jun 2012 at 2:46

GoogleCodeExporter commented 8 years ago
did you try this?

Original comment by ericmelton1@gmail.com on 6 Jun 2012 at 8:59

GoogleCodeExporter commented 8 years ago
Thanks so much, it is working.  The only issue now, is that the stats are
not being reported to the mysql database.  They were working prior to
the additional code insertion.

Original comment by ash...@gmail.com on 7 Jun 2012 at 7:47

GoogleCodeExporter commented 8 years ago
How do you know it's working if there are no stats?

Original comment by ericmelton1@gmail.com on 7 Jun 2012 at 8:23

GoogleCodeExporter commented 8 years ago
I can see the cko location in Horizon

Original comment by ash...@gmail.com on 7 Jun 2012 at 8:27

GoogleCodeExporter commented 8 years ago
ok. before it was only showing the one cko location?

Original comment by ericmelton1@gmail.com on 7 Jun 2012 at 8:32

GoogleCodeExporter commented 8 years ago
Yes, that it is true.

Original comment by ash...@gmail.com on 7 Jun 2012 at 8:40

GoogleCodeExporter commented 8 years ago
In the list in config.php, can you try shortening the name of the location your 
testing from and see if that has any affect?

Original comment by ericmelton1@gmail.com on 7 Jun 2012 at 8:50

GoogleCodeExporter commented 8 years ago
I have allready changed all of the location names to the three letter
Horizon Code, so Leesville Community Library is LEE...

Original comment by ash...@gmail.com on 7 Jun 2012 at 8:56

GoogleCodeExporter commented 8 years ago
I moved the new code to near the top of the config file and the stats are
working again.

//========================== Site Rules ==============================
//$sc_location='ERL';//enter a name for the self-check's location (e.g.
'East Branch') to track transactions in your SIP2 logs (in Polaris this is
required and is the numeric organization ID)
$location['ELF']='10.135.128.0';
$location['ORL']='10.135.129.0';
$location['ADR']='110.135.130.0';
$location['CAM']='10.135.131.0';
$location['CRY']='10.135.132.0';
$location['DUR']='10.135.133.0';
$location['ERLl']='10.135.134.0';
$location['EVA']='10.135.135.0';
$location['FUQ']='10.135.136.0';
$location['GRE']='10.135.137.0';
$location['HSP']='10.135.138.0';
$location['LEE']='10.135.139.0';
$location['NOR']='10.135.140.0';
$location['RBH']='10.135.141.0';
$location['SER']='10.135.142.0';
$location['SGA']='10.135.143.0';
$location['WAK']='10.135.144.0';
$location['WEN']='10.135.145.0';
$location['WRL']='10.135.146.0';
$location['ZEB']='10.135.147.0';
foreach ($location as $key=>$val){
       $ip_start=$val;
       $ip_end=substr($ip_start,0,-1).'255';
       if(ip2long($ip_start)<=ip2long($_SERVER['REMOTE_ADDR']) &&
ip2long($ip_end)>=ip2long($_SERVER['REMOTE_ADDR'])){
       $sc_location=$key;
               break;
               }
}
$allow_manual_userid_entry=false;
$show_fines=true;
$show_available_holds=true;
$allow_email_receipts=false;
$display_php_errors='on'; //off or on
$hide_cursor_pointer=false; //hides default cursor pointer -should probably
set to true on live self check

Original comment by ash...@gmail.com on 8 Jun 2012 at 6:13

GoogleCodeExporter commented 8 years ago
Good! So everything is ok now right?

Original comment by ericmelton1@gmail.com on 8 Jun 2012 at 6:15

GoogleCodeExporter commented 8 years ago
Yes, thank you so much.  We would like more granular statistics, but I can
work on that.

Original comment by ash...@gmail.com on 8 Jun 2012 at 6:26

GoogleCodeExporter commented 8 years ago

Original comment by ericmelton1@gmail.com on 8 Jun 2012 at 6:39