- 1
define("MANAGER_SAIL", 13);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
define("MANAGER_SAIL", 13);
Менеджер-парус, что непонятного?
+1
<?php
if ($fields['emailhide'] == "true" OR $fields['emailhide'] == true OR $fields['emailhide'] == 1) {
$newEmail = $values['fid2'][0]['val'];
$cond = 1;
$this->smarty->assign('is_phone', 1);
} elseif ($fields['emailhide'] == "false" OR $fields['emailhide'] == false OR $fields['emailhide'] == 0) {
$newEmail = $fields['email'];
$cond = 0;
$this->smarty->assign('is_phone', 0);
}
if ($this->user->is_phone == 1 OR $this->user->is_phone == true OR $this->user->is_phone == 'true') {
$this->smarty->assign('is_phone', 1);
} elseif ($this->user->is_phone == 0 OR $this->user->is_phone == false OR $this->user->is_phone == 'false') {
$this->smarty->assign('is_phone', 0);
Продолжение предыдущего ( #18863 )
+1
void __fastcall TExpressProgForm::miAddClick (TObject *Sender)
{
/* куча гавна */
if (Sender != miAdd && !SuperUser && GridMain->FieldByName ("ID_city")->AsString != GetValue (DB, "SELECT @EXPRESS_CITY")
&& GetValue (DB, "SELECT 1 FROM debitor_cfo WHERE ID_city=" + GridMain->FieldByName ("ID_city")->AsString) == 1
&& GetValue (DB, "SELECT @EXPRESS_CITY") != 1538)
{
FrameEdit->Edit2->ReadOnly = true;
FrameEdit->CheckBox1->Enabled = false;
FrameEdit->Panel4->Enabled = false;
FrameEdit->miDelEmployee->Enabled = false;
}
/* куча гавна */
}
+1
if (jQuery('.products-items').attr('init-load') !== 'true') {
if (jQuery(this).parent().find('ul.subcategory').length > 0) {
if (jQuery(this).parent().find('ul.subcategory:first').is(":visible")) {
} else {
}
getProductsList({
search: ''
});
} else {
getProductsList({
search: ''
});
}
}
Я просто оставлю это здесь
+1
public function save() {
if (!empty(self::$single)) {
if (isset(self::$single['id'])) {
$id = self::$single['id'];
unset(self::$single['id']);
$arraySetters = [];
foreach (self::$single as $key => $value) {
$arraySetters[] = '`'.$key.'` = \''.$value.'\'';
}
self::$single['id'] = $id;
self::$exec = static::$db->prepare('UPDATE '.self::$table.' SET '.implode(', ', $arraySetters).' WHERE `id` = '.$id.' LIMIT 1');
return self::$exec->execute();
} else {
$arrayKeys = [];
$arrayValues = [];
foreach (self::$single as $key => $value) {
$arrayKeys[] = '`'.$key.'`';
$arrayValues[] = '\''.$value.'\'';
}
self::$exec = static::$db->prepare('INSERT INTO '.self::$table.' ('.implode(', ', $arrayKeys).') VALUES ('.implode(', ', $arrayValues).')');
if ($status = self::$exec->execute()) {
self::$single['id'] = static::$db->lastInsertId();
}
return $status;
}
}
return false;
}
+1
$content = array(
'html' => '',
'meta_title' => $sitename,
'meta_keys' => $sitename,
'meta_desc' => $sitename,
'left_menu' => '',
'path' => ''
);
if ($_GET['module'] == 'page')
$_GET['module'] = 'site';
if (!isset($_GET['module'])) {
$_GET['module'] = 'site';
}
l('modules');
/* подключение текущего модуля, все остальные грузятся через __autoload() в includes/function.php */
$file = ROOT_DIR . 'modules/' . $_GET['module'] . '/i.php';
if (file_exists($file)) {
//l('load_module '. $file);
require($file);
} else {
echo 'Файл modules/' . $_GET['module'] . '/i.php не найден';
}
if (empty($content['path']) || $content['path'] == '')
$site->_404();
if (!empty($content['html'])) {
$content['html'] = fix_content($content['html']);
}
почти на уровне 1 != 1
+1
https://i.imgur.com/S0Ti1EO.png
Макаки - они везде.
+1
using DocsTaskInfo = System.Collections.Generic.KeyValuePair<int, bool>;
using DocAndContentType = System.Collections.Generic.KeyValuePair<int, string>;
using DocAndContentTypeToCount = System.Collections.Generic.Dictionary<System.Collections.Generic.KeyValuePair<int, string>, System.Collections.Generic.KeyValuePair<int, bool>>;
//...
private void DocsCountInternal(RefNetDbContainerDirect db, int docType, string contentType, int status, int count, bool Checked = true){/*...*/}
//...
private DocAndContentTypeToCount[] _docCheckTasks;
private RefNetDbContainerDirect _dbForCheck;
private void ClearAllDocCounts(RefNetDbContainerDirect dbForCheck)
{
_dbForCheck = dbForCheck;
_docCheckTasks = Enumerable.Repeat(new DocAndContentTypeToCount(), 2).ToArray();
//new DocAndContentTypeToCount[2] { new DocAndContentTypeToCount(), new DocAndContentTypeToCount() };
}
private void DocsCount(RefNetDbContainerDirect db, int docType, string contentType, int status, int count, bool Checked = true)
{
var taskHistory = _docCheckTasks[status];
var taskKey = new DocAndContentType(docType, contentType);
var taskInfo = new DocsTaskInfo(count, Checked);
if(taskHistory.ContainsKey(taskKey))
_exceptions.Add(new Exception(string.Format(
"CheckDocsTask with (_.idDocType == {0}) && (_.contentType == \"{1}\") && (_.status == {2}) ) already contained",
docType, contentType, status)));
taskHistory.Add(taskKey, taskInfo);
}
private void CheckAllDocCounts()
{
if (AllDocumentsMadeByServer)
{
//1
var taskKeys = _docCheckTasks.SelectMany(_ => _.Keys)/*.Distinct()*/.ToArray();
foreach (var taskKey in taskKeys)
{
DocAndContentType key = taskKey;
foreach (var statusedTask in _docCheckTasks.Where(statusedTask => !statusedTask.ContainsKey(key)))
statusedTask.Add(taskKey, new DocsTaskInfo(0, true));
}
taskKeys.Select(_ => new
{
docAndContentType = _,
count = _docCheckTasks[0][_].Key + _docCheckTasks[1][_].Key,
Checked = _docCheckTasks[0][_].Value && _docCheckTasks[1][_].Value
}).ForEach(_ => DocsCountInternal(_dbForCheck, _.docAndContentType.Key, _.docAndContentType.Value, 1, _.count, _.Checked));
}
else
//0 и 1
foreach(var statusedTask in _docCheckTasks.Select((tasks, status) => new {tasks, status}))
foreach (var task in statusedTask.tasks)
DocsCountInternal(_dbForCheck, task.Key.Key, task.Key.Value, statusedTask.status, task.Value.Key, task.Value.Value);
_docCheckTasks = null;
_dbForCheck = null;
}
Автору я бы посоветовал утопиться, но как посоветуете отрефакторить?
Планировалось, что чувак вызывает ClearAllDocCounts, затем много раз метод DocsCount, а потом CheckAllDocCounts.
+1
.selection-href {
height: inherit !important;
font-size: 1em !important;
font-weight: inherit !important;
box-sizing: inherit !important;
width: inherit !important;
text-transform: none !important;
}
+1
{header}
<p style="font-weight: bold; text-decoration: underline">{$orgName}</p>
<p style="font-weight: bold">Адреса: {$orgBillingAddress}, тел.: {$orgPhone}</p>
<div style="font-weight: bold; text-align: center">Зразок заповенння платіжного доручення</div>
<table border="1" cellpadding="2">
<tr>
<td width="140">ЄДРПО {$orgInn}</td><td width="140">ІДПРС {$orgKpp}</td><td rowspan="2" width="50"><br/><br/>Рахунок. №</td><td rowspan="2" width="200"><br/><br/>{$orgBankAccount}</td>
</tr>
<tr>
<td colspan="2" width="280"><span style="font-size: 8pt">Одержувач</span><br/>{$orgName}</td>
</tr>
<tr>
<td colspan="2" rowspan="2" width="280"><span style="font-size: 8pt">Банк отримувача</span><br/>{$orgBankName}</td>
<td width="50">БІК</td>
<td rowspan="2" width="200">{$orgBankId}<br/>{$orgCorrAccount}</td>
</tr>
<tr>
<td width="50">Рахунок. №</td>
</tr>
</table>
<br/>
<h1 style="text-align: center">Рахунок № {$invoice_no} від {$invoice_invoicedate}</h1>
<br/><br/>
<table border="0">
<tr>
<td width="100">Платник:</td><td width="450"><span style="font-weight: bold">{$account_accountname}</span></td>
</tr>
<tr>
<td width="100">Одержувач:</td><td width="450"><span style="font-weight: bold">{$orgName}</span></td>
</tr>
</table>
{/header}
{table_head}
<table border="1" style="font-size: 8pt" cellpadding="2">
<tr style="text-align: center; font-weight: bold">
<td width="30">№</td>
<td width="260">Назва<br/>товару</td>
<td width="65">Одиниця<br/>вимір-<br/>рювання</td>
<td width="35">Кіль-<br/>кість</td>
<td width="70">Ціна</td>
<td width="70">Сумма</td>
</tr>
{/table_head}
{table_row}
<tr>
<td width="30">{$productNumber}</td>
<td width="260">{$productName} {$productComment}</td>
<td width="65" style="text-align: center">{$productUnits}</td>
<td width="35" style="text-align: right">{$productQuantityInt}</td>
<td width="70" style="text-align: right">{$productPrice}</td>
<td width="70" style="text-align: right">{$productNetTotal}</td>
</tr>
{/table_row}
{summary}
</table>
<table border="0" style="font-size: 8pt;font-weight: bold">
<tr>
<td width="460">
<table border="0" cellpadding="2">
<tr><td width="460" style="text-align: right">Разом:</td></tr>
<tr><td width="460" style="text-align: right">Сумма ПРД:</td></tr>
<tr><td width="460" style="text-align: right">Всього до сплати:</td></tr>
</table>
</td>
<td width="70">
<table border="1" cellpadding="2">
<tr><td width="70" style="text-align: right">{$summaryNetTotal}</td></tr>
<tr><td width="70" style="text-align: right">{$summaryTax}</td></tr>
<tr><td width="70" style="text-align: right">{$summaryGrandTotal}</td></tr>
</table>
</td>
</tr>
</table>
<p>
Всього найменувань {$summaryTotalItems}, на сумму {$summaryGrandTotal} грн.<br/>
<span style="font-weight: bold">{$summaryGrandTotalLiteral}</span>
</p>
{/summary}
{ending}
<br/>
<p>Крівник підприємства __________________ ( {$orgDirector} ) <br/>
<br/>
Головний бухгалтер __________________ ( {$orgBookkeeper} )
</p>
{/ending}
генератор пдф