Module for custom auto increment field

Apr 28, 2016 at 8:41 PM
Hi,

Im working with Orchard Collaboration to use as a collaborative platform in our my organization, but need some requirements, and as I'm newbie to Orchard (Framework and OC), I would like to know the best approach to solve the issues:

1 - Add to tickets a read-only custom field with auto increment. I know that I can use tokens in content types, but how I can use tokens in custom fields?

2 - How can add a button to the ticket's view, to print the ticket with custom layout?

3 - Where and what are the files .cshtml that I have to change to change the view and edit layout of tickets?

If some one can explain at least an approach of how to solve one or several of those issues, it'll be of great help to me.
Coordinator
Apr 28, 2016 at 9:25 PM
Hi,

1) Tickets already contain a hard-coded auto-incremented value called Identity, (It is hard-coded), if it does not fulfill your requirement, can you please provide more detail, I am also not quite sure what you mean by tokens in content types and custom fields

2 and 3) The layout of the ticket is in the Orchard.CRM.Core/Views/Content-Ticket.Detail.cshtml. As you may know, it is a pattern in Orchard. That cshtml provides a layout for detail displayType of tickets. The shape which have been passed to that view contain several sub-views such as Views/Parts/Ticket.cshtml, Views/Parts/Ticket.Dates.cshtml, Views/Parts/Ticket.People.cshtml etc.

Now, in order to add a button to the ticket, you can add the button to the Views/Content-Ticket.Detail.cshtml or one of the sub-views of tickets depends on your design.
In order to provide a print friendly version of the ticket, one option is supporting another displayType such "print", then made necessary changes to the placement.info file, add a new View called Content-Ticket.print.cshtml and make necessary changes to the TicketDriver and ContentOwnershipDriver to support the print layout (Actually, doing the same things which are done for detail view). In this way, you can have custom views for the print displayType.

The button that you want to add can redirect the user to the same url with different DisplayType.

If you want to get rid of Layer menus, such as the menu above etc, you can create a new Layer for the Print DisplayType.


I hope these comments help you on the way.

Regards,
Siyamand
Apr 29, 2016 at 4:40 PM
Hi!,

First of all, thanks for your very detailed answer!! Really it's very helpful. I give my comments about it:

1) The auto increment field needs to be re set to 0 every year, and it needs to have a mask (ex. YYYY/MM-#####). YYYY for the year and MM for the month as prefix. #### starts in 1 to 99999 with each new item. By tokens, I mean such values provided by tokens module; like ownerid, creation date or time of items.

2, 3) I knew about the use of shape to change the layout of detail and summary, but didn't know about creating new displayType such "print"!! If that is possibly, I think is great, it'll easier to acomplish the custom print feature. And yes, get rid of menus and the rest of html elements not part of tickets, will be 'a must' to print it. Your suggestion of create a new layer for the Print DisplayType looks to me as a very good approach too.

I'll try to make some research and testing about creating the new displayType.

Again, thanks for your very helpful answer!

Regards,

Jose