Commit f82e4b38 authored by Karamel's avatar Karamel
Browse files

Make getDirectFieldNames and getAssociationFields protected static.

parent 67a61d16
......@@ -31,10 +31,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class CashRegister extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'reference', 'label', 'nextTicketId', 'nextSessionId'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'sessions',
......
......@@ -45,14 +45,14 @@ class CashSession extends DoctrineModel
/** Close type for a fiscal year close. */
const CLOSE_FYEAR = 2;
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['sequence', 'continuous', 'openDate', 'closeDate',
'openCash', 'closeCash', 'expectedCash',
'ticketCount', 'custCount',
'cs', 'csPeriod', 'csFYear'];
// 'closeType' (optional) imported on close but not exported nor stored.
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'cashRegister',
......
......@@ -36,11 +36,11 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class CashSessionCat extends DoctrineModel // Embedded class
{
public function getDirectFieldNames() {
protected static function getDirectFieldNames() {
// Not associative to be able to delete empty categories.
return ['reference', 'label', 'amount'];
}
public function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'cashSession',
......
......@@ -36,11 +36,11 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class CashSessionCatTax extends DoctrineModel // Embedded class
{
public function getDirectFieldNames() {
protected static function getDirectFieldNames() {
// Not associative to be able to delete empty categories.
return ['reference', 'label', 'base', 'amount'];
}
public function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'cashSession',
......
......@@ -36,10 +36,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class CashSessionCustBalance extends DoctrineModel // Embedded class
{
public function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['balance'];
}
public function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'cashSession',
......
......@@ -35,10 +35,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class CashSessionPayment extends DoctrineModel // Embedded class
{
public function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['amount', 'currencyAmount'];
}
public function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'cashSession',
......@@ -135,7 +135,7 @@ class CashSessionPayment extends DoctrineModel // Embedded class
$payment = new CashSessionPayment();
$payment->setAmount($struct['amount']);
$payment->setCurrencyAmount($struct['currencyAmount']);
$currencyField = $payment->getAssociationFields()[2];
$currencyField = static::getAssociationFields()[2];
$payment->setCurrency($payment->readAssociationValue($struct, $dao, $currencyField));
$search = $dao->search(\Pasteque\Server\Model\PaymentMode::class,
new DAOCondition('reference', '=', $struct['type']));
......
......@@ -36,12 +36,12 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class CashSessionTax extends DoctrineModel // Embedded class
{
public function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['taxRate',
'base', 'basePeriod', 'baseFYear',
'amount', 'amountPeriod', 'amountFYear'];
}
public function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'cashSession',
......
......@@ -33,10 +33,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
class Category extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'reference', 'label', 'dispOrder', 'hasImage'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'parent',
......
......@@ -32,10 +32,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class CompositionGroup extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'label', 'dispOrder'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'product',
......
......@@ -32,10 +32,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class CompositionProduct extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['dispOrder'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'compositionGroup',
......
......@@ -33,11 +33,11 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class Currency extends DoctrineModel
{
public function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'reference', 'label', 'symbol', 'decimalSeparator',
'thousandsSeparator', 'format', 'rate', 'main', 'visible'];
}
public function getAssociationFields() {
protected static function getAssociationFields() {
return [];
}
......
......@@ -33,14 +33,14 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class Customer extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'dispName', 'card',
'maxDebt', 'balance',
'firstName', 'lastName', 'email', 'phone1', 'phone2', 'fax',
'addr1', 'addr2', 'zipCode', 'city', 'region', 'country',
'note', 'visible', 'hasImage', 'expireDate'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'discountProfile',
......
......@@ -34,11 +34,11 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class Discount extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'label', 'startDate', 'endDate', 'rate', 'barcode',
'barcodeType', 'dispOrder'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [];
}
......
......@@ -32,10 +32,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class DiscountProfile extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'label', 'rate'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [];
}
......
......@@ -37,10 +37,10 @@ class FiscalTicket extends DoctrineModel
const TYPE_ZTICKET = 'z';
const TYPE_TICKET = 'tkt';
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['type', 'sequence', 'number', 'date', 'content', 'signature'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return []; // Must be empty, FiscalTickets must be self-contained.
}
......
......@@ -32,10 +32,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class Floor extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'label', 'dispOrder'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'places',
......
......@@ -64,10 +64,10 @@ class Image extends DoctrineModel
}
}
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['model', 'modelId', 'mimeType', 'image'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [];
}
......
......@@ -33,11 +33,11 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class Option extends DoctrineModel
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
// 'key' and 'value' are keywords in mysql and crash Doctrine
return ['name', 'system', 'mandatory', 'content'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [];
}
......
......@@ -47,10 +47,10 @@ class PaymentMode extends DoctrineModel
/** Uses customer's prepaid (includes CUST_ASSIGNED) */
const CUST_PREPAID = 5; // 4 + PaymentMode::CUST_ASSIGNED;
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['id', 'reference', 'label', 'backLabel', 'type', 'visible', 'dispOrder', 'hasImage'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'values',
......
......@@ -33,10 +33,10 @@ use \Pasteque\Server\System\DAO\DoctrineModel;
*/
class PaymentModeReturn extends DoctrineModel // Embedded class
{
protected function getDirectFieldNames() {
protected static function getDirectFieldNames() {
return ['minAmount'];
}
protected function getAssociationFields() {
protected static function getAssociationFields() {
return [
[
'name' => 'paymentMode',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment