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 all 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.
3 changes: 2 additions & 1 deletion app/PartKeeprRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ protected function isWritableRecursive($dir)
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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Ext.application({
}

if (data.inactiveCronjobCount > 0) {
alert(i18n("The following cronjobs aren't running:") + "\n\n" + data.inactiveCronjobs.join("\n"));
//alert(i18n("The following cronjobs aren't running:") + "\n\n" + data.inactiveCronjobs.join("\n"));
}
},
/*
Expand Down
10 changes: 9 additions & 1 deletion src/PartKeepr/PartBundle/Entity/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
class Part extends BaseEntity
{
private $origin;
/**
* The category of the part.
*
Expand Down Expand Up @@ -759,7 +760,9 @@ public function getAveragePrice()
*/
public function setAveragePrice($price)
{
$this->averagePrice = $price;
if ($price != 0) {
$this->averagePrice = $price;
}
}

/**
Expand All @@ -784,6 +787,11 @@ public function onPreUpdate()
public function addStockLevel(StockEntry $stockEntry)
{
$stockEntry->setPart($this);

if ($this->getAveragePrice() != 0) {
$stockEntry->setPrice($this->getAveragePrice());
}

$this->stockLevels->add($stockEntry);
}

Expand Down
24 changes: 19 additions & 5 deletions src/PartKeepr/ProjectBundle/Entity/ReportPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class ReportPart extends BaseEntity
*/
private $quantity;

private $remarks;

/**
* @ORM\ManyToOne(targetEntity="PartKeepr\DistributorBundle\Entity\Distributor")
* @Groups({"default"})
Expand Down Expand Up @@ -337,13 +339,25 @@ public function setPart($part)
return $this;
}

// remark getter
public function getRemarks()
{
return $this->remarks;
}

//remark setter
public function setRemarks($remarks)
{
$this->remarks = $remarks;

return $this;
}

public function __toString()
{
// @todo i18n
return sprintf(
"Used in project report %s %s",
$this->getReport()->getName(),
$this->getReport()->getCreateDateTime()->format("Y-m-d H:i:s")
)." / ".parent::__toString();

return sprintf("Used in project report %s %s", $this->getReport()->getName(),
$this->getReport()->getCreateDateTime()->format("Y-m-d H:i:s"))." / ".parent::__toString();
}
}
2 changes: 1 addition & 1 deletion src/PartKeepr/StockBundle/Entity/StockEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function getUser()
public function checkPrice()
{
if ($this->getStockLevel() < 0 && $this->getPrice() !== null) {
$this->setPrice(null);
//$this->setPrice(null);
}
}

Expand Down