core/api/modules/lk-my-orgs/index.php

79 lines
4.2 KiB
PHP

<?php
ini_set('display_errors', 0);
if ( $db['type'] == 'mysql' ) \DB::alterTable( "ALTER TABLE `org` ADD `bic` int(10) NULL, ADD `rs` varchar(40) COLLATE 'utf8_general_ci' NULL AFTER `bic`, ADD FOREIGN KEY (`bic`) REFERENCES `bic` (`id`)" );
if ( $db['type']=='sqlite3' ) \DB::alterTable( "ALTER TABLE `org` ADD `bic` TEXT" );
if ( $db['type']=='sqlite3' ) \DB::alterTable( "ALTER TABLE `org` ADD `rs` TEXT" );
if ( $db['type'] == 'mysql' ) \DB::alterTable( "ALTER TABLE `org` ADD `podval_scheta` longtext NULL" );
if ( $db['type'] == 'mysql' ) \DB::alterTable( "ALTER TABLE `org` ADD `dir` varchar(200) NULL" );
if ( $db['type'] == 'mysql' ) \DB::alterTable( "ALTER TABLE `org` ADD `buh` varchar(200) NULL" );
if ( $db['type']=='sqlite3' ) \DB::alterTable( "ALTER TABLE `org` ADD `podval_scheta` TEXT" );
if ( $db['type']=='sqlite3' ) \DB::alterTable( "ALTER TABLE `org` ADD `dir` TEXT" );
if ( $db['type']=='sqlite3' ) \DB::alterTable( "ALTER TABLE `org` ADD `buh` TEXT" );
$smarty -> assign( 'editor_js', '<script language="javascript" type="text/javascript" src="/api/soft/tinymce/4.3.12/tinymce.min.js"></script><script language="javascript" type="text/javascript" src="/api/soft/tinymce/4.3.12/load.php"></script>');
/* ----------------------------------------------------------------------
07.12.2023
Получаем список своих организаций
---------------------------------------------------------------------- */
$listMyOrgs=\DB::getAll("SELECT * FROM `multiOrg` WHERE `user_id`=? AND `status`=1", $_SESSION['user_id']);
for ($i=0; $i<count($listMyOrgs); $i++)$listMyOrgs[$i]['txt'] = \DB::getValue("SELECT `txt` FROM `org` WHERE `id`=?", $listMyOrgs[$i]['org_id']);
$smarty -> assign( 'listMyOrgs', $listMyOrgs );
/* ----------------------------------------------------------------------
07.12.2023
Получаем список своих организаций на проверке
---------------------------------------------------------------------- */
$listMyOrgsCheck=\DB::getAll("SELECT * FROM `multiOrg` WHERE `user_id`=? AND `status`=0", $_SESSION['user_id']);
for ($i=0; $i<count($listMyOrgsCheck); $i++)$listMyOrgsCheck[$i]['txt'] = \DB::getValue("SELECT `txt` FROM `org` WHERE `id`=?", $listMyOrgsCheck[$i]['org_id']);
$smarty -> assign( 'listMyOrgsCheck', $listMyOrgsCheck );
/* ----------------------------------------------------------------------
14.10.2022
Меню личного кабинета
---------------------------------------------------------------------- */
//$smarty -> assign ( 'mnulk', MYDIR . '/skin/inc/mnulk.html');
/* ----------------------------------------------------------------------
01.05.2021
Выгонялка
---------------------------------------------------------------------- */
if ( !$_SESSION['user_id'] && !ID ) header ( 'Location: /login/' );
/* ----------------------------------------------------------------------
15.02.2022
Получаем справочник типов складов
---------------------------------------------------------------------- */
$smarty -> assign( 'sp_sklad_tip', \DB::getAll("SELECT * FROM `sp_sklad_tip` ORDER BY `txt`") );
/* ----------------------------------------------------------------------
15.02.2022
Получаем справочник регионов
---------------------------------------------------------------------- */
$smarty -> assign( 'region', \DB::getAll("SELECT * FROM `region` WHERE `strana_id`=1 ORDER BY `txt`") );
/* ----------------------------------------------------------------------
15.02.2022
Получаем справочник городов
---------------------------------------------------------------------- */
$smarty -> assign( 'city', \DB::getAll("SELECT * FROM `city` WHERE `strana_id`=1 ORDER BY `txt`") );
/* ----------------------------------------------------------------------
15.02.2022
Подключение модулей
---------------------------------------------------------------------- */
$smarty -> assign( 'modal_new_sklad', "api/modules/lk-my-orgs/modal_new_sklad.html" );
$smarty -> assign( 'inc_org_edit', "api/modules/lk-my-orgs/inc_org_edit.html" );
?>