Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added Profile
Empty file.
41 changes: 26 additions & 15 deletions app/PartKeeprRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function_exists('curl_init'),
sprintf('The php.ini memory_limit directive must be set to 128MB or higher. Your limit is set to %s',
ini_get('memory_limit')));

$this->checkWritable(realpath(dirname(__FILE__) . '/../data/'));
$this->checkWritable(realpath(dirname(__FILE__) . '/../app/'));
$this->checkWritable(realpath(dirname(__FILE__) . '/../web/'));
$this->checkWritable(realpath(dirname(__FILE__).'/../data/'));
$this->checkWritable(realpath(dirname(__FILE__).'/../app/'));
$this->checkWritable(realpath(dirname(__FILE__).'/../web/'));

$this->addRecommendation(
function_exists('apc_fetch'),
Expand All @@ -59,6 +59,12 @@ function_exists('mb_convert_case'),
sprintf('Please compile PHP with the mbstring functions in case you are using Gentoo, or install php-mbstring on RedHat, Fedora or CentOS.')
);

$this->addRequirement(
function_exists('bcscale'),
sprintf('BCMath library not found'),
sprintf('Install the BCMath library extension')
);

if (ini_get('opcache.enable')) {
if (version_compare(phpversion(), '7.0', '<')) {
$this->addPhpIniRequirement('opcache.save_comments', 1,
Expand Down Expand Up @@ -103,7 +109,7 @@ protected function checkWritable($path)
*/
protected function getBytesIniSetting($setting)
{
return (int)$this->returnBytes(ini_get($setting));
return (int) $this->returnBytes(ini_get($setting));
}

/**
Expand All @@ -117,20 +123,23 @@ protected function returnBytes($val)
{
$val = trim($val);
$last = strtolower($val[strlen($val) - 1]);
$vali = (int) substr($val, 0, -1);
switch ($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1073741824;
$vali *= 1073741824;
break;
case 'm':
$val *= 1048576;
$vali *= 1048576;
break;
case 'k':
$val *= 1024;
$vali *= 1024;
break;
default:
$vali = (int) $val;
}

return $val;
return $vali;
}

/**
Expand All @@ -145,24 +154,26 @@ protected function returnBytes($val)
protected function isWritableRecursive($dir)
{
if (!is_writable($dir)) {
throw new \Exception($dir . ' is not writable.');
throw new \Exception($dir.' is not writable.');
}

$folder = opendir($dir);
while ($file = readdir($folder)) {
if ($file != '.' && $file != '..') {
if (!is_writable($dir . '/' . $file)) {
if (!is_writable($dir.'/'.$file)) {
closedir($folder);
throw new \Exception($dir . '/' . $file . ' is not writable.');

throw new \Exception($dir.'/'.$file.' is not writable.');
} else {
// Skip hidden directories
if ((is_dir($dir . '/' . $file)) && ($file[0] == '.')) {
if ((is_dir($dir.'/'.$file)) && ($file[0] == '.')) {
continue;
}
if (is_dir($dir . '/' . $file)) {
if (!$this->isWritableRecursive($dir . '/' . $file)) {
if (is_dir($dir.'/'.$file)) {
if (!$this->isWritableRecursive($dir.'/'.$file)) {
closedir($folder);
throw new \Exception($dir . '/' . $file . ' is not writable.');

throw new \Exception($dir.'/'.$file.' is not writable.');
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions app/config/config_framework.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#services:
# app.doctrine.apc_cache:
# class: Doctrine\Common\Cache\ApcCache
# calls:
# - [setNamespace, [""]]
framework:
# annotations:
# cache: "app.doctrine.apc_cache"
#esi: ~
translator: { fallback: en }
serializer: { enable_annotations: true }
Expand Down
2 changes: 0 additions & 2 deletions app/logs/.htaccess

This file was deleted.

3 changes: 0 additions & 3 deletions app/logs/ignore.json

This file was deleted.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"symfony/assetic-bundle": "~2.8.2",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0.0",
"sensio/framework-extra-bundle": "~3.0",
"nelmio/api-doc-bundle": "~2.9@dev",
"friendsofsymfony/rest-bundle": "~1.7.1",
Expand All @@ -77,7 +76,8 @@
"phpseclib/phpseclib": "~2.0",
"snc/redis-bundle": "^1.1",
"predis/predis": "^1.0",
"guzzlehttp/guzzle": "6.2.2"
"guzzlehttp/guzzle": "6.2.2",
"sensio/distribution-bundle": "4.0.0"
},
"require-dev": {
"phpunit/phpunit": "5.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,4 @@ margin-left: -75px;
border: 1px solid #b8daff;
border-radius: .25rem;
padding: .25rem .75rem;
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ Ext.define("PartKeepr.Exporter.GridExporter", {
}

if (!column.isHidden()) {
rowValues.push(Ext.util.Format.stripTags(value));
try{
rowValues.push(Ext.util.Format.stripTags(value.replace(/[^\x1F-\x7D]/g,'')))
}
catch(err){
rowValues.push(Ext.util.Format.stripTags(value));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ Ext.define('PartKeepr.PartEditor', {
}, {
xtype: 'CategoryComboBox',
fieldLabel: i18n("Category"),
fieldClass: '',
name: 'category',
allowBlank: false,
displayField: "name",
returnObject: true
},
Expand Down Expand Up @@ -400,6 +402,7 @@ Ext.define('PartKeepr.PartEditor', {
Ext.String.format(i18n("The number of attachments must be greater than {0}"), minAttachmentCount));
}


// Force footprint to be "null" when the checkbox is checked.
if (this.footprintNone.getValue() === true) {
this.record.setFootprint(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ Ext.define("PartKeepr.PartParameterValueEditor", {
{
fieldLabel: i18n("Description"),
name: 'description',
itemId: 'description',
xtype: 'textarea'
},
{
xtype: 'UnitComboBox',
fieldLabel: i18n("Unit"),
name: 'unit',
itemId: "unit",
returnObject: true,
name: 'unit'
returnObject: true
},
{
fieldLabel: i18n("Value Type"),
Expand Down Expand Up @@ -111,14 +112,31 @@ Ext.define("PartKeepr.PartParameterValueEditor", {
},
onPartParameterSelect: function (combo, record) {

var description = record.get("description");
if (description !== null) {
this.down("#description").setRawValue(description);
}

if (record.get("unitName") !== null) {
var unit = this.down("#unit").getStore().findRecord("name", record.get("unitName"), 0, false, true, true);

if (unit instanceof PartKeepr.UnitBundle.Entity.Unit) {
this.down("#unit").select(unit);
this.down("#valueType").setValue({valueType: "numeric"});
}

} else {
this.down("#unit").select(null);
}

var valueType = record.get("valueType");
if (valueType == "numeric") {
this.down("#valueType").setValue({valueType: "numeric"});

} else if (valueType == "string") {
this.down("#valueType").setValue({valueType: "string"});
}

},
onUnitChange: function (combo, newValue) {
var prefixes,j, unitFilter = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ Ext.define('PartKeepr.PartsGrid', {

this.bottomToolbar.add({
xtype: 'button',
tooltip: i18n("Expand all Groups"),
iconCls: this.expandRowButtonIconCls,
tooltip: i18n("Collapse all Groups"),
iconCls: this.collapseRowButtonIconCls,
listeners: {
scope: this.groupingFeature,
click: this.groupingFeature.expandAll
click: this.groupingFeature.collapseAll
}

});
Expand Down Expand Up @@ -408,10 +408,11 @@ Ext.define('PartKeepr.PartsGrid', {
{
if (siPrefix instanceof PartKeepr.SiPrefixBundle.Entity.SiPrefix) {
var fractionValue = value * Math.pow(siPrefix.get("base"), siPrefix.get("exponent"));

if (siPrefix.get("exponent") < 0)
{
return fractionValue.toFixed(Math.abs(siPrefix.get("exponent")));
return fractionValue.toFixed(15); // set to femto by default
//Math.abs(siPrefix.get("exponent")));
} else
{
return fractionValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ Ext.define('PartKeepr.PartManager', {
record.setCategory(this.getSelectedCategory());
} else
{
record.setCategory(this.tree.getRootNode().firstChild);
//record.setCategory(this.tree.getRootNode().firstChild);
}

record.setPartUnit(defaultPartUnit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Ext.define('PartKeepr.Components.Project.MetaPartSubgrid', {
onApplyMetaPartsClick: function (button)
{
var parentRecord = button.up("grid").parentRecord;

this.convertMetaPartsToParts(parentRecord);
},
/**
Expand Down Expand Up @@ -113,13 +113,17 @@ Ext.define('PartKeepr.Components.Project.MetaPartSubgrid', {
} else {
missing = Math.abs(missing);
}


if(subPart.get("comment").indexOf("DO NOT CHANGE") == -1)
subPart.set("comment", subPart.get("comment") + "\nDO NOT CHANGE:" + record.data.report + record._part.data.name);
else if(subPart.get("comment").indexOf(record.data.report) != -1)
subPart.set("comment", subPart.get("comment") + record._part.data.name);
else
subPart.set("comment", subPart.get("comment").slice(0,subPart.get("comment").indexOf("DO NOT CHANGE")+14) + record.data.report + record._part.data.name);
projectReportItem = Ext.create("PartKeepr.ProjectBundle.Entity.ReportPart");
projectReportItem.setPart(subPart);
projectReportItem.set("quantity", subPart.get("stockToUse"));
projectReportItem.setReport(this.up("#projectReportResult").projectReport);


record.store.add(projectReportItem);
}
}
Expand Down Expand Up @@ -192,4 +196,4 @@ Ext.define('PartKeepr.Components.Project.MetaPartSubgrid', {
return total;
}

});
});
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Ext.define('PartKeepr.ProjectReportView', {
quantity: projectsToReport[i].quantity
}));
}

this.doSaveProjectReport();
},
/**
Expand All @@ -130,7 +130,6 @@ Ext.define('PartKeepr.ProjectReportView', {
{
this.reportResult.setProjectsToReport([]);
this.reportResult.setStore(new Ext.data.Store());

var selection = this.reportList.getSelection();
if (selection.length === 1)
{
Expand All @@ -152,7 +151,14 @@ Ext.define('PartKeepr.ProjectReportView', {
scope: this
});

this.reportList.getStore().reload();








},
onProjectReportLoaded: function () {
this.reportResult.reconfigure(this.projectReport.reportParts());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Ext.define('PartKeepr.Components.Project.ProjectReportGrid', {
autoSync: false,
remoteFilter: true,
remoteSort: true,
pageSize: 10,
pageSize: 5,
model: "PartKeepr.ProjectBundle.Entity.Report",
filters: [{
property: "name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", {
amount: item.get("quantity"),
comment: item.getReport().reportProjects().getFieldValues("project.name").join(", "),
lotNumber: item.projectParts().getFieldValues("lotNumber").join(", "),
projects: [] // item.getReport().reportProjects()
projects: []
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,42 @@ Ext.define("PartKeepr.Components.ProjectReport.Renderers.RemarksRenderer", {
return renderObj.getProjectParts(record);
},
getProjectParts: function (rec) {

var report = rec.getReport(),
i, j, project, projectPart, projectPartQuantities = [];
i, j, k, project, projectPart, projectPartQuantities = [];

for (i = 0; i < report.reportProjects().getCount(); i++)
{
project = report.reportProjects().getAt(i).getProject();

for (j = 0; j < project.parts().getCount(); j++)
{
projectPart = project.parts().getAt(j);



if (projectPart.getPart().getId() === rec.getPart().getId())
{
if (projectPart.get("remarks") !== "" && projectPart.get("remarks") !== null)
{
projectPartQuantities.push(project.get("name") + ": " + projectPart.get("remarks"));
}
}
else
{

if (rec.getPart().data.comment.includes(projectPart.getPart().data.name))
{
if (projectPart.get("remarks") !== "" && projectPart.get("remarks") !== null)
{
projectPartQuantities.push(project.get("name") + ": " + projectPart.get("remarks"));
}
}

}

}
}

return projectPartQuantities.join("&#013;&#010;")
},

Expand Down
Loading