/** * * Return POS Config * * @return array Array with config */ public static function getConfig() { global $db, $conf, $langs; $cash = new Cash($db); $terminal = $_SESSION['TERMINAL_ID']; $cash->fetch($terminal); $userstatic = new User($db); $userstatic->fetch($_SESSION['uid']); $soc = new Societe($db, $cash->fk_soc); $soc->fetch($cash->fk_soc); $name = $soc->name ? $soc->name : $soc->nom; $ret['error']['value'] = 0; $ret['error']['desc'] = ''; $ret['data']['terminal']['id'] = $cash->id; $ret['data']['terminal']['name'] = $cash->name; $ret['data']['terminal']['tactil'] = $cash->tactil; $ret['data']['terminal']['warehouse'] = $cash->fk_warehouse; $ret['data']['terminal']['barcode'] = $cash->barcode; $ret['data']['terminal']['mode_info'] = 0; $ret['data']['terminal']['faclimit'] = $conf->global->POS_MAX_TTC; $ret['data']['module']['places'] = $conf->global->POS_PLACES; $ret['data']['module']['print'] = $conf->global->POS_PRINT; $ret['data']['module']['mail'] = $conf->global->POS_MAIL; $ret['data']['module']['points'] = $conf->global->REWARDS_DISCOUNT; $ret['data']['module']['ticket'] = $conf->global->POS_TICKET; $ret['data']['module']['facture'] = $conf->global->POS_FACTURE; $ret['data']['module']['print_mode'] = $conf->global->POS_PRINT_MODE; $ret['data']['user']['id'] = $userstatic->id; $ret['data']['user']['name'] = $userstatic->getFullName($langs); $dir = $conf->user->dir_output; if ($userstatic->photo) { $file = get_exdir($userstatic->id, 2) . $userstatic->photo; } if ($file && file_exists($dir . "/" . $file)) { $ret['data']['user']['photo'] = DOL_URL_ROOT . '/viewimage.php?modulepart=userphoto&entity=' . $userstatic->entity . '&file=' . urlencode($file); } else { $ret['data']['user']['photo'] = DOL_URL_ROOT . '/theme/common/nophoto.jpg'; } $ret['data']['customer']['id'] = $soc->id; $ret['data']['customer']['name'] = $name; $ret['data']['customer']['remise'] = $soc->remise_percent; $ret['data']['customer']['coupon'] = $soc->getAvailableDiscounts(); $ret['data']['customer']['points'] = null; if ($conf->global->REWARDS_POS && !empty($conf->rewards->enabled)) { $rew = new Rewards($db); $res = $rew->getCustomerReward($soc->id); if ($res) { $ret['data']['customer']['points'] = $rew->getCustomerPoints($soc->id); } } $ret['data']['decrange']['unit'] = $conf->global->MAIN_MAX_DECIMALS_UNIT; $ret['data']['decrange']['tot'] = $conf->global->MAIN_MAX_DECIMALS_TOT; $ret['data']['decrange']['maxshow'] = $conf->global->MAIN_MAX_DECIMALS_SHOWN; return $ret; }