Release 2.0.6 (#3900)

* cleanup invoice templates
* cleanup invoice translations
* fix invoice datetime for now
* support invoice archive order by number and status
* bump version
* allow meta-field sub-classing
* removed unused translation task.delete
* prevent null in str_replace
This commit is contained in:
Kevin Papst
2023-03-08 00:38:10 +01:00
committed by GitHub
parent 80f8f70695
commit 9d503300f6
46 changed files with 422 additions and 534 deletions

View File

@@ -1,130 +1,142 @@
{% import "macros/widgets.html.twig" as widgets %}
{% extends 'invoice/layout.html.twig' %}
{% block invoice %}
{% set isDecimal = true %}
{% set project = model.query.project %}
{% set activity = model.query.activity %}
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
<span contenteditable="true">{{ model.template.title }}</span>
</h2>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table no-border table-sm">
<tr>
<th class="ps-0">{{ 'invoice.from'|trans }}</th>
<td contenteditable="true">
{% if model.query.user is not empty %}
{{ widgets.username(model.query.user) }}
{% else %}
{{ model.template.company }}
{% endif %}
</td>
</tr>
<tr>
<th class="ps-0">{{ 'date'|trans }}</th>
<td contenteditable="true">
{% if model.query.begin|date('m') != model.query.end|date('m') or model.query.begin|date('Y') != model.query.end|date('Y') %}
{{ model.query.begin|date_short }} - {{ model.query.end|date_short }}
{% else %}
{{ model.query.end|month_name }} {{ model.query.end|date('Y') }}
{% endif %}
</td>
</tr>
<tr>
<th class="ps-0">{{ 'customer'|trans }}</th>
<td contenteditable="true">
{% if model.customer.number is not empty %}[{{ model.customer.number }}]{% endif %}
{{ model.customer.name }}{% if model.customer.contact is not empty %} / {{ model.customer.contact }}{% endif %}
</td>
</tr>
{% if project is not null %}
<tr>
<th class="ps-0">{{ 'project'|trans }}</th>
<td contenteditable="true">
{{ project.name }}
{% if project.orderNumber is not empty %}
({{ 'orderNumber'|trans }}: {{ project.orderNumber }})
{% endif %}
</td>
</tr>
{% endif %}
{% if activity is not null %}
<tr>
<th class="ps-0">{{ 'activity'|trans }}</th>
<td contenteditable="true">
{{ activity.name }}
</td>
</tr>
{% endif %}
</table>
</div>
</div>
<div class="row invoice-items mt-2 mb-3">
<div class="col-xs-12 table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ 'date'|trans }}</th>
{% if model.query.user is empty %}
<th>{{ 'user'|trans }}</th>
{% endif %}
<th>{{ 'activity'|trans }}</th>
<th class="text-right">{{ 'hours'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entry in model.calculator.entries %}
<tr>
<td>{{ entry.begin|date_short }}</td>
{% if model.query.user is empty %}
<td>{{ widgets.username(entry.user) }}</td>
{% endif %}
<td contenteditable="true">
{% if entry.description is not empty %}
{{ entry.description|nl2br }}
{% else %}
{% if entry.activity is not null %}{{ entry.activity.name }} / {% endif %}{{ entry.project.name }}
{% endif %}
</td>
<td class="text-right text-nowrap">{{ entry.duration|duration(isDecimal) }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th></th>
{% if model.query.user is empty %}
<th></th>
{% endif %}
<th>{{ 'invoice.total_working_time'|trans }}</th>
<th class="text-right text-nowrap">{{ model.calculator.timeWorked|duration(isDecimal) }}</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="row">
<div class="col-xs-12">
{% if model.template.paymentTerms is not empty %}
<p class="lead">{{ 'payment_terms'|trans }}</p>
<p class="text-muted well well-sm no-shadow" contenteditable="true" style="margin-bottom: 100px">
{{ model.template.paymentTerms|trim|nl2br }}
</p>
{% endif %}
<div class="table-responsive">
<p class="bt-1 pb-4 pt-1">{{ 'invoice.signature_user'|trans }}</p>
<p class="bt-1 pb-4 pt-1">{{ 'invoice.signature_customer'|trans }}</p>
<!DOCTYPE html>
{% set fallback = app.request is not null ? app.request.locale : 'en' %}
{% set language = model.template.language|default(fallback) %}
{% set isDecimal = true %}
{% set project = model.query.project %}
{% set activity = model.query.activity %}
<html lang="{{ language }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title>{{ model.invoiceNumber }}-{{ model.customer.company|default(model.customer.name)|u.snake }}</title>
<style type="text/css">
{{ encore_entry_css_source('invoice')|raw }}
</style>
</head>
<body class="invoice_print">
<div class="wrapper">
<section class="invoice">
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
<span contenteditable="true">{{ model.template.title }}</span>
</h2>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table no-border table-sm">
<tr>
<th class="ps-0">{{ 'invoice.from'|trans }}</th>
<td contenteditable="true">
{% if model.query.user is not empty %}
{{ model.query.user.displayName }}
{% else %}
{{ model.template.company }}
{% endif %}
</td>
</tr>
<tr>
<th class="ps-0">{{ 'date'|trans }}</th>
<td contenteditable="true">
{% if model.query.begin|date('m') != model.query.end|date('m') or model.query.begin|date('Y') != model.query.end|date('Y') %}
{{ model.query.begin|date_short }} - {{ model.query.end|date_short }}
{% else %}
{{ model.query.end|month_name }} {{ model.query.end|date('Y') }}
{% endif %}
</td>
</tr>
<tr>
<th class="ps-0">{{ 'customer'|trans }}</th>
<td contenteditable="true">
{% if model.customer.number is not empty %}[{{ model.customer.number }}]{% endif %}
{{ model.customer.name }}{% if model.customer.contact is not empty %} / {{ model.customer.contact }}{% endif %}
</td>
</tr>
{% if project is not null %}
<tr>
<th class="ps-0">{{ 'project'|trans }}</th>
<td contenteditable="true">
{{ project.name }}
{% if project.orderNumber is not empty %}
({{ 'orderNumber'|trans }}: {{ project.orderNumber }})
{% endif %}
</td>
</tr>
{% endif %}
{% if activity is not null %}
<tr>
<th class="ps-0">{{ 'activity'|trans }}</th>
<td contenteditable="true">
{{ activity.name }}
</td>
</tr>
{% endif %}
</table>
</div>
</div>
<div class="row invoice-items mt-2 mb-3">
<div class="col-xs-12 table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ 'date'|trans }}</th>
{% if model.query.user is empty %}
<th>{{ 'user'|trans }}</th>
{% endif %}
<th>{{ 'activity'|trans }}</th>
<th class="text-right">{{ 'hours'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entry in model.calculator.entries %}
<tr>
<td>{{ entry.begin|date_short }}</td>
{% if model.query.user is empty %}
<td>{{ entry.user.displayName }}</td>
{% endif %}
<td contenteditable="true">
{% if entry.description is not empty %}
{{ entry.description|nl2br }}
{% else %}
{% if entry.activity is not null %}{{ entry.activity.name }} / {% endif %}{{ entry.project.name }}
{% endif %}
</td>
<td class="text-right text-nowrap">{{ entry.duration|duration(isDecimal) }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th></th>
{% if model.query.user is empty %}
<th></th>
{% endif %}
<th>{{ 'invoice.total_working_time'|trans }}</th>
<th class="text-right text-nowrap">{{ model.calculator.timeWorked|duration(isDecimal) }}</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="row">
<div class="col-xs-12">
{% if model.template.paymentTerms is not empty %}
<p class="lead">{{ 'payment_terms'|trans }}</p>
<p class="text-muted well well-sm no-shadow" contenteditable="true" style="margin-bottom: 100px">
{{ model.template.paymentTerms|trim|nl2br }}
</p>
{% endif %}
<div class="table-responsive">
<p class="bt-1 pb-4 pt-1">{{ 'invoice.signature_user'|trans }}</p>
<p class="bt-1 pb-4 pt-1">{{ 'invoice.signature_customer'|trans }}</p>
</div>
</div>
</div>
</section>
</div>
{% endblock %}
</body>
</html>

View File

@@ -284,33 +284,33 @@
{% endmacro %}
{% macro form_type_value(type, value, entity) %}
{% if '\\ColorPickerType' in type or '\\ColorChoiceType' in type %}
{% if 'ColorPickerType' in type or 'ColorChoiceType' in type %}
{% if value is not empty %}
<span class="label-color" data-toggle="tooltip" data-placement="top" title="{{ value }}">
<i class="dot {{ 'dot'|icon(true) }} fa-fw" style="color:{{ value }}"></i>
</span>
{% endif %}
{% elseif '\\DurationType' in type %}
{% elseif 'DurationType' in type %}
{{ value|duration }}
{% elseif '\\YesNoType' in type or '\\CheckBoxType' in type %}
{% elseif 'YesNoType' in type or 'CheckBoxType' in type %}
{{ _self.label_boolean(value) }}
{% elseif '\\DatePickerType' in type %}
{% elseif 'DatePickerType' in type %}
{{ value|date_short }}
{% elseif '\\DateTimePickerType' in type %}
{% elseif 'DateTimePickerType' in type %}
{{ value|date_time }}
{% elseif '\\CountryType' in type %}
{% elseif 'CountryType' in type %}
{{ value|country_name }}
{% elseif '\\CurrencyType' in type %}
{% elseif 'CurrencyType' in type %}
{{ value|currency_name }}
{% elseif '\\LanguageType' in type %}
{% elseif 'LanguageType' in type %}
{{ value|locale_name }}
{% elseif '\\TagsType' in type %}
{% elseif 'TagsType' in type %}
{% for tag in value|split(',') %}
{% if tag is not empty %}
{{ _self.badge(tag, null|colorize(tag)) }}
{% endif %}
{% endfor %}
{% elseif '\\MoneyType' in type %}
{% elseif 'MoneyType' in type %}
{% set classname = class_name(entity) %}
{% if entity is null %}
{{ value }}
@@ -325,11 +325,11 @@
{% else %}
{{ value }}
{% endif %}
{% elseif '\\TextareaType' in type %}
{% elseif 'TextareaType' in type %}
{{ value|nl2br }}
{% elseif '\\EmailType' in type %}
{% elseif 'EmailType' in type %}
<a href="mailto:{{ value }}">{{ value }}</a>
{% elseif '\\UrlType' in type %}
{% elseif 'UrlType' in type %}
<a href="{{ value }}" target="_blank">{{ value }}</a>
{% else %}
{{ value }}

View File

@@ -1,99 +1,110 @@
{% extends 'invoice/layout.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
<!DOCTYPE html>
{% import "macros/datatables.html.twig" as tables %}
{% set language = app.request is not null ? app.request.locale : 'en' %}
{% set decimal = false %}
{% set showUserColumn = true %}
{% if query.user %}
{% set showUserColumn = false %}
{% endif %}
<html lang="{{ language }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title>{{ 'export'|trans }}</title>
<style type="text/css">
{{ encore_entry_css_source('invoice')|raw }}
</style>
</head>
<body class="invoice_print">
<div class="wrapper">
<section class="invoice">
{% block title %}{{ 'export'|trans }}{% endblock %}
{% block invoice %}
{% set decimal = decimal|default(false) %}
{% set showUserColumn = true %}
{% if query.user %}
{% set showUserColumn = false %}
{% endif %}
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
{% if not showUserColumn %}
{{ widgets.username(query.user) }}:
{% endif %}
{% if query.begin is not empty %}
{{ query.begin|date_short }}
{% else %}
{% set last = entries|last %}
{{ last.begin|date_short }}
{% endif %}
&ndash;
{% if query.end is not empty %}
{{ query.end|date_short }}
{% else %}
{% set first = entries|first %}
{{ first.end|date_short }}
{% endif %}
</h2>
</div>
</div>
<div class="row">
<div class="col-xs-12 table-responsive">
<table class="table">
<thead>
<tr>
<th>{{ 'date'|trans }}</th>
{% if showUserColumn %}
<th>{{ 'username'|trans }}</th>
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
{% if not showUserColumn %}
{{ query.user.displayName }}:
{% endif %}
<th>{{ 'description'|trans }}</th>
{% for field in timesheetMetaFields %}
<th class="text-nowrap">{{ field.label|trans }}</th>
{% endfor %}
<th>{{ 'hours'|trans }}</th>
</tr>
</thead>
<tbody>
{% set timeWorked = 0 %}
{% for entry in entries %}
{% set timeWorked = timeWorked + entry.duration %}
{% if query.begin is not empty %}
{{ query.begin|date_short }}
{% else %}
{% set last = entries|last %}
{{ last.begin|date_short }}
{% endif %}
&ndash;
{% if query.end is not empty %}
{{ query.end|date_short }}
{% else %}
{% set first = entries|first %}
{{ first.end|date_short }}
{% endif %}
</h2>
</div>
</div>
<div class="row">
<div class="col-xs-12 table-responsive">
<table class="table">
<thead>
<tr>
<td class="text-nowrap">{{ entry.begin|date_short }}</td>
<th>{{ 'date'|trans }}</th>
{% if showUserColumn %}
<td>{{ widgets.username(entry.user) }}</td>
<th>{{ 'username'|trans }}</th>
{% endif %}
<td>
{% if entry.description is not empty %}
<div>
{{ entry.description|desc2html }}
</div>
<th>{{ 'description'|trans }}</th>
{% for field in timesheetMetaFields %}
<th class="text-nowrap">{{ field.label|trans }}</th>
{% endfor %}
<th>{{ 'hours'|trans }}</th>
</tr>
</thead>
<tbody>
{% set timeWorked = 0 %}
{% for entry in entries %}
{% set timeWorked = timeWorked + entry.duration %}
<tr>
<td class="text-nowrap">{{ entry.begin|date_short }}</td>
{% if showUserColumn %}
<td>{{ entry.user.displayName }}</td>
{% endif %}
<span class="small">
<td>
{% if entry.description is not empty %}
<div>
{{ entry.description|desc2html }}
</div>
{% endif %}
<span class="small">
{% if entry.activity is not null %}{{ 'activity'|trans }}: {{ entry.activity.name }} |{% endif %}
{{ 'project'|trans }}: {{ entry.project.name }} |
{{ 'project'|trans }}: {{ entry.project.name }} |
{{ 'customer'|trans }}: {{ entry.project.customer.name }}
</span>
</td>
{% for field in timesheetMetaFields %}
<td>{{ tables.datatable_meta_column(entry, field) }}</td>
{% endfor %}
<td class="text-nowrap">{{ entry.duration|duration(decimal) }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th></th>
{% if showUserColumn %}
<th></th>
{% endif %}
{% for field in timesheetMetaFields %}
<th></th>
</td>
{% for field in timesheetMetaFields %}
<td>{{ tables.datatable_meta_column(entry, field) }}</td>
{% endfor %}
<td class="text-nowrap">{{ entry.duration|duration(decimal) }}</td>
</tr>
{% endfor %}
<th>{{ 'invoice.total_working_time'|trans }}</th>
<th class="text-nowrap">{{ timeWorked|duration(decimal) }}</th>
</tr>
</tfoot>
</table>
</tbody>
<tfoot>
<tr>
<th></th>
{% if showUserColumn %}
<th></th>
{% endif %}
{% for field in timesheetMetaFields %}
<th></th>
{% endfor %}
<th>{{ 'invoice.total_working_time'|trans }}</th>
<th class="text-nowrap">{{ timeWorked|duration(decimal) }}</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
{% endblock %}
{% block print_button %}{% endblock %}
</section>
</div>
</body>
</html>