-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonas Dambacher
committed
May 27, 2016
1 parent
b392760
commit e0a7b3d
Showing
17 changed files
with
1,107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
/bin/* | ||
!bin/console | ||
!bin/symfony_requirements | ||
/composer.lock | ||
/vendor/ | ||
|
||
# Assets and user uploads | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
before_script: | ||
|
||
stages: | ||
- test | ||
|
||
test: | ||
stage: test | ||
script: | ||
- export ENV=Development | ||
- rm -r /var/www | ||
- ln -s /builds/efis/collmexBundle /var/www | ||
- cd /var/www | ||
- wget http://getcomposer.org/composer.phar -O composer.phar | ||
- php -dmemory_limit=2G composer.phar install --optimize-autoloader | ||
- php app/console assetic:dump --env=dev | ||
- php app/console cache:clear --env=dev | ||
- php app/console assets:install web --symlink | ||
- chown -R www-data:root /var/www | ||
- ./bin/phpunit -c app --coverage-text --colors=never | ||
allow_failure: false | ||
tags: | ||
- docker-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace CoffeeBike\CollmexBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class CoffeeBikeCollmexBundle extends Bundle | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace CoffeeBike\CollmexBundle\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
use Symfony\Component\DependencyInjection\Loader; | ||
|
||
/** | ||
* This is the class that loads and manages your bundle configuration | ||
* | ||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} | ||
*/ | ||
class CoffeeBikeCollmexExtension extends Extension | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$configuration = new Configuration(); | ||
$config = $this->processConfiguration($configuration, $configs); | ||
|
||
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
$loader->load('services.xml'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace CoffeeBike\CollmexBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
/** | ||
* This is the class that validates and merges configuration from your app/config files | ||
* | ||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} | ||
*/ | ||
class Configuration implements ConfigurationInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder(); | ||
$rootNode = $treeBuilder->root('coffee_bike_collmex'); | ||
|
||
// Here you should define the parameters that are allowed to | ||
// configure your bundle. See the documentation linked above for | ||
// more information on that topic. | ||
|
||
return $treeBuilder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<?php | ||
|
||
namespace CoffeeBike\CollmexBundle\Models; | ||
|
||
|
||
|
||
class Invoice | ||
{ | ||
const INVOICE_TYPE_INVOICE = 0; | ||
const INVOICE_TYPE_CREDIT_MEMO = 1; | ||
const INVOICE_TYPE_DOWN_PAYMENT = 2; | ||
const INVOICE_TYPE_CASH_SALE = 3; | ||
const INVOICE_TYPE_CREDIT_FOR_RETURNS = 4; | ||
const INVOICE_TYPE_PRO_FORMA_INVOICE = 5; | ||
|
||
const NOT_DELETED = 0; | ||
const DELETED = 1; | ||
|
||
const LANGUAGE_GERMAN = 0; | ||
const LANGUAGE_ENGLISH = 1; | ||
|
||
const STATUS_NEW = 0; | ||
const STATUS_TO_BOOK = 10; | ||
const STATUS_OPEN = 20; | ||
const STATUS_REMINDED = 30; | ||
const STATUS_DONE = 40; | ||
const STATUS_DELETED = 100; | ||
|
||
const POSITION_NORMAL = 0; | ||
const POSITION_SUM = 1; | ||
const POSITION_TEXT = 2; | ||
const POSITION_FREE = 3; | ||
|
||
const TAX_RATE_FULL = 0; | ||
const TAX_RATE_REDUCED = 1; | ||
const TAX_RATE_TAXFREE = 2; | ||
|
||
/** | ||
* Type data template | ||
* | ||
* @var array | ||
*/ | ||
protected $template = array( | ||
'type_identifier' => 'CMXINV', | ||
'invoice_id' => null, | ||
'position' => null, | ||
'invoice_type' => null, | ||
'client_id' => null, | ||
'order_id' => null, | ||
'customer_id' => null, | ||
'customer_salutation' => null, | ||
'customer_title' => null, | ||
'customer_forename' => null, | ||
'customer_lastname' => null, | ||
'customer_firm' => null, | ||
'customer_department' => null, | ||
'customer_street' => null, | ||
'customer_zipcode' => null, | ||
'customer_city' => null, | ||
'customer_country' => null, | ||
'customer_phone' => null, | ||
'customer_phone_2' => null, | ||
'customer_fax' => null, | ||
'customer_email' => null, | ||
'customer_bank_account' => null, | ||
'customer_bank_code' => null, | ||
'customer_bank_account_owner' => null, | ||
'customer_bank_iban' => null, | ||
'customer_bank_bic' => null, | ||
'customer_bank_name' => null, | ||
'customer_vat_id' => null, | ||
'reserved' => null, | ||
'invoice_date' => null, | ||
'price_date' => null, | ||
'terms_of_payment' => null, | ||
'currency' => null, | ||
'price_group' => null, | ||
'discount_id' => null, | ||
'discount_final' => null, | ||
'discount_reason' => null, | ||
'invoice_text' => null, | ||
'final_text' => null, | ||
'annotation' => null, | ||
'deleted' => null, | ||
'language' => null, | ||
'employee_id' => null, | ||
'agent_id' => null, | ||
'system_name' => null, | ||
'status' => null, | ||
'discount_final_2' => null, | ||
'discount_final_2_reason' => null, | ||
'shipping_id' => null, | ||
'shipping_costs' => null, | ||
'cod_costs' => null, | ||
'time_of_delivery' => null, | ||
'delivery_conditions' => null, | ||
'delivery_conditions_additional' => null, | ||
'delivery_salutation' => null, | ||
'delivery_title' => null, | ||
'delivery_forename' => null, | ||
'delivery_lastname' => null, | ||
'delivery_firm' => null, | ||
'delivery_department' => null, | ||
'delivery_street' => null, | ||
'delivery_zipcode' => null, | ||
'delivery_city' => null, | ||
'delivery_country' => null, | ||
'delivery_phone' => null, | ||
'delivery_phone_2' => null, | ||
'delivery_fax' => null, | ||
'delivery_email' => null, | ||
'position_type' => null, | ||
'product_id' => null, | ||
'product_description' => null, | ||
'quantity_unit' => null, | ||
'quantity' => null, | ||
'price' => null, | ||
'price_quantity' => null, | ||
'position_discount' => null, | ||
'position_value' => null, | ||
'product_type' => null, | ||
'tax_rate' => null, | ||
'foreign_tax' => null, | ||
'customer_order_position' => null, | ||
'revenue_type' => null, | ||
'sum_over_positions' => null, | ||
'revenue' => null, | ||
'costs' => null, | ||
'gross_profit' => null, | ||
'margin' => null, | ||
'costs_manual' => null, | ||
); | ||
|
||
/** | ||
* Formally validates the type data in $data attribute. | ||
* | ||
* @return bool Validation success | ||
*/ | ||
public function validate() | ||
{ | ||
// TODO: Implement validate() method. | ||
} | ||
|
||
public function setInvoiceData($aTemplate) | ||
{ | ||
$i = 0; | ||
foreach ($this->template as $key => $value) { | ||
$this->template[$key] = $aTemplate[$i]; | ||
$i++; | ||
|
||
} | ||
} | ||
|
||
public function getData() | ||
{ | ||
return $this->template; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?php | ||
|
||
namespace CoffeeBike\CollmexBundle\Models; | ||
|
||
|
||
class Product | ||
{ | ||
protected $template = array( | ||
'type_identifier' => 'CMXPRD', | ||
'product_id' => null, | ||
'product_name' => null, | ||
'product_name_en' => null, | ||
'base_unit_measure' => null, | ||
'product_group' => null, | ||
'company' => null, | ||
'tax_classification' => null, | ||
'weight' => null, | ||
'weight_base_unit' => null, | ||
'price_quotation' => null, | ||
'product_type' => null, | ||
'inactive' => null, | ||
'price_group' => null, | ||
'retail_price' => null, | ||
'ean' => null, | ||
'manufacturer' => null, | ||
'shipping_group' => null, | ||
'minimum_stock ' => null, | ||
'order_volume' => null, | ||
'batch_management_requirement' => null, | ||
'procurement' => null, | ||
'production_time' => null, | ||
'wage_costs' => null, | ||
'wage_costs_reference_amount' => null, | ||
'remark' => null, | ||
'cost_determination' => null, | ||
'cost' => null, | ||
'cost_reference_amount' => null, | ||
'supplier' => null, | ||
'supplier_tax_classification' => null, | ||
'supplier_product_id' => null, | ||
'supplier_package_unit' => null, | ||
'supplier_designation' => null, | ||
'supplier_price' => null, | ||
'supplier_price_amount' => null, | ||
'supplier_delivery_time' => null, | ||
'supplier_currency' => null, | ||
'reserved1' => null, | ||
'reserved2' => null, | ||
'website_no' => null, | ||
'shop_shorttext' => null, | ||
'shop_fulltext' => null, | ||
'text_html' => null, | ||
'filename' => null, | ||
'keywords' => null, | ||
'title' => null, | ||
'different_template' => null, | ||
'picture_url' => null, | ||
'basic_price_amount_1' => null, | ||
'basic_price_amount_2' => null, | ||
'basic_unit' => null, | ||
'requested_price' => null, | ||
'inactive_product' => null, | ||
'shop_category' => null, | ||
'reserved3' => null, | ||
'reserved4' => null, | ||
'reserved5' => null, | ||
'manufacturer_product_id' => null, | ||
'delivery_relevance' => null, | ||
'amazon_asin' => null, | ||
'ebay_article_id' => null, | ||
'direct_delivery' => null, | ||
'goods_number' => null, | ||
); | ||
|
||
protected $extraInfo; | ||
|
||
|
||
public function setData($aTemplate) | ||
{ | ||
$i = 0; | ||
foreach ($this->template as $key => $value) { | ||
$this->template[$key] = $aTemplate[$i]; | ||
$i++; | ||
} | ||
|
||
$this->parseRemark(); | ||
} | ||
|
||
public function getData() | ||
{ | ||
return $this->template; | ||
} | ||
|
||
public function setField($key, $value) | ||
{ | ||
$this->template[$key] = $value; | ||
|
||
if ($key == 'remark') { | ||
$this->parseRemark(); | ||
} | ||
} | ||
|
||
public function getField($key) | ||
{ | ||
return $this->template[$key]; | ||
} | ||
|
||
public function getExtraInfo() | ||
{ | ||
return $this->extraInfo; | ||
} | ||
|
||
public function parseRemark() | ||
{ | ||
$remark = $this->getField('remark'); | ||
$key = null; | ||
$value = null; | ||
|
||
preg_match_all("/(\[)(.*?)(\])/", $remark, $aMatches); | ||
|
||
foreach ($aMatches[2] as $match) { | ||
$parameters = explode('=', $match); | ||
$key = $parameters[0]; | ||
$value = $parameters[1]; | ||
} | ||
|
||
$this->extraInfo[$key] = $value; | ||
} | ||
} |
Oops, something went wrong.