Compare commits

..

17 Commits

Author SHA1 Message Date
Jan Böhmer
56828e9e00 Bumped version to 1.4.2 2023-06-11 00:41:19 +02:00
Jan Böhmer
d2358c9550 Updated dependencies 2023-06-11 00:41:00 +02:00
Jan Böhmer
ab11747fab Fixed issue, that users table were delete while PartKeepr import on certain databases
This fixes issue #299
2023-06-11 00:31:05 +02:00
Jan Böhmer
44cb0fa434 Added a more verbose error message in the case of a pretty generic Database DriverException 2023-06-11 00:20:27 +02:00
Jan Böhmer
13814695ac Add hint to docker logs to error page 2023-06-11 00:12:24 +02:00
Jan Böhmer
377e2eb613 Properly redirect the stdout of php-fpm to the docker logs
This fixes issue #298
2023-06-11 00:09:00 +02:00
Jan Böhmer
636776c531 Bumped version to 1.4.1 2023-06-06 23:22:39 +02:00
Jan Böhmer
ca4a33d408 Merge remote-tracking branch 'origin/l10n_master' 2023-06-06 23:21:44 +02:00
Jan Böhmer
9db158f4d4 Updated dependencies 2023-06-06 23:20:51 +02:00
Jan Böhmer
ea8b179df1 Added timetravel URL for PartAttachment elements 2023-06-06 23:16:51 +02:00
Jan Böhmer
efc152e3c8 Do not throw an exception during rendering of log detail page, if element has no time travel URL 2023-06-06 23:15:14 +02:00
Jan Böhmer
e68827bf3b Show a validation error message, when try to submit a form where a input is still set to a disabled value.
Normally this would just send a null to the server, which often cause excptions. We now catch that earlier, and say the user that he have to select another option, when he tries to submit
2023-06-06 23:05:44 +02:00
Jan Böhmer
58bf69882f Updated dependencies. 2023-06-05 22:15:07 +02:00
Jan Böhmer
915f313efd New translations security.en.xlf (English) 2023-05-28 18:05:45 +02:00
Jan Böhmer
52d29099a2 New translations messages.en.xlf (English) 2023-05-28 18:05:44 +02:00
japm48
c06fc926a1 Update translation (#295)
* Update security.en.xlf

* Update messages.en.xlf
2023-05-28 18:02:02 +02:00
japm48
7640ed08bc docker: add missing PassEnv directives (#294) 2023-05-27 23:59:21 +02:00
16 changed files with 956 additions and 882 deletions

View File

@@ -26,10 +26,11 @@
# Pass the configuration from the docker env to the PHP environment (here you should list all .env options)
PassEnv APP_ENV APP_DEBUG APP_SECRET
PassEnv TRUSTED_PROXIES TRUSTED_HOSTS LOCK_DSN
PassEnv DATABASE_URL ENFORCE_CHANGE_COMMENTS_FOR
PassEnv DEFAULT_LANG DEFAULT_TIMEZONE BASE_CURRENCY INSTANCE_NAME ALLOW_ATTACHMENT_DOWNLOADS USE_GRAVATAR MAX_ATTACHMENT_FILE_SIZE DEFAULT_URI
PassEnv MAILER_DSN ALLOW_EMAIL_PW_RESET EMAIL_SENDER_EMAIL EMAIL_SENDER_NAME
PassEnv HISTORY_SAVE_CHANGED_FIELDS HISTORY_SAVE_CHANGED_DATA HISTORY_SAVE_REMOVED_DATA
PassEnv HISTORY_SAVE_CHANGED_FIELDS HISTORY_SAVE_CHANGED_DATA HISTORY_SAVE_REMOVED_DATA HISTORY_SAVE_NEW_DATA
PassEnv ERROR_PAGE_ADMIN_EMAIL ERROR_PAGE_SHOW_HELP
PassEnv DEMO_MODE NO_URL_REWRITE_AVAILABLE FIXER_API_KEY BANNER
PassEnv SAML_ENABLED SAML_ROLE_MAPPING SAML_UPDATE_GROUP_ON_LOGIN SAML_IDP_ENTITY_ID SAML_IDP_SINGLE_SIGN_ON_SERVICE SAML_IDP_SINGLE_LOGOUT_SERVICE SAML_IDP_X509_CERT SAML_SP_ENTITY_ID SAML_SP_X509_CERT SAMLP_SP_PRIVATE_KEY

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# For sh files, always use LF line endings
*.sh text eol=lf

View File

@@ -34,12 +34,25 @@ RUN sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
ln -sfT /dev/stderr /var/log/php8.1-fpm.log; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR";
# Enable php-fpm
RUN a2enmod proxy_fcgi setenvif && a2enconf php8.1-fpm
# Configure php-fpm to log to stdout of the container (stdout of PID 1)
# We have to use /proc/1/fd/1 because /dev/stdout or /proc/self/fd/1 does not point to the container stdout (because we use apache as entrypoint)
# We also disable the clear_env option to allow the use of environment variables in php-fpm
RUN { \
echo '[global]'; \
echo 'error_log = /proc/1/fd/1'; \
echo; \
echo '[www]'; \
echo 'access.log = /proc/1/fd/1'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
echo 'clear_env = no'; \
} | tee "/etc/php/8.1/fpm/pool.d/zz-docker.conf"
# PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \
echo '<FilesMatch \.php$>'; \

View File

@@ -1 +1 @@
1.4.0
1.4.2

View File

@@ -57,10 +57,29 @@ export default class extends Controller {
'<small class="text-muted float-end">(' + addHint +')</small>' +
'</div>';
},
}
},
//Add callbacks to update validity
onInitialize: this.updateValidity.bind(this),
onChange: this.updateValidity.bind(this),
};
this._tomSelect = new TomSelect(this.element, settings);
this._tomSelect.sync();
}
updateValidity() {
//Mark this input as invalid, if the selected option is disabled
const input = this.element;
const selectedOption = input.options[input.selectedIndex];
if (selectedOption && selectedOption.disabled) {
input.setCustomValidity("This option was disabled. Please select another option.");
} else {
input.setCustomValidity("");
}
}
getTomSelect() {

370
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -176,6 +176,11 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface
continue;
}
// The table name might be quoted, we have to trim it
// See https://github.com/Part-DB/Part-DB-server/issues/299
$tbl = trim($tbl, '"');
$tbl = trim($tbl, '`');
// If the table is excluded, skip it as well
if (in_array($tbl, $this->excluded, true)) {
continue;

View File

@@ -26,6 +26,7 @@ use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Parameters\PartParameter;
use App\Entity\ProjectSystem\Project;
use App\Entity\LabelSystem\LabelProfile;
use App\Entity\Parts\Category;
@@ -106,7 +107,7 @@ class EntityURLGenerator
/**
* Gets the URL to view the given element at a given timestamp.
*/
public function timeTravelURL(AbstractDBElement $entity, DateTime $dateTime): string
public function timeTravelURL(AbstractDBElement $entity, \DateTimeInterface $dateTime): string
{
$map = [
Part::class => 'part_info',
@@ -158,10 +159,16 @@ class EntityURLGenerator
'timestamp' => $dateTime->getTimestamp(),
]);
}
if ($entity instanceof PartParameter) {
return $this->urlGenerator->generate('part_info', [
'id' => $entity->getElement()->getID(),
'timestamp' => $dateTime->getTimestamp(),
]);
}
}
//Otherwise throw an error
throw new EntityNotSupportedException('The given entity is not supported yet!');
throw new EntityNotSupportedException('The given entity is not supported yet! Passed class type: '.get_class($entity));
}
public function viewURL(Attachment $entity): string

