This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

tech.computeraid55120
tech.computeraid55120

Hi friends,

I am a beginner to PHP, MVC, Laravel and OctoberCMS though its been an amazing learning experience. Way to Go OctoberCMS Team & Contributors !

Please excuse my query if I churn out a stupid query.

Here goes ....

I have developed a Plugin called ERP in which I am performing Ticket Management by LAITUS (Level, Area, Importance, Type, User, Status).

Query # 1 : How do I apply Validation in the Date Range Filter so that the user cannot specify an After Date > Before Date ?

Query # 2 : My Migration definitions for SLAIT (Status, Level, Area, Importance, & Type) are identical - ['id','title','sort_order']. I use status.title,level.title in nameFrom in config_filter.yaml. Only the first Filter 'Status' works fine but after I have applied this filter, when I try to apply the second, third, etc. filters, I get below error -

Error

"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and daf_erp_ticket.deleted_at is null' at line 1 (SQL: select count(*) as aggregate from daf_erp_ticket where status_id in ('1') and level_id in ('2')) and daf_erp_ticket.deleted_at is null)" on line 664 of /home/computeraid/public_html/erp/vendor/laravel/framework/src/Illuminate/Database/Connection.php

Before I used status.title and level.title in nameFrom, the error that I got and what I could gather from the Forum is that this was a whitespace character issue which I was unable to understand. Post using status.title and level.title in nameFrom, I am getting the above error.

Unable to catch my error. Humble request for another pair of eyes to please help me.

Query # 3: I have utilized the Backend User Model to implement User Management as this has a good Permission Management System. Allows me to show Employee Tickets to corresponding Employees (as well as the Managers) and also to allow Managers to Perform Employee Ticket Management in addition to their own. However, I am currently allowing Employees to Create Tickets for Managers even though the created ticket will not be visible to them. The question is in case I want to restrict the Employee to Create a Ticket for their Managers, how do I disable the User Drop Down in my Create Ticket Form for Employees with a default value of their own User Id ? so that they are by default allowed to create Tickets only for themselves ?

Query # 4: I have tried to use concat('first_name',' ','last_name') but I am not getting through. I am only able to get the first_name in both the Drop Downs in the Create Ticket Form and the User Filter.

config.yaml

user: label: daf.erp::lang.ticket.backenduser modelClass: Daf\Erp\Models\Ticket conditions: backenduser_id in (:filtered) nameFrom: backenduser.first_name options: getBackendUserOptions

Ticket Model (For Drop Down)

public function getBackEndUserIDOptions($backenduser_value, $backenduser_data) {
    return BackendUser::where('id', '!=', array_get($backenduser_data, 'first_name'))->lists('first_name', 'id');
}

Ticket Model (For Filter)

public function getBackendUserOptions() {
    return BackendUser::lists('first_name','id');
}

Query # 5: I understand that I am going against the DRY rule but for some reason I was not able to implement one method for both the Drop Down and the Filter. Can I do this ? If yes, how ?

Please let me know if you need any information from me.

Regards, David

Last updated

tech.computeraid55120
tech.computeraid55120

Got this to work in the List (config_list.yaml) but not in the Filter Options nor in the Create Ticket Drop Down. concat(first_name,' ',last_name) I had used single quotes incorrectly for first_name and last_name. My bad !

tech.computeraid55120
tech.computeraid55120

Changed 'title' for SLAIT records to 'status_title', 'type_title,..., and so on but no change. My Status filter is working fine in the list but LAIT filters give me the same sql error. Dunno why. The query seems correct to me. What am I missing / overlooking ?

tech.computeraid55120
tech.computeraid55120

Aahhhh ... Fixed the filter issue...had an extra ) in the config_filter.yaml after each LAIT condition.

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.