Topic: Shipment Module PHP Error

I have done a fresh, brand new install of Tracmor.  Initially things appear to be running smoothly.  However, when I click to the Admin > Shipping/Receiving OR Shipping > Schedule Shipment, I receive the following PHP Error and the page does not load:

==========================================

Error in PHP Script
/inventory/shipping/shipment_edit.php    PHP Version: 5.2.10-2ubuntu6.3;  Zend Engine Version: 2.2.0;  Qcodo Version: 0.3.32 (Qcodo Beta 3)
Application: Apache/2.2.12 (Ubuntu);  Server Name: systems.willowcreek.org
HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.43 Safari/532.5
Trying to get property of non-object
Error Type:   E_NOTICE   

Source File:   /var/www/inventory/includes/data_classes/TracmorSettings.class.php         Line:   46   

Line 41:                    ///////////////////
Line 42:   
Line 43:                    default:
Line 44:                        try {
Line 45:                            $objAdminSetting = AdminSetting::LoadByShortDescription(QConvertNotation::UnderscoreFromCamelCase($strName));
Line 46:                            return $objAdminSetting->Value;
Line 47:                        } catch (QCallerException $objExc) {
Line 48:                            $objExc->IncrementOffset();
Line 49:                            throw $objExc;
Line 50:                        }
Line 51:                }

Call Stack:

#0 /var/www/inventory/includes/data_classes/TracmorSettings.class.php(46): QcodoHandleError()
#1 /var/www/inventory/shipping/fedexdc.class.php(53): TracmorSettings->__get()
#2 /var/www/inventory/shipping/shipment_edit.php(28): require_once()

--------------------------------------------------------------------------------

Error in PHP Script
/inventory/admin/shipping_account_list.php    PHP Version: 5.2.10-2ubuntu6.3;  Zend Engine Version: 2.2.0;  Qcodo Version: 0.3.32 (Qcodo Beta 3)
Application: Apache/2.2.12 (Ubuntu);  Server Name: systems.willowcreek.org
HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.43 Safari/532.5
Trying to get property of non-object
Error Type:   E_NOTICE   

Rendered Page:   Click here to view contents able to be rendered

Source File:   /var/www/inventory/includes/data_classes/TracmorSettings.class.php         Line:   46   

Line 41:                    ///////////////////
Line 42:   
Line 43:                    default:
Line 44:                        try {
Line 45:                            $objAdminSetting = AdminSetting::LoadByShortDescription(QConvertNotation::UnderscoreFromCamelCase($strName));
Line 46:                            return $objAdminSetting->Value;
Line 47:                        } catch (QCallerException $objExc) {
Line 48:                            $objExc->IncrementOffset();
Line 49:                            throw $objExc;
Line 50:                        }
Line 51:                }

Call Stack:

#0 /var/www/inventory/includes/data_classes/TracmorSettings.class.php(46): QcodoHandleError()
#1 /var/www/inventory/admin/shipping_account_list.php(169): TracmorSettings->__get()
#2 /var/www/inventory/admin/shipping_account_list.php(76): ShippingAccountListForm->txtFedexGatewayUri_Create()
#3 /var/www/inventory/includes/qcodo/_core/qform/QFormBase.class.php(275): ShippingAccountListForm->Form_Create()
#4 /var/www/inventory/admin/shipping_account_list.php(347): QFormBase::Run()

Re: Shipment Module PHP Error

PHP Version:    5.2.10-2ubuntu6.3
MySql Version:    5.1.37
Qcodo Version:    0.3.32 (Qcodo Beta 3)
Build Date:    Mon Jun 15 23:24:41 PDT 2009

Re: Shipment Module PHP Error

My guess is you are receiving this error because you have not set your Default Company in the Admin module. Go to the Admin module, Shipping/Receiving section, and choose a Default Company (the first setting on that page). If no companies are listed, you will need to create one first in the Contacts module.

Let us know if that doesn't solve your problem.

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Shipment Module PHP Error

That's just it - when I go to the Admin module, Shipping/Receiving section, I get the PHP error and nothing is parsed on the page (see the second error above).  I have created contacts, but everything "Shipping" related turns up the PHP errors above.

Re: Shipment Module PHP Error

It looks like your `admin_setting` table is missing a required entry. Run the following SQL on your database:

SELECT * FROM admin_setting WHERE short_description = 'fedex_gateway_URI';

It should return one result. If it doesn't, run this SQL:

INSERT INTO admin_setting (short_description,value) VALUES ('fedex_gateway_URI',NULL);
Justin Sinclair

Got Inventory? Get Tracmor.

Re: Shipment Module PHP Error

Running that query returned:

setting_id: 3
short_description: fedex_gateway_URI
value: NULL

Appears to already be in the database table...next?

Re: Shipment Module PHP Error

Can you do a

SELECT * FROM admin_setting

and paste the results here?

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Shipment Module PHP Error

setting_id    short_description    value
            1    company_id    NULL
            2    image_upload_prefix    NULL
            3    fedex_gateway_URI    NULL
            4    company_logo    empty.gif
            5    packing_list_terms    NULL
            6    packing_list_logo    NULL
            7    min_asset_code    NULL
            8    fedex_account_id    NULL
            9    autodetect_tracking_numbers    NULL
            10    custom_shipment_numbers    NULL
            11    custom_receipt_numbers    NULL
            12    receive_to_last_location    NULL
            13    portable_pin_required    1
            14    user_limit    NULL

Re: Shipment Module PHP Error

Can you try manually setting your default company in the database? For example, if you have a company with company_id 1, run the following:

UPDATE admin_setting SET value = 1 WHERE short_description = 'company_id';
Justin Sinclair

Got Inventory? Get Tracmor.

Re: Shipment Module PHP Error

Ok - done.  Changed it to ID 9 - new SQL output below, still receiving PHP errors on shipping module:

    setting_id    short_description    value
            1    company_id    9
            2    image_upload_prefix    NULL
            3    fedex_gateway_URI    NULL
            4    company_logo    empty.gif
            5    packing_list_terms    NULL
            6    packing_list_logo    NULL
            7    min_asset_code    NULL
            8    fedex_account_id    NULL
            9    autodetect_tracking_numbers    NULL
            10    custom_shipment_numbers    NULL
            11    custom_receipt_numbers    NULL
            12    receive_to_last_location    NULL
            13    portable_pin_required    1
            14    user_limit    NULL

Re: Shipment Module PHP Error

In looking more closely at the error you're getting, it appears you have your php error_reporting setting (in php.ini) set to show run-time notices (E_NOTICE).  See in your error messages that the type is E_NOTICE. I would change this to E_ALL in your php.ini, and you should not get these messages any more.

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Shipment Module PHP Error

Well you at least sent me down the right direction here - in my php.ini, I was already set to error reporting E_ALL & ~E_NOTICE, thus not showing any E_NOTICE error messages.  E_ALL will display these error messages.  So, started digging through your code and in /includes/prepend.inc.php on line 260, you have set error_reporting to E_ALL, which will show E_NOTICE errors.

Changing "E_ALL" to "E_ALL & ~E_NOTICE" resolved this.  New line reads:

                       set_error_handler('QcodoHandleError', E_ALL & ~E_NOTICE);

This fixed the problem.