123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- namespace Core\App\Factory;
- class SettingsFactory extends EntityFactory
- {
- const DEFAULT_AUTO_STOCK_SYNC = 'activ';
- const DEFAULT_AUTO_ORDER_SYNC = 'activ';
- const DEFAULT_ORDER_OR_PROFORMA = 'order';
- const DEFAULT_PROFORMA_SERIE = '';
- const DEFAULT_ORDERED_DAYS_AGO = '7';
- const DEFAULT_STOCK_FILTER = '';
- const AUTO_SYNC_ENABLED = 'activ';
- const AUTO_SYNC_DISABLED = 'inactiv';
- const SYNC_ENABLED = 'activ';
- const SYNC_DISABLED = 'inactiv';
- const SELECT_ORDER = 'order';
- const SELECT_PROFORMA = 'proforma';
- const DEFAULT_LOCATIONS = null;
- const DEFAULT_WITH_DISCOUNT = 'activ';
- public function createSettings(
- $auth_api_key = '',
- $auth_username = '',
- $auth_password = '',
- $auth_fiscal_code = '',
- $option_auto_stock_sync = '',
- $option_auto_order_sync = '',
- $option_stock_filter = '',
- $option_order_or_proforma = '',
- $option_proforma_serie = '',
- $option_ordered_days_ago = '',
- $option_locations = null,
- $option_with_discount = ''
- )
- {
- $settings = new \Core\App\Entity\Settings();
- $settings->setAuthApiKey($auth_api_key);
- $settings->setAuthUsername($auth_username);
- $settings->setAuthPassword($auth_password);
- $settings->setAuthFiscalCode($auth_fiscal_code);
- $settings->setOptionAutoStockSync(($option_auto_stock_sync != '') ? $option_auto_stock_sync : self::DEFAULT_AUTO_STOCK_SYNC);
- $settings->setOptionAutoOrderSync(($option_auto_order_sync != '') ? $option_auto_order_sync : self::DEFAULT_AUTO_ORDER_SYNC);
- $settings->setOptionStockFilter(($option_stock_filter != '') ? $option_stock_filter : self::DEFAULT_STOCK_FILTER);
- $settings->setOptionOrderOrProforma(($option_order_or_proforma != '') ? $option_order_or_proforma : self::DEFAULT_ORDER_OR_PROFORMA);
- $settings->setOptionProformaSerie(($option_proforma_serie != '') ? $option_proforma_serie : self::DEFAULT_PROFORMA_SERIE);
- $settings->setOptionOrderedDaysAgo(($option_ordered_days_ago != '') ? $option_ordered_days_ago : self::DEFAULT_ORDERED_DAYS_AGO);
- $settings->setOptionLocations(!is_null($option_locations) ? explode(", ", $option_locations) : self::DEFAULT_LOCATIONS);
- $settings->setOptionWithDiscount(($option_with_discount != '') ? $option_with_discount : self::DEFAULT_WITH_DISCOUNT);
- $settings->setCustomFieldBank(array(
- 'Banca',
- 'Nume banca',
- 'Numele bancii',
- 'Bancă',
- ));
- $settings->setCustomFieldAccount(array(
- 'Cont bancar',
- 'Contul bancii',
- 'Cont',
- 'Contul bancar',
- ));
- $settings->setCustomFieldCompany(array(
- 'Denumire firmă',
- 'Denumire firma',
- 'Denumirea firmei',
- 'Nume firmă',
- 'Nume firma',
- 'Firma',
- 'Firmă'
- ));
- $settings->setCustomFieldFiscalCode(array(
- 'CUI',
- 'Cod Fiscal',
- 'Codul Fiscal'
- ));
- $settings->setCustomFieldRegNumber(array(
- 'Număr de înregistrare',
- 'Numar de inregistrare',
- ));
-
- $settings->setAutoSyncOptions(array(self::AUTO_SYNC_ENABLED, self::AUTO_SYNC_DISABLED));
- $settings->setOrderOrProformaOptions(array(self::SELECT_ORDER, self::SELECT_PROFORMA));
- $settings->setSyncDataTypes(array(
- 'product',
- 'order',
- 'stock'
- ));
- return $settings;
-
- }
- }
|