View File

@@ -43,8 +43,8 @@ class PKImportHelper
*/
public function purgeDatabaseForImport(): void
{
//Versions with "" are needed !!
$purger = new ResetAutoIncrementORMPurger($this->em, ['users', '"users"', 'groups', '"groups"', 'u2f_keys', 'internal', 'migration_versions']);
//We use the ResetAutoIncrementORMPurger to reset the auto increment values of the tables. Also it normalizes table names before checking for exclusion.
$purger = new ResetAutoIncrementORMPurger($this->em, ['users', 'groups', 'u2f_keys', 'internal', 'migration_versions']);
$purger->purge();
}

View File

@@ -34,6 +34,7 @@ use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use App\Exceptions\EntityNotSupportedException;
use App\Services\ElementTypeNameGenerator;
use App\Services\EntityURLGenerator;
use App\Services\Trees\TreeViewGenerator;
@@ -72,7 +73,7 @@ final class EntityExtension extends AbstractExtension
/* Returns the URL to the given entity */
new TwigFunction('entity_url', [$this, 'generateEntityURL']),
/* Returns the URL to the given entity in timetravel mode */
new TwigFunction('timetravel_url', [$this->entityURLGenerator, 'timetravelURL']),
new TwigFunction('timetravel_url', [$this, 'timeTravelURL']),
/* Generates a JSON array of the given tree */
new TwigFunction('tree_data', [$this, 'treeData']),
@@ -81,6 +82,15 @@ final class EntityExtension extends AbstractExtension
];
}
public function timeTravelURL(AbstractDBElement $element, \DateTimeInterface $dateTime): ?string
{
try {
return $this->entityURLGenerator->timeTravelURL($element, $dateTime);
} catch (EntityNotSupportedException $e) {
return null;
}
}
public function treeData(AbstractDBElement $element, string $type = 'newEdit'): string
{
$tree = $this->treeBuilder->getTreeView(get_class($element), null, $type, $element);

View File

@@ -33,7 +33,7 @@
{% block admin_info %}
You could try to do following things, if this error is unexpected:
<ul>
<li>Check <code>var/log/prod.log</code> for additional informations</li>
<li>Check <code>var/log/prod.log</code> (or <code>docker logs</code> when Part-DB is running inside a docker container) for additional informations</li>
<li>Run <kbd>php bin/console cache:clear</kbd> to clear cache</li>
</ul>
{% endblock %}

View File

@@ -19,17 +19,27 @@
<li>Run <kbd>yarn install</kbd> and <kbd>yarn build</kbd> in Part-DB folder.</li>
<li>Run <kbd>php bin/console cache:clear</kbd></li>
</ul>
{% elseif exception.class == "Doctrine\\DBAL\\Exception\\InvalidFieldNameException" or exception.class == "Doctrine\\DBAL\\Exception\\TableNotFoundException" %}
{% elseif exception.class == "Doctrine\\DBAL\\Exception\\InvalidFieldNameException"
or exception.class == "Doctrine\\DBAL\\Exception\\TableNotFoundException"
%}
<b><i>Invalid or not existing database schema.</i></b><br><p>Try following things:</p>
<ul>
<li>Check if the <code>DATABASE_URL</code> in <code>.env.local</code> is correct</li>
<li>Check if the <code>DATABASE_URL</code> in <code>.env.local</code> (or docker configure) is correct</li>
<li>Run <kbd>php bin/console doctrine:migrations:migrate</kbd> to upgrade database schema</li>
<li>Run <kbd>php bin/console cache:clear</kbd></li>
</ul>
{% elseif exception.class == "Doctrine\\DBAL\\Exception\\DriverException" %}
<b><i>Error while executing database query.</i></b><br>This is maybe caused by an old database schema.<br><p>Try following things:</p>
<ul>
<li>Check if the <code>DATABASE_URL</code> in <code>.env.local</code> (or docker configure) is correct</li>
<li>Run <kbd>php bin/console doctrine:migrations:migrate</kbd> to upgrade database schema (if upgrade is available)</li>
<li>Run <kbd>php bin/console cache:clear</kbd></li>
<li>If this issue persist, create a ticket at <a href="https://github.com/Part-DB/Part-DB-symfony/issues" rel="noopener">GitHub</a>.</li>
</ul>
{% else %}
You could try following things, if this error is unexpected:
<ul>
<li>Check <code>var/log/prod.log</code> for additional informations</li>
<li>Check <code>var/log/prod.log</code> (or <code>docker logs</code> when Part-DB is running inside a docker container) for additional informations</li>
<li>Run <kbd>php bin/console cache:clear</kbd> to clear cache</li>
</ul>
{% endif %}

View File

@@ -32,10 +32,13 @@
<i class="fas fa-fw fa-backward" title="{% trans %}log.undo.revert{% endtrans %}"></i> {{ 'log.undo.revert.short' | trans }}
</button>
{% set url = timetravel_url(target_element, entry.timestamp) %}
{# View button #}
{% if target_element and ((attribute(entry, 'oldDataInformation') is defined and entry.oldDataInformation)
or entry is instanceof('App\\Entity\\LogSystem\\CollectionElementDeleted')) %}
<a class="btn btn-outline-secondary" href="{{ timetravel_url(target_element, entry.timestamp)}}"><i class="fas fa-fw fa-eye"></i>
or entry is instanceof('App\\Entity\\LogSystem\\CollectionElementDeleted'))
and url is not null %}
<a class="btn btn-outline-secondary" href="{{ url }}"><i class="fas fa-fw fa-eye"></i>
{% trans %}log.view_version{% endtrans %}
</a>
{% endif %}

