Code Duplication    Length = 12-15 lines in 10 locations

src/dbo/records.php 10 locations

@@ 623-636 (lines=14) @@
620
621
        switch ($column['column_type'])
622
        {
623
            case COLUMN_TYPE_ID:
624
625
                array_push($clause_select, 'r.template_prefix');
626
627
                if ($i == $sort)
628
                {
629
                    array_push($clause_order, 'record_id asc');
630
                }
631
                elseif (-$i == $sort)
632
                {
633
                    array_push($clause_order, 'record_id desc');
634
                }
635
636
                break;
637
638
            case COLUMN_TYPE_STATE_ABBR:
639
@@ 638-651 (lines=14) @@
635
636
                break;
637
638
            case COLUMN_TYPE_STATE_ABBR:
639
640
                array_push($clause_select, 'r.state_abbr');
641
642
                if ($i == $sort)
643
                {
644
                    array_push($clause_order, 'state_abbr asc');
645
                }
646
                elseif (-$i == $sort)
647
                {
648
                    array_push($clause_order, 'state_abbr desc');
649
                }
650
651
                break;
652
653
            case COLUMN_TYPE_PROJECT:
654
@@ 653-666 (lines=14) @@
650
651
                break;
652
653
            case COLUMN_TYPE_PROJECT:
654
655
                array_push($clause_select, 'r.project_name');
656
657
                if ($i == $sort)
658
                {
659
                    array_push($clause_order, 'project_name asc');
660
                }
661
                elseif (-$i == $sort)
662
                {
663
                    array_push($clause_order, 'project_name desc');
664
                }
665
666
                break;
667
668
            case COLUMN_TYPE_SUBJECT:
669
@@ 668-681 (lines=14) @@
665
666
                break;
667
668
            case COLUMN_TYPE_SUBJECT:
669
670
                array_push($clause_select, 'r.subject');
671
672
                if ($i == $sort)
673
                {
674
                    array_push($clause_order, 'subject asc');
675
                }
676
                elseif (-$i == $sort)
677
                {
678
                    array_push($clause_order, 'subject desc');
679
                }
680
681
                break;
682
683
            case COLUMN_TYPE_AUTHOR:
684
@@ 683-697 (lines=15) @@
680
681
                break;
682
683
            case COLUMN_TYPE_AUTHOR:
684
685
                array_push($clause_select, 'ac.fullname as author_fullname');
686
                array_push($clause_join,   'left outer join tbl_accounts ac on ac.account_id = r.creator_id');
687
688
                if ($i == $sort)
689
                {
690
                    array_push($clause_order, 'author_fullname asc');
691
                }
692
                elseif (-$i == $sort)
693
                {
694
                    array_push($clause_order, 'author_fullname desc');
695
                }
696
697
                break;
698
699
            case COLUMN_TYPE_RESPONSIBLE:
700
@@ 699-713 (lines=15) @@
696
697
                break;
698
699
            case COLUMN_TYPE_RESPONSIBLE:
700
701
                array_push($clause_select, 'ar.fullname as responsible_fullname');
702
                array_push($clause_join,   'left outer join tbl_accounts ar on ar.account_id = r.responsible_id');
703
704
                if ($i == $sort)
705
                {
706
                    array_push($clause_order, 'responsible_fullname asc');
707
                }
708
                elseif (-$i == $sort)
709
                {
710
                    array_push($clause_order, 'responsible_fullname desc');
711
                }
712
713
                break;
714
715
            case COLUMN_TYPE_LAST_EVENT:
716
@@ 715-726 (lines=12) @@
712
713
                break;
714
715
            case COLUMN_TYPE_LAST_EVENT:
716
717
                if ($i == $sort)
718
                {
719
                    array_push($clause_order, 'change_time asc');
720
                }
721
                elseif (-$i == $sort)
722
                {
723
                    array_push($clause_order, 'change_time desc');
724
                }
725
726
                break;
727
728
            case COLUMN_TYPE_AGE:
729
@@ 746-759 (lines=14) @@
743
744
                break;
745
746
            case COLUMN_TYPE_CREATION_DATE:
747
748
                array_push($clause_select, 'r.creation_time');
749
750
                if ($i == $sort)
751
                {
752
                    array_push($clause_order, 'creation_time asc');
753
                }
754
                elseif (-$i == $sort)
755
                {
756
                    array_push($clause_order, 'creation_time desc');
757
                }
758
759
                break;
760
761
            case COLUMN_TYPE_TEMPLATE:
762
@@ 761-774 (lines=14) @@
758
759
                break;
760
761
            case COLUMN_TYPE_TEMPLATE:
762
763
                array_push($clause_select, 'r.template_name');
764
765
                if ($i == $sort)
766
                {
767
                    array_push($clause_order, 'template_name asc');
768
                }
769
                elseif (-$i == $sort)
770
                {
771
                    array_push($clause_order, 'template_name desc');
772
                }
773
774
                break;
775
776
            case COLUMN_TYPE_STATE_NAME:
777
@@ 776-789 (lines=14) @@
773
774
                break;
775
776
            case COLUMN_TYPE_STATE_NAME:
777
778
                array_push($clause_select, 'r.state_name');
779
780
                if ($i == $sort)
781
                {
782
                    array_push($clause_order, 'state_name asc');
783
                }
784
                elseif (-$i == $sort)
785
                {
786
                    array_push($clause_order, 'state_name desc');
787
                }
788
789
                break;
790
791
            case COLUMN_TYPE_LAST_STATE:
792