123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?php
- namespace Core\App\Factory;
- class SettingsFactory extends EntityFactory
- {
- const DEFAULT_AUTO_STOCK_SYNC = 'activ';
- const DEFAULT_AUTO_ORDER_SYNC = 'activ';
- const DEFAULT_DOC_UPD = 'inactiv';
- const DEFAULT_PDLS = '';
- const DEFAULT_SHOW_OBS = 'activ';
- const DEFAULT_ORDER_OR_PROFORMA = 'order';
- const DEFAULT_PROFORMA_SERIE = '';
- const DEFAULT_AVIZE_SERIE = '';
- const DEFAULT_EXPFACTURA_SERIE = '';
- const DEFAULT_ORDERED_DAYS_AGO = '7';
- const DEFAULT_STOCK_FILTER = '';
- const AUTO_SYNC_ENABLED = 'activ';
- const AUTO_SYNC_DISABLED = 'inactiv';
- const DOC_UPD_ENABLED = 'activ';
- const DOC_UPD_DISABLED = 'inactiv';
- const SHOW_OBS_ENABLED = 'activ';
- const SHOW_OBS_DISABLED = 'inactiv';
- const SYNC_ENABLED = 'activ';
- const SYNC_DISABLED = 'inactiv';
- const SELECT_ORDER = 'order';
- const SELECT_PROFORMA = 'proforma';
- const SELECT_FACTURA = 'factura';
- const SELECT_AVIZE = 'avize';
- const SELECT_EXPFACTURA = 'expfactura';
- const DEFAULT_ADD_PROFORMA = 'inactiv';
- const DEFAULT_ADD_AVIZE = 'inactiv';
- const DEFAULT_ADD_EXPFACTURA = 'inactiv';
- const DEFAULT_ADD_INVOICE = 'activ';
- const DEFAULT_VIEW_PROFORMA = 'activ';
- const DEFAULT_VIEW_AVIZE = 'activ';
- const DEFAULT_VIEW_EXPFACTURA = 'activ';
- const DEFAULT_VIEW_INVOICE = 'activ';
- const DEFAULT_EDIT_PROFORMA = 'inactiv';
- const DEFAULT_EDIT_AVIZE = 'inactiv';
- const DEFAULT_EDIT_EXPFACTURA = 'inactiv';
- const DEFAULT_EDIT_INVOICE = 'inactiv';
- const DEFAULT_LOCATIONS = null;
- const DEFAULT_WITH_DISCOUNT = 'activ';
- const DEFAULT_PROFORMA_SERIE2 = '';
- const DEFAULT_AVIZE_SERIE2 = '';
- const DEFAULT_EXPFACTURA_SERIE2 = '';
- const DEFAULT_INVOICE_SERIE = '';
- public function createSettings(
- $auth_api_key = '',
- $auth_username = '',
- $auth_password = '',
- $auth_fiscal_code = '',
- $option_auto_stock_sync = '',
- $option_auto_order_sync = '',
- $option_pdls = '',
- $option_stock_filter = '',
- $option_order_or_proforma = '',
- $option_proforma_serie = '',
- $option_avize_serie = '',
- $option_expfactura_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->setOptionAvizeSerie(($option_avize_serie != '') ? $option_avize_serie : self::DEFAULT_AVIZE_SERIE);
- $settings->setOptionExpfacturaSerie(($option_expfactura_serie != '') ? $option_expfactura_serie : self::DEFAULT_EXPFACTURA_SERIE);
- $settings->setOptionPdls(($option_pdls != '') ? $option_pdls : self::DEFAULT_PDLS);
- $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->setDocUpdOptions(array(self::DOC_UPD_ENABLED, self::DOC_UPD_DISABLED));
- // $settings->setShowObsOptions(array(self::SHOW_OBS_ENABLED, self::SHOW_OBS_DISABLED));
- $settings->setOrderOrProformaOptions(array(self::SELECT_ORDER, self::SELECT_PROFORMA, self::SELECT_EXPFACTURA, self::SELECT_AVIZE));
- $settings->setSyncDataTypes(array(
- 'product',
- 'order',
- 'stock'
- ));
- return $settings;
-
- }
- }
|