| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_apps/leve/application/controllers/ |
Upload File : |
<?php
_auth();
$ui->assign('_application_menu', 'orders');
$ui->assign('_title', $_L['Shipping method'] . ' - ' . $config['CompanyName']);
$ui->assign('_st', $_L['Shipping method']);
$ui->assign('content_inner', inner_contents($config['c_cache']));
$action = $routes['1'];
$user = User::_info();
$ui->assign('user', $user);
$ui->assign('jsvar', '
_L[\'Working\'] = \'' . $_L['Working'] . '\';
_L[\'Submit\'] = \'' . $_L['Submit'] . '\';
');
switch ($action) {
case 'list':
// find all groups
$s = ORM::for_table('shipping_method')->order_by_asc('sorder')->find_array();
$ui->assign('s', $s);
$ui->assign('xfooter', Asset::js(array('shipping_method')));
$ui->assign('jsvar', '
_L[\'are_you_sure\'] = \'' . $_L['are_you_sure'] . '\';
_L[\'Save\'] = \'' . $_L['Save'] . '\';
');
$ui->display('shipping_method.tpl');
break;
case 'add-post':
//recebe o nome do segmento para adicionar no banco de dados
$name = _post('name');
if ($name != '') {
//check same group already exist
$c = ORM::for_table('shipping_method')->where('name', $name)->find_one();
if ($c) {
ib_die($_L['Shipping method with same name already exist']);
}
$d = ORM::for_table('shipping_method')->create();
$d->name = $name;
$d->sorder = 0;
$d->save();
echo $d->id();
} else {
echo $_L['Shipping method'] . $_L['is required'];
}
break;
case 'edit-post':
$id = _post('id');
$name = _post('name');
//grupos fixos no sistema não pode editar. validação para ação
$d = ORM::for_table('shipping_method')->find_one($id);
if ($d) {
$c = ORM::for_table('shipping_method')
->where('name', $name)
->where_not_equal('id',$d->id)
->find_one();
if ($c) {
ib_die($_L['Shipping method with same name already exist']);
}
if ($d->default) {
ib_die($_L['Not Permited']);
}
// update all gname in contacts
$d->name = $name;
$d->save();
echo $d->id;
}
break;
case 'ajax-list':
//recebe o parametro do estado
$segment = ORM::for_table('shipping_method')->find_many();
$data='';
foreach ($segment as $s) {
$data[] = array(
'id' => $s->id,
'name' => ($s->default) ? $_L[$s->name] : $s->name
);
}
echo json_encode($data);
break;
//remove o segmento
case 'delete':
$id = intval(str_replace('s', '', $routes[2]));
$d = ORM::for_table('shipping_method')->find_one($id);
if ($d) {
if ($d->default) {
r2(U . 'shipping_method/list/', 'e', $_L['Not Permited']);
}else{
// $client = ORM::for_table('crm_accounts')->where("segment_id", $id)->find_many();
// if (count($client) > 0) {
// r2(U . 'segment/list/', 'e', $_L['Not permited remove this segment. Segment having Contacts']);
// } else {
$d->delete();
_log($_L['Shipping method Deleted Successfully'] . " - " . $d->name, 'Admin', $user['id']);
r2(U . 'shipping_method/list/', 's', $_L['Shipping method Deleted Successfully']);
// }
}
} else {
echo 'not found';
}
break;
case 'reorder':
$nature = ORM::for_table('shipping_method')->order_by_asc('sorder')->find_array();
//passa o id no getone()
$ui->assign('ritem', $_L['Shipping method']);
$ui->assign('d', $nature);
$ui->assign('xheader', '
<link rel="stylesheet" type="text/css" href="' . $_theme . '/css/liststyle.css"/>
');
$ui->assign('display_name', 'name');
$ui->assign('xjq', Reorder::js('shipping_method'));
$ui->display('reorder.tpl');
break;
default:
echo 'action not defined';
}