sgl/flts-bundle

自由职业者时间表和账单Symfony2 Bundle

安装: 134

依赖: 0

建议者: 0

安全: 0

星标: 12

关注者: 4

分支: 3

开放问题: 0

类型:symfony-bundle

v1.0.4 2018-02-22 22:14 UTC

This package is auto-updated.

Last update: 2024-09-10 07:46:07 UTC


README

SGLFLTSBundle 是一个时间表和账单应用程序,主要针对自由职业者。它是我的 sf1.0 时间表应用程序的移植,我使用这个应用程序已经有4年了。

演示

flts.centdix.com

版本 1

构建状态

对象

  • 用户 - 使用 FLTS 应用(FOSUserBundle 用户)的自由职业者
  • 客户 - 直接客户或与客户打交道的代理
  • 项目 - 例如:一些快速整洁的应用程序
  • 项目部分 - 例如:仪表板修改
  • 任务 - 例如:后端编程、团队协调、旅行等。
  • 工作 - 例如:在用户仪表板上工作(修订版 110)
  • 账单 - 带有待向客户开具的已检查工作的发票

安装

  1. 使用 composer 安装 FLTS

        # composer.json  
        "require": {
            "php": ">=5.5",
            "sgl/flts-bundle": "dev-master"  
        }  
  2. 检查 FLTS 需求文档
    (使用 composer)

    1.1 FOSUserBundle
    1.2 GenemuFormBundle
    1.3 KnpSnappyBundle
    1.4 JMSSecurityExtraBundle
    1.5 AsseticBundle
    1.6 Hashids

  3. 启用 FLTS 和需求包

        
        # AppKernel.php
        
        $bundles = array(
            # [...]
            
            new JMS\AopBundle\JMSAopBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new Genemu\Bundle\FormBundle\GenemuFormBundle(),
            new Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
            new SGL\FLTSBundle\SGLFLTSBundle(),
  4. 添加所需的参数(parameters.yml.dist)、配置(config.yml)和路由(routing.yml)
    见下面的示例

  5. 安装第三方助手
    提示:您可以在项目中扩展 FLTS 包,并安装这些库。

    5.1 TinyMCE

  6. 编辑防火墙和安全(security.yml)
    见下面的 security.yml 示例

  7. 更新您的数据库

        app/console doctrine:schema:update --dump-sql
        app/console doctrine:schema:update --force
  8. 导出资产

        app/console assets:install web --symlink
        app/console --env=prod assetic:dump
        app/console --env=dev assetic:dump
  9. 添加管理员用户
    浏览 "http://the-hostname/register"
    检查角色 'ROLE_ADMIN'

  10. 在创建您的第一个管理员用户后,删除匿名注册访问权限
    (FLTS 有用户 CRUD) 您还可以在 routing.yml 中删除注册路由

        # security.yml
        access_control: {
            - { path: ^/register, role: ROLE_ADMIN }
        }
  11. 浏览 "http://the-hostname/timesheet" 并创建新的客户、您频繁的任务等。

配置示例

参数

    # app/config/parameters.yml.dist
    
    # SGL FLTS params
    sgl_flts.business_name:                   "Symfony dev4fun"
    sgl_flts.business_logo_src:               ~ # Ex.: "/bundles/myFltsExtended/images/logos/sgl.png"
    sgl_flts.business_logo_width:             ~
    sgl_flts.business_invoice_logo_src:       %sgl_flts.business_logo_src%
    sgl_flts.business_invoice_logo_width:     %sgl_flts.business_logo_width%
    sgl_flts.business_address:                "30, rue de la Visitation\nSaint-Charles-Borromée, Québec\nJ6E 4M8"
    sgl_flts.business_phone:                  "457 059-1113"

    sgl_flts.tax_class:                       SGL\FLTSBundle\Util\Tax\CanadaTax
    sgl_flts.tax_gst:   # Goods and Services Tax
        - 5.00
    sgl_flts.tax_pst:   # Quebec Tax rates (year : rate)
        2008: 7.875         # Earlier years will get the first year value
        2009: 7.875
        2010: 7.875
        2011: 8.925
        2012: 9.975         # Later years will get the last year value
    sgl_flts.tax_hst:   # Harmonized Sales Tax
        - null

    sgl_flts.bill_gst_registration_number:    99999 9999 RT0001
    sgl_flts.bill_pst_registration_number:    9999999999 TQ0001
    sgl_flts.bill_hst_registration_number:    null

    sgl_flts.bill_latest_period:              P0Y4M  # In years-months, see DateInterval __construct parameter
    sgl_flts.bill_taxable:                    true   # Bill taxable by default

    sgl_flts.recent_parts_limit:              10     # Maximum element in recent parts list

    # knp snappy params
    knp_snappy.pdf_binary:                    /usr/local/bin/wkhtmltopdf  # which wkhtmltopdf
    knp_snappy.pdf_option_lowquality:         false
    knp_snappy.pdf_option_image-quality:      100
    knp_snappy.pdf_option_no-pdf-compression: false
    knp_snappy.pdf_option_grayscale:          true
    knp_snappy.temporary_folder:              %kernel.cache_dir%
    knp_snappy.disable-smart-shrinking:       true
    
    fos_user.from_email.address:              test@test.com
    fos_user.from_email.sender_name:          Admin

配置

    # app/config/config.yml  
    

    $ Assetic
    assetic:
        debug:          '%kernel.debug%'
        use_controller: '%kernel.debug%'
        filters:
            cssrewrite: ~
    
    # Twig global variables
    twig:
        debug:            %kernel.debug%
        strict_variables: %kernel.debug%
        globals:
            business_name:       %sgl_flts.business_name%
            business_logo_src:   %sgl_flts.business_logo_src%
            business_logo_width: %sgl_flts.business_logo_width%
    
    # FOS conf
    fos_user:
        db_driver: orm # other valid values are 'mongodb', 'couchdb'
        firewall_name: main
        user_class: SGL\FLTSBundle\Entity\User
    
        registration:
            form:
                type: SGL\FLTSBundle\Form\RegistrationFormType
        profile:
            form:
                type: SGL\FLTSBundle\Form\UserType
        from_email:
            address: %fos_user.from_email.address%
            sender_name: %fos_user.from_email.sender_name%
    
    # knp snappy conf
    knp_snappy:
        pdf:
            enabled:    true
            binary:     %knp_snappy.pdf_binary%
            options:
                lowquality: %knp_snappy.pdf_option_lowquality%
                image-quality: %knp_snappy.pdf_option_image-quality%
                no-pdf-compression: %knp_snappy.pdf_option_no-pdf-compression%
                grayscale: %knp_snappy.pdf_option_grayscale%
                disable-smart-shrinking: %knp_snappy.disable-smart-shrinking%
        image:
            enabled:    false
    
    # genemu form conf
    genemu_form:
        date: ~
        image: ~
        tinymce:
            enabled: true
            theme:   advanced
            script_url: /bundles/myFltsExtended/js/tiny_mce/tiny_mce.js
            configs:
                content_css : /bundles/sglflts/css/invoice.css
                plugins : table
                theme_advanced_buttons1 : bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink
                theme_advanced_buttons2 : tablecontrols,separator
                theme_advanced_buttons3 : ~
                theme_advanced_toolbar_location : top
                theme_advanced_toolbar_align : center
                extended_valid_elements : a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]

