Skip to content

Commit

Permalink
Merge branch 'pu/cw/purchasingApp' into 'main'
Browse files Browse the repository at this point in the history
feature(Purchases): new purchases module

See merge request tine20/tine20!6496
  • Loading branch information
corneliusweiss committed Jan 29, 2025
2 parents 15c2617 + fc69f9e commit c5fd935
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 15 deletions.
44 changes: 44 additions & 0 deletions tine20/Purchasing/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/*
* Tine 2.0
*
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Cornelius Weiß <[email protected]>
* @copyright Copyright (c) 2025 Metaways Infosystems GmbH (http://www.metaways.de)
*/

/**
* Purchasing config class
*
* @package Purchasing
* @subpackage Config
*/
class Purchasing_Config extends Tinebase_Config_Abstract
{
use Tinebase_Controller_SingletonTrait;

const APP_NAME = 'Purchasing';

/**
* (non-PHPdoc)
* @see tine20/Tinebase/Config/Abstract::$_appName
*/
protected $_appName = self::APP_NAME;

/**
* (non-PHPdoc)
* @see tine20/Tinebase/Config/Definition::$_properties
*/
protected static $_properties = [

];

/**
* (non-PHPdoc)
* @see tine20/Tinebase/Config/Abstract::getProperties()
*/
public static function getProperties()
{
return self::$_properties;
}
}
12 changes: 12 additions & 0 deletions tine20/Purchasing/Setup/setup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<application>
<name>Purchasing</name>
<!-- gettext('Purchasing') -->
<version>18.0</version>
<order>60</order>
<status>enabled</status>
<depends>
<application>Sales</application>
</depends>
<tables/>
</application>
16 changes: 16 additions & 0 deletions tine20/Purchasing/images/purchasing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions tine20/Purchasing/js/Mainscreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Tine 2.0
*
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Cornelius Weiß <[email protected]>
* @copyright Copyright (c) 2025 Metaways Infosystems GmbH (http://www.metaways.de)
*/

Ext.ns('Tine.Purchasing');

Tine.Purchasing.MainScreen = Ext.extend(Tine.widgets.MainScreen, {
appName: 'Sales',
activeContentType: 'Supplier',
contentTypes: [
{appName: 'Sales', modelName: 'Supplier', requiredRight: 'manage_suppliers', singularContainerMode: true},
{appName: 'Sales', modelName: 'PurchaseInvoice', requiredRight: 'manage_purchase_invoices', singularContainerMode: true},
]
});
14 changes: 14 additions & 0 deletions tine20/Purchasing/js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Purchasing",
"version": "18.0.0",
"description": "tine groupware purchasing Application",
"main": "purchasing.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"Purchasing"
],
"author": "Cornelius Weiß",
"license": "AGPL-3.0"
}
9 changes: 9 additions & 0 deletions tine20/Purchasing/js/purchasing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Tine 2.0
*
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Cornelius Weiß <[email protected]>
* @copyright Copyright (c) 2025 Metaways Infosystems GmbH (http://www.metaways.de)
*/
import '../styles/purchasing.less'
import './Mainscreen'
3 changes: 3 additions & 0 deletions tine20/Purchasing/styles/purchasing.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.PurchasingIconCls {
background-image:url(../images/purchasing.svg) !important;
}
4 changes: 2 additions & 2 deletions tine20/Sales/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// this switches modules off in business edition
'features' => array(
'invoicesModule' => false,
'suppliersModule' => false,
'suppliersModule' => true,
'offersModule' => false,
'orderConfirmationsModule' => false,
'purchaseInvoicesModule' => false,
'purchaseInvoicesModule' => true,
)
);
1 change: 1 addition & 0 deletions tine20/Sales/css/Sales.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@

