| 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/www/lrsys_apps/marisol/application/controllers/ |
Upload File : |
<?php
_auth();
$ui->assign('_application_menu', 'settings');
$ui->assign('_title', $_L['Physical location in stock'] . ' - ' . $config['CompanyName']);
$ui->assign('_st', $_L['Physical location in stock']);
$ui->assign('content_inner', inner_contents($config['c_cache']));
$action = $routes['1'];
$user = User::_info();
$ui->assign('user', $user);
switch ($action) {
case 'list':
// find all groups
$s = ORM::for_table('sys_items_location')->order_by_asc('sorder')->find_array();
$ui->assign('s', $s);
$ui->assign('xfooter', Asset::js(array('jslib/location')));
//coloca no vetor do idioma todos os textos necessários no js location
$ui->assign('jsvar', '
_L[\'are_you_sure\'] = \'' . $_L['are_you_sure'] . '\';
_L[\'Save\'] = \'' . $_L['Save'] . '\';
_L[\'Add New Location\'] = \'' . $_L['Add New Location'] . '\';
_L[\'Edit\'] = \'' . $_L['Edit'] . '\';
_L[\'Location\'] = \'' . $_L['Location'] . '\';
_L[\'OK\'] = \'' . $_L['OK'] . '\';
_L[\'Cancel\'] = \'' . $_L['Cancel'] . '\';
');
$ui->display('list-product-location.tpl');
break;
case 'add-post':
//recebe o nome do segmento para adicionar no banco de dados
$name = _post('location_name');
if ($name != '') {
//check same group already exist
$c = ORM::for_table('sys_items_location')->where('name', $name)->find_one();
if ($c) {
ib_die($_L['A Location with same name already exist']);
}
$d = ORM::for_table('sys_items_location')->create();
$d->name = $name;
$d->sorder = 0;
$d->save();
_log($_L['Physical location in stock'] ." ".$_L['Added'] . " - $d->id - " + $d->name, 'Admin', $user['id']);
//se informar que deve emitir msg de salvo
if ($routes['2'] == 'msg') {
_msglog("s", $_L['added_successful']);
}
echo $d->id();
} else {
echo $_L['Location'] . $_L['is required'];
}
break;
case 'edit-post':
$id = str_replace('l', '', _post('id'));
$name = _post('name');
if ($name != '') {
$d = ORM::for_table('sys_items_location')->find_one($id);
if ($d) {
// update all gname in contacts
$d->name = $name;
$d->save();
_log($_L['Physical location in stock'] ." ".$_L['Edited'] . " - $d->id - " + $d->name, 'Admin', $user['id']);
//se informar que deve emitir msg de salvo
if ($routes['2'] == 'msg') {
_msglog("s", $_L['edit_successful']);
}
echo $d->id;
}
} else {
echo $_L['Location'] . $_L['is required'];
}
break;
//lista ajax, utilizada nos combos
case 'ajax-list':
//recebe o parametro do estado
$segment = ORM::for_table('sys_items_location')->find_many();
foreach ($segment as $s) {
$data[] = array(
'id' => $s->id,
'name' => $s->name
);
}
echo json_encode($data);
break;
//remove o segmento
case 'delete':
$id = intval(str_replace('l', '', $routes[2]));
$d = ORM::for_table('sys_items_location')->find_one($id);
if ($d) {
// find all items com a unidade
$item = ORM::for_table('sys_items')->where("items_location_id", $id)->find_many();
if (count($item) > 0) {
r2(U . 'product_location/list/', 'e', $_L['Not permited remove this location. Location having Products']);
} else {
$d->delete();
_log($_L['Location Deleted'] . " - " . $d->name, 'Admin', $user['id']);
r2(U . 'product_location/list/', 's', $_L['Location Deleted Successfully']);
}
} else {
echo $_L['Not found'];
}
break;
default:
echo 'action not defined';
}