21288 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1058 Views |
-
Extending SideReport - Class not found

11 June 2010 at 2:09am Last edited: 11 June 2010 2:10am
Hello
I'm trying to extend SideReport to create a custom report. Here is my code
Also note this is using a clean install of SS 2.4
RentalRequestReport.php located in mysite/code
<?php
/*
* Custom report class for Rental Requests
*/class RentalRequestReport extends SideReport {
function title() {
return 'Rental Requests';
}
function records() {
return DataObject::get("BookingFormSubmission", "", "LastName");
}
function fieldsToShow(){
return array(
'FirstName' => array('NestedTitle', array('2')),
);
}
}?>
and in my _config.php file i have
SS_Report::register('SideReport', 'RentalRequestReport');
this is the error I receive when trying to load the SS CMS
Fatal error: Class 'SideReport' not found in *directory* on line 7
*directory was added by me for clients privacyI was reading in the change log that SideReport was removed "Removed SideReport class, use SSReport as the base-class for them instead"
I tried using SSReport instead but same error.
Am I missing something?
-
Re: Extending SideReport - Class not found

11 June 2010 at 3:36am
I think I have it figured out
Used SS_Report and not getting the error.
-
Re: Extending SideReport - Class not found

11 June 2010 at 4:16am
okay making some progress, but still having problems. Right now I have this
RentalRequestReport.php in mysite/code
<?php
/*
* Custom report class for Rental Requests
*/class RentalRequestReport extends SS_Report {
function title() {
return 'Rental Requests';
}
function description() {
return 'All Rental Requests';
}
function records() {
return DataObject::get('BookingFormSubmission', NULL, 'LastName');
}
function fieldsToShow(){
return array(
'FirstName' => array('NestedTitle', array('2')),
);
}
}?>
and in my _config.php
SS_Report::register('ReportAdmin', 'RentalRequestReport', 1);
The report shows, but when i click on it it just shows the "error loading page" and won't show anything.
I think i need to do something with columns()? but not sure what to do with it.
-
Re: Extending SideReport - Class not found

11 June 2010 at 5:44am
Success. I have the initial functionality I was looking for. For anybody who is interested...
RentalRequestReport.php in mysite/code
<?php
/**
* An extension to {@link SSReport} that allows a user to view all booking requets
*//**
*Gets all Rental Requests
*
*/
class RentalRequestReport extends SS_Report {
function title() {
return 'Rental Requests';
}
function description() {
return 'All Rental Requests';
}
function sourceQuery($params){
$sqlQuery = new SQLQuery();
$sqlQuery->from = array('BookingFormSubmission');
$sqlQuery->orderby = 'LastName';
return $sqlQuery;
}
function columns() {
$columns['LastName'] = array(
'title' => 'Last name',
);
$columns['FirstName'] = array(
'title' => 'First name',
);$columns['Email'] = array(
'title' => 'Email',
);
$columns['PhoneNumber'] = array(
'title' => 'Phone number',
);
$columns['ArrivalDate'] = array(
'title' => 'Arrival date',
);
$columns['DepartureDate'] = array(
'title' => 'Departure date',
);
$columns['Guests'] = array(
'title' => 'Guests',
);
$columns['AdditionalQuestions'] = array(
'title' => 'Questions',
);
return $columns;
}
}?>
| 1058 Views | ||
|
Page:
1
|
Go to Top |