.preview-panel-invoice-left {
float: left;
/*box-sizing: border-box;*/
position: relative;
width: 32%;
height: 122px;
Expand Down
33 changes: 28 additions & 5 deletions tine20/Sales/js/PurchaseInvoiceDetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ Tine.Sales.PurchaseInvoiceDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPan
* @todo: generalize this
*/
initDefaultTemplate: function() {

this.defaultTpl = new Ext.XTemplate(
'<div class="preview-panel-timesheet-nobreak">',
this.defaultTpl = new Ext.XTemplate(
'<div class="preview-panel-timesheet-nobreak">',
'<!-- Preview contacts -->',
'<div class="preview-panel preview-panel-invoice-default">',
'<div class="preview-panel preview-panel-timesheet-left">',
'<div class="bordercorner_1"></div>',
'<div class="bordercorner_2"></div>',
'<div class="bordercorner_3"></div>',
'<div class="bordercorner_4"></div>',
'<div class="preview-panel-declaration">' + this.app.i18n.n_hidden('Invoice', 'Invoices', 3) + '</div>',
'<div class="preview-panel-declaration">'+ this.app.i18n.n_hidden('Invoice', 'Invoices', 3) + '</div>',
'<div class="preview-panel-timesheet-leftside preview-panel-left">',
'<span class="preview-panel-bold">',
this.app.i18n._('Select invoice') + '<br/>',
Expand All @@ -78,6 +77,30 @@ Tine.Sales.PurchaseInvoiceDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPan
'</span>',
'</div>',
'</div>',
'<!-- Preview xxx -->',
'<div class="preview-panel-timesheet-right">',
'<div class="bordercorner_gray_1"></div>',
'<div class="bordercorner_gray_2"></div>',
'<div class="bordercorner_gray_3"></div>',
'<div class="bordercorner_gray_4"></div>',
'<div class="preview-panel-declaration"></div>',
'<div class="preview-panel-timesheet-leftside preview-panel-left">',
'<span class="preview-panel-bold">',
'<br/>',
'<br/>',
'<br/>',
'<br/>',
'</span>',
'</div>',
'<div class="preview-panel-timesheet-rightside preview-panel-left">',
'<span class="preview-panel-nonbold">',
'<br/>',
'<br/>',
'<br/>',
'<br/>',
'</span>',
'</div>',
'</div>',
'</div>'
);
},
Expand Down
4 changes: 2 additions & 2 deletions tine20/Sales/js/Sales.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Tine.Sales.MainScreen = Ext.extend(Tine.widgets.MainScreen, {
{modelName: 'Product', requiredRight: 'manage_products', singularContainerMode: true},
{modelName: 'Contract', requiredRight: 'manage_contracts', singularContainerMode: true, genericCtxActions: ['grants']},
{modelName: 'Customer', requiredRight: 'manage_customers', singularContainerMode: true},
{modelName: 'Supplier', requiredRight: 'manage_suppliers', singularContainerMode: true},
{modelName: 'PurchaseInvoice', requiredRight: 'manage_purchase_invoices', singularContainerMode: true},
// {modelName: 'Supplier', requiredRight: 'manage_suppliers', singularContainerMode: true},
// {modelName: 'PurchaseInvoice', requiredRight: 'manage_purchase_invoices', singularContainerMode: true},

// deprecated documents
// TODO add migration to new documents
Expand Down
8 changes: 4 additions & 4 deletions tine20/Sales/js/SupplierDetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Tine.Sales.SupplierDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
initDefaultTemplate: function() {

this.defaultTpl = new Ext.XTemplate(
'<div class="preview-panel-timesheet-nobreak">',
'<div class="preview-panel-timesheet-nobreak">',
'<!-- Preview contacts -->',
'<div class="preview-panel preview-panel-timesheet-left">',
'<div class="bordercorner_1"></div>',
Expand Down Expand Up @@ -115,7 +115,7 @@ Tine.Sales.SupplierDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
this.tpl = new Ext.XTemplate(
'<tpl for=".">',
'<!-- Preview core data -->',
'<div class="preview-panel preview-panel-left preview-panel-supplier">',
'<div class="preview-panel preview-panel-invoice-left preview-panel-left preview-panel-supplier">',
'<div class="bordercorner_1"></div>',
'<div class="bordercorner_2"></div>',
'<div class="bordercorner_3"></div>',
Expand All @@ -133,7 +133,7 @@ Tine.Sales.SupplierDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
'</div>',

'<!-- Preview accounting data -->',
'<div class="preview-panel preview-panel-left preview-panel-supplier">',
'<div class="preview-panel preview-panel-invoice-left preview-panel-left preview-panel-supplier">',
'<div class="bordercorner_1"></div>',
'<div class="bordercorner_2"></div>',
'<div class="bordercorner_3"></div>',
Expand All @@ -149,7 +149,7 @@ Tine.Sales.SupplierDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
'</div>',

'<!-- Preview description -->',
'<div class="preview-panel-description preview-panel-left preview-panel-supplier">',
'<div class="preview-panel-description preview-panel-invoice-left preview-panel-left preview-panel-supplier" style="box-sizing: border-box; height: 132px;">',
'<div class="bordercorner_gray_1"></div>',
'<div class="bordercorner_gray_2"></div>',
'<div class="bordercorner_gray_3"></div>',
Expand Down
5 changes: 3 additions & 2 deletions tine20/Tinebase/js/widgets/ContentTypeTreePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ Ext.extend(Tine.widgets.ContentTypeTreePanel, Ext.tree.TreePanel, {
var groupNodes = {};
this.setRootNode(treeRoot);
var treeRoot = this.getRootNode();

this.recordClass = Tine[this.app.appName].Model[this.contentType];

var def = this.mainScreen.getContentTypeDefinition(this.contentType) || {};
this.recordClass = Tine[def.appName || this.app.appName].Model[def.modelName || this.contentType];

this.on('click', this.saveClickedNodeState, this);

Expand Down

0 comments on commit c5fd935

Please sign in to comment.