birekmek.com, our last project at company, was very strange and interest project. The aim of project is choice best supplier for customers. At this project we use a lot of list and flow cart. Lets give some example;
Member Status
- Pending: give email and username waiting activation email
- Activation: click the activation mail and actived profile
- Approved: admin approved the user
- Block: admin blocked the user
Order Status
- sms: waiting sms activation code
- create: when order starts
- preparation: when system decides the supplier
- shipping: when supplier starts shipping
- delivery: when delivery is finised
- noservice: If no supplier accepts the order
- norouting: ıf there isn’t any available supplier
- nothouse: customer isn’t at house
- notaccept: customer doesn’t accept the good or service
- cancel: order is canceled
At this project the main problem is our customer, owner of project, want to having right change each resource at admin panel. Normally system knows the flow charts but admin may be not know because system is computer but admin is human. So we need to check admin’s choices right options.
Lets give details examples;
- User want to sign up so he/she fills the form and waits mail. Now his/her statu is pending. He/she can pass activation, block not approved.
- User clicks the activation mail. Now his/her statu is activation. Status can pass approved, block not pending becaouse we check the email.
Simple we can say that status can pass all other. There is a rule.
- Customer wanna give order. If his/her first order, we sent SMS. Now order statu is sms. After sms status, order’s statu can pass create or cancel
- After preparation status, order can’t cancel because system make a deal with between customer and supplier at that moment.
So if system’s admin wanna change order status from preparation to create or cancel. System couldn’t be calculate statistics right. This is the main problem! What is the solution?
I have wrote classes, Kebab_List overs this problem. The solution is simple we write a rules array and manage the passing between status. First how to use?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Get all rules
1 2 3 4 5 6 7 | |
Check rights
1 2 3 | |
Check the items exist
1 2 | |
Set item
1 2 3 | |
Get item
1 2 | |
In the future i want to integrate this classes with Kebab_Translate helper and Doctrine enum data type.
Best Regards.