[#56767438] Merge Order and OrderLine into Contract and ContractLine

Squashed commit of the following:

commit 503d6f5a423e6aba8856a18b5b8e9698b7c519d6
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Sun Oct 6 17:35:13 2013 +0200

    [FIX CI] use next_open_date instead of Date.today on contract_line factory, preventing CI failing on weekends

commit 339552cf32b4ab266e3e5acff8d5b3974db1cca1
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Sat Oct 5 23:12:31 2013 +0200

    [FIX CI] features/examples/probleme.feature

commit 19ff0c11db35efda263d6cc2677507df36e0b85a
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Fri Oct 4 09:46:32 2013 +0200

    [FIX CI] features/backend/acknowledge/approve_anyway.feature

commit d0262d4b1336323bd91b935f4f67151a4f123591
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Oct 3 16:04:54 2013 +0200

    Bugfix: added line to an approved contract should not inherit any purpose from other lines

commit 5482c80a2f185b773628bc06371c92dfbb493d85
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Oct 3 13:19:33 2013 +0200

    Fix CI: features/examples/zweck.feature

commit d799dad0702fbc152e354438008acae465b82f91
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 15:41:09 2013 +0200

    [FIX CI] features/examples/probleme.feature (wip)

commit 3de4e5aa2174a73724537d90a20202c06103c389
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 15:05:51 2013 +0200

    [FIX CI] features/examples/passwort.feature

commit 8458491e83e5abd8a83cdc184064edba591b70ce
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 14:50:44 2013 +0200

    [FIX CI] features/examples/modell.feature

commit 2b8a59f819d757062bc02db232e2386aa68df04b
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 14:31:05 2013 +0200

    [FIX CI] features/examples/kalender.feature

commit c7330d5c4abbe6f64e1dd98dfbe05c3805c5290a
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 14:22:47 2013 +0200

    [FIX CI] features/examples/hinzufuegen.feature

commit f8974c3f905c333daa9c32d0d61d6586e99573ee
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 14:03:48 2013 +0200

    [FIX CI] features/examples/benutzerverwaltung.feature

commit 521a81dc4188080c47227e8c6517224f225bd7b4
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Oct 3 13:19:33 2013 +0200

    Fix CI: features/examples/zweck.feature WIP

commit f0497d173361eedb553541a2bc6761c85006fc03
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Oct 3 12:20:36 2013 +0200

    Fix CI: login.feature

commit c2ae3864570e832002926acb23bca9b134bb642d
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Oct 3 12:20:06 2013 +0200

    Fix CI: features/work_days

commit 3dc9de0be4593c33e3a1ec84f92a3374a2616d2a
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Oct 3 12:19:34 2013 +0200

    Fix CI: features/acknowledge

commit b021eb21ab3af8cd160c22a7b1a156f7b731018b
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 12:36:58 2013 +0200

    [FIX CI] features/examples/ausleihe.feature

commit ab4aba1b59a993bd017e377a9fe41000bcd321ef
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 11:31:45 2013 +0200

    [FIX CI] features/backend/hand_over/edit_contract_line.feature

commit 28b61b87251c75658af8f0760f7d4c06c2ae358e
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Oct 3 10:59:07 2013 +0200

    Fix CI: backend/approve_anyway.feature

commit c6b08896c1f12f21eb1ed5cebd8b78593b55692d
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Oct 3 10:48:11 2013 +0200

    [FIX CI] features/backend (wip)

commit 9168f974400b70cdee34fecae35b99426de86743
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Oct 2 17:53:18 2013 +0200

    [FIX CI] borrow/timeoutpage.feature

commit c2bb2d9ea57f7f07561d78f0177b6211e9cadf96
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Oct 2 17:21:01 2013 +0200

    [FIX CI] borrow/timeoutpage.feature

commit 102fc7ba4719a70958000091bc2456904a0f2a7d
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Oct 2 16:58:01 2013 +0200

    [FIX CI] borrow

commit d19458d79c77c72f968206b8c45ad157ff1f39da
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Wed Oct 2 16:14:56 2013 +0200

    fixing borrow/timeoutpage.feature WIP

commit 2ca0ee0b07fa1ffaae7076507d6642b0c5ec23e3
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Oct 2 15:55:01 2013 +0200

    [FIX CI] borrow/bestellungen.feature

commit fcf6812290489769a1bbe66072d7aee0a64dde29
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Oct 2 15:40:03 2013 +0200

    [FIX CI] borrow/bestelluebersicht.feature

commit f6f1c4063ac10f09cb0efb8fccc322d76037e0e2
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Wed Oct 2 14:15:36 2013 +0200

    Fix order timeout out path in test

commit 0976b86d346635e5d53126623313e01010487bbd
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Oct 2 14:15:16 2013 +0200

    [FIX CI] borrow/timeoutpage.feature (wip)

commit 121f9657841f225368c04a0936170ac56eb84df3
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Oct 2 14:07:51 2013 +0200

    [FIX CI] borrow/bestelluebersicht.feature (wip)

commit c329cef964833d89b5f94f97b6af90abe02aee46
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Oct 2 13:51:25 2013 +0200

    [FIX CI] borrow/bestelluebersicht.feature (wip)

commit 793d360bbe93e55665718425e411b552d32c0a03
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Wed Oct 2 13:30:51 2013 +0200

    fix visit & visit lines sql views

commit b8247c00c877a93a9bc43c20fec1ab383490c85e
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Tue Oct 1 17:15:52 2013 +0200

    fixing typo

commit b2449ce33e863b74f4d54c37ea636b095bc765e6
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Tue Oct 1 16:58:28 2013 +0200

    [FIX CI] borrow

commit 05ac7b7432f66ccb9e8da8c7a8af79269b7633e0
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Tue Oct 1 16:33:25 2013 +0200

    current_order completely dropped

commit 923bf39c5229270350a6b21bc76b27f930be7cb1
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Tue Oct 1 14:51:17 2013 +0200

    new Contract flow, after dropping Order

commit d73ed408692515a1432458a5797649e06a986a92
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Tue Oct 1 14:32:45 2013 +0200

    (wip) dropping current_order

commit cdcabe252ce803e0f93b35b5f58a64d18dc1872e
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Tue Oct 1 13:50:48 2013 +0200

    (wip) borrow section

commit c4dcf25f6c2afb11e1cf9a69b60b5e411f5dea02
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Tue Oct 1 13:40:26 2013 +0200

    (wip) borrow section

commit 9785fd4b14c910126c7e7c31dd83f857441c7d18
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Tue Oct 1 11:50:08 2013 +0200

    rename forgotten class names in borrow section

commit 6d974294d2242a2b43083e54a1442bb31cef305c
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Tue Oct 1 09:56:43 2013 +0200

    refactor routes.rb

commit 893e4daecb322eff5a4fa668893d7696f0069aa5
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Tue Oct 1 09:56:35 2013 +0200

    refactor borrow views

commit 837ba47b4fbd4ab190c3489fa0c0a899044fe98e
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Mon Sep 30 16:43:49 2013 +0200

    refactor orders_controller and order_lines_controller in borrow section

commit 65f465fd4a70a5c521d98d7c023e3f0079484da0
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Mon Sep 30 16:43:49 2013 +0200

    refactor orders_controller and order_lines_controller in borrow section

commit 805e57d80e8f06f4780751e25adffeb87d7db026
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Mon Sep 30 17:50:25 2013 +0200

    merging Backend::OrdersController into Backend::ContractsController

commit 8e6c3d1de1147083feea7cb39fdbef622c7217d8
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Mon Sep 30 16:43:49 2013 +0200

    renaming orders to contracts in borrow section WIP

commit 4c5ebf3d95dafc07148a00c5d585adf221f82852
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Mon Sep 30 15:31:16 2013 +0200

    rename @orders to @contracts in orders/index view

commit 9cb5d22ea2124500afbad9ea6fde7e8cae1c7e8e
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Mon Sep 30 15:27:38 2013 +0200

    contract and contract_line json helpers

commit 139b0c0cd12dd17b23f7163f241dc1782a013c6c
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Mon Sep 30 15:07:12 2013 +0200

    merging order and order_line json helpers to contract and contract_line

commit 3741664a89f4c60aa7f2aa1edc94cbf30a1fb9c5
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Mon Sep 30 14:00:08 2013 +0200

    minor optimization in one step

commit 1bffeda8286e50da8b7bd64c030b99662900745b
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Mon Sep 30 14:00:08 2013 +0200

    [FIX CI] personas create contract_lines

commit 724f3b2038038f2860b1f99c0015850c7437eb06
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Mon Sep 30 13:46:35 2013 +0200

    [FIX CI] add lines to contract

commit 8b6259a4640721055a423dd01bba340c74bad1ae
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Mon Sep 30 12:46:18 2013 +0200

    [FIX CI]

commit e5244fcac73c46fb85f0b291f377be7599815d71
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Mon Sep 30 12:19:02 2013 +0200

    fix leihs factory to create settings

commit 3b58903c1032c48d8dba52bfe47ccedb69bc1294
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Mon Sep 30 12:18:34 2013 +0200

    use the correct method unsubmitted_contracts

commit fafb0d7b25fd92178e89fba7d5a46a7565650f5b
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Mon Sep 30 12:02:43 2013 +0200

    [FIX CI] features/technical/

commit 3799509bb7518522dc6bfc87231ee074680e15e9
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Fri Sep 27 18:06:56 2013 +0200

    minor fix

commit df40c31c3428bd927bb161d04b8187bfbae2261e
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Fri Sep 27 18:00:56 2013 +0200

    - refactoring user#current_order to user#contracts.unsubmitted and user#unsubmitted_contract(ip)
    - refactoring contract#timeout? to user#timeout?
    - adapted contract_line#purpose
    - adapted mailer templates
    - adapted contract and contract_line factories

commit b4b8fd1a4f2ac1fec2d5cdade752ee0097f3624c
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Fri Sep 27 14:16:24 2013 +0200

    flatting Document and DocumentLine into Contract and ContractLine

commit 87922c64758f5e8a1fd2ec7c609dff42c192fc73
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Fri Sep 27 14:04:41 2013 +0200

    move order rspec tests to contract folder

commit 506f403898c949f97d6ab9ae7116a5c5428a3051
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Fri Sep 27 12:05:08 2013 +0200

    missing renamings order -> contract in tests & using FactoryGirl instead of LeihsFactory for orders

commit f7f3a97ebddd4ad3c40efba498465dcd2ea7f616
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Sep 26 19:12:10 2013 +0200

    (wip) translating order to contract

commit b2b5f155e926bd750be66cda183069fb976ba92d
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Sep 26 16:59:32 2013 +0200

    (wip) second migration draft, merging Order and OrderLine into Contract/Document and ContractLine

commit e14523b691dae88d07e9cf763dfc35dc2d244740
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Sep 26 16:00:19 2013 +0200

    rename order to contract in backend features and steps

commit d8eb13484d5bdf40ebcb85a2c0753157564eef96
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Sep 26 15:24:28 2013 +0200

    factories and personas

commit ed10a5d38a80f59748a8a6fda6e7b254faf285dc
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Thu Sep 26 14:53:51 2013 +0200

    validates presence of status in contract

commit fd0a8f0ca4eed74c925faa498db8835986a6dd05
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Thu Sep 26 10:44:22 2013 +0200

    (wip) first migration draft, removing Order and OrderLine, new diagram

commit bb9e65eacf5df0c0ef3ff14ddc09e9feeda11683
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Sep 25 19:36:43 2013 +0200

    renaming method

commit 996caf330f5f74f83c33cee7561290be93c78e44
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Sep 25 19:35:28 2013 +0200

    translating constants

commit 1322d4bb1c270f0135302c4b5144729782d04df4
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Wed Sep 25 19:25:37 2013 +0200

    adapting sql views

commit 80a2d7a91e88107811dddc4c1d7187a123e7cc53
Author: Franco Sellitto <franco.sellitto@zhdk.ch>
Date:   Tue Sep 24 18:06:01 2013 +0200

    activating pending migrations => from now on the database doesn't support leihs2 and leihs3 parallel running anymore!