Changeset 8e4bdee
- Timestamp:
- Jan 19, 2016, 3:06:51 AM (7 years ago)
- Branches:
- master
- Children:
- e591bf0
- Parents:
- 6729522
- Files:
-
- 10 added
- 307 edited
Legend:
- Unmodified
- Added
- Removed
-
cli/async.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/backup.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/core.cli.inc.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
cli/daily.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/db_check_struct.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/db_optimize.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/db_update.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify … … 18 18 // along with this program. If not, see <http://www.gnu.org/licenses/>. 19 19 // 20 21 20 /// Наложение патчей на активную базу данных при обновлении, либо вручную 22 $c=explode('/',__FILE__);$base_path=''; 23 for($i=0;$i<(count($c)-2);$i++) $base_path.=$c[$i].'/'; 21 $c = explode('/', __FILE__); 22 $base_path = ''; 23 for ($i = 0; $i < (count($c) - 2); $i++) 24 $base_path.=$c[$i] . '/'; 24 25 include_once("$base_path/config_cli.php"); 25 require_once($CONFIG['cli']['location'] ."/core.cli.inc.php");26 require_once($CONFIG['cli']['location'] . "/core.cli.inc.php"); 26 27 27 28 unset($CONFIG['backup']['dirs']); 28 include_once($CONFIG['cli']['location']."/backup.php"); 29 include_once($CONFIG['cli']['location'] . "/backup.php"); 30 31 $cur_query = ''; 29 32 30 33 function applyPatch($patch) { 31 global $db; 32 $file = file_get_contents($patch); 33 if (!$file) 34 throw new Exception("Не удаётся открыть файл патча!"); 35 $queries = explode(";", $file); 36 $db->query("START TRANSACTION"); 37 foreach ($queries as $query) { 38 if (strlen(trim($query)) == 0) 39 continue; 40 $db->query($query); 41 } 42 $db->query("COMMIT"); 34 global $db, $cur_query; 35 $file = file_get_contents($patch); 36 if (!$file) { 37 throw new Exception("Не удаётся открыть файл патча!"); 38 } 39 $queries = explode(";", $file); 40 $db->query("START TRANSACTION"); 41 foreach ($queries as $query) { 42 if (strlen(trim($query)) == 0) { 43 continue; 44 } 45 $cur_query = $query; 46 $db->query($query); 47 } 48 $db->query("COMMIT"); 43 49 } 44 50 45 51 try { 46 47 48 49 50 51 if($res->num_rows)52 53 else $db_version = 0; 54 if ($db_version != MULTIMAG_REV) { 55 foreach ($patches as $patch) {56 if (strpos($patch, '~') !== false) 57 continue; 58 if (strpos($patch, $db_version) === 0) { 59 echo "Накладываем патч $patch\n"; 60 applyPatch($CONFIG['location'] . "/db_patches/$patch");61 break;62 } 63 64 65 else break; 66 67 52 $patches = scandir($CONFIG['location'] . "/db_patches/"); 53 if (!is_array($patches)) 54 throw new Exception("Не удалось получить список файлов патчей!"); 55 for ($i = 0; $i < 1000; $i++) { 56 $res = $db->query("SELECT `version` FROM `db_version`"); 57 if ($res->num_rows) 58 list($db_version) = $res->fetch_row(); 59 else 60 $db_version = 0; 61 if ($db_version != MULTIMAG_REV) { 62 foreach ($patches as $patch) { 63 if (strpos($patch, '~') !== false) 64 continue; 65 if (strpos($patch, $db_version) === 0) { 66 echo "Накладываем патч $patch\n"; 67 applyPatch($CONFIG['location'] . "/db_patches/$patch"); 68 break; 69 } 70 } 71 } else 72 break; 73 } 68 74 } catch (Exception $e) { 69 echo "\n\n==============================================\nОШИБКА ОБНОВЛЕНИЯ БАЗЫ: " . $e->getMessage() . "\n==============================================\n\n"; 75 echo "\n\n==============================================\n" 76 . "ОШИБКА ОБНОВЛЕНИЯ БАЗЫ: " . $e->getMessage() . "\n" 77 . "Запрос: $cur_query\n==============================================\n\n"; 70 78 } 71 79 72 ?> -
cli/fixer.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/hourly.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/iptinit.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/price_an.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/resp_clear.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/salary.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
cli/up_to_0.2.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/action.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/actions/agentcalcavgsum.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/actions/agentdiscountnotify.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/actions/badpricenotify.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/actions/chpricenotify.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/actions/clearcache.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/actions/currencyupdater.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/actions/docmove.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/actions/respdebtnotify.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/actions/userfree.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/async/dbcheck.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/async/psparser.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/async/salary.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/asyncworker.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/bank1c.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/core.common.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify … … 18 18 // 19 19 20 define("MULTIMAG_REV", "86 1");20 define("MULTIMAG_REV", "864"); 21 21 define("MULTIMAG_VERSION", "0.2.".MULTIMAG_REV); 22 22 -
common/document.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
common/priceloader.ods.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/priceloader.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/priceloader.xls.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
common/valuequeue.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/1c_sync.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/adm.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/adv_search.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/articles.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/attachments.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/c_img.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/core.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify … … 544 544 /// @param $param_name Параметр ссылки выбора вкладки 545 545 function addTabsWidget($list, $opened, $link_prefix, $param_name) { 546 $sel = array(); 547 $str = '<ul class="tabs">'; 548 foreach($list as $id=>$value) { 549 $sel = $opened==$id ? ' class="selected"':''; 550 $str .= "<li><a{$sel} href='{$link_prefix}&{$param_name}={$id}'>".html_out($value['name'])."</a></li>"; 551 } 552 $str .= '</ul>'; 546 $str = \widgets::getEscapedTabsWidget($list, $opened, $link_prefix, $param_name); 553 547 $this->addContent($str); 554 548 } 555 549 556 550 function addTableWidget($table_header, $table_body, $head_each_lines = 100) { 557 $str = "<table class='list'>"; 558 $line_cnt = 0; 559 foreach($table_body as $line) { 560 if( ($line_cnt % $head_each_lines) == 0) { 561 $str .= "<tr>"; 562 foreach($table_header as $cell) { 563 $str .= "<th>$cell</th>"; 564 } 565 $str .= "</tr>"; 566 } 567 $str .= "<tr>"; 568 foreach($line as $cell) { 569 $str .= "<td>$cell</td>"; 570 } 571 $str .= "</tr>"; 572 $line_cnt++; 573 } 574 $str .= "</table>"; 551 $str = \widgets::getTable($table_header, $table_body, $head_each_lines); 575 552 $this->addContent($str); 576 553 } -
web/counter.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/doc.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/doc_opt.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/doc_reports.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/doc_sc.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/doc_service.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify … … 681 681 $editor->acl_object_name = 'directory.postype'; 682 682 $editor->run(); 683 } elseif ($mode == 'params') { 683 } elseif ($mode == 'gparams') { 684 $editor = new \ListEditors\PGroupListEditor($db); 685 $editor->line_var_name = 'id'; 686 $editor->link_prefix = '/doc_service.php?mode=gparams'; 687 $editor->acl_object_name = 'directory.pgroup'; 688 $tmpl->addContent("<ul class='tabs'> 689 <li><a class='selected' href='/doc_service.php?mode=gparams'>Группы свойств</a></li> 690 <li><a href='/doc_service.php?mode=params'>Свойства</a></li> 691 </ul>"); 692 $editor->run(); 693 } 694 elseif ($mode == 'params') { 684 695 $editor = new \ListEditors\PosParamListEditor($db); 685 696 $editor->line_var_name = 'id'; -
web/docj_new.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/docs.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/e404.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/factory.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/get_yml.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/gpb_check.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/gpb_pay.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/gpb_pay_failed.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/gpb_pay_success.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/images.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/acl.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify … … 36 36 const GET_PRINTFORM = 0x200; ///< Формирование печатной формы 37 37 const GET_PRINTDRAFT= 0x400; ///< Формирование черновика печатной формы (непроведённого документа) 38 const VIEW_IN_LIST = 0x800; ///< Просмотр в списках39 38 40 39 /// Конструктор копирования запрещён … … 71 70 self::GET_PRINTFORM => 'Формирование печатной формы', 72 71 self::GET_PRINTDRAFT => 'Формирование черновика печатной формы', 73 self::VIEW_IN_LIST => 'Отображение в списке',74 72 ); 75 73 return $access_names; … … 184 182 self::need_auth(); 185 183 } 186 if(!$access) {184 //if(!$access) { 187 185 //echo "$flags - {$cur->acl[$object]} - $object<br>"; 188 186 //var_dump($cur->acl); 189 187 //die(); 190 }188 //} 191 189 return $access; 192 190 } -
web/include/acl/aclcontainer.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify … … 22 22 /// Контейнер списков доступа к категории 23 23 class aclContainer { 24 protected $list ;24 protected $list = null; 25 25 protected $name = 'UNKNOWN'; 26 26 … … 40 40 return $this->list; 41 41 } 42 } ;42 } -
web/include/acl/admin/main.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/acl/directory/main.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify … … 24 24 25 25 public function __construct() { 26 $this->list = array( 26 global $db; 27 $list1 = array( 27 28 'agent' => array( 28 "name" => "Агенты ",29 "name" => "Агенты: доступ к справочнику и редактирование контактов", 29 30 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE 30 31 ), 32 'agent.global' => array( 33 "name" => 'Агенты: Глобальные разрешения', 34 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE, 35 ), 36 'agent.ingroup.0' => array( 37 "name" => 'Агенты в группе "0"', 38 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE, 39 ), 40 ); 41 $res = $db->query("SELECT `id`, `name` FROM `doc_agent_group` ORDER BY `name`"); 42 while($line = $res->fetch_assoc()) { 43 $list1['agent.ingroup.'.$line['id']] = array( 44 "name" => 'Агенты в группе "'.$line['id'].':'.$line['name'].'"', 45 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE, 46 ); 47 } 48 $list2 = array( 49 'agent.groups' => array( 50 "name" => 'Агенты: Справочник групп', 51 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE, 52 ), 31 53 'agent.ext' => array( 32 "name" => "Агенты: дата сверки и ответственный",54 "name" => "Агенты: Дата сверки и ответственный", 33 55 "mask" => \acl::UPDATE 34 56 ), … … 40 62 "name" => "Товары и услуги", 41 63 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE 42 ), 64 ), 65 'goods.groups' => array( 66 "name" => "Товары и услуги: Справочник групп", 67 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE 68 ), 69 'goods.secfields' => array( 70 "name" => "Товары и услуги: Секретные поля", 71 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE 72 ), 73 'goods.parts' => array( 74 "name" => "Товары и услуги: Комплектующие", 75 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE | \acl::DELETE 76 ), 43 77 'bank' => array( 44 78 "name" => "Банки", … … 73 107 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE 74 108 ), 109 'pgroup' => array( 110 "name" => "Группы параметров складских наименований", 111 "mask" => \acl::VIEW | \acl::CREATE | \acl::UPDATE 112 ), 75 113 'posparam' => array( 76 114 "name" => "Параметры складских наименований", … … 94 132 ), 95 133 ); 134 $this->list = array_merge($list1, $list2); 96 135 } 97 136 -
web/include/acl/doc/main.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify … … 39 39 "mask" => \acl::VIEW | \acl::UPDATE | \acl::DELETE | \acl::CREATE 40 40 | \acl::APPLY | \acl::CANCEL | \acl::TODAY_APPLY | \acl::TODAY_CANCEL 41 | \acl::CANCEL_FORCE | \acl::GET_PRINTFORM | \acl::GET_PRINTDRAFT | \acl::VIEW _IN_LIST41 | \acl::CANCEL_FORCE | \acl::GET_PRINTFORM | \acl::GET_PRINTDRAFT | \acl::VIEW 42 42 ); 43 43 } -
web/include/acl/firm/main.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify … … 32 32 "mask" => \acl::VIEW | \acl::UPDATE | \acl::DELETE | \acl::CREATE 33 33 | \acl::APPLY | \acl::CANCEL | \acl::TODAY_APPLY | \acl::TODAY_CANCEL 34 | \acl::CANCEL_FORCE | \acl::GET_PRINTFORM | \acl::GET_PRINTDRAFT | \acl::VIEW _IN_LIST34 | \acl::CANCEL_FORCE | \acl::GET_PRINTFORM | \acl::GET_PRINTDRAFT | \acl::VIEW 35 35 ); 36 36 } -
web/include/acl/generic/main.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/acl/report/main.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/acl/service/main.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/authenticator.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/basegsreport.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/basereport.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/comments.inc.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/doc.agent_dov.inc.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/doc.contact.inc.php
r6729522 r8e4bdee 13 13 14 14 15 ?> -
web/include/doc.core.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.corract.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.dogovor.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/doc.doveren.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.kompredl.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.korbonus.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.kordolga.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.nulltype.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify … … 232 232 $r = ($last) ? " IsLast" : ''; 233 233 $ret .= "<li class='Node ExpandLeaf $r'><div class='Expand'></div><div class='Content'>"; 234 if (!\acl::testAccess('firm.' . $item['firm_id'], \acl::VIEW _IN_LIST) && $item['firm_id']>0) {234 if (!\acl::testAccess('firm.' . $item['firm_id'], \acl::VIEW) && $item['firm_id']>0) { 235 235 if ($item['id'] == $this->id) { 236 236 $ret .= "<b>"; -
web/include/doc.payinfo.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.pbank.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.peremeshenie.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.perkas.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.permitout.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.pko.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/doc.pko_oper.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/doc.poseditor.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.postuplenie.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/doc.predlojenie.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.rbank.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.realiz_bonus.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.realiz_op.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.realizaciya.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.rko.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.s.agent.php
r6729522 r8e4bdee 1 1 <?php 2 2 3 // MultiMag v0.2 - Complex sales system 3 4 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 6 // 6 7 // This program is free software: you can redistribute it and/or modify … … 20 21 /// Редактор справочника агентов 21 22 class doc_s_Agent { 22 23 function __construct(){24 $this->agent_vars = array('group', 'name', 'type', 'fullname', 'adres', 'real_address', 'inn', 'kpp', 'rs', 'ks', 'okved', 'okpo', 'ogrn', 'bank', 25 'bik', 'pfio', 'pdol', 'pasp_num', 'pasp_date', 'pasp_kem', 'comment', 'responsible', 'data_sverki', 'dir_fio', 'dir_fio_r', 'dishonest',26 27 28 29 30 31 32 doc_menu(0,0);33 34 35 36 37 38 39 40 41 23 24 function __construct() { 25 $this->agent_vars = array('group', 'name', 'type', 'fullname', 'adres', 'real_address', 'inn', 'kpp', 'rs', 'ks', 'okved', 'okpo', 'ogrn', 'bank', 26 'bik', 'pfio', 'pdol', 'pasp_num', 'pasp_date', 'pasp_kem', 'comment', 'responsible', 'data_sverki', 'dir_fio', 'dir_fio_r', 'dishonest', 27 'p_agent', 'price_id', 'no_retail_prices', 'no_bulk_prices', 'no_bonuses', 'region'); 28 } 29 30 /// Просмотр списка агентов 31 function View() { 32 global $tmpl; 33 doc_menu(0, 0); 34 \acl::accessGuard('directory.agent', \acl::VIEW); 35 $tmpl->setTitle("Редактор агентов"); 36 $tmpl->addContent("<h1>Агенты</h1><table width=100%><tr><td id='groups' width='200' valign='top' class='lin0'>"); 37 $this->draw_groups(0); 38 $tmpl->addContent("<td id='list' valign='top' class='lin1'>"); 39 $this->ViewList(); 40 $tmpl->addContent("</table>"); 41 } 42 42 43 /// Служебные методы 43 44 function Service() { … … 54 55 $this->ViewList($g); 55 56 } 56 } 57 else if ($opt == 'ep') { 57 } else if ($opt == 'ep') { 58 58 $this->Edit(); 59 59 } else if ($opt == 'acost') { … … 93 93 } 94 94 $result = array( 95 'response' 96 'content' 95 'response' => 'contract_list', 96 'content' => $list, 97 97 ); 98 $tmpl->setContent( json_encode($result, JSON_UNESCAPED_UNICODE));98 $tmpl->setContent(json_encode($result, JSON_UNESCAPED_UNICODE)); 99 99 } else { 100 100 throw new \NotFoundException("Неверный режим!"); 101 101 } 102 102 } 103 104 // Редактирование справочника 105 function Edit() { 106 global $tmpl, $db, $CONFIG; 107 doc_menu(); 108 $pos = rcvint('pos'); 109 $param = request('param'); 110 $group = rcvint('g'); 111 \acl::accessGuard('directory.agent', \acl::VIEW); 112 $tmpl->setTitle("Правка агента"); 113 $tmpl->addBreadcrumb('Агенты', '/docs.php?l=agent'); 114 115 if(($pos==0)&&($param!='g')) $param=''; 116 117 if ($pos != 0) { 118 $this->PosMenu($pos, $param); 119 } 120 121 if($param=='' || $param=='v') { 122 $tmpl->addBreadcrumb('Агенты', '/docs.php?l=agent'); 123 $contact_info = ''; 124 $agent_obj = new \models\agent(); 125 if($pos>0) { 126 $agent_obj->load($pos); 127 $agent_info = $agent_obj->getData(); 128 $tmpl->addBreadcrumb($agent_info['id'].': '.$agent_info['name'], ''); 129 130 $ace = new \ListEditors\agentContactEditor($db); 131 $ace->acl_object_name = 'directory.agent'; /// TODO: Поменять 132 $ace->agent_id = intval($pos); 133 $contact_info = $ace->getListItems(false); 134 135 } else { 136 $tmpl->addBreadcrumb('Новая запись', ''); 137 $agent_info = array(); 138 foreach ($this->agent_vars as $value) { 139 $agent_info[$value] = ''; 140 } 141 } 142 143 $html_pagent_name=''; 144 145 if($agent_info['p_agent']>0) { 146 $pagent_info = $db->selectRowA('doc_agent', $agent_info['p_agent'], array('name')); 147 $html_pagent_name = html_out($pagent_info['name']); 148 } 149 150 151 152 $tmpl->setTitle("Правка агента ".html_out($agent_info['name'])); 153 154 $span = 5; 155 $ext=''; 156 if(!\acl::testAccess('directory.agent.ext', \acl::UPDATE)) $ext='disabled'; 157 $dish_checked = $agent_info['dishonest']?'checked':''; 158 $nbp_checked = $agent_info['no_bulk_prices']?'checked':''; 159 $nrp_checked = $agent_info['no_retail_prices']?'checked':''; 160 $nbon_checked = $agent_info['no_bonuses']?'checked':''; 161 162 $link_users = ''; 163 $r = $db->query("SELECT `id`, `name` FROM `users` WHERE `agent_id`=$pos"); 164 if($r->num_rows) { 165 while($nn = $r->fetch_assoc()) { 166 if($link_users) 167 $link_users .= ', '; 168 $link_users .= "<a href='/adm.php?mode=users&sect=view&user_id={$nn['id']}'>".html_out($nn['name'])." ({$nn['id']})</a>"; 169 } 170 } 171 else $link_users = 'отсутствуют'; 172 173 $tmpl->addContent("<form action='' method='post' id='agent_edit_form'> 174 <table cellpadding='0' width='100%' class='list'> 175 <input type='hidden' name='mode' value='esave'> 176 <input type='hidden' name='l' value='agent'> 177 <input type='hidden' name='pos' value='$pos'> 178 <tr><td align='right' width='20%'>Краткое наименование<br> 179 <small>По этому полю выполняется поиск. Не пишите здесь аббревиатуры вроде OOO, ИП, МУП, итд. а так же кавычки и подобные символы!</small> 180 <td colspan='3'><input type='text' name='name' value='".html_out($agent_info['name'])."' style='width: 90%;' maxlength='64'></td> 181 <td align='right'>Связанные пользователи</td> 182 <td>$link_users</td> 183 </tr> 184 <tr><td align=right>Полное название / ФИО:<br><small>Так, как должно быть в документах</small> 185 <td colspan='$span'><input type=text name='fullname' value='".html_out($agent_info['fullname'])."' style='width: 90%;' maxlength='256'></td></tr> 186 <tr><td align=right>Тип:</td><td>"); 187 188 $at_check = array(0=>'', 1=>'', 2=>''); 189 $at_check[$agent_info['type']] = ' checked'; 190 191 $tmpl->addContent(" 192 <label><input type='radio' name='type' value='0'{$at_check[0]} id='atype_rb0'>Физическое лицо</label><br> 193 <label><input type='radio' name='type' value='1'{$at_check[1]} id='atype_rb1'>Юридическое лицо</label><br> 194 <label><input type='radio' name='type' value='2'{$at_check[2]} id='atype_rb2'>Нерезидент</label>"); 195 196 197 $tmpl->addContent("<td align='right'>Группа</td> 198 <td>" . selectAgentGroup('g', $agent_info['group'], false, '', '', @$CONFIG['agents']['leaf_only']) . "</select> 199 <td align='right'>Относится к:</td> 200 <td><input type='hidden' name='p_agent' id='agent_id' value='{$agent_info['p_agent']}'> 201 <input type='text' id='agent_nm' name='p_agent_nm' style='width: 95%;' value='$html_pagent_name'> 202 <div id='agent_info'></div> 203 <tr><td align=right>Юридический адрес / Адрес прописки 204 <td colspan='2'><textarea name='adres'>".html_out($agent_info['adres'])."</textarea> 205 <td colspan='3'>Контакты:<br> 206 $contact_info 207 <tr><td align=right>ИНН: 208 <td><input type=text name='inn' value='".html_out($agent_info['inn'])."' class='inn validate'> 209 <td align=right>КПП: 210 <td><input type=text name='kpp' value='".html_out($agent_info['kpp'])."'> 211 <td><td> 212 <tr><td align=right>Рассчетный счет<br><small>Проверяется на корректность совместно с БИК</small> 213 <td><input type=text name='rs' value='".html_out($agent_info['rs'])."' class='rs validate'> 214 <td align=right>Корр. счет 215 <td><input type=text name='ks' value='".html_out($agent_info['ks'])."' class='ks validate'> 216 <td><td> 217 <tr><td align=right>БИК 218 <td><input type=text name='bik' value='".html_out($agent_info['bik'])."' class='bik validate'><td align=right>Банк 219 <td colspan='3'><input type=text name='bank' value='".html_out($agent_info['bank'])."' style='width: 90%;'> 220 <tr><td align=right>ОКВЭД 221 <td colspan='$span'><input type=text name='okved' value='".html_out($agent_info['okved'])."'> 222 <tr><td align=right>ОГРН / ОГРНИП 223 <td colspan='$span'><input type=text name='ogrn' value='".html_out($agent_info['ogrn'])."'> 224 <tr><td align=right>ОКПО 225 <td colspan='$span'><input type=text name='okpo' value='".html_out($agent_info['okpo'])."' class='okpo validate'> 226 <tr><td align=right>ФИО директора 227 <td colspan='$span'><input type=text name='dir_fio' value='".html_out($agent_info['dir_fio'])."'> 228 <tr><td align=right>ФИО директора в родительном падеже 229 <td colspan='$span'><input type=text name='dir_fio_r' value='".html_out($agent_info['dir_fio_r'])."'> 230 <tr><td align=right>Контактное лицо 231 <td colspan='$span'><input type=text name='pfio' value='".html_out($agent_info['pfio'])."'> 232 <tr><td align=right>Должность контактног лица 233 <td colspan='$span'><input type=text name='pdol' value='".html_out($agent_info['pdol'])."'> 234 <tr><td align=right>Паспорт: Номер 235 <td colspan='$span'><input type=text name='pasp_num' value='".html_out($agent_info['pasp_num'])."'> 236 <tr><td align=right>Паспорт: Дата выдачи 237 <td colspan='$span'><input type=text name='pasp_date' value='".html_out($agent_info['pasp_date'])."' id='pasp_date'> 238 <tr><td align=right>Паспорт: Кем выдан 239 <td colspan='$span'><input type=text name='pasp_kem' value='".html_out($agent_info['pasp_kem'])."'> 240 <tr><td align=right>Дата последней сверки: 241 <td><input type=text name='data_sverki' value='".html_out($agent_info['data_sverki'])."' id='data_sverki' $ext> 242 <td align=right>Ответственный: 243 <td><select name='responsible' $ext> 244 <option value='null'>--не назначен--</option>"); 245 $rres = $db->query("SELECT `user_id`, `worker_real_name` FROM `users_worker_info` WHERE `worker`='1' ORDER BY `worker_real_name`"); 246 while($nx = $rres->fetch_row()) { 247 $s=($agent_info['responsible']==$nx[0])?'selected':''; 248 $tmpl->addContent("<option value='$nx[0]' $s>". html_out($nx[1])."</option>"); 249 } 250 251 $tmpl->addContent("</select></td> 252 <td>Регион:</td> 253 <td><select name='region'> 254 <option value='null'>--не назначен--</option>"); 255 $rres = $db->query("SELECT `id`, `name` FROM `delivery_regions` ORDER BY `name`"); 256 while($nx = $rres->fetch_row()) { 257 $s=($agent_info['region']==$nx[0])?'selected':''; 258 $tmpl->addContent("<option value='$nx[0]' $s>". html_out($nx[1])."</option>"); 259 } 260 261 $tmpl->addContent("</select></td> 262 <tr><td align='right'>Фиксированная цена</td> 263 <td><select name='price_id'> 264 <option value='0'> -- не задана -- </option>"); 265 $price_res = $db->query("SELECT `id`, `name` FROM `doc_cost` ORDER BY `id`"); 266 while($line = $price_res->fetch_row()) { 267 $s=($agent_info['price_id']==$line[0])?'selected':''; 268 $tmpl->addContent("<option value='$line[0]' $s>". html_out($line[1])."</option>"); 269 } 270 271 $tmpl->addContent("</select></td> 272 <td><label><input type='checkbox' name='no_bulk_prices' value='1' $nbp_checked>Отключить разовые скидки</label></td> 273 <td><label><input type='checkbox' name='no_retail_prices' value='1' $nrp_checked>Игнорировать розничные цены</label></td> 274 <td><label><input type='checkbox' name='no_bonuses' value='1' $nbon_checked>Отключить бонусы</label></td> 275 <td></td> 276 <tr><td align='right'>Особые отметки 277 <td colspan='$span'><label><input type='checkbox' name='dishonest' value='1' $dish_checked>Недобросовестный агент</label> 278 279 <tr><td align=right>Комментарий 280 <td colspan='$span'><textarea name='comment'>".html_out($agent_info['comment'])."</textarea> 281 <tr><td><td><button type='submit' id='b_submit'>Сохранить</button> 282 </table></form> 283 284 <script type='text/javascript' src='/css/jquery/jquery.autocomplete.js'></script> 285 <script type='text/javascript' src='/js/formvalid.js'></script> 286 <script type=\"text/javascript\"> 287 $(document).ready(function(){ 288 $(\"#agent_nm\").autocomplete(\"/docs.php\", { 289 delay:300, 290 minChars:1, 291 matchSubset:1, 292 autoFill:false, 293 selectFirst:true, 294 matchContains:1, 295 cacheLength:10, 296 maxItemsToShow:15, 297 onItemSelect:agselectItem, 298 extraParams:{'l':'agent','mode':'srv','opt':'ac'} 299 }); 300 }); 301 302 303 304 function agselectItem(li) { 305 if( li == null ) var sValue = \"Ничего не выбрано!\"; 306 if( !!li.extra ) var sValue = li.extra[0]; 307 else var sValue = li.selectValue; 308 document.getElementById('agent_id').value=sValue; 309 } 310 initCalendar('pasp_date'); 311 initCalendar('data_sverki'); 312 var valid=form_validator('agent_edit_form'); 313 314 var atype_rb0 = document.getElementById('atype_rb0'); 315 var atype_rb1 = document.getElementById('atype_rb1'); 316 var atype_rb2 = document.getElementById('atype_rb2'); 317 atype_rb0.onclick = atype_rb1.onclick = function () {valid.enable(true);}; 318 atype_rb2.onclick = function () {valid.enable(false);}; 319 if(atype_rb2.checked) { 320 valid.enable(false); 321 } 322 </script>"); 323 324 } 325 elseif($param == 'c') { 326 $tmpl->addBreadcrumb('Агенты', '/docs.php?l=agent'); 327 $info = $db->selectRow('doc_agent', $pos); 328 if ($info) { 329 $tmpl->addBreadcrumb($info['id'] . ': ' . $info['name'], '/docs.php?l=agent&mode=srv&opt=ep&pos=' . $pos); 330 } else { 331 throw new \NotFoundException('Агент не найден'); 332 } 333 $editor = new \ListEditors\agentContactEditor($db); 334 $editor->line_var_name = 'leid'; 335 $editor->opt_var_name = 'leopt'; 336 $editor->link_prefix = '/docs.php?l=agent&mode=srv&opt=ep&param=c&pos='.$pos; 337 $editor->acl_object_name = 'directory.agent'; 338 $editor->agent_id = $pos; 339 $editor->run(); 340 } 341 else if($param=='h') { 342 $tmpl->addBreadcrumb('Агенты', '/docs.php?l=agent'); 343 344 $ares = $db->query("SELECT * FROM `doc_agent` WHERE `id` = $pos"); 345 if($ares->num_rows) { 346 $agent_info = $ares->fetch_assoc(); 347 $tmpl->addBreadcrumb($agent_info['id'].': '.$agent_info['name'], '/docs.php?l=agent&mode=srv&opt=ep&pos='.$pos); 348 $tmpl->addBreadcrumb('История правок', ''); 349 } 350 else throw new NotFoundException('Агент не найден'); 351 $logview = new \LogView(); 352 $logview->setObject('agent'); 353 $logview->setObjectId($pos); 354 $logview->showLog(); 355 } 356 // Банковские реквизиты 357 elseif($param=='b') { 358 $ares = $db->query("SELECT * FROM `doc_agent` WHERE `id` = $pos"); 359 if($ares->num_rows) { 360 $agent_info = $ares->fetch_assoc(); 361 $tmpl->addBreadcrumb($agent_info['id'].': '.$agent_info['name'], '/docs.php?l=agent&mode=srv&opt=ep&pos='.$pos); 362 } 363 else throw new NotFoundException('Агент не найден'); 364 $editor = new \ListEditors\agentBankEditor($db); 365 $editor->line_var_name = 'leid'; 366 $editor->opt_var_name = 'leopt'; 367 $editor->link_prefix = '/docs.php?l=agent&mode=srv&opt=ep&param=b&pos='.$pos; 368 $editor->acl_object_name = 'directory.agent'; 369 $editor->agent_id = $pos; 370 $editor->run(); 371 } 372 // Правка описания группы 373 else if($param=='g') { 374 $res = $db->query("SELECT `id`, `name`, `desc`, `pid` FROM `doc_agent_group` WHERE `id`='$group'"); 375 $nxt = $res->fetch_row(); 376 $tmpl->addContent("<h1>Описание группы</h1> 377 <form action='docs.php' method='post'> 378 <input type='hidden' name='mode' value='esave'> 379 <input type='hidden' name='l' value='agent'> 380 <input type='hidden' name='g' value='$nxt[0]'> 381 <input type='hidden' name='param' value='g'> 382 <table cellpadding='0' width='50%'> 383 <tr><td>Наименование группы $nxt[0]:</td><td><input type=text name='name' value='".html_out($nxt[1])."'></td></tr> 384 <tr class=lin0> 385 <td>Находится в группе: 386 <td>".selectAgentGroup('pid', $nxt[3], true)."</td> 387 <tr class=lin1> 388 <td>Описание: 389 <td><textarea name='desc'>".html_out($nxt[2])."</textarea> 390 <tr class=lin0><td colspan=2 align=center> 391 <input type='submit' value='Сохранить'> 392 </table> 393 </form>"); 394 } 395 else $tmpl->msg("Неизвестная закладка"); 396 397 } 398 function ESave() 399 { 400 global $tmpl, $db, $CONFIG; 401 doc_menu(); 402 $pos = rcvint('pos'); 403 $param = request('param'); 404 $group = rcvint('g'); 405 $tmpl->setTitle("Правка агента"); 406 if($param=='' || $param=='v') { 407 $ag_info = $db->selectRowA('doc_agent', $pos, $this->agent_vars); 408 unset($ag_info['id']); 409 if(!$ag_info['p_agent']) $ag_info['p_agent']='NULL'; 410 411 $new_agent_info = array(); 412 foreach ($this->agent_vars as $value) 413 $new_agent_info[$value] = request($value); 414 if(request('p_agent_nm')) 415 $new_agent_info['p_agent'] = rcvint('p_agent'); 416 else $new_agent_info['p_agent']='NULL'; 417 $new_agent_info['group'] = rcvint('g'); 418 419 settype($ag_info['group'],'int'); 420 settype($ag_info['dishonest'],'int'); 421 settype($new_agent_info['group'],'int'); 422 settype($new_agent_info['dishonest'],'int'); 423 settype($ag_info['no_retail_prices'],'int'); 424 settype($new_agent_info['no_retail_prices'],'int'); 425 settype($ag_info['no_bulk_prices'],'int'); 426 settype($new_agent_info['no_bulk_prices'],'int'); 427 settype($ag_info['no_bonuses'],'int'); 428 settype($new_agent_info['no_bonuses'],'int'); 429 430 if(!\acl::testAccess('directory.agent.ext', \acl::UPDATE)) { 431 unset($new_agent_info['responsible']); 432 unset($new_agent_info['data_sverki']); 433 unset($ag_info['responsible']); 434 unset($ag_info['data_sverki']); 435 } 436 437 if(@$CONFIG['agents']['leaf_only']) { 438 $new_group = $new_agent_info['group']; 439 $res = $db->query("SELECT `id` FROM `doc_agent_group` WHERE `pid`=$new_group"); 440 if($res->num_rows) 441 throw new Exception ("Запись агента возможна только в конечную группу!"); 442 } 443 444 $log_text = getCompareStr($ag_info, $new_agent_info); 445 446 //if( (!preg_match('/^\w+([-\.\w]+)*\w@\w(([-\.\w])*\w+)*\.\w{2,8}$/', $new_agent_info['email'])) && ($new_agent_info['email']!='') ) 447 // throw new Exception("Неверный e-mail!"); 448 if($pos) { 449 \acl::accessGuard('directory.agent', \acl::UPDATE); 450 $log_start='UPDATE'; 451 $db->updateA('doc_agent', $pos, $new_agent_info); 452 $this->PosMenu($pos, ''); 453 $tmpl->msg("Данные обновлены!"); 454 } 455 else { 456 $log_start='CREATE'; 457 $new_agent_info['responsible'] = $_SESSION['uid']; 458 \acl::accessGuard('directory.agent', \acl::CREATE); 459 460 $pos = $db->insertA('doc_agent', $new_agent_info); 461 $this->PosMenu($pos, ''); 462 $tmpl->msg("Добавлена новая запись!"); 463 } 464 465 doc_log($log_start, $log_text, 'agent', $pos); 466 } 467 else if($param=='g') { 468 $new_data = array( 469 'name' => request('name'), 470 'desc' => request('desc'), 471 'pid' => rcvint('pid') 472 ); 473 if($group){ 474 \acl::accessGuard('directory.agent', \acl::UPDATE); 475 $old_data = $db->selectRowAi('doc_agent_group', $group, $new_data); 476 $log_text = getCompareStr($old_data, $new_data); 477 $db->updateA('doc_agent_group', $group,$new_data); 478 doc_log('UPDATE', $log_text, 'agent_group', $group); 479 } 480 else { 481 \acl::accessGuard('directory.agent', \acl::CREATE); 482 $old_data = array(); 483 foreach ($new_data as $id => $value) 484 $old_data[$id]=''; 485 $log_text = getCompareStr($old_data, $new_data); 486 $db->insertA('doc_agent_group', $new_data); 487 doc_log('CREATE', $log_text, 'agent_group', $group); 488 } 489 $tmpl->msg("Сохранено!"); 490 } 491 else throw new \NotFoundException("Неизвестная закладка"); 492 } 493 494 /// Сформировать один и все вложенные уровни списка групп агентов 495 function draw_level($select, $level) { 496 global $db; 497 settype($level, 'int'); 498 $ret = ''; 499 $res = $db->query("SELECT `id`, `name`, `desc` FROM `doc_agent_group` WHERE `pid`='$level' ORDER BY `name`"); 500 $i = 0; 501 $r = ''; 502 if ($level == 0) 503 $r = 'IsRoot'; 504 while ($nxt = $res->fetch_row()) { 505 if ($nxt[0] == 0) continue; 506 $item = "<a href='' title='$nxt[2]' onclick=\"EditThis('/docs.php?l=agent&mode=srv&opt=pl&g=$nxt[0]','list'); return false;\" >".html_out($nxt[1])."</a>"; 507 if ($i >= ($res->num_rows - 1)) 508 $r.=" IsLast"; 509 510 $tmp = $this->draw_level($select, $nxt[0]); // рекурсия 511 if ($tmp) 512 $ret.=" 513 <li class='Node ExpandClosed $r'> 514 <div class='Expand'></div> 515 <div class='Content'>$item 516 </div><ul class='Container'>" . $tmp . '</ul></li>'; 517 else 518 $ret.="<li class='Node ExpandLeaf $r'><div class='Expand'></div><div class='Content'>$item</div></li>"; 519 $i++; 520 } 521 return $ret; 522 } 523 524 /// Отобразить список групп агентов 525 function draw_groups($select) { 526 global $tmpl, $db; 527 $tmpl->addContent(" 528 Отбор:<input type='text' id='f_search' onkeydown=\"DelayedSave('/docs.php?l=agent&mode=srv&opt=pl','list', 'f_search'); return true;\" ><br> 529 <div onclick='tree_toggle(arguments[0])'> 530 <div><a href='' title='' onclick=\"EditThis('/docs.php?l=agent&mode=srv&opt=pl&g=0','list'); return false;\" >Группы</a> (<a href='/docs.php?l=agent&mode=edit¶m=g&g=0'><img src='/img/i_add.png' alt=''></a>)</div> 531 <ul class='Container'>".$this->draw_level($select,0)."</ul></div> 532 <hr>"); 533 $res = $db->query("SELECT `user_id`, `worker_real_name` FROM `users_worker_info` WHERE `worker`='1' ORDER BY `worker_real_name`"); 534 while($nx = $res->fetch_row()) { 535 $m=($_SESSION['uid']==$nx[0])?' (МОИ)':''; 536 $tmpl->addContent("<a href='' onclick=\"EditThis('/docs.php?l=agent&mode=srv&opt=pl&resp=$nx[0]','list'); return false;\">Агенты ".html_out($nx[1])."{$m}</a><br>"); 537 } 538 $tmpl->addContent("<br><a href='' onclick=\"EditThis('/docs.php?l=agent&mode=srv&opt=pl&resp=0','list'); return false;\">Непривязанные агенты</a>"); 539 } 540 541 /// Отобразить список агентов из заданной группы 103 104 /// Сформировать главную форму редактирования агента 105 protected function getMainForm($form_data) { 106 global $db; 107 $ret = ''; 108 $item_id = intval($form_data['id']); 109 110 $linked_users = ''; 111 $r = $db->query("SELECT `id`, `name` FROM `users` WHERE `agent_id`=$item_id"); 112 if ($r->num_rows) { 113 while ($nn = $r->fetch_assoc()) { 114 if ($linked_users) { 115 $linked_users .= ', '; 116 } 117 $linked_users .= "<a href='/adm.php?mode=users&sect=view&user_id={$nn['id']}'>" . html_out($nn['name']) . " ({$nn['id']})</a>"; 118 } 119 } else { 120 $linked_users = 'отсутствуют'; 121 } 122 $ext = ''; 123 if (!\acl::testAccess('directory.agent.ext', \acl::UPDATE)) { 124 $ext = 'disabled'; 125 } 126 if ($form_data['p_agent'] > 0) { 127 $pagent_info = $db->selectRowA('doc_agent', $form_data['p_agent'], array('name')); 128 $html_pagent_name = html_out($pagent_info['name']); 129 } else { 130 $html_pagent_name = ''; 131 } 132 if($form_data['id']>0) { 133 $ace = new \ListEditors\agentContactEditor($db); 134 $ace->acl_object_name = 'directory.agent'; /// TODO: Поменять 135 $ace->agent_id = intval($item_id); 136 $contact_info = $ace->getListItems(false); 137 } else { 138 $contact_info = ''; 139 } 140 $span = 5; 141 142 $ret .= "<form action='' method='post' id='agent_edit_form'> 143 <table cellpadding='0' width='100%' class='list'> 144 <input type='hidden' name='mode' value='esave'> 145 <input type='hidden' name='l' value='agent'> 146 <input type='hidden' name='pos' value='$item_id'> 147 <tr><td align='right' width='20%'>Краткое наименование<br> 148 <small>По этому полю выполняется поиск. Не пишите здесь аббревиатуры вроде OOO, ИП, МУП, итд. а так же кавычки и подобные символы!</small> 149 <td colspan='3'><input type='text' name='name' value='" . html_out($form_data['name']) . "' style='width: 90%;' maxlength='64'></td> 150 <td align='right'>Связанные пользователи</td> 151 <td>$linked_users</td> 152 </tr> 153 <tr><td align=right>Полное название / ФИО:<br><small>Так, как должно быть в документах</small> 154 <td colspan='$span'><input type=text name='fullname' value='" . html_out($form_data['fullname']) . "' style='width: 90%;' maxlength='256'></td></tr> 155 <tr><td align=right>Тип:</td><td>"; 156 157 $at_check = array(0 => '', 1 => '', 2 => ''); 158 $at_check[$form_data['type']] = ' checked'; 159 160 $ret .= "<label><input type='radio' name='type' value='0'{$at_check[0]} id='atype_rb0'>Физическое лицо</label><br> 161 <label><input type='radio' name='type' value='1'{$at_check[1]} id='atype_rb1'>Юридическое лицо</label><br> 162 <label><input type='radio' name='type' value='2'{$at_check[2]} id='atype_rb2'>Нерезидент</label>"; 163 164 $ret .= "<td align='right'>Группа</td> 165 <td>" . selectAgentGroup('g', $form_data['group'], false, '', '', \cfg::get('agents', 'leaf_only') ) . "</select> 166 <td align='right'>Относится к:</td> 167 <td><input type='hidden' name='p_agent' id='agent_id' value='{$form_data['p_agent']}'> 168 <input type='text' id='agent_nm' name='p_agent_nm' style='width: 95%;' value='$html_pagent_name'> 169 <div id='agent_info'></div> 170 <tr><td align=right>Юридический адрес / Адрес прописки 171 <td colspan='2'><textarea name='adres'>" . html_out($form_data['adres']) . "</textarea> 172 <td colspan='3'>Контакты:<br> 173 $contact_info 174 <tr><td align=right>ИНН: 175 <td><input type=text name='inn' value='" . html_out($form_data['inn']) . "' class='inn validate'> 176 <td align=right>КПП: 177 <td><input type=text name='kpp' value='" . html_out($form_data['kpp']) . "'> 178 <td><td> 179 <tr><td align=right>Рассчетный счет<br><small>Проверяется на корректность совместно с БИК</small> 180 <td><input type=text name='rs' value='" . html_out($form_data['rs']) . "' class='rs validate'> 181 <td align=right>Корр. счет 182 <td><input type=text name='ks' value='" . html_out($form_data['ks']) . "' class='ks validate'> 183 <td><td> 184 <tr><td align=right>БИК 185 <td><input type=text name='bik' value='" . html_out($form_data['bik']) . "' class='bik validate'><td align=right>Банк 186 <td colspan='3'><input type=text name='bank' value='" . html_out($form_data['bank']) . "' style='width: 90%;'> 187 <tr><td align=right>ОКВЭД 188 <td colspan='$span'><input type=text name='okved' value='" . html_out($form_data['okved']) . "'> 189 <tr><td align=right>ОГРН / ОГРНИП 190 <td colspan='$span'><input type=text name='ogrn' value='" . html_out($form_data['ogrn']) . "'> 191 <tr><td align=right>ОКПО 192 <td colspan='$span'><input type=text name='okpo' value='" . html_out($form_data['okpo']) . "' class='okpo validate'> 193 <tr><td align=right>ФИО директора 194 <td colspan='$span'><input type=text name='dir_fio' value='" . html_out($form_data['dir_fio']) . "'> 195 <tr><td align=right>ФИО директора в родительном падеже 196 <td colspan='$span'><input type=text name='dir_fio_r' value='" . html_out($form_data['dir_fio_r']) . "'> 197 <tr><td align=right>Контактное лицо 198 <td colspan='$span'><input type=text name='pfio' value='" . html_out($form_data['pfio']) . "'> 199 <tr><td align=right>Должность контактног лица 200 <td colspan='$span'><input type=text name='pdol' value='" . html_out($form_data['pdol']) . "'> 201 <tr><td align=right>Паспорт: Номер 202 <td colspan='$span'><input type=text name='pasp_num' value='" . html_out($form_data['pasp_num']) . "'> 203 <tr><td align=right>Паспорт: Дата выдачи 204 <td colspan='$span'><input type=text name='pasp_date' value='" . html_out($form_data['pasp_date']) . "' id='pasp_date'> 205 <tr><td align=right>Паспорт: Кем выдан 206 <td colspan='$span'><input type=text name='pasp_kem' value='" . html_out($form_data['pasp_kem']) . "'> 207 <tr><td align=right>Дата последней сверки: 208 <td><input type=text name='data_sverki' value='" . html_out($form_data['data_sverki']) . "' id='data_sverki' $ext> 209 <td align=right>Ответственный: 210 <td>"; 211 $ldo = new \Models\LDO\workernames(); 212 $ret .= \widgets::getEscapedSelect('responsible', $ldo->getData(), $form_data['responsible'], 'не назначен' 213 , !\acl::testAccess('directory.agent.ext', \acl::UPDATE)); 214 $ret .= "</td> 215 <td>Регион:</td> 216 <td>"; 217 $ldo = new \Models\LDO\regionnames(); 218 $ret .= \widgets::getEscapedSelect('region', $ldo->getData(), $form_data['region'], 'не назначен'); 219 $ret .="</td> 220 <tr><td align='right'>Фиксированная цена</td> 221 <td>"; 222 $ldo = new \Models\LDO\pricenames(); 223 $ret .= \widgets::getEscapedSelect('price_id', $ldo->getData(), $form_data['price_id'], 'не задана'); 224 $dish_checked = $form_data['dishonest'] ? 'checked' : ''; 225 $nbp_checked = $form_data['no_bulk_prices'] ? 'checked' : ''; 226 $nrp_checked = $form_data['no_retail_prices'] ? 'checked' : ''; 227 $nbon_checked = $form_data['no_bonuses'] ? 'checked' : ''; 228 229 $ret .= "</td> 230 <td><label><input type='checkbox' name='no_bulk_prices' value='1' $nbp_checked>Отключить разовые скидки</label></td> 231 <td><label><input type='checkbox' name='no_retail_prices' value='1' $nrp_checked>Игнорировать розничные цены</label></td> 232 <td><label><input type='checkbox' name='no_bonuses' value='1' $nbon_checked>Отключить бонусы</label></td> 233 <td></td> 234 <tr><td align='right'>Особые отметки 235 <td colspan='$span'><label><input type='checkbox' name='dishonest' value='1' $dish_checked>Недобросовестный агент</label> 236 237 <tr><td align=right>Комментарий 238 <td colspan='$span'><textarea name='comment'>" . html_out($form_data['comment']) . "</textarea> 239 <tr><td><td><button type='submit' id='b_submit'>Сохранить</button> 240 </table></form> 241 242 <script type='text/javascript' src='/css/jquery/jquery.autocomplete.js'></script> 243 <script type='text/javascript' src='/js/formvalid.js'></script> 244 <script type=\"text/javascript\"> 245 $(document).ready(function(){ 246 $(\"#agent_nm\").autocomplete(\"/docs.php\", { 247 delay:300, 248 minChars:1, 249 matchSubset:1, 250 autoFill:false, 251 selectFirst:true, 252 matchContains:1, 253 cacheLength:10, 254 maxItemsToShow:15, 255 onItemSelect:agselectItem, 256 extraParams:{'l':'agent','mode':'srv','opt':'ac'} 257 }); 258 }); 259 260 function agselectItem(li) { 261 if( li == null ) var sValue = \"Ничего не выбрано!\"; 262 if( !!li.extra ) var sValue = li.extra[0]; 263 else var sValue = li.selectValue; 264 document.getElementById('agent_id').value=sValue; 265 } 266 initCalendar('pasp_date'); 267 initCalendar('data_sverki'); 268 var valid=form_validator('agent_edit_form'); 269 270 var atype_rb0 = document.getElementById('atype_rb0'); 271 var atype_rb1 = document.getElementById('atype_rb1'); 272 var atype_rb2 = document.getElementById('atype_rb2'); 273 atype_rb0.onclick = atype_rb1.onclick = function () {valid.enable(true);}; 274 atype_rb2.onclick = function () {valid.enable(false);}; 275 if(atype_rb2.checked) { 276 valid.enable(false); 277 } 278 </script>"; 279 return $ret; 280 } 281 282 283 /// Отобразить главную форму редактирования агента 284 protected function showMainForm($item_id, $group_id) { 285 global $tmpl; 286 $tmpl->addBreadcrumb('Агенты', '/docs.php?l=agent'); 287 $agent_obj = new \models\agent(); 288 if ($item_id > 0) { 289 $agent_obj->load($item_id); 290 $agent_info = $agent_obj->getData(); 291 $is_access = \acl::testAccess('directory.agent.global', \acl::VIEW) | \acl::testAccess('directory.agent.ingroup.'.$agent_info['group'], \acl::VIEW); 292 if(!$is_access) { 293 throw new \AccessException("Нет привилегии *Просмотр* для directory.agent.global или directory.agent.ingroup.".$agent_info['group']); 294 } 295 $tmpl->addBreadcrumb($agent_info['id'] . ': ' . $agent_info['name'], ''); 296 $tmpl->setTitle("Правка агента " . html_out($agent_info['name'])); 297 } else { 298 $tmpl->addBreadcrumb('Новая запись', ''); 299 $tmpl->setTitle("Новая запись"); 300 $agent_info = array(); 301 foreach ($this->agent_vars as $value) { 302 $agent_info[$value] = ''; 303 } 304 $agent_info['id'] = null; 305 $agent_info['group'] = $group_id; 306 $is_access = \acl::testAccess('directory.agent.global', \acl::CREATE) | \acl::testAccess('directory.agent.ingroup.'.$agent_info['group'], \acl::CREATE); 307 if(!$is_access) { 308 throw new \AccessException("Нет привилегии *Создание* для directory.agent.global или directory.agent.ingroup.".$agent_info['group']); 309 } 310 } 311 312 $tmpl->addContent( $this->getMainForm($agent_info) ); 313 } 314 315 /// Точка входа в редактирование справочника 316 public function Edit() { 317 global $tmpl, $db, $CONFIG; 318 doc_menu(); 319 $pos = rcvint('pos'); 320 $param = request('param'); 321 $group = rcvint('g'); 322 \acl::accessGuard('directory.agent', \acl::VIEW); 323 $tmpl->setTitle("Правка агента"); 324 $tmpl->addBreadcrumb('Агенты', '/docs.php?l=agent'); 325 326 if (($pos == 0) && ($param != 'g')) { 327 $param = ''; 328 } 329 330 if ($pos != 0) { 331 $this->PosMenu($pos, $param); 332 } 333 334 if ($param == '' || $param == 'v') { 335 $this->showMainForm($pos, $group); 336 } elseif ($param == 'c') { 337 $tmpl->addBreadcrumb('Агенты', '/docs.php?l=agent'); 338 $info = $db->selectRow('doc_agent', $pos); 339 if ($info) { 340 if(!\acl::testAccess('directory.agent.global', \acl::VIEW)) { 341 \acl::accessGuard('directory.agent.ingroup.'.$info['group'], \acl::VIEW); 342 } 343 $tmpl->addBreadcrumb($info['id'] . ': ' . $info['name'], '/docs.php?l=agent&mode=srv&opt=ep&pos=' . $pos); 344 } else { 345 throw new \NotFoundException('Агент не найден'); 346 } 347 $editor = new \ListEditors\agentContactEditor($db); 348 $editor->line_var_name = 'leid'; 349 $editor->opt_var_name = 'leopt'; 350 $editor->link_prefix = '/docs.php?l=agent&mode=srv&opt=ep&param=c&pos=' . $pos; 351 $editor->acl_object_name = 'directory.agent'; 352 $editor->agent_id = $pos; 353 $editor->run(); 354 } else if ($param == 'h') { 355 $tmpl->addBreadcrumb('Агенты', '/docs.php?l=agent'); 356 357 $ares = $db->query("SELECT * FROM `doc_agent` WHERE `id` = $pos"); 358 if ($ares->num_rows) { 359 $agent_info = $ares->fetch_assoc(); 360 if(!\acl::testAccess('directory.agent.global', \acl::VIEW)) { 361 \acl::accessGuard('directory.agent.ingroup.'.$agent_info['group'], \acl::VIEW); 362 } 363 $tmpl->addBreadcrumb($agent_info['id'] . ': ' . $agent_info['name'], '/docs.php?l=agent&mode=srv&opt=ep&pos=' . $pos); 364 $tmpl->addBreadcrumb('История правок', ''); 365 } else { 366 throw new \NotFoundException('Агент не найден'); 367 } 368 $logview = new \LogView(); 369 $logview->setObject('agent'); 370 $logview->setObjectId($pos); 371 $logview->showLog(); 372 } 373 // Банковские реквизиты 374 elseif ($param == 'b') { 375 $ares = $db->query("SELECT * FROM `doc_agent` WHERE `id` = $pos"); 376 if ($ares->num_rows) { 377 $agent_info = $ares->fetch_assoc(); 378 if(!\acl::testAccess('directory.agent.global', \acl::VIEW)) { 379 \acl::accessGuard('directory.agent.ingroup.'.$agent_info['group'], \acl::VIEW); 380 } 381 $tmpl->addBreadcrumb($agent_info['id'] . ': ' . $agent_info['name'], '/docs.php?l=agent&mode=srv&opt=ep&pos=' . $pos); 382 } else { 383 throw new \NotFoundException('Агент не найден'); 384 } 385 $editor = new \ListEditors\agentBankEditor($db); 386 $editor->line_var_name = 'leid'; 387 $editor->opt_var_name = 'leopt'; 388 $editor->link_prefix = '/docs.php?l=agent&mode=srv&opt=ep&param=b&pos=' . $pos; 389 $editor->acl_object_name = 'directory.agent'; /// TODO: Поменять 390 $editor->agent_id = $pos; 391 $editor->run(); 392 } 393 // Правка описания группы 394 else if ($param == 'g') { 395 \acl::accessGuard('directory.agent.groups', \acl::VIEW); 396 $res = $db->query("SELECT `id`, `name`, `desc`, `pid` FROM `doc_agent_group` WHERE `id`='$group'"); 397 $nxt = $res->fetch_row(); 398 $tmpl->addContent("<h1>Описание группы</h1> 399 <form action='docs.php' method='post'> 400 <input type='hidden' name='mode' value='esave'> 401 <input type='hidden' name='l' value='agent'> 402 <input type='hidden' name='g' value='$nxt[0]'> 403 <input type='hidden' name='param' value='g'> 404 <table cellpadding='0' width='50%'> 405 <tr><td>Наименование группы $nxt[0]:</td><td><input type=text name='name' value='" . html_out($nxt[1]) . "'></td></tr> 406 <tr class=lin0> 407 <td>Находится в группе: 408 <td>" . selectAgentGroup('pid', $nxt[3], true) . "</td> 409 <tr class=lin1> 410 <td>Описание: 411 <td><textarea name='desc'>" . html_out($nxt[2]) . "</textarea> 412 <tr class=lin0><td colspan=2 align=center> 413 <input type='submit' value='Сохранить'> 414 </table> 415 </form>"); 416 } else { 417 throw new \NotFoundException("Неизвестная закладка"); 418 } 419 } 420 421 function ESave() { 422 global $tmpl, $db, $CONFIG; 423 doc_menu(); 424 $pos = rcvint('pos'); 425 $param = request('param'); 426 $group = rcvint('g'); 427 $tmpl->setTitle("Правка агента"); 428 if ($param == '' || $param == 'v') { 429 $ag_info = $db->selectRowA('doc_agent', $pos, $this->agent_vars); 430 unset($ag_info['id']); 431 if (!$ag_info['p_agent']) { 432 $ag_info['p_agent'] = 'NULL'; 433 } 434 435 $new_agent_info = array(); 436 foreach ($this->agent_vars as $value) { 437 $new_agent_info[$value] = request($value); 438 } 439 if (request('p_agent_nm')) { 440 $new_agent_info['p_agent'] = rcvint('p_agent'); 441 } else { 442 $new_agent_info['p_agent'] = 'NULL'; 443 } 444 $new_agent_info['group'] = rcvint('g'); 445 446 settype($ag_info['group'], 'int'); 447 settype($ag_info['dishonest'], 'int'); 448 settype($new_agent_info['group'], 'int'); 449 settype($new_agent_info['dishonest'], 'int'); 450 settype($ag_info['no_retail_prices'], 'int'); 451 settype($new_agent_info['no_retail_prices'], 'int'); 452 settype($ag_info['no_bulk_prices'], 'int'); 453 settype($new_agent_info['no_bulk_prices'], 'int'); 454 settype($ag_info['no_bonuses'], 'int'); 455 settype($new_agent_info['no_bonuses'], 'int'); 456 457 if (!\acl::testAccess('directory.agent.ext', \acl::UPDATE)) { 458 unset($new_agent_info['responsible']); 459 unset($new_agent_info['data_sverki']); 460 unset($ag_info['responsible']); 461 unset($ag_info['data_sverki']); 462 } 463 464 if (@$CONFIG['agents']['leaf_only']) { 465 $new_group = $new_agent_info['group']; 466 $res = $db->query("SELECT `id` FROM `doc_agent_group` WHERE `pid`=$new_group"); 467 if ($res->num_rows) 468 throw new Exception("Запись агента возможна только в конечную группу!"); 469 } 470 471 $log_text = getCompareStr($ag_info, $new_agent_info); 472 473 //if( (!preg_match('/^\w+([-\.\w]+)*\w@\w(([-\.\w])*\w+)*\.\w{2,8}$/', $new_agent_info['email'])) && ($new_agent_info['email']!='') ) 474 // throw new Exception("Неверный e-mail!"); 475 if ($pos) { 476 if(!\acl::testAccess('directory.agent.global', \acl::UPDATE)) { 477 \acl::accessGuard('directory.agent.ingroup.'.$ag_info['group'], \acl::UPDATE); 478 \acl::accessGuard('directory.agent.ingroup.'.$new_agent_info['group'], \acl::UPDATE); 479 } 480 $log_start = 'UPDATE'; 481 $db->updateA('doc_agent', $pos, $new_agent_info); 482 $this->PosMenu($pos, ''); 483 $tmpl->msg("Данные обновлены!"); 484 $this->showMainForm($pos, $new_agent_info['group']); 485 } else { 486 $log_start = 'CREATE'; 487 $new_agent_info['responsible'] = $_SESSION['uid']; 488 if(!\acl::testAccess('directory.agent.global', \acl::CREATE)) { 489 \acl::accessGuard('directory.agent.ingroup.'.$new_agent_info['group'], \acl::CREATE); 490 } 491 492 $pos = $db->insertA('doc_agent', $new_agent_info); 493 $this->PosMenu($pos, ''); 494 $tmpl->msg("Добавлена новая запись!"); 495 $this->showMainForm($pos, $new_agent_info['group']); 496 } 497 doc_log($log_start, $log_text, 'agent', $pos); 498 499 } else if ($param == 'g') { 500 $new_data = array( 501 'name' => request('name'), 502 'desc' => request('desc'), 503 'pid' => rcvint('pid') 504 ); 505 if ($group) { 506 \acl::accessGuard('directory.agent.groups', \acl::UPDATE); 507 $old_data = $db->selectRowAi('doc_agent_group', $group, $new_data); 508 $log_text = getCompareStr($old_data, $new_data); 509 $db->updateA('doc_agent_group', $group, $new_data); 510 doc_log('UPDATE', $log_text, 'agent_group', $group); 511 } else { 512 \acl::accessGuard('directory.agent.groups', \acl::CREATE); 513 $old_data = array(); 514 foreach ($new_data as $id => $value) { 515 $old_data[$id] = ''; 516 } 517 $log_text = getCompareStr($old_data, $new_data); 518 $db->insertA('doc_agent_group', $new_data); 519 doc_log('CREATE', $log_text, 'agent_group', $group); 520 } 521 $tmpl->msg("Сохранено!"); 522 } else { 523 throw new \NotFoundException("Неизвестная закладка"); 524 } 525 } 526 527 /// Сформировать один и все вложенные уровни списка групп агентов 528 function draw_level($select, $level) { 529 global $db; 530 settype($level, 'int'); 531 $ret = ''; 532 $res = $db->query("SELECT `id`, `name`, `desc` FROM `doc_agent_group` WHERE `pid`='$level' ORDER BY `name`"); 533 $i = 0; 534 $r = ''; 535 if ($level == 0) { 536 $r = 'IsRoot'; 537 } 538 while ($nxt = $res->fetch_row()) { 539 if ($nxt[0] == 0) { 540 continue; 541 } 542 $item = "<a href='' title='$nxt[2]' onclick=\"EditThis('/docs.php?l=agent&mode=srv&opt=pl&g=$nxt[0]','list'); return false;\" >" . html_out($nxt[1]) . "</a>"; 543 if ($i >= ($res->num_rows - 1)) { 544 $r.=" IsLast"; 545 } 546 547 $tmp = $this->draw_level($select, $nxt[0]); // рекурсия 548 if ($tmp) { 549 $ret.="<li class='Node ExpandClosed $r'> 550 <div class='Expand'></div> 551 <div class='Content'>$item 552 </div><ul class='Container'>" . $tmp . '</ul></li>'; 553 } else { 554 $ret.="<li class='Node ExpandLeaf $r'><div class='Expand'></div><div class='Content'>$item</div></li>"; 555 } 556 $i++; 557 } 558 return $ret; 559 } 560 561 /// Отобразить список групп агентов 562 function draw_groups($select) { 563 global $tmpl, $db; 564 $tmpl->addContent(" 565 Фильтр:<input type='text' id='f_search' onkeydown=\"DelayedSave('/docs.php?l=agent&mode=srv&opt=pl','list', 'f_search'); return true;\" ><br> 566 <div onclick='tree_toggle(arguments[0])'> 567 <div><a href='' title='' onclick=\"EditThis('/docs.php?l=agent&mode=srv&opt=pl&g=0','list'); return false;\" >Группы</a> (<a href='/docs.php?l=agent&mode=edit¶m=g&g=0'><img src='/img/i_add.png' alt=''></a>)</div> 568 <ul class='Container'>" . $this->draw_level($select, 0) . "</ul></div> 569 <hr>"); 570 $res = $db->query("SELECT `user_id`, `worker_real_name` FROM `users_worker_info` WHERE `worker`='1' ORDER BY `worker_real_name`"); 571 while ($nx = $res->fetch_row()) { 572 $m = ($_SESSION['uid'] == $nx[0]) ? ' (МОИ)' : ''; 573 $tmpl->addContent("<a href='' onclick=\"EditThis('/docs.php?l=agent&mode=srv&opt=pl&resp=$nx[0]','list'); return false;\">Агенты " . html_out($nx[1]) . "{$m}</a><br>"); 574 } 575 $tmpl->addContent("<br><a href='' onclick=\"EditThis('/docs.php?l=agent&mode=srv&opt=pl&resp=0','list'); return false;\">Непривязанные агенты</a>"); 576 } 577 578 /// Отобразить список агентов из заданной группы 542 579 function ViewList($group = 0) { 543 580 global $tmpl, $db; 544 581 545 582 if (isset($_REQUEST['resp'])) { 546 583 $this->ViewListRespFiltered(request('resp')); 547 584 } else { 585 if(!\acl::testAccess('directory.agent.global', \acl::VIEW)) { 586 \acl::accessGuard('directory.agent.ingroup.'.$group, \acl::VIEW); 587 } 548 588 if ($group) { 549 589 $desc_data = $db->selectRow('doc_agent_group', $group); … … 609 649 610 650 /// Отобразить список агентов, отфильторванный по заданной строке 611 function ViewListS($s='') {612 613 614 615 651 function ViewListS($s = '') { 652 global $tmpl, $db; 653 $sf = 0; 654 $tmpl->addContent("<b>Показаны записи изо всех групп!</b><br>"); 655 $tmpl->addContent("<table class='list' width='100%' cellspacing='1' cellpadding='2'> 616 656 <tr><th>№</th><th>Название</th><th>Телефон</th><th>e-mail</th><th>Дополнительно</th><th>Отв.менеджер</th></tr>"); 617 618 657 $s_sql = $db->real_escape_string($s); 658 $sql = "SELECT `doc_agent`.`id`, `doc_agent`.`group`, `doc_agent`.`name`, `doc_agent`.`type`, `doc_agent`.`fullname`, 619 659 `doc_agent`.`pfio`, `users`.`name` AS `responsible_name`, `doc_agent`.`dishonest` 620 660 , (SELECT `value` FROM `agent_contacts` WHERE `agent_contacts`.`agent_id`=`doc_agent`.`id` AND `agent_contacts`.`type`='phone' LIMIT 1) AS `phone` … … 624 664 LEFT JOIN `users` ON `doc_agent`.`responsible`=`users`.`id`"; 625 665 626 $sqla = $sql."WHERE `doc_agent`.`name` LIKE '$s_sql%' OR `doc_agent`.`fullname` LIKE '$s_sql%' ORDER BY `doc_agent`.`name` LIMIT 30"; 627 $res = $db->query($sqla); 628 if($res->num_rows) { 629 $tmpl->addContent("<tr><th colspan='16' align='center'>Фильтр по названию, начинающемуся на ".html_out($s).": {$res->num_rows} строк найдено</th></tr>"); 630 $this->DrawTable($res, $s); 631 $sf = 1; 632 } 633 634 $sqla = $sql."WHERE (`doc_agent`.`name` LIKE '%$s%' OR `doc_agent`.`fullname` LIKE '%$s_sql%') AND (`doc_agent`.`name` NOT LIKE '$s_sql%' AND `doc_agent`.`fullname` NOT LIKE '$s_sql%') ORDER BY `doc_agent`.`name` LIMIT 30"; 635 $res = $db->query($sqla); 636 if($res->num_rows) { 637 $tmpl->addContent("<tr><th colspan='16' align='center'>Фильтр по названию, содержащему ".html_out($s).": {$res->num_rows} строк найдено</th></tr>"); 638 $this->DrawTable($res, $s); 639 $sf = 1; 640 } 641 642 $tmpl->addContent("</table><a href='/docs.php?l=agent&mode=srv&opt=ep&pos=0&g=0'><img src='/img/i_add.png' alt=''> Добавить</a>"); 643 644 if($sf==0) $tmpl->msg("По данным критериям записей не найдено!"); 645 } 646 647 /// Список агентов с фильтрацией по ответственному сотруднику 648 function ViewListRespFiltered($resp) { 649 global $tmpl, $db; 650 settype($resp,'int'); 651 $sf=0; 652 $tmpl->addContent("<table class='list' width='100%' cellspacing='1' cellpadding='2'> 666 $sqla = $sql . "WHERE `doc_agent`.`name` LIKE '$s_sql%' OR `doc_agent`.`fullname` LIKE '$s_sql%' ORDER BY `doc_agent`.`name` LIMIT 30"; 667 $res = $db->query($sqla); 668 if ($res->num_rows) { 669 $tmpl->addContent("<tr><th colspan='16' align='center'>Фильтр по названию, начинающемуся на " . html_out($s) . ": {$res->num_rows} строк найдено</th></tr>"); 670 $this->DrawTable($res, $s); 671 $sf = 1; 672 } 673 674 $sqla = $sql . "WHERE (`doc_agent`.`name` LIKE '%$s%' OR `doc_agent`.`fullname` LIKE '%$s_sql%') AND (`doc_agent`.`name` NOT LIKE '$s_sql%' AND `doc_agent`.`fullname` NOT LIKE '$s_sql%') ORDER BY `doc_agent`.`name` LIMIT 30"; 675 $res = $db->query($sqla); 676 if ($res->num_rows) { 677 $tmpl->addContent("<tr><th colspan='16' align='center'>Фильтр по названию, содержащему " . html_out($s) . ": {$res->num_rows} строк найдено</th></tr>"); 678 $this->DrawTable($res, $s); 679 $sf = 1; 680 } 681 682 $tmpl->addContent("</table><a href='/docs.php?l=agent&mode=srv&opt=ep&pos=0&g=0'><img src='/img/i_add.png' alt=''> Добавить</a>"); 683 684 if ($sf == 0) 685 $tmpl->msg("По данным критериям записей не найдено!"); 686 } 687 688 /// Список агентов с фильтрацией по ответственному сотруднику 689 function ViewListRespFiltered($resp) { 690 global $tmpl, $db; 691 settype($resp, 'int'); 692 $sf = 0; 693 $tmpl->addContent("<table class='list' width='100%' cellspacing='1' cellpadding='2'> 653 694 <tr><th>№</th><th>Название</th><th>Телефон</th><th>e-mail</th><th>Дополнительно</th><th>Ответственный</th></tr>"); 654 $sql = "SELECT `doc_agent`.`id`, `doc_agent`.`group`, `doc_agent`.`name`, `doc_agent`.`tel`, `doc_agent`.`email`, `doc_agent`.`type`, `doc_agent`.`fullname`, `doc_agent`.`pfio`, `users`.`name` AS `responsible_name`, `doc_agent`.`dishonest`, `doc_agent`.`fax_phone`, `doc_agent`.`sms_phone`, `doc_agent`.`alt_phone` 695 $sql = "SELECT `doc_agent`.`id`, `doc_agent`.`group`, `doc_agent`.`name`, `doc_agent`.`type`, `doc_agent`.`fullname`, `doc_agent`.`pfio`, `users`.`name` AS `responsible_name`, `doc_agent`.`dishonest` 696 , (SELECT `value` FROM `agent_contacts` WHERE `agent_contacts`.`agent_id`=`doc_agent`.`id` AND `agent_contacts`.`type`='phone' LIMIT 1) AS `phone` 697 , (SELECT `value` FROM `agent_contacts` WHERE `agent_contacts`.`agent_id`=`doc_agent`.`id` AND `agent_contacts`.`type`='email' LIMIT 1) AS `email` 698 655 699 FROM `doc_agent` 656 700 LEFT JOIN `users` ON `doc_agent`.`responsible`=`users`.`id` 657 701 WHERE `doc_agent`.`responsible`='$resp'"; 658 $res = $db->query($sql); 659 if($res->num_rows) { 660 $tmpl->addContent("<tr><th colspan='6' align='center'>Использован фильтр по ответственному. Найдено: {$res->num_rows}. ID: $resp"); 661 $this->DrawTable($res, ''); 662 $sf = 1; 663 } 664 $tmpl->addContent("</table>"); 665 if($sf == 0) $tmpl->msg("По данным критериям записей не найдено!"); 666 } 667 668 /// Расширенный поиск агентов 669 function Search() { 670 global $tmpl, $db; 671 $opt = request("opt"); 672 if($opt=='') { 673 doc_menu(); 674 $tmpl->addContent("<h1>Расширенный поиск</h1> 702 $res = $db->query($sql); 703 if ($res->num_rows) { 704 $tmpl->addContent("<tr><th colspan='6' align='center'>Использован фильтр по ответственному. Найдено: {$res->num_rows}. ID: $resp"); 705 $this->DrawTable($res, ''); 706 $sf = 1; 707 } 708 $tmpl->addContent("</table>"); 709 if ($sf == 0) 710 $tmpl->msg("По данным критериям записей не найдено!"); 711 } 712 713 /// Расширенный поиск агентов 714 function Search() { 715 global $tmpl, $db; 716 $opt = request("opt"); 717 if ($opt == '') { 718 doc_menu(); 719 $tmpl->addContent("<h1>Расширенный поиск</h1> 675 720 <form action='docs.php' method='post'> 676 721 <input type='hidden' name='mode' value='search'> … … 706 751 </table> 707 752 </form>"); 708 } 709 else if($opt=='s') { 710 doc_menu(); 711 $tmpl->addContent("<h1>Результаты</h1>"); 712 $name = $db->real_escape_string( request('name') ); 713 $mail = $db->real_escape_string(request('mail') ); 714 $inn = $db->real_escape_string( request('inn') ); 715 $tel = $db->real_escape_string( request('tel') ); 716 $adres = $db->real_escape_string( request('adres') ); 717 $rs = $db->real_escape_string( request('rs') ); 718 $kont = $db->real_escape_string( request('kont') ); 719 $pasp_num = rcvint('pasp_num'); 720 721 $sql = "SELECT `doc_agent`.`id`, `doc_agent`.`group`, `doc_agent`.`name`, `doc_agent`.`tel`, `doc_agent`.`email`, `doc_agent`.`type`, `doc_agent`.`fullname`, `doc_agent`.`pfio`, `users`.`name`, `doc_agent`.`dishonest`, `doc_agent`.`fax_phone`, `doc_agent`.`sms_phone`, `doc_agent`.`alt_phone` 753 } else if ($opt == 's') { 754 doc_menu(); 755 $tmpl->addContent("<h1>Результаты</h1>"); 756 $name = $db->real_escape_string(request('name')); 757 $mail = $db->real_escape_string(request('mail')); 758 $inn = $db->real_escape_string(request('inn')); 759 $tel = $db->real_escape_string(request('tel')); 760 $adres = $db->real_escape_string(request('adres')); 761 $rs = $db->real_escape_string(request('rs')); 762 $kont = $db->real_escape_string(request('kont')); 763 $pasp_num = rcvint('pasp_num'); 764 765 $sql = "SELECT `doc_agent`.`id`, `doc_agent`.`group`, `doc_agent`.`name`, `doc_agent`.`tel`, `doc_agent`.`email`, `doc_agent`.`type`, `doc_agent`.`fullname`, `doc_agent`.`pfio`, `users`.`name`, `doc_agent`.`dishonest`, `doc_agent`.`fax_phone`, `doc_agent`.`sms_phone`, `doc_agent`.`alt_phone` 722 766 FROM `doc_agent` 723 767 LEFT JOIN `users` ON `doc_agent`.`responsible`=`users`.`id` 724 768 WHERE 1"; 725 769 726 if($name) $sql.=" AND (`doc_agent`.`name` LIKE '%$name%' OR `doc_agent`.`fullname` LIKE '%$name%')"; 727 if($mail) $sql.=" AND `doc_agent`.`email` LIKE '%$mail%'"; 728 if($inn) $sql.=" AND `doc_agent`.`inn` LIKE '%$inn%'"; 729 if($tel) $sql.=" AND `doc_agent`.`tel` LIKE '%$tel%'"; 730 if($adres) $sql.=" AND `doc_agent`.`adres` LIKE '%$adres%'"; 731 if($rs) $sql.=" AND `doc_agent`.`rs` LIKE '%$rs%'"; 732 if($kont) $sql.=" AND `doc_agent`.`kont` LIKE '%$kont%'"; 733 if($pasp_num) $sql.=" AND `doc_base_dop`.`size` LIKE '%$pasp_num%'"; 734 735 $sql.=" ORDER BY `doc_agent`.`name`"; 736 737 $tmpl->addContent("<table class='list' width='100%' cellspacing='1' cellpadding='2'><tr> 770 if ($name) 771 $sql.=" AND (`doc_agent`.`name` LIKE '%$name%' OR `doc_agent`.`fullname` LIKE '%$name%')"; 772 if ($mail) 773 $sql.=" AND `doc_agent`.`email` LIKE '%$mail%'"; 774 if ($inn) 775 $sql.=" AND `doc_agent`.`inn` LIKE '%$inn%'"; 776 if ($tel) 777 $sql.=" AND `doc_agent`.`tel` LIKE '%$tel%'"; 778 if ($adres) 779 $sql.=" AND `doc_agent`.`adres` LIKE '%$adres%'"; 780 if ($rs) 781 $sql.=" AND `doc_agent`.`rs` LIKE '%$rs%'"; 782 if ($kont) 783 $sql.=" AND `doc_agent`.`kont` LIKE '%$kont%'"; 784 if ($pasp_num) 785 $sql.=" AND `doc_base_dop`.`size` LIKE '%$pasp_num%'"; 786 787 $sql.=" ORDER BY `doc_agent`.`name`"; 788 789 $tmpl->addContent("<table class='list' width='100%' cellspacing='1' cellpadding='2'><tr> 738 790 <th>№</th><th>Название</th><th>Телефон</th><th>e-mail</th><th>Дополнительно</th><th>Ответственный</th></tr>"); 739 740 if($res->num_rows) {741 742 743 } 744 else$tmpl->msg("По данным критериям записей не найдено!");745 746 747 791 $res = $db->query($sql); 792 if ($res->num_rows) { 793 $tmpl->addContent("<tr><th colspan='16' align='center'>Параметрический поиск, найдено {$res->num_rows} агентов</th></tr>"); 794 $this->DrawTable($res, request('name')); 795 } else 796 $tmpl->msg("По данным критериям записей не найдено!"); 797 $tmpl->addContent("</table>"); 798 } 799 } 748 800 749 801 /// Отобразить строки таблицы агентов … … 754 806 global $tmpl; 755 807 $c = 0; 756 while ($nxt = $res->fetch_array()) { 808 while ($nxt = $res->fetch_assoc()) { 809 if(!\acl::testAccess('directory.agent.global', \acl::VIEW) && 810 !\acl::testAccess('directory.agent.ingroup.'.$nxt['group'], \acl::VIEW)) { 811 continue; 812 } 757 813 $name = SearchHilight(html_out($nxt['name']), $s); 758 814 if ($nxt['type']) { … … 772 828 $phone_info.='тел. ' . formatPhoneNumber($nxt['phone']) . ' '; 773 829 } 774 /* if ($nxt['fax_phone'] && $nxt['fax_phone'] != $nxt['phone']) 775 $phone_info.='факс ' . formatPhoneNumber($nxt['fax_phone']) . ' '; 776 if ($nxt['sms_phone'] && $nxt['sms_phone'] != $nxt['phone']) 777 $phone_info.='sms: ' . formatPhoneNumber($nxt['sms_phone']) . ' '; 778 if ($nxt['alt_phone'] && $nxt['alt_phone'] != $nxt['phone']) 779 $phone_info.='доп: ' . formatPhoneNumber($nxt['alt_phone']) . ' ';*/ 780 $tmpl->addContent("<tr class='pointer' align='right' $red oncontextmenu=\"ShowAgentContextMenu(event,$nxt[0]); return false;\"> 781 <td><a href='/docs.php?l=agent&mode=srv&opt=ep&pos=$nxt[0]'>$nxt[0]</a> 782 <a href='' onclick=\"ShowAgentContextMenu(event,$nxt[0]); return false;\" title='Меню' accesskey=\"S\"><img src='img/i_menu.png' alt='Меню' border='0'></a></td> 830 831 $tmpl->addContent("<tr class='pointer' align='right' $red oncontextmenu=\"ShowAgentContextMenu(event,{$nxt['id']}); return false;\"> 832 <td><a href='/docs.php?l=agent&mode=srv&opt=ep&pos={$nxt['id']}'>{$nxt['id']}</a> 833 <a href='' onclick=\"ShowAgentContextMenu(event,{$nxt['id']}); return false;\" title='Меню' accesskey=\"S\"><img src='img/i_menu.png' alt='Меню' border='0'></a></td> 783 834 <td align='left'>$name<td>$phone_info</td><td>$email</td><td>$info</td><td>" . html_out($nxt['responsible_name']) . "</td></tr>"); 784 835 if ($c++ >= $limit) … … 796 847 $link = "/docs.php?l=agent&mode=srv&opt=ep&pos=$pos"; 797 848 $tmpl->addContent("<ul class='tabs'>"); 798 foreach ($items as $id => $name) {799 $sel = $param ==$id?" class='selected'":'';849 foreach ($items as $id => $name) { 850 $sel = $param == $id ? " class='selected'" : ''; 800 851 $tmpl->addContent("<li><a href='{$link}&param={$id}'{$sel}>$name</a></li>"); 801 852 } 802 853 $tmpl->addContent("</ul>"); 803 854 } 855 804 856 } -
web/include/doc.s.agent_dov.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/doc.s.inform.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify -
web/include/doc.s.nulltype.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.s.price_an.php
r6729522 r8e4bdee 2 2 // MultiMag v0.2 - Complex sales system 3 3 // 4 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org4 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 5 5 // 6 6 // This program is free software: you can redistribute it and/or modify -
web/include/doc.s.sklad.php
r6729522 r8e4bdee 3 3 // MultiMag v0.2 - Complex sales system 4 4 // 5 // Copyright (C) 2005-201 5, BlackLight, TND Team, http://tndproject.org5 // Copyright (C) 2005-2016, BlackLight, TND Team, http://tndproject.org 6 6 // 7 7 // This program is free software: you can redistribute it and/or modify … … 75 75 } elseif ($_pos_cnt > 2000) { 76 76 $pos_cnt = number_format($_pos_cnt / 1000, 1, '.', ' ') . ' тыс.'; 77 } else 77 } else { 78 78 $pos_cnt = number_format($_pos_cnt, 0, '.', ' '); 79 } 79 80 80 81 if ($_item_cnt > 20000000) { … … 82 83 } elseif ($_item_cnt > 2000) { 83 84 $item_cnt = number_format($_item_cnt / 1000, 1, '.', ' ') . ' тыс.'; 84 } else 85 } else { 85 86 $item_cnt = number_format($_item_cnt, 2, '.', ' '); 87 } 86 88 87 89 if ($_all_mass > 20000000) { … … 89 91 } elseif ($_all_mass > 2000) { 90 92 $all_mass = number_format($_all_mass / 1000, 1, '.', ' ') . ' тонн'; 91 } else 93 } else { 92 94 $all_mass = number_format($_all_mass, 2, '.', ' ') . ' кг.'; 95 } 93 96 } else 94 97 $pos_cnt = $item_cnt = $all_mass = 0; … … 151 154 $s = request('s'); 152 155 $tmpl->ajax = 1; 153 if ($s) 154 $this->ViewSkladS($s); 155 else 156 $this->ViewSklad($g); 157 } 158 else if ($opt == 'ep') 156 $s ? $this->ViewSkladS($s) : $this->ViewSklad($g); 157 } 158 else if ($opt == 'ep') { 159 159 $this->Edit(); 160 else if ($opt == 'acost') {160 } else if ($opt == 'acost') { 161 161 $pos = rcvint('pos'); 162 162 $tmpl->ajax = 1; … … 167 167 $dend = date("Y-m-d"); 168 168 $tmpl->addContent(" 169 170 171 172 169 <div onclick=\"ShowPopupWin('/docs.php?l=pran&mode=srv&opt=ceni&pos=$pos'); return false;\" >Где и по чём</div> 170 <div onclick=\"window.open('/docj_new.php?pos_id=$pos&date_to=$dend')\">Товар в журнале</div> 171 <div onclick=\"window.open('/doc_reports.php?mode=sales&w_docs=1&sel_type=pos&opt=pdf&sklad={$_SESSION['sklad_num']}&dt_t=$dend&pos_id=$pos')\">Отчёт по движению</div> 172 <div onclick=\"window.open('/docs.php?mode=srv&opt=ep&pos=$pos')\">Редактирование позиции</div>"); 173 173 } else if ($opt == 'ac') { 174 174 $q = request('q'); … … 177 177 $res = $db->query("SELECT `id`, `name`, `proizv`, `vc` FROM `doc_base` WHERE LOWER(`name`) LIKE LOWER('%$q_sql%') OR LOWER(`vc`) LIKE LOWER('%$q_sql%') ORDER BY `name`"); 178 178 while ($nxt = $res->fetch_row()) { 179 if (@$CONFIG['poseditor']['vc']) 179 if (@$CONFIG['poseditor']['vc']) { 180 180 $nxt[1].='(' . $nxt[3] . ')'; 181 } 181 182 $tmpl->addContent(html_out("$nxt[1]|$nxt[0]|$nxt[2]|$nxt[3]") . "\n"); 182 183 } … … 190 191 $str = ''; 191 192 while ($nxt = $res->fetch_row()) { 192 if (@$CONFIG['poseditor']['vc']) 193 if (@$CONFIG['poseditor']['vc']) { 193 194 $nxt[1].='(' . $nxt[3] . ')'; 194 if ($str) 195 } 196 if ($str) { 195 197 $str.=",\n"; 198 } 196 199 $str.="{id:'$nxt[0]',name:'$nxt[1]',vendor:'$nxt[2]',vc:'$nxt[3]'}"; 197 200 } … … 205 208 $tmpl->ajax = 1; 206 209 $res = $db->query("SELECT `id`, `name`, `proizv`, `vc` FROM `doc_base` WHERE LOWER(`vc`) LIKE LOWER('%$q_sql%') ORDER BY `vc`"); 207 while ($nxt = $res->fetch_row()) 210 while ($nxt = $res->fetch_row()) { 208 211 $tmpl->addContent("$nxt[3]|$nxt[0]|$nxt[2]|$nxt[1]\n"); 212 } 209 213 } else if ($opt == 'acp') { 210 214 $q = request('q'); … … 212 216 $tmpl->ajax = 1; 213 217 $res = $db->query("SELECT `id`, `proizv` FROM `doc_base` WHERE LOWER(`proizv`) LIKE LOWER('%$q_sql%') GROUP BY `proizv` ORDER BY `proizv`"); 214 while ($nxt = $res->fetch_row()) 218 while ($nxt = $res->fetch_row()) { 215 219 $tmpl->addContent("$nxt[1]|$nxt[0]\n"); 220 } 216 221 } else if ($opt == 'go') { 217 222 $to_group = rcvint('to_group'); … … 256 261 } 257 262 $tmpl->msg("Успешно обновлено $a строк. " . ($c - $a) . " из $c выбранных строк остались неизменёнными.", "ok"); 258 } else 263 } else { 259 264 $tmpl->msg("Не выбраны позиции для обновления!", 'err'); 260 } else 265 } 266 } else { 261 267 $tmpl->msg("Не выбрано действие!", 'err'); 262 } else 268 } 269 } else { 263 270 $tmpl->msg("Неверная опция - " . html_out($opt)); 271 } 264 272 } 265 273 266 function s toreDataEditForm($pos) {274 function showStoreDataEditForm($pos) { 267 275 global $db, $tmpl; 268 276 $res = $db->query("SELECT `doc_sklady`.`name` AS `store_name`, `doc_base_cnt`.`cnt`, `doc_base_cnt`.`mincnt`, `doc_base_cnt`.`mesto` AS `place`, … … 334 342 $tmpl->msg("Ничего не обновилось!", 'info'); 335 343 } 336 $this->s toreDataEditForm($pos);344 $this->showStoreDataEditForm($pos); 337 345 } 338 346 339 /// Отобразить форму редактирования 347 /// Отобразить форму редактирования основных свойств наименования 348 protected function getMainForm($form_data, $def_img_data) { 349 global $db; 350 $ret = ''; 351 $pos_id = intval($form_data['id']); 352 if($pos_id) { 353 if ($form_data['pos_type']) { 354 $pos_type_html = "<input type='hidden' name='pd[type]' value='1'>Услуга"; 355 } else { 356 $pos_type_html = "<input type='hidden' name='pd[type]' value='0'>Товар"; 357 } 358 } else { 359 $ret .= "<h3>Новая запись</h3>"; 360 $pos_type_html = "<label><input type='radio' name='pd[type]' value='0' checked>Товар</label><br> 361 <label><input type='radio' name='pd[type]' value='1'>Услуга</label>"; 362 } 363 364 // foreach ($this->pos_vars as $value) { 365 // $pos_info[$value] = ''; 366 // } 367 368 $image_html = ''; 369 if($def_img_data) { 370 if ($def_img_data['id']) { 371 $miniimg = new ImageProductor($def_img_data['id'], 'p', $def_img_data['type']); 372 $miniimg->SetY(320); 373 $miniimg->SetX(240); 374 $image_html = "<td rowspan='18' style='width: 250px;'><img src='" . $miniimg->GetURI() . "' alt='" . html_out($form_data['name']) . "'></td>"; 375 } 376 } 377 378 if ($form_data['nds'] === null) { 379 $form_data['nds'] = ''; 380 } 381 382 $actual_in_price = \acl::testAccess('directory.goods.secfields', \acl::VIEW) ? sprintf('%0.2f', getInCost($pos_id)) : '***'; 383 $hid_check = $form_data['hidden'] ? 'checked' : ''; 384 $yml_check = $form_data['no_export_yml'] ? 'checked' : ''; 385 $stock_check = $form_data['stock'] ? 'checked' : ''; 386 $wt0_check = $form_data['warranty_type'] ? '' : 'checked'; 387 $wt1_check = $form_data['warranty_type'] ? 'checked' : ''; 388 389 $ret .= "<form action='' method='post'> 390 <input type='hidden' name='mode' value='esave'> 391 <input type='hidden' name='l' value='sklad'> 392 <input type='hidden' name='pos' value='$pos_id'> 393 <input type='hidden' name='pd[id]' value='$pos_id'> 394 <table cellpadding='0' width='100%' class='list'> 395 <tr><td align='right' width='20%'>$pos_type_html</td> 396 <td colspan='3'><input type='text' name='pd[name]' value='" . html_out($form_data['name']) . "' style='width: 95%'>$image_html 397 <tr><td align='right'>Группа</td> 398 <td>" . selectGroupPos('pd[group]', $form_data['group'], false, '', '', \cfg::get('store', 'leaf_only', false) ) . "</td> 399 <td align='right'>Имя группы аналогов:<br><small>Аналогами будут товары<br>с совпадающим значением поля</small></td> 400 <td><input type='text' name='pd[analog_group]' value='" . html_out($form_data['analog_group']) . "'></td> 401 </tr> 402 <tr><td align='right'>Страна происхождения<br><small>Для счёта-фактуры</small></td><td><select name='pd[country]'>"; 403 404 $ret .= "<option value='0'>--не выбрана--</option>"; 405 $res = $db->query("SELECT `id`, `name` FROM `class_country` ORDER BY `name`"); 406 while ($nx = $res->fetch_row()) { 407 $selected = ($form_data['group'] == $nx[0]) || ($nx[0] == $form_data['country']) ? 'selected' : ''; 408 $ret .= "<option value='$nx[0]' $selected>" . html_out($nx[1]) . "</option>"; 409 } 410 $ret .= "</select></td> 411 <td align='right'>Масса, кг:<br><small>Используется в ТОРГ-12</small></td> 412 <td><input type='text' name='pd[mass]' value='" . html_out($form_data['mass']) . "'></td> 413 </tr> 414 <tr><td align='right'>Изготовитель</td> 415 <td><input type='text' name='pd[proizv]' value='" . html_out($form_data['proizv']) . "' id='proizv_nm' style='width: 95%'><br> 416 <div id='proizv_p' class='dd'></div></td> 417 <td align='right'>Код изготовителя</td><td><input type='text' name='pd[vc]' value='" . html_out($form_data['vc']) . "'></td></tr> 418 <tr><td align='right'>Единица измерения</td><td><select name='pd[unit]'>"; 419 420 $res2 = $db->query("SELECT `id`, `name` FROM `class_unit_group` ORDER BY `id`"); 421 while ($nx2 = $res2->fetch_row()) { 422 $ret .= "<option disabled style='color:#fff; background-color:#000'>" . html_out($nx2[1]) . "</option>\n"; 423 $res = $db->query("SELECT `id`, `name`, `rus_name1` FROM `class_unit` WHERE `class_unit_group_id`='$nx2[0]'"); 424 while ($nx = $res->fetch_row()) { 425 $i = ''; 426 if ($nx[0] == \cfg::get('doc', 'default_unit') && $pos_id == 0) { 427 $i = " selected"; 428 } 429 elseif ($nx[0] == $form_data['unit']) { 430 $i = " selected"; 431 } 432 $ret .= "<option value='$nx[0]' $i>" . html_out("$nx[1] ($nx[2])") . "</option>"; 433 } 434 } 435 $ret .= "</select></td> 436 <td align='right'>Количество оптом:</td> 437 <td><input type='text' name='pd[bulkcnt]' value='" . html_out($form_data['bulkcnt']) . "'></td> 438 </tr> 439 <tr><td align='right'>Базовая цена</td> 440 <td><input type='text' name='pd[cost]' value='{$form_data['cost']}'> с {$form_data['cost_date']} </td> 441 <td align='right'>Кратность:</td> 442 <td><input type='text' name='pd[mult]' value='" . html_out($form_data['mult']) . "'></td> 443 </tr> 444 <tr><td align='right'>Ставка НДС</td> 445 <td><input type='text' name='pd[nds]' value='{$form_data['nds']}'></td> 446 <td align='right' colspan=2></td> 447 </tr> 448 <tr><td align='right'>Ликвидность:</td> 449 <td><b>{$form_data['likvid']}% 450 <small>=Сумма(Кол-во заявок + Кол-во реализаций) / МаксСумма(Кол-во заявок + Кол-во реализаций)</small></b></td> 451 <td align='right'>Актуальная цена поступления:</td><td><b>$actual_in_price</b></td> 452 </tr> 453 <tr><td align='right'>Гарантийный срок:</td><td><input type='text' name='pd[warranty]' value='{$form_data['warranty']}'> мес.</td> 454 <td align='right'>Гарантия:</td><td><label><input type='radio' name='pd[warranty_type]' value='0' $wt0_check>От продавца</label> <label><input type='radio' name='pd[warranty_type]' value='1' $wt1_check>От производителя</label></td></tr> 455 <tr><td align='right'>Видимость:</td><td><label><input type='checkbox' name='pd[hidden]' value='1' $hid_check>Не отображать на витрине</label></td><td><label><input type='checkbox' name='pd[no_export_yml]' value='1' $yml_check>Не экспортировать в YML</label> 456 <td><label><input type='checkbox' name='pd[stock]' value='1' $stock_check>Поместить в спецпредложения</label></td></tr> 457 458 <tr><td align='right'>Описание</td><td colspan='3'><textarea name='pd[desc]'>" . html_out($form_data['desc']) . "</textarea></td></tr> 459 <tr><td align='right'>Тэг title карточки товара на витрине</td> 460 <td colspan='3'><input type='text' name='pd[title_tag]' value='" . html_out($form_data['title_tag']) . "' style='width: 95%' maxlength='128'></td></tr> 461 <tr><td align='right'>Мета-тэг keywords карточки товара на витрине</td> 462 <td colspan='3'><input type='text' name='pd[meta_keywords]' value='" . html_out($form_data['meta_keywords']) . "' style='width: 95%' maxlength='128'></td></tr> 463 <tr><td align='right'>Мета-тэг description карточки товара на витрине</td> 464 <td colspan='3'><input type='text' name='pd[meta_description]' value='" . html_out($form_data['meta_description']) . "' style='width: 95%' maxlength='256'></td></tr> 465 "; 466 if ($pos_id != 0) { 467 $ret.="<tr><td align='right'>Режим записи:</td><td colspan='3'> 468 <label><input type='radio' name='sr' value='0' checked>Сохранить</label> 469 <label><input type='radio' name='sr' value='1'>Добавить</label></td></tr>"; 470 } 471 $ret .= "<tr><td></td><td colspan='3'><input type='submit' value='Сохранить'></td></tr> 472 <script type='text/javascript' src='/css/jquery/jquery.js'></script> 473 <script type='text/javascript' src='/css/jquery/jquery.autocomplete.js'></script> 474 475 <script type=\"text/javascript\"> 476 $(document).ready(function(){ 477 $(\"#proizv_nm\").autocomplete(\"/docs.php\", { 478 delay:300, 479 minChars:1, 480 matchSubset:1, 481 autoFill:false, 482 selectFirst:true, 483 matchContains:1, 484 cacheLength:20, 485 maxItemsToShow:15, 486 extraParams:{'l':'sklad','mode':'srv','opt':'acp'} 487 }); 488 }); 489 </script> 490 </table></form>"; 491 return $ret; 492 } 493 494 /// Отобразить форму редактирования основных свойств наименования 495 protected function showMainForm($pos_id, $group_id) { 496 global $tmpl; 497 if($pos_id) { 498 $gi = new \models\goodsitem($pos_id); 499 $pos_info = $gi->getData(); 500 $gi->loadImagesData(); 501 if(!$pos_info) { 502 throw new \NotFoundException("Элемент справочника товаров и услуг не найден"); 503 } 504 $def_img_data = $gi->getImageDefaultData(); 505 } else { 506 $gi = new \models\goodsitem(); 507 $pos_info = $gi->getDefaultMainData(); 508 $def_img_data = null; 509 $pos_info['group'] = $group_id; 510 } 511 $tmpl->addContent( $this->getMainForm($pos_info, $def_img_data) ); 512 } 513 514 /// Отобразить форму редактора комплектующих 515 protected function showPartsForm($pos_id) { 516 global $tmpl, $db; 517 \acl::accessGuard('directory.goods.parts', \acl::VIEW); 518 $peopt = request('peopt'); 519 require_once("include/doc.sklad.kompl.php"); 520 $poseditor = new KomplPosList($pos_id); 521 $poseditor->SetEditable(1); 522 if ($peopt == '') { 523 $res = $db->query("SELECT `doc_base_values`.`value` FROM `doc_base_params` 524 LEFT JOIN `doc_base_values` ON `doc_base_values`.`param_id`=`doc_base_params`.`id` AND `doc_base_values`.`id`='$pos_id' 525 WHERE `doc_base_params`.`codename`='ZP'"); 526 if ($res->num_rows) { 527 list($zp) = $res->fetch_row(); 528 } else { 529 $zp = ''; 530 } 531 $tmpl->addContent($poseditor->Show('', $zp)); 532 } else { 533 $tmpl->ajax = 1; 534 switch($peopt) { 535 case 'jget': // Получение списка комплектующих 536 $str = $poseditor->GetAllContent(); 537 $tmpl->setContent($str); 538 break; 539 case 'jgpi': // Получение данных наименования 540 $pos_id = rcvint('pos'); 541 $tmpl->setContent($poseditor->GetPosInfo($pos_id)); 542 break; 543 case 'jadd': // Json вариант добавления позиции 544 \acl::accessGuard('directory.goods.parts', \acl::CREATE); 545 $pe_pos = rcvint('pe_pos'); 546 $tmpl->setContent($poseditor->AddPos($pe_pos)); 547 break; 548 case 'jdel': // Json вариант удаления строки 549 \acl::accessGuard('directory.goods.parts', \acl::DELETE); 550 $line_id = rcvint('line_id'); 551 $tmpl->setContent($poseditor->Removeline($line_id)); 552 break; 553 case 'jup': // Json вариант обновления 554 \acl::accessGuard('directory.goods.parts', \acl::UPDATE); 555 $line_id = rcvint('line_id'); 556 $value = request('value'); 557 $type = request('type'); 558 $tmpl->setContent($poseditor->UpdateLine($line_id, $type, $value)); 559 break; 560 case 'jsklad': // Получение номенклатуры выбранной группы 561 $group_id = rcvint('group_id'); 562 $str = "{ response: 'sklad_list', group: '$group_id', content: [" . $poseditor->GetSkladList($group_id) . "] }"; 563 $tmpl->setContent($str); 564 break; 565 case 'jsklads': // Поиск по подстроке по складу 566 $s = request('s'); 567 $str = "{ response: 'sklad_list', content: [" . $poseditor->SearchSkladList($s) . "] }"; 568 $tmpl->setContent($str); 569 break; 570 case 'jgetgroups': // Получение списка групп 571 $doc_content = $poseditor->getGroupList(); 572 $tmpl->setContent($doc_content); 573 break; 574 default: 575 throw new \NotFoundException('Опция комплектующих не существует'); 576 } 577 } 578 } 579 580 581 /// Формы редактирования 340 582 function Edit() { 341 583 global $tmpl, $CONFIG, $db; … … 345 587 $group = rcvint('g'); 346 588 \acl::accessGuard('directory.goods', \acl::VIEW); 347 if (($pos == 0) && ($param != 'g')) 589 if (($pos == 0) && ($param != 'g')) { 348 590 $param = ''; 591 } 349 592 $tmpl->setTitle("Правка складского наименования"); 350 if ($pos != 0) 593 if ($pos != 0) { 351 594 $this->PosMenu($pos, $param); 352 353 if ($param == '') { 354 $pres = $db->query("SELECT `doc_base`.`group`, `doc_base`.`name`, `doc_base`.`desc`, `doc_base`.`proizv`, `doc_base`.`cost`, `doc_base`.`likvid`, `doc_img`.`id` AS `img_id`, `doc_img`.`type` AS `img_type`, `doc_base`.`pos_type`, `doc_base`.`hidden`, `doc_base`.`unit`, `doc_base`.`vc`, `doc_base`.`stock`, `doc_base`.`warranty`, `doc_base`.`warranty_type`, `doc_base`.`no_export_yml`, `doc_base`.`country`, `doc_base`.`title_tag`, `doc_base`.`meta_keywords`, `doc_base`.`meta_description`, `doc_base`.`cost_date`, `doc_base`.`mult`, `doc_base`.`bulkcnt`, `doc_base`.`analog_group`, `doc_base`.`mass`, `doc_base`.`nds` 355 FROM `doc_base` 356 LEFT JOIN `doc_base_img` ON `doc_base_img`.`pos_id`=`doc_base`.`id` AND `doc_base_img`.`default`='1' 357 LEFT JOIN `doc_img` ON `doc_img`.`id`=`doc_base_img`.`img_id` 358 WHERE `doc_base`.`id`='$pos'"); 359 360 if ($pres->num_rows) { 361 $pos_info = $pres->fetch_assoc(); 362 if ($pos_info['pos_type']) 363 $n = "<input type='hidden' name='pd[type]' value='1'>Услуга"; 364 else 365 $n = "<input type='hidden' name='pd[type]' value='0'>Товар"; 366 } 367 else { 368 $pos_info = array(); 369 foreach ($this->pos_vars as $value) 370 $pos_info[$value] = ''; 371 $tmpl->addContent("<h3>Новая запись</h3>"); 372 $n = "<label><input type='radio' name='pd[type]' value='0' checked>Товар</label><br> 373 <label><input type='radio' name='pd[type]' value='1'>Услуга</label>"; 374 } 375 376 $cc = ''; 377 378 if ($pos_info['nds'] === null) { 379 $pos_info['nds'] = ''; 380 } 381 382 if (@$pos_info['img_id']) { 383 $miniimg = new ImageProductor($pos_info['img_id'], 'p', $pos_info['img_type']); 384 $miniimg->SetY(320); 385 $miniimg->SetX(240); 386 $cc = "<td rowspan='18' style='width: 250px;'><img src='" . $miniimg->GetURI() . "' alt='" . html_out($pos_info['name']) . "'></td>"; 387 } 388 389 $i = ''; 390 $act_cost = sprintf('%0.2f', getInCost($pos)); 391 if ($pos != 0) 392 $selected = $pos_info['group']; 393 else 394 $selected = $group; 395 $hid_check = $pos_info['hidden'] ? 'checked' : ''; 396 $yml_check = $pos_info['no_export_yml'] ? 'checked' : ''; 397 $stock_check = $pos_info['stock'] ? 'checked' : ''; 398 $wt0_check = (!$pos_info['warranty_type']) ? 'checked' : ''; 399 $wt1_check = ($pos_info['warranty_type']) ? 'checked' : ''; 400 401 if (!isset($CONFIG['store']['pos_leaf_only'])) 402 $CONFIG['store']['pos_leaf_only'] = false; 403 404 $tmpl->addContent("<form action='' method='post'> 405 <input type='hidden' name='mode' value='esave'> 406 <input type='hidden' name='l' value='sklad'> 407 <input type='hidden' name='pos' value='$pos'> 408 <input type='hidden' name='pd[id]' value='$pos'> 409 <table cellpadding='0' width='100%' class='list'> 410 <tr><td align='right' width='20%'>$n</td> 411 <td colspan='3'><input type='text' name='pd[name]' value='" . html_out($pos_info['name']) . "' style='width: 95%'>$cc 412 <tr><td align='right'>Группа</td> 413 <td>" . selectGroupPos('pd[group]', $selected, false, '', '', @$CONFIG['store']['leaf_only']) . "</td> 414 <td align='right'>Имя группы аналогов:<br><small>Аналогами будут товары<br>с совпадающим значением поля</small></td> 415 <td><input type='text' name='pd[analog_group]' value='" . html_out($pos_info['analog_group']) . "'></td> 416 </tr> 417 <tr><td align='right'>Страна происхождения<br><small>Для счёта-фактуры</small></td><td><select name='pd[country]'>"); 418 $tmpl->addContent("<option value='0'>--не выбрана--</option>"); 419 $res = $db->query("SELECT `id`, `name` FROM `class_country` ORDER BY `name`"); 420 while ($nx = $res->fetch_row()) { 421 $selected = ($group == $nx[0]) || ($nx[0] == $pos_info['country']) ? 'selected' : ''; 422 $tmpl->addContent("<option value='$nx[0]' $selected>" . html_out($nx[1]) . "</option>"); 423 } 424 $tmpl->addContent("</select></td> 425 <td align='right'>Масса, кг:<br><small>Используется в ТОРГ-12</small></td> 426 <td><input type='text' name='pd[mass]' value='" . html_out($pos_info['mass']) . "'></td> 427 </tr> 428 <tr><td align='right'>Изготовитель</td> 429 <td><input type='text' name='pd[proizv]' value='" . html_out($pos_info['proizv']) . "' id='proizv_nm' style='width: 95%'><br> 430 <div id='proizv_p' class='dd'></div></td> 431 <td align='right'>Код изготовителя</td><td><input type='text' name='pd[vc]' value='" . html_out($pos_info['vc']) . "'></td></tr> 432 <tr><td align='right'>Единица измерения</td><td><select name='pd[unit]'>"); 433 434 $res2 = $db->query("SELECT `id`, `name` FROM `class_unit_group` ORDER BY `id`"); 435 while ($nx2 = $res2->fetch_row()) { 436 $tmpl->addContent("<option disabled style='color:#fff; background-color:#000'>" . html_out($nx2[1]) . "</option>\n"); 437 $res = $db->query("SELECT `id`, `name`, `rus_name1` FROM `class_unit` WHERE `class_unit_group_id`='$nx2[0]'"); 438 while ($nx = $res->fetch_row()) { 439 $i = ""; 440 if ($pos != 0) { 441 if ($nx[0] == $pos_info['unit']) 442 $i = " selected"; 443 } 444 else if ($nx[0] == @$CONFIG['doc']['default_unit']) 445 $i = " selected"; 446 $tmpl->addContent("<option value='$nx[0]' $i>" . html_out("$nx[1] ($nx[2])") . "</option>"); 447 } 448 } 449 $tmpl->addContent("</select></td> 450 <td align='right'>Количество оптом:</td> 451 <td><input type='text' name='pd[bulkcnt]' value='" . html_out($pos_info['bulkcnt']) . "'></td> 452 </tr> 453 <tr><td align='right'>Базовая цена</td> 454 <td><input type='text' name='pd[cost]' value='{$pos_info['cost']}'> с {$pos_info['cost_date']} </td> 455 <td align='right'>Кратность:</td> 456 <td><input type='text' name='pd[mult]' value='" . html_out($pos_info['mult']) . "'></td> 457 </tr> 458 <tr><td align='right'>Ставка НДС</td> 459 <td><input type='text' name='pd[nds]' value='{$pos_info['nds']}'></td> 460 <td align='right' colspan=2></td> 461 </tr> 462 <tr><td align='right'>Ликвидность:</td> 463 <td><b>{$pos_info['likvid']}% 464 <small>=Сумма(Кол-во заявок + Кол-во реализаций) / МаксСумма(Кол-во заявок + Кол-во реализаций)</small></b></td> 465 <td align='right'>Актуальная цена поступления:</td><td><b>$act_cost</b></td> 466 </tr> 467 <tr><td align='right'>Гарантийный срок:</td><td><input type='text' name='pd[warranty]' value='{$pos_info['warranty']}'> мес.</td> 468 <td align='right'>Гарантия:</td><td><label><input type='radio' name='pd[warranty_type]' value='0' $wt0_check>От продавца</label> <label><input type='radio' name='pd[warranty_type]' value='1' $wt1_check>От производителя</label></td></tr> 469 <tr><td align='right'>Видимость:</td><td><label><input type='checkbox' name='pd[hidden]' value='1' $hid_check>Не отображать на витрине</label></td><td><label><input type='checkbox' name='pd[no_export_yml]' value='1' $yml_check>Не экспортировать в YML</label> 470 <td><label><input type='checkbox' name='pd[stock]' value='1' $stock_check>Поместить в спецпредложения</label></td></tr> 471 472 <tr><td align='right'>Описание</td><td colspan='3'><textarea name='pd[desc]'>" . html_out($pos_info['desc']) . "</textarea></td></tr> 473 <tr><td align='right'>Тэг title карточки товара на витрине</td> 474 <td colspan='3'><input type='text' name='pd[title_tag]' value='" . html_out($pos_info['title_tag']) . "' style='width: 95%' maxlength='128'></td></tr> 475 <tr><td align='right'>Мета-тэг keywords карточки товара на витрине</td> 476 <td colspan='3'><input type='text' name='pd[meta_keywords]' value='" . html_out($pos_info['meta_keywords']) . "' style='width: 95%' maxlength='128'></td></tr> 477 <tr><td align='right'>Мета-тэг description карточки товара на витрине</td> 478 <td colspan='3'><input type='text' name='pd[meta_description]' value='" . html_out($pos_info['meta_description']) . "' style='width: 95%' maxlength='256'></td></tr> 479 "); 480 if ($pos != 0) 481 $tmpl->addContent("<tr><td align='right'>Режим записи:</td><td colspan='3'> 482 <label><input type='radio' name='sr' value='0' checked>Сохранить</label> 483 <label><input type='radio' name='sr' value='1'>Добавить</label></td></tr>"); 484 $tmpl->addContent("<tr><td></td><td colspan='3'><input type='submit' value='Сохранить'></td></tr> 485 <script type='text/javascript' src='/css/jquery/jquery.js'></script> 486 <script type='text/javascript' src='/css/jquery/jquery.autocomplete.js'></script> 487 488 <script type=\"text/javascript\"> 489 $(document).ready(function(){ 490 $(\"#proizv_nm\").autocomplete(\"/docs.php\", { 491 delay:300, 492 minChars:1, 493 matchSubset:1, 494 autoFill:false, 495 selectFirst:true, 496 matchContains:1, 497 cacheLength:20, 498 maxItemsToShow:15, 499 extraParams:{'l':'sklad','mode':'srv','opt':'acp'} 500 }); 501 }); 502 </script> 503 </table></form>"); 595 } 596 597 if ($param == '' || $param == 'v') { 598 $this->showMainForm($pos, $group); 504 599 } 505 600 // Дополнительные свойства 506 601 else if ($param == 'd') { 507 $this-> dopDataEditForm($pos);602 $this->showDopDataEditForm($pos); 508 603 } 509 604 // Складские свойства 510 605 else if ($param == 's') { 511 $this->storeDataEditForm($pos); 606 $this->showStoreDataEditForm($pos); 607 } 608 // Комплектующие 609 else if ($param == 'k') { 610 $this->showPartsForm($pos); 512 611 } 513 612 // Изображения … … 517 616 518 617 $res = $db->query("SELECT `doc_base_img`.`img_id`, `doc_img`.`type` 519 520 521 618 FROM `doc_base_img` 619 LEFT JOIN `doc_img` ON `doc_img`.`id`=`doc_base_img`.`img_id` 620 WHERE `doc_base_img`.`pos_id`='$pos'"); 522 621 $checked = ($res->num_rows == 0) ? 'checked' : ''; 523 622 $tmpl->addContent(" 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 623 <table> 624 <tr><th width='50%'>Изображения</th><th width='50%'>Прикреплённые файлы</th></tr> 625 <tr><td valign='top'> 626 <form action='' method='post' enctype='multipart/form-data'> 627 <input type='hidden' name='mode' value='esave'> 628 <input type='hidden' name='l' value='sklad'> 629 <input type='hidden' name='pos' value='$pos'> 630 <input type='hidden' name='param' value='i'> 631 <table class='list' width='100%'> 632 <tr><th width='10%'>По умолч.</th><th>Файл</th><th>Имя изображения</th></tr> 633 <tr><td><input type='radio' name='def_img' value='1' $checked></td> 634 <td><input type='hidden' name='MAX_FILE_SIZE' value='$max_fs'><input name='userfile1' type='file'></td> 635 <td><input type='text' name='photoname_1' value=''></td> 636 </tr> 637 <tr><td><input type='radio' name='def_img' value='2'></td> 638 <td><input type='hidden' name='MAX_FILE_SIZE' value='$max_fs'><input name='userfile2' type='file'></td> 639 <td><input type='text' name='photoname_2' value=''></td> 640 </tr> 641 <tr><td><input type='radio' name='def_img' value='3'></td> 642 <td><input type='hidden' name='MAX_FILE_SIZE' value='$max_fs'><input name='userfile3' type='file'></td> 643 <td><input type='text' name='photoname_3' value=''></td> 644 </tr> 645 <tr><td><input type='radio' name='def_img' value='4'></td> 646 <td><input type='hidden' name='MAX_FILE_SIZE' value='$max_fs'><input name='userfile4' type='file'></td> 647 <td><input type='text' name='photoname_4' value=''></td> 648 </tr> 649 <tr><td><input type='radio' name='def_img' value='5'></td> 650 <td><input type='hidden' name='MAX_FILE_SIZE' value='$max_fs'><input name='userfile5' type='file'></td> 651 <td><input type='text' name='photoname_5' value=''></td> 652 </tr> 653 <tr><td colspan='3' align='center'> 654 <button type='submit'>Сохранить</button> 655 </table> 656 <b>Форматы</b>: Не более $max_fs_size суммарно, разрешение от 150*150 до 10000*10000, форматы JPG, PNG, допустим, но не рекомендуется GIF<br> 657 <b>Примечание</b>: Если написать имя картинки, которая уже есть в базе, то она и будет установлена вне зависимости от того, передан файл или нет. 658 </form><h2>Ассоциированные с товаром картинки</h2>"); 560 659 while ($nxt = $res->fetch_row()) { 561 660 $miniimg = new ImageProductor($nxt[0], 'p', $nxt[1]); 562 661 $miniimg->SetX(175); 563 662 $img = "<img src='" . $miniimg->GetURI() . "' width='175'>"; 564 565 $tmpl->addContent("$img<br> 566 <a href='?mode=esave&l=sklad&param=i_d&pos=$pos&img=$nxt[0]'>Убрать ассоциацию</a><br><br>"); 663 $tmpl->addContent("$img<br><a href='?mode=esave&l=sklad&param=i_d&pos=$pos&img=$nxt[0]'>Убрать ассоциацию</a><br><br>"); 567 664 } 568 665 $tmpl->addContent("</td><td valign='top'> 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 666 <form action='' method='post' enctype='multipart/form-data'> 667 <input type='hidden' name='mode' value='esave'> 668 <input type='hidden' name='l' value='sklad'> 669 <input type='hidden' name='pos' value='$pos'> 670 <input type='hidden' name='param' value='i_a'> 671 <table cellpadding='0' class='list'> 672 <tr><td>Прикрепляемый файл: 673 <td><input type='hidden' name='MAX_FILE_SIZE' value='$max_fs'><input name='userfile' type='file'><br><small>Не более $max_fs_size</small> 674 <tr><td>Описание файла (до 128 символов): 675 <td><input type='text' name='comment' value='Инструкция для $pos'><br> 676 <small>Если написать описание файла, которое уже есть в базе, то соответствующий файл и будет установлен, вне зависимости от того, передан он или нет.</small> 677 <tr><td colspan='2' align='center'> 678 <input type='submit' value='Сохранить'> 679 </table> 680 <table class='list' width='100%'> 681 <tr><th colspan='4'>Прикреплённые файлы</th></tr>"); 585 682 $res = $db->query("SELECT `doc_base_attachments`.`attachment_id`, `attachments`.`original_filename`, `attachments`.`comment` 586 587 588 683 FROM `doc_base_attachments` 684 LEFT JOIN `attachments` ON `attachments`.`id`=`doc_base_attachments`.`attachment_id` 685 WHERE `doc_base_attachments`.`pos_id`='$pos'"); 589 686 while ($nxt = $res->fetch_row()) { 590 if ($CONFIG['site']['recode_enable']) 687 if ($CONFIG['site']['recode_enable']) { 591 688 $link = "/attachments/{$nxt[0]}/$nxt[1]"; 592 else689 } else { 593 690 $link = "/attachments.php?att_id={$nxt[0]}"; 691 } 594 692 $tmpl->addContent("<tr><td>$nxt[0]</td><td><a href='$link'>" . html_out($nxt[1]) . "</a></td></td><td>" . html_out($nxt[2]) . "</td><td><a href='?mode=esave&l=sklad&param=i_ad&pos=$pos&att=$nxt[0]' title='Убрать ассоциацию'><img src='/img/i_del.png' alt='Убрать ассоциацию'></a></td></tr>"); 595 693 } … … 608 706 $direct = array((-1) => 'Вниз', 0 => 'K ближайшему', 1 => 'Вверх'); 609 707 $res = $db->query("SELECT `doc_cost`.`id`, `doc_base_cost`.`id`, `doc_cost`.`name`, `doc_cost`.`type`, `doc_cost`.`value`, `doc_base_cost`.`type`, `doc_base_cost`.`value`, `doc_base_cost`.`accuracy`, `doc_base_cost`.`direction`, `doc_cost`.`accuracy`, `doc_cost`.`direction` 610 611 708 FROM `doc_cost` 709 LEFT JOIN `doc_base_cost` ON `doc_cost`.`id`=`doc_base_cost`.`cost_id` AND `doc_base_cost`.`pos_id`='$pos'"); 612 710 $tmpl->addContent(" 613 614 615 616 617 618 619 620 711 <form action='docs.php' method='post'> 712 <input type='hidden' name='mode' value='esave'> 713 <input type='hidden' name='l' value='sklad'> 714 <input type='hidden' name='pos' value='$pos'> 715 <input type='hidden' name='param' value='c'> 716 <table cellpadding='0' width='50%' class='list'> 717 <tr><th>Цена</th><th>Тип</th><th>Значение</th><th>Точность</th><th>Округление</th><th>Результат</th></tr> 718 <tr><td><b>Базовая</b><td>Базовая цена<td>{$pos_info['base_price']} руб.<td>-<td>-<td>{$pos_info['base_price']} руб."); 621 719 $pc = PriceCalc::getInstance(); 622 720 while ($cn = $res->fetch_row()) { 623 721 $sig = ($cn[4] > 0) ? '+' : ''; 624 if ($cn[3] == 'pp') 625 $def_val = "({$sig}$cn[4] %)"; 626 else if ($cn[3] == 'abs') 627 $def_val = "({$sig}$cn[4] руб.)"; 628 else if ($cn[3] == 'fix') 629 $def_val = "(= $cn[4] руб.)"; 630 else 631 $def_val = "({$sig}$cn[4] XX)"; 722 switch($cn[3]) { 723 case 'pp': 724 $def_val = "({$sig}$cn[4] %)"; 725 break; 726 case 'abs': 727 $def_val = "({$sig}$cn[4] руб.)"; 728 break; 729 case 'fix': 730 $def_val = "(= $cn[4] руб.)"; 731 break; 732 default : 733 $def_val = "({$sig}$cn[4] XX)"; 734 } 632 735 633 736 $checked = $cn[1] ? 'checked' : ''; … … 665 768 $tmpl->addContent("</table> 666 769 <button>Сохранить цены</button></form>"); 667 }668 // Комплектующие669 else if ($param == 'k') {670 $peopt = request('peopt');671 require_once("include/doc.sklad.kompl.php");672 $poseditor = new KomplPosList($pos);673 $poseditor->SetEditable(1);674 if ($peopt == '') {675 $res = $db->query("SELECT `doc_base_values`.`value` FROM `doc_base_params`676 LEFT JOIN `doc_base_values` ON `doc_base_values`.`param_id`=`doc_base_params`.`id` AND `doc_base_values`.`id`='$pos'677 WHERE `doc_base_params`.`codename`='ZP'");678 if ($res->num_rows)679 list($zp) = $res->fetch_row();680 else681 $zp = '';682 $tmpl->addContent($poseditor->Show('', $zp));683 } else {684 $tmpl->ajax = 1;685 if ($peopt == 'jget') {686 $str = $poseditor->GetAllContent();687 $tmpl->setContent($str);688 }689 // Получение данных наименования690 else if ($peopt == 'jgpi') {691 $pos = rcvint('pos');692 $tmpl->setContent($poseditor->GetPosInfo($pos));693 }694 // Json вариант добавления позиции695 else if ($peopt == 'jadd') {696 \acl::accessGuard('directory.goods', \acl::UPDATE);697 $pe_pos = rcvint('pe_pos');698 $tmpl->setContent($poseditor->AddPos($pe_pos));699 }700 // Json вариант удаления строки701 else if ($peopt == 'jdel') {702 \acl::accessGuard('directory.goods', \acl::UPDATE);703 $line_id = rcvint('line_id');704 $tmpl->setContent($poseditor->Removeline($line_id));705 }706 // Json вариант обновления707 else if ($peopt == 'jup') {708 \acl::accessGuard('directory.goods', \acl::UPDATE);709 $line_id = rcvint('line_id');710 $value = request('value');711 $type = request('type');712 $tmpl->setContent($poseditor->UpdateLine($line_id, $type, $value));713 }714 // Получение номенклатуры выбранной группы715 else if ($peopt == 'jsklad') {716 $group_id = rcvint('group_id');717 $str = "{ response: 'sklad_list', group: '$group_id', content: [" . $poseditor->GetSkladList($group_id) . "] }";718 $tmpl->setContent($str);719 }720 // Поиск по подстроке по складу721 else if ($peopt == 'jsklads') {722 $s = request('s');723 $str = "{ response: 'sklad_list', content: [" . $poseditor->SearchSkladList($s) . "] }";724 $tmpl->setContent($str);725 }726 // Получение списка групп727 else if ($peopt == 'jgetgroups') {728 $doc_content = $poseditor->getGroupList();729 $tmpl->setContent($doc_content);730 } else731 throw new NotFoundException();732 }733 770 } 734 771 // Связанные товары … … 797 834 $analog_group = $pos_info['analog_group']; 798 835 $tmpl->addContent("<form action='' method='post'> 799 800 801 802 803 804 805 806 807 808 809 836 <input type='hidden' name='mode' value='esave'> 837 <input type='hidden' name='l' value='sklad'> 838 <input type='hidden' name='pos' value='$pos'> 839 <input type='hidden' name='param' value='n'> 840 Имя группы аналогов:<br> 841 <input type='text' name='analog_group' value='$analog_group'> 842 <button type='submit'>Записать</button> 843 </form> 844 <h3>Аналоги в группе</h3> 845 <table class='list'> 846 <tr><th>id</th><th>Код</th><th>Название</th><th>Производитель</th><th>Цена</th><th>Остаток</th>"); 810 847 if (@$CONFIG['poseditor']['rto']) { 811 848 $tmpl->addContent("<th>Резерв</th><th>Под заказ</th><th>В пути</th>"); … … 816 853 $analog_group_sql = $db->real_escape_string($analog_group); 817 854 $res = $db->query("SELECT `doc_base`.`id`, `doc_base`.`vc`, `doc_base`.`name`, `doc_base`.`proizv` AS `vendor`, `cost` AS `price`, ( 818 819 820 821 822 823 855 SELECT SUM(`cnt`) FROM `doc_base_cnt` WHERE `doc_base_cnt`.`id`=`doc_base`.`id` 856 ) AS `cnt`, 857 `doc_base_dop`.`reserve`, `doc_base_dop`.`transit`, `doc_base_dop`.`offer` 858 FROM `doc_base` 859 LEFT JOIN `doc_base_dop` ON `doc_base_dop`.`id`=`doc_base`.`id` 860 WHERE `analog_group`='$analog_group_sql' AND `analog_group`!=''"); 824 861 while ($line = $res->fetch_assoc()) { 825 862 $link = $base_link . '&pos=' . $line['id']; … … 849 886 } 850 887 $tmpl->addContent("<tr> 851 852 853 854 888 <td><a href='{$link}&opt=ep'>{$line['id']}</a></td> 889 <td>{$line['vc']}</td><td>{$line['name']}</td><td>{$line['vendor']}</td> 890 <td align='right'>{$line['price']}</td><td align='right'>{$line['cnt']}</td>$rto 891 </tr>"); 855 892 } 856 893 … … 867 904 // Правка описания группы 868 905 else if ($param == 'g') { 906 \acl::accessGuard('directory.goods.groups', \acl::VIEW); 869 907 $max_fs = get_max_upload_filesize(); 870 908 $max_fs_size = formatRoundedFileSize($max_fs); … … 879 917 } 880 918 $tmpl->addContent("<h1>Описание группы</h1> 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 919 <script type=\"text/javascript\"> 920 function rmLine(t) 921 { 922 var line=t.parentNode.parentNode 923 line.parentNode.removeChild(line) 924 } 925 926 function addLine() 927 { 928 var fgtab=document.getElementById('fg_table').tBodies[0] 929 var sel=document.getElementById('fg_select') 930 var newrow=fgtab.insertRow(fgtab.rows.length) 931 var lineid=sel.value 932 var checked=(document.getElementById('fg_check').checked)?'checked':'' 933 934 var ctext = sel.selectedIndex !== -1 ? sel.options[sel.selectedIndex].text : '' 935 936 newrow.innerHTML=\"<td><input type='hidden' name='fn[\"+lineid+\"]' value='1'>\"+ 937 \"<input type='checkbox' name='fc[\"+lineid+\"]' value='1' \"+checked+\"></td><td>\"+ctext+\"</td><td>\"+ 938 \"<img src='/img/i_del.png' alt='' onclick='return rmLine(this)'></td>\" 939 } 940 941 </script> 942 <form action='docs.php' method='post' enctype='multipart/form-data'> 943 <input type='hidden' name='mode' value='esave'> 944 <input type='hidden' name='l' value='sklad'> 945 <input type='hidden' name='g' value='$group'> 946 <input type='hidden' name='param' value='g'> 947 <table cellpadding='0' width='50%' class='list'> 948 <tr><td>Наименование группы $group:</td> 949 <td><input type='text' name='name' value='" . html_out($group_info['name']) . "'></td></tr> 950 <tr><td>Находится в группе:</td> 951 <td>" . selectGroupPos('pid', $group_info['pid'], true)); 914 952 915 953 if (file_exists("{$CONFIG['site']['var_data_fs']}/category/$group.jpg")) … … 922 960 923 961 $tmpl->addContent("</td></tr> 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 962 <tr><td>Скрытие:</td> 963 <td><label><input type='checkbox' name='hid' value='3' $hid_check>Не отображать на витрине и в прайсах</label><br> 964 <label><input type='checkbox' name='no_export_yml' value='3' $yml_check>Не экспортировать в YML</label></td></tr> 965 <tr><td>Печатное название:</td> 966 <td><input type='text' name='pname' value='" . html_out($group_info['printname']) . "'></td></tr> 967 <tr><td>Тэг title группы на витрине:</td> 968 <td><input type='text' name='title_tag' value='" . html_out($group_info['title_tag']) . "' maxlength='128'></td></tr> 969 <tr><td>Мета-тэг keywords группы на витрине:</td> 970 <td><input type='text' name='meta_keywords' value='" . html_out($group_info['meta_keywords']) . "' maxlength='128'></td></tr> 971 <tr><td>Мета-тэг description группы на витрине:</td> 972 <td><input type='text' name='meta_description' value='" . html_out($group_info['meta_description']) . "' maxlength='256'></td></tr> 973 974 <tr><td>Изображение (jpg, до $max_fs_size, от 100*100):</td> 975 <td><input type='hidden' name='MAX_FILE_SIZE' value='$max_fs'><input name='userfile' type='file'>$img</td></tr> 976 <tr><td>Описание:</td> 977 <td><textarea name='desc'>" . html_out($group_info['desc']) . "</textarea></td></tr> 978 <tr><td>Статические дополнительные свойства товаров группы<br><br> 979 Добавить из набора:<select name='collection'> 980 <option value='0'>--не выбран--</option>"); 943 981 $rgroups = $db->query("SELECT `id`, `name` FROM `doc_base_pcollections_list` ORDER BY `name`"); 944 982 while ($col = $res->fetch_row()) { … … 946 984 } 947 985 $tmpl->addContent("</select></td> 948 949 950 951 952 953 954 955 956 986 <td> 987 <table width='100%' id='fg_table' class='list'> 988 <thead> 989 <tr><th><img src='/img/i_filter.png' alt='Отображать в фильтрах'></th><th>Название параметра</th><th> </th></tr> 990 </thead> 991 <tfoot> 992 <tr><td><input type='checkbox' id='fg_check'><td> 993 <select name='pp' id='fg_select'> 994 <option value='0' selected>--не выбрано--</option>"); 957 995 $res_group = $db->query("SELECT `id`, `name` FROM `doc_base_gparams` ORDER BY `name`"); 958 996 while ($groupp = $res_group->fetch_row()) { … … 964 1002 } 965 1003 $tmpl->addContent("</select> 966 967 </td><td><img src='/img/i_add.png' alt='' onclick='return addLine()'></td></tr> 968 </td></tr></tfoot> 969 <tbody>"); 1004 </td><td><img src='/img/i_add.png' alt='' onclick='return addLine()'></td></tr> 1005 </td></tr></tfoot> 1006 <tbody>"); 970 1007 971 1008 $r = $db->query("SELECT `doc_base_params`.`id`, `doc_base_params`.`name`, `doc_group_params`.`show_in_filter` FROM `doc_base_params` 972 973 974 1009 LEFT JOIN `doc_group_params` ON `doc_group_params`.`param_id`=`doc_base_params`.`id` 1010 WHERE `doc_group_params`.`group_id`='$group' 1011 ORDER BY `doc_base_params`.`id`"); 975 1012 while ($p = $r->fetch_row()) { 976 1013 $checked = $p[2] ? 'checked' : ''; … … 1283 1320 $db->query("INSERT INTO `doc_base_cnt` (`id`, `sklad`, `cnt`) VALUES ('$pos_id', '$nxt[0]', '0')"); 1284 1321 } 1285 1322 $db->commit(); 1323 1286 1324 $this->PosMenu($pos_id, ''); 1287 $tmpl->msg("Добавлена новая позиция!<br><a href='/docs.php?l=sklad&mode=srv&opt=ep&pos=$pos_id'>Перейти</a>"); 1288 $db->commit(); 1325 $tmpl->msg("Новый элемент успешно создан!"); 1326 $this->showMainForm($pos_id, $pd['group']); 1327 1289 1328 } 1290 1329 } … … 1302 1341 } 1303 1342 1304 if ($param == '' ) {1343 if ($param == '' || $param == 'v') { 1305 1344 $this->saveProduct($pos); 1306 1345 } else if ($param == 'd') { … … 1381 1420 $tmpl->msg("Данные сохранены!"); 1382 1421 1383 $this-> dopDataEditForm($pos);1422 $this->showDopDataEditForm($pos); 1384 1423 } else if ($param == 's') { 1385 1424 $this->storeDataSave($pos); … … 1525 1564 $db->startTransaction(); 1526 1565 $res = $db->query("SELECT `doc_cost`.`id`, `doc_base_cost`.`id`, `doc_base_cost`.`type`, `doc_base_cost`.`value`, `doc_base_cost`.`accuracy`, `doc_base_cost`.`direction` 1527 1528 1566 FROM `doc_cost` 1567 LEFT JOIN `doc_base_cost` ON `doc_cost`.`id`=`doc_base_cost`.`cost_id` AND `doc_base_cost`.`pos_id`='$pos'"); 1529 1568 $log = ''; 1530 1569 while ($nxt = $res->fetch_row()) { … … 1570 1609 } 1571 1610 $tmpl->msg("Изменения сохранены!", "ok"); 1572 if ($log) 1611 if ($log) { 1573 1612 doc_log('UPDATE pos-ceni', $log, 'pos', $pos); 1613 } 1574 1614 $db->commit(); 1575 1615 } … … 1595 1635 $tmpl->msg("Ничего не изменилось!"); 1596 1636 } 1597 else if ($param == 'g') { 1598 \acl::accessGuard('directory.goods', \acl::UPDATE); 1637 else if ($param == 'g') { 1599 1638 $max_size = get_max_upload_filesize(); 1600 1639 $name = request('name'); … … 1615 1654 $meta_keywords_sql = $db->real_escape_string($meta_keywords); 1616 1655 $meta_description_sql = $db->real_escape_string($meta_description); 1617 1656 if($name=='') { 1657 throw new Exception('Нельзя создать группу с пустым названием!'); 1658 } 1618 1659 if ($group) { 1619 if ($pid == $group) 1660 if ($pid == $group) { 1620 1661 throw new Exception("Нельзя добавить группу саму в себя!"); 1662 } 1663 \acl::accessGuard('directory.goods.groups', \acl::UPDATE); 1621 1664 $res = $db->query("UPDATE `doc_group` SET `name`='$name_sql', `desc`='$desc_sql', `pid`='$pid', `hidelevel`='$hid', 1622 1623 1665 `printname`='$pname_sql', `no_export_yml`='$no_export_yml', `title_tag`='$title_tag_sql', 1666 `meta_keywords`='$meta_keywords_sql', `meta_description`='$meta_description_sql' WHERE `id` = '$group'"); 1624 1667 } else { 1668 \acl::accessGuard('directory.goods.groups', \acl::CREATE); 1625 1669 $res = $db->query("INSERT INTO `doc_group` (`name`, `desc`, `pid`, `hidelevel`, `printname`, `no_export_yml`, `title_tag`, 1626 1627 1628 1670 `meta_keywords`, `meta_description`) 1671 VALUES ('$name_sql', '$desc_sql', '$pid', '$hid', '$pname_sql', '$no_export_yml', '$title_tag_sql', '$meta_keywords_sql', 1672 '$meta_description_sql' )"); 1629 1673 } 1630 1674 … … 1846 1890 /// Отображает список товаров группы, разбитый на страницы 1847 1891 /// @param group ID группы, товары из которой нужно показать 1848 /// @param s не используется 1849 /// TODO: убрать обращения к параметру s и сам параметр 1850 function ViewSklad($group = 0, $s = '') { 1892 function ViewSklad($group = 0) { 1851 1893 global $tmpl, $CONFIG, $db; 1852 1894 $sklad = $_SESSION['sklad_num']; … … 1862 1904 1863 1905 $tmpl->addContent(" 1864 1865 1866 1867 1906 <a href='/docs.php?l=sklad&mode=srv&opt=ep&pos=0&g=$group'><img src='/img/i_add.png' alt=''> Добавить</a> | 1907 <a href='/docs.php?l=sklad&mode=edit&param=g&g=$group'><img src='/img/i_edit.png' alt=''> Правка группы</a> | 1908 <a href='/docs.php?l=sklad&mode=search'><img src='/img/i_find.png' alt=''> Расширенный поиск</a> | 1909 <a href='#' onclick=\"EditThis('/docs.php?mode=srv&opt=pl&g=$group&go=1','sklad'); return false;\" ><img src='/img/i_reload.png' alt=''> Групповые операции</a><br>"); 1868 1910 } 1869 1911 else if ($go) { 1870 1912 $tmpl->addContent("<form action='' method='post'> 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1913 <input type='hidden' name='l' value='sklad'> 1914 <input type='hidden' name='mode' value='srv'> 1915 <input type='hidden' name='opt' value='go'> 1916 1917 <div class='sklad-go'> 1918 <table width='100%'> 1919 <tr><td width='25%'><fieldset><legend>Поместить в спецпредложения</legend> 1920 <label><input type='radio' name='sale_flag' value='' checked>Не менять</label><br> 1921 <label><input type='radio' name='sale_flag' value='set'>Установить</label><br> 1922 <label><input type='radio' name='sale_flag' value='unset'>Снять</label> 1923 </fieldset></td> 1924 <td width='25%'><fieldset><legend>Не отображать на витрине</legend> 1925 <label><input type='radio' name='hidden_flag' value='' checked>Не менять</label><br> 1926 <label><input type='radio' name='hidden_flag' value='set'>Установить</label><br> 1927 <label><input type='radio' name='hidden_flag' value='unset'>Снять</label> 1928 </fieldset></td> 1929 <td width='25%'><fieldset><legend>Не экспортировать в YML</legend> 1930 <label><input type='radio' name='yml_flag' value='' checked>Не менять</label><br> 1931 <label><input type='radio' name='yml_flag' value='set'>Установить</label><br> 1932 <label><input type='radio' name='yml_flag' value='unset'>Снять</label> 1933 </fieldset></td> 1934 <td width='25%'><fieldset><legend>Переместить в группу</legend> 1935 " . selectGroupPos('to_group', 0, false, '', '', @$CONFIG['store']['leaf_only']) . " 1936 </fieldset></td> 1937 </table> 1938 <br><button type='submit'>Выполнить</button> 1939 </div>"); 1898 1940 $lim = 5000000; 1899 1941 $vc_add.="<input type='checkbox' id='selall' onclick='return SelAll(this);'>"; … … 1986 2028 $tmpl->addContent('<th>Код</th>'); 1987 2029 } 1988 $tmpl->addContent("<th>Наименование</th><th>Производитель</th><th>Цена, р.</th><th>Ликв.</th><th>АЦП, р.</th>"); 2030 $tmpl->addContent("<th>Наименование</th><th>Производитель</th><th>Цена, р.</th><th>Ликв.</th>"); 2031 if(\acl::testAccess('directory.goods.secfields', \acl::VIEW)) { 2032 $tmpl->addContent("<th>АЦП, р.</th>"); 2033 } 1989 2034 if ($_SESSION['sklad_cost'] > 0) { 1990 2035 $tmpl->addContent('<th>Выб. цена</th>'); … … 2017 2062 $tmpl->addContent("<tr class='lin0'><th colspan='20' align='center'>В группе $row наименований, показаны " . ( ($sl + $lim) < $row ? $lim : ($row - $sl) ) . ", начиная с $sl"); 2018 2063 $i = 0; 2019 $this->DrawSkladTable($res, $s, $lim, $e_options);2064 $this->DrawSkladTable($res, '', $lim, $e_options); 2020 2065 $tmpl->addContent("</table>$pagebar"); 2021 2066 if ($go) { … … 2051 2096 $tmpl->addContent('<th>Код</th>'); 2052 2097 } 2053 $tmpl->addContent("<th>Наименование</th><th>Производитель</th><th>Цена, р.</th><th>Ликв.</th><th>АЦП, р.</th>"); 2098 $tmpl->addContent("<th>Наименование</th><th>Производитель</th><th>Цена, р.</th><th>Ликв.</th>"); 2099 if(\acl::testAccess('directory.goods.secfields', \acl::VIEW)) { 2100 $tmpl->addContent("<th>АЦП, р.</th>"); 2101 } 2054 2102 if ($_SESSION['sklad_cost'] > 0) { 2055 2103 $tmpl->addContent('<th>Выб. цена</th>'); … … 2434 2482 2435 2483 $price_p = sprintf("%0.2f", $line['base_price']); 2436 $in_price = sprintf("%0.2f", getInCost($line['id'])); 2484 if(\acl::testAccess('directory.goods.secfields', \acl::VIEW)) { 2485 $in_price = '<td>'.sprintf("%0.2f", getInCost($line['id'])).'</td>'; 2486 } else { 2487 $in_price = ''; 2488 } 2489 2437 2490 2438 2491 $vc_add = @$CONFIG['poseditor']['vc'] ? "<td align='left'>" . SearchHilight(html_out($line['vc']), $s) . "</td>" : ''; … … 2469 2522 . "<img src='img/i_menu.png' alt='Меню' border='0'></a></td>" 2470 2523 . "$vc_add<td align='left'>$name $info</td><td align='left'>{$line['proizv']}</td><td{$price_class}>$price_p</td><td>{$line['likvid']}</td>" 2471 . " <td>$in_price</td>{$cadd}$tdb_add<td>{$line['mass']}</td>{$opts_add}{$rto_add}<td>{$line['cnt']}</td><td>{$line['allcnt']}</td><td>{$line['mesto']}</td></tr>";2524 . "{$in_price}{$cadd}$tdb_add<td>{$line['mass']}</td>{$opts_add}{$rto_add}<td>{$line['cnt']}</td><td>{$line['allcnt']}</td><td>{$line['mesto']}</td></tr>"; 2472 2525 } 2473 2526 … … 2511 2564 /// @param pos_name Наименование запрашиваемого товара 2512 2565 function PosMenu($pos, $param) { 2513 global $tmpl, $ CONFIG, $db;2566 global $tmpl, $db; 2514 2567 settype($pos, 'int'); 2515 $sel = array('v' => '', 'd' => '', 'a' => '', 's' => '', 'i' => '', 'c' => '', 'k' => '', 'l' => '', 'n' => '', 'h' => '', 'y' => ''); 2516 if ($param == '') 2568 if ($param == '') { 2517 2569 $param = 'v'; 2518 $sel[$param] = "class='selected'";2519 2520 if ($CONFIG['poseditor']['vc'])2521 $res = $db->query("SELECT CONCAT(`doc_base`.`vc`, ' - ', `doc_base`.`name`) FROM `doc_base` WHERE `doc_base`.`id`='$pos'");2522 else2523 $res = $db->query("SELECT `doc_base`.`name` FROM `doc_base` WHERE `doc_base`.`id`='$pos'");2570 } 2571 if (\cfg::get('poseditor', 'vc') ) { 2572 $res = $db->query("SELECT CONCAT(`name`, ' (', `vc`, ')'), `pos_type` FROM `doc_base` WHERE `doc_base`.`id`='$pos'"); 2573 } else { 2574 $res = $db->query("SELECT `name`, `pos_type` FROM `doc_base` WHERE `doc_base`.`id`='$pos'"); 2575 } 2524 2576 $pos_info = $res->fetch_row(); 2525 2577 if ($pos_info) { 2526 $tmpl->setTitle("Редактируем " . html_out($pos_info[0])); 2527 $tmpl->addContent("<h1>Редактируем " . html_out($pos_info[0]) . "</h1>"); 2528 } 2529 2530 $tmpl->addContent(" 2531 <ul class='tabs'> 2532 <li><a {$sel['v']} href='/docs.php?l=sklad&mode=srv&opt=ep&pos=$pos'>Основные</a></li> 2533 <li><a {$sel['d']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=d&pos=$pos'>Дополнительные</a></li> 2534 <li><a {$sel['s']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=s&pos=$pos'>Склады</a></li> 2535 <li><a {$sel['i']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=i&pos=$pos'>Картинки и файлы</a></li> 2536 <li><a {$sel['c']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=c&pos=$pos'>Цены</a></li> 2537 <li><a {$sel['l']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=l&pos=$pos'>Связи</a></li> 2538 <li><a {$sel['n']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=n&pos=$pos'>Аналоги</a></li> 2539 <li><a {$sel['k']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=k&pos=$pos'>Комплектующие</a></li> 2540 <li><a {$sel['a']} href='/docs.php?l=pran&mode=srv&opt=ep&param=a&pos=$pos'>Анализатор</a></li> 2541 <li><a {$sel['h']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=h&pos=$pos'>История</a></li> 2542 <li><a {$sel['y']} href='/docs.php?l=sklad&mode=srv&opt=ep&param=y&pos=$pos'>Импорт Я.Маркет</a></li> 2543 </ul>"); 2578 $txt = ($pos_info[1] ? 'Услуга: ':'Товар: ') . html_out($pos_info[0]); 2579 $tmpl->setTitle($txt); 2580 $tmpl->addContent("<h1>$txt</h1>"); 2581 } 2582 $list = array( 2583 'v' => ['name' => 'Основные'], 2584 'd' => ['name' => 'Дополнительные'], 2585 's' => ['name' => 'Склады'], 2586 'i' => ['name' => 'Картинки и файлы'], 2587 'c' => ['name' => 'Цены'], 2588 'l' => ['name' => 'Связи'], 2589 'n' => ['name' => 'Аналоги'], 2590 ); 2591 if(\acl::testAccess('directory.goods.parts', \acl::VIEW)) { 2592 $list['k'] = ['name' => 'Комплектующие']; 2593 } 2594 $list['a'] = ['name' => 'Анализатор']; 2595 $list['h'] = ['name' => 'История']; 2596 $list['y'] = ['name' => 'Импорт Я.Маркет']; 2597 2598 $tmpl->addTabsWidget($list, $param, "/docs.php?l=sklad&mode=srv&opt=ep&pos=$pos", 'param'); 2544 2599 } 2545 2546 protected function dopDataEditForm($pos_id) {2600 2601 protected function showDopDataEditForm($pos_id) { 2547 2602 global $db, $tmpl; 2603 $hide_secret = ! \acl::testAccess('directory.goods.secfields', \acl::VIEW); 2548 2604 $pres = $db->query("SELECT `doc_base_dop`.`type`, `doc_base_dop`.`analog`, `doc_base_dop`.`d_int`, `doc_base_dop`.`d_ext`, 2549 2605 `doc_base_dop`.`size`, `doc_base_dop`.`ntd`, `doc_base`.`group` AS `group_id` … … 2574 2630 // Динамические свойства - записанные 2575 2631 $dyn_table = ''; 2632 // Не состоящие в группах 2576 2633 $dpv_res = $db->query("SELECT `doc_base_params`.`id`, `doc_base_params`.`name`, `doc_base_values`.`value` 2577 , `class_unit`.`rus_name1` AS `unit_name` 2634 , `class_unit`.`rus_name1` AS `unit_name`, `doc_base_params`.`secret` 2578 2635 FROM `doc_base_values` 2579 2636 LEFT JOIN `doc_base_params` ON `doc_base_params`.`id`=`doc_base_values`.`param_id` … … 2582 2639 . " AND ( `doc_base_params`.`group_id`=0 OR `doc_base_params`.`group_id` IS NULL)"); 2583 2640 while ($nx = $dpv_res->fetch_assoc()) { 2641 if($nx['secret'] && $hide_secret) { 2642 continue; 2643 } 2584 2644 $dyn_table .= "<tr><td align='right'>" . html_out($nx['name']) . ", " . html_out($nx['unit_name']) . "</td>" 2585 . "<td><input type='text' name='par[{$nx['id']}]' value='" . html_out($nx['value']) . "'></td></tr>"; 2586 } 2645 . "<td><input type='text' name='par[{$nx['id']}]' value='" . html_out($nx['value']) . "'></td></tr>"; 2646 } 2647 // Теперь по группам 2587 2648 $g_res = $db->query("SELECT * FROM `doc_base_gparams` ORDER BY `name`"); 2588 2649 while ($g_info = $g_res->fetch_assoc()) { 2589 2650 $add_table = ''; 2590 2651 $dpv_res = $db->query("SELECT `doc_base_params`.`id`, `doc_base_params`.`name`, `doc_base_values`.`value` 2591 , `class_unit`.`rus_name1` AS `unit_name` 2652 , `class_unit`.`rus_name1` AS `unit_name`, `doc_base_params`.`secret` 2592 2653 FROM `doc_base_values` 2593 2654