路由

    # app/config/routing.yml
    
    sgl_flts:
        resource: "@SGLFLTSBundle/Resources/config/routing/flts.yml"
        prefix:   /timesheet
    
    fos_user_security:
        resource: "@FOSUserBundle/Resources/config/routing/security.xml"
    
    fos_user_profile:
        resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
        prefix: /profile
    
    fos_user_resetting:
        resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
        prefix: /resetting
    
    fos_user_change_password:
        resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
        prefix: /profile
    
    fos_user_registration:
        resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
        prefix: /register
    
    genemu_image:
        resource: "@GenemuFormBundle/Resources/config/routing/image.xml"

安全

    # app/config/security.yml

    jms_security_extra:
        secure_all_services: false
        expressions: true
    
    security:
        encoders:
            FOS\UserBundle\Model\UserInterface: sha512
    
        providers:
            fos_userbundle:
                id: fos_user.user_provider.username
    
        firewalls:
            main:
                pattern: ^/
                form_login:
                    provider: fos_userbundle    # See providers
                    csrf_provider: security.csrf.token_manager
                    default_target_path: /timesheet/dashboard
    
                logout:       true
                anonymous:    true
            dev:
                pattern:  ^/(_(profiler|wdt)|css|images|js)/
                security: false
    
            login:
                pattern:  ^/login$
                security: false
    
                #anonymous: ~
                #http_basic:
                #    realm: "Secured Demo Area"
    
        role_hierarchy:
            ROLE_USER:        ~
            ROLE_BILL:        ROLE_USER   # Bill user has user roles
            ROLE_ADMIN:       ROLE_BILL   # Admin user has bill and user roles
            ROLE_SUPER_ADMIN: ROLE_ADMIN  # Super admin has admin, bill and user roles
    
        access_control:
            - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    
            - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } # Set to ROLE_ADMIN after 1st user creation
            - { path: ^/profile, role: ROLE_ADMIN }
    
            - { path: ^/timesheet/invoices, roles: IS_AUTHENTICATED_ANONYMOUSLY }  # Used by wkhtmltopdf locally
            - { path: ^/timesheet/clients, role: ROLE_ADMIN }
            - { path: ^/timesheet/projects, role: ROLE_ADMIN }
            - { path: ^/timesheet/bills, role: ROLE_BILL }
            - { path: ^/timesheet/tasks/frequent, role: ROLE_ADMIN }
            - { path: ^/timesheet/users, role: ROLE_ADMIN }
            - { path: ^/timesheet/dashboard, role: ROLE_USER }
    
            - { path: ^/timesheet, role: ROLE_USER }
    
            - { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY }

即将推出

TODO

  • 多用户尚未测试
  • 主题布局/CSS
  • svn/git 集成(修订版/散列)
  • 测试