View File

@@ -242,7 +242,7 @@
</notes>
<segment state="final">
<source>part.info.timetravel_hint</source>
<target>This is how the part appeared before %timestamp%. &lt;i&gt;Please note that this feature is experimental, so the infos are maybe not correct.&lt;/i&gt;</target>
<target>This is how the part appeared before %timestamp%. &lt;i&gt;Please note that this feature is experimental, so the info may not be correct.&lt;/i&gt;</target>
</segment>
</unit>
<unit id="7uawYY6" name="standard.label">
@@ -264,7 +264,7 @@
</notes>
<segment state="translated">
<source>infos.label</source>
<target>Infos</target>
<target>Info</target>
</segment>
</unit>
<unit id="PNqzf_X" name="history.label">
@@ -560,7 +560,7 @@
</notes>
<segment state="translated">
<source>storelocation.labelp</source>
<target>Store locations</target>
<target>Storage locations</target>
</segment>
</unit>
<unit id="eSA7p5N" name="storelocation.edit">
@@ -570,7 +570,7 @@
</notes>
<segment state="translated">
<source>storelocation.edit</source>
<target>Edit store location</target>
<target>Edit storage location</target>
</segment>
</unit>
<unit id="eIvG1.A" name="storelocation.new">
@@ -580,7 +580,7 @@
</notes>
<segment state="translated">
<source>storelocation.new</source>
<target>New store location</target>
<target>New storage location</target>
</segment>
</unit>
<unit id="ykqfBBp" name="supplier.caption">
@@ -1899,7 +1899,7 @@ Sub elements will be moved upwards.</target>
</notes>
<segment state="translated">
<source>part.edit.tab.orderdetails</source>
<target>Purchase informations</target>
<target>Purchase information</target>
</segment>
</unit>
<unit id="fLuFk_2" name="part.edit.tab.specifications">
@@ -2049,7 +2049,7 @@ Sub elements will be moved upwards.</target>
</notes>
<segment state="translated">
<source>vendor.partinfo.shopping_infos</source>
<target>Shopping informations</target>
<target>Shopping information</target>
</segment>
</unit>
<unit id="1Soir6U" name="vendor.partinfo.history">
@@ -2089,7 +2089,7 @@ Sub elements will be moved upwards.</target>
</notes>
<segment state="translated">
<source>extended_info.label</source>
<target>Extended infos</target>
<target>Extended info</target>
</segment>
</unit>
<unit id="vMya34Z" name="attachment.name">
@@ -2623,7 +2623,7 @@ Sub elements will be moved upwards.</target>
</notes>
<segment state="translated">
<source>part.delete.message</source>
<target>This part and any associated information (like attachments, price informations, etc.) will be deleted. This can not be undone!</target>
<target>This part and any associated information (like attachments, price information, etc.) will be deleted. This can not be undone!</target>
</segment>
</unit>
<unit id="CJHxw_e" name="part.delete">
@@ -2693,7 +2693,7 @@ Sub elements will be moved upwards.</target>
</notes>
<segment state="translated">
<source>parts_list.storelocation.title</source>
<target>Parts with store locations</target>
<target>Parts with storage locations</target>
</segment>
</unit>
<unit id="K3Nj1UQ" name="parts_list.supplier.title">
@@ -3395,7 +3395,7 @@ Sub elements will be moved upwards.</target>
</notes>
<segment state="translated">
<source>user.info.label</source>
<target>User informations</target>
<target>User information</target>
</segment>
</unit>
<unit id="PwI64fM" name="user.firstName.label">
@@ -4003,7 +4003,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can
</notes>
<segment state="translated">
<source>storelocation.label</source>
<target>Store location</target>
<target>Storage location</target>
</segment>
</unit>
<unit id="z1DQ7QF" name="ordernumber.label.short">
@@ -4828,7 +4828,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can
</notes>
<segment state="translated">
<source>part.table.storeLocations</source>
<target>Store locations</target>
<target>Storage locations</target>
</segment>
</unit>
<unit id="rD.1skI" name="part.table.amount">
@@ -7368,7 +7368,7 @@ Element 3</target>
</notes>
<segment state="translated">
<source>storelocation.only_single_part.help</source>
<target>If this option is activated, only a single part (with every amount) can be assigned to this store location. Useful for small SMD boxes or feeders.</target>
<target>If this option is activated, only a single part (with every amount) can be assigned to this storage location. Useful for small SMD boxes or feeders.</target>
</segment>
</unit>
<unit id="AE1UiRe" name="storelocation.storage_type.label">
@@ -7819,7 +7819,7 @@ Element 3</target>
</notes>
<segment state="translated">
<source>perm.part.no_price_parts</source>
<target>List parts without price infos</target>
<target>List parts without price info</target>
</segment>
</unit>
<unit id="ym76SPS" name="perm.part.obsolete_parts">
@@ -7969,7 +7969,7 @@ Element 3</target>
</notes>
<segment state="translated">
<source>perm.part.orderdetails</source>
<target>Order informations</target>
<target>Order information</target>
</segment>
</unit>
<unit id="4CedmDv" name="perm.part.prices">
@@ -8189,7 +8189,7 @@ Element 3</target>
</notes>
<segment state="translated">
<source>perm.users.edit_infos</source>
<target>Edit infos</target>
<target>Edit info</target>
</segment>
</unit>
<unit id="Q1NDQfs" name="perm.users.edit_permissions">
@@ -8329,7 +8329,7 @@ Element 3</target>
</notes>
<segment state="translated">
<source>perm.self.edit_infos</source>
<target>Edit infos</target>
<target>Edit info</target>
</segment>
</unit>
<unit id="tn675bY" name="perm.self.edit_username">

View File

@@ -10,7 +10,7 @@
<unit id="Dpb9AmY" name="saml.error.cannot_login_local_user_per_saml">
<segment state="translated">
<source>saml.error.cannot_login_local_user_per_saml</source>
<target>You can not login as local user via SSO! Use your local user password instead.</target>
<target>You cannot login as local user via SSO! Use your local user password instead.</target>
</segment>
</unit>
</file>

1330
yarn.lock

File diff suppressed because it is too large Load Diff