Hello Laurentiu,
your analysis is very correct. The problem lies on the $pid.
Actually I also found that out just yesterday and made a work-around. This is
of course not the cleanest way on the face of software engineering practices
but it works.
Here is the patched file. Sorry for breaking our informal rule of not
attaching any file to mailing list posts, but since the file is quite small,
the urgency of the matter outweighs this slight violation :-)
Just replace the file and it should work. This file will also be available on
the CVS soon.
To all others who have installed D2.1 and got this annoying error (error when
trying to make a new appointment), please replace the
/modules/registration_admission/show_appointment.php file with the one
attached here.
Regards,
Elpidio
On Wednesday 20 October 2004 03:28, Laurentiu Drob wrote:
> Hi all,
>
> Sorry to bother you again, but doing some tests
> I've found that problem is related to $pid variable.
> The Appointments link
> [http://192.168.1.11/care2x/modules/registration_admission/show_appointment
>.php?ntid=false&lang=en&pid=10000002&target=search] from 'Options for this
> person' table send pid variable
> to script, meanwhile the 'Schedule New Appointment'
> link [
> http://192.168.1.11/care2x/modules/registration_admission/show_appointment.
>php?ntid=false&lang=en&target=search&mode=new ] doesn't, so the $pid value
> in this case is empty or
> null or whatever. This means that $person_obj variable
> has an unknown value due line 33 from
> /var/www/htdocs/care2x/modules/registration_admission/include/init_show.php
>: ...
> if(isset($pid) && ($pid!='')) {
> $person_obj=new Person($pid);
> ...
>
> Then the reference to $person_obj member from line 60
> of the same file [init_show.php] is a "Call to a
> member function on a non-object"
>
> ...
> # Check if person is currently admitted
> $current_encounter=$person_obj->CurrentEncounter($pid);
> ...
>
> Line numbers may not be accurate due some lines [ echo
> 'Pid=$pid; ... ] introduced to display some variables.
> OK, so if I'm wrong or right please let me know. I
> trully want to get rid of this error.
>
> Regards,
> lwd.
>
>
>
>
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Care2002-developers mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/care2002-developers
<?php
//error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
require('./roots.php');
require($root_path.'include/inc_environment_global.php');
/**
* CARE2X Integrated Hospital Information System beta 2.0.1 - 2004-07-04
* GNU General Public License
* Copyright 2002,2003,2004,2005 Elpidio Latorilla
* [EMAIL PROTECTED],
*
* See the file "copy_notice.txt" for the licence notice
*/
$thisfile=basename(__FILE__);
require_once($root_path.'include/care_api_classes/class_appointment.php');
$obj=new Appointment();
//$db->debug=true;
$bPastDateError = FALSE;
#
# Save PID to session. Patch as result of bug report from Francesco and Marco.
#
if((!isset($pid)||!$pid)&&$HTTP_SESSION_VARS['sess_pid'])
$pid=$HTTP_SESSION_VARS['sess_pid'];
elseif(isset($pid)&&$pid) $HTTP_SESSION_VARS['sess_pid']=$pid;
if(!isset($mode)){
$mode='show';
} else{
#
# Validate date against past date
#
if($mode=='create'||$mode=='update') {
include_once($root_path.'include/inc_date_format_functions.php');
$HTTP_POST_VARS['date'[EMAIL
PROTECTED]($HTTP_POST_VARS['date'],$date_format);
$sBufDate = (int) str_replace('-','',$HTTP_POST_VARS['date']);
$sBufToday = (int) date('Ymd');
$sBufDate = ($sBufDate - $sBufToday);
#
# If date in the past, force mode to "select" and erase date data
#
if($sBufDate < 0 ){
$bPastDateError = TRUE;
$mode = 'select';
$date = '';
}
}
if($mode=='create'||$mode=='update') {
$HTTP_POST_VARS['time'[EMAIL PROTECTED]($HTTP_POST_VARS['time']);
if($mode=='update'){
if(!isset($HTTP_POST_VARS['remind_mail']))
$HTTP_POST_VARS['remind_mail']='0';
if(!isset($HTTP_POST_VARS['remind_email']))
$HTTP_POST_VARS['remind_email']='0';
if(!isset($HTTP_POST_VARS['remind_phone']))
$HTTP_POST_VARS['remind_phone']='0';
$HTTP_POST_VARS['modify_id']=$HTTP_SESSION_VARS['sess_user_name'];
$HTTP_POST_VARS['modify_time'] = date('YmdHis');
$HTTP_POST_VARS['history']= $obj->ConcatHistory("Update:
".date('Y-m-d H:i:s')." : ".$HTTP_SESSION_VARS['sess_user_name']."\n");
}else{
$HTTP_POST_VARS['appt_status']='pending';
$HTTP_POST_VARS['create_id']=$HTTP_SESSION_VARS['sess_user_name'];
$HTTP_POST_VARS['create_time'] = date('YmdHis');
$HTTP_POST_VARS['history'] = "Created: ".date('Y-m-d H:i:s')."
".$HTTP_SESSION_VARS['sess_user_name']."\n";
}
include('./include/save_admission_data.inc.php');
}elseif(($mode=='select')&&!empty($nr)){
$appt_row=$obj->getAppointment($nr);
if(is_array($appt_row)){
extract($appt_row);
//while(list($x,$v)=each($appt_row)) $$x=$v;
}
}elseif($mode=='appt_cancel'&&!empty($nr)){
$HTTP_POST_VARS['history']=$obj->ConcatHistory("Cancel:
".date('Y-m-d H:i:s')." : ".$HTTP_SESSION_VARS['sess_user_name']."\n");
$HTTP_POST_VARS['appt_status']='cancelled';
$HTTP_POST_VARS['cancel_reason']=$reason;
$HTTP_POST_VARS['modify_id']=$HTTP_SESSION_VARS['sess_user_name'];
$HTTP_POST_VARS['modify_time'] = date('YmdHis');
$mode='update';
include('./include/save_admission_data.inc.php');
}
}
$lang_tables=array('prompt.php','departments.php');
require('./include/init_show.php');
if($result=&$obj->getPersonsAppointmentsObj($pid)){
$rows=$result->RecordCount();
}
# Load the encounter classes
require_once($root_path.'include/care_api_classes/class_encounter.php');
$enc_obj=new Encounter;
/* Get all encounter classes */
$encounter_classes=&$enc_obj->AllEncounterClassesObject();
$subtitle=$LDAppointments;
$HTTP_SESSION_VARS['sess_file_return']=$thisfile;
/* Load departments */
require_once($root_path.'include/care_api_classes/class_department.php');
$dept_obj=new Department;
$deptarray=$dept_obj->getAllMedical('name_formal');
$buffer=str_replace('~tag~',$title.' '.$name_last,$LDNoRecordYet);
$norecordyet=str_replace('~obj~',strtolower($subtitle),$buffer);
/* Load GUI page */
require('./gui_bridge/default/gui_show.php');
?>