mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-26 19:52:37 +01:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56828e9e00 | ||
|
|
d2358c9550 | ||
|
|
ab11747fab | ||
|
|
44cb0fa434 | ||
|
|
13814695ac | ||
|
|
377e2eb613 | ||
|
|
636776c531 | ||
|
|
ca4a33d408 | ||
|
|
9db158f4d4 | ||
|
|
ea8b179df1 | ||
|
|
efc152e3c8 | ||
|
|
e68827bf3b | ||
|
|
58bf69882f | ||
|
|
915f313efd | ||
|
|
52d29099a2 | ||
|
|
c06fc926a1 | ||
|
|
7640ed08bc |
@@ -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
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# For sh files, always use LF line endings
|
||||
*.sh text eol=lf
|
||||
15
Dockerfile
15
Dockerfile
@@ -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$>'; \
|
||||
|
||||
@@ -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
370
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
</notes>
|
||||
<segment state="final">
|
||||
<source>part.info.timetravel_hint</source>
|
||||
<target>This is how the part appeared before %timestamp%. <i>Please note that this feature is experimental, so the infos are maybe not correct.</i></target>
|
||||
<target>This is how the part appeared before %timestamp%. <i>Please note that this feature is experimental, so the info may not be correct.</i></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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user