Exemple #1
0
 function SearchData($catid, $vendor, $string)
 {
     $pIFACE = content_lookup(config_get('document-root') . '/price')->GetData();
     $words = explode(' ', preg_replace('/\\s+/', ' ', strtolower($string)));
     $result = array();
     if (!isNumber($catid)) {
         return $result;
     }
     $subcats = $pIFACE->GetCatalogueData(1, $catid);
     $vendor = strtolower(trim($vendor));
     for ($j = 0, $m = count($subcats); $j < $m; ++$j) {
         $data = $pIFACE->GetCatalogueData(2, $subcats[$j]['uid']);
         for ($i = 0, $n = count($data); $i < $n; ++$i) {
             $it = $data[$i];
             if ($vendor != '' && strtolower($it['vendor']) != $vendor) {
                 continue;
             }
             $found = true;
             $name = strtolower($it['name']);
             for ($k = 0, $l = count($words); $k < $l; ++$k) {
                 if (trim($words[$k]) == '') {
                     continue;
                 }
                 if (strpos($name, $words[$k]) == false) {
                     $found = false;
                     break;
                 }
             }
             if ($found) {
                 $result[] = $it;
             }
         }
     }
     return $result;
 }
Exemple #2
0
 function MARKET_BasketAdd()
 {
     global $id, $MARKET;
     InitMarket();
     if (isNumber($id) && $MARKET->BASKET->AddItemById($id)) {
         print '+OK';
     } else {
         print '-ERR';
     }
 }
Exemple #3
0
 function MARKET_GetVendors()
 {
     global $catid, $MARKET;
     InitMarket();
     if (isNumber($catid)) {
         print '+OK ' . $MARKET->GetVendorsJSON($catid);
     } else {
         print '-ERR';
     }
 }
function validateYear($year)
{
    if (!isNumber($year)) {
        return false;
    }
    if ($year < 1900 || $year > 2016) {
        return false;
    }
    return true;
}
 public function verify()
 {
     // Verify that the elt we want to add is correct
     /* verify only the datatype */
     if (strlen(trim($this->ad_text)) == 0) {
         throw new Exception('La description ne peut pas être vide', 1);
     }
     if (strlen(trim($this->ad_type)) == 0) {
         throw new Exception('Le type ne peut pas être vide', 1);
     }
     $this->ad_type = strtolower($this->ad_type);
     if (in_array($this->ad_type, array('date', 'text', 'numeric', 'zone', 'poste', 'card', 'select')) == false) {
         throw new Exception('Le type doit être text, numeric,poste, card, select ou date', 1);
     }
     if (trim($this->ad_size) == '' || isNumber($this->ad_size) == 0 || $this->ad_size > 22) {
         switch ($this->ad_type) {
             case 'text':
                 $this->ad_size = 22;
                 break;
             case 'numeric':
                 $this->ad_size = 9;
                 break;
             case 'date':
                 $this->ad_size = 8;
                 break;
             case 'zone':
                 $this->ad_size = 22;
                 break;
             default:
                 $this->ad_size = 22;
         }
     }
     if ($this->ad_type == 'numeric') {
         $this->ad_extra = trim($this->ad_extra) == '' ? '2' : $this->ad_extra;
         if (isNumber($this->ad_extra) == 0) {
             throw new Exception("La précision doit être un chiffre");
         }
     }
     if ($this->ad_type == 'select') {
         if (trim($this->ad_extra) == "") {
             throw new Exception("La requête SQL est vide ");
         }
         if (preg_match('/^\\h*select/i', $this->ad_extra) == 0) {
             throw new Exception("La requête SQL doit commencer par SELECT ");
         }
         try {
             $this->cn->exec_sql($this->ad_extra);
         } catch (Exception $e) {
             throw new Exception("La requête SQL " . h($this->ad_extra) . " est invalide ");
         }
     }
 }
function validateFORM(&$errors)
{
    global $n1, $n2, $operator;
    if (!validateRequred($n1)) {
        $errors['number1'][] = 'This field is reqired';
    } elseif (!isNumber($n1)) {
        $errors['number1'][] = 'Invalid input';
    }
    if (!validateRequred($n2)) {
        $errors['number2'][] = 'Invalid input';
    } elseif (!isNumber($n2)) {
        $errors['number2'][] = 'This field is reqired';
    }
}
 public function check($p_idx, &$p_value)
 {
     if (strcmp($p_idx, 'tl_id') == 0) {
         if (strlen($p_value) > 6 || isNumber($p_value) == false) {
             return false;
         }
     }
     if (strcmp($p_idx, 'tl_date') == 0) {
         if (strlen(trim($p_value)) == 0 || strlen($p_value) > 12 || isDate($p_value) == false) {
             return false;
         }
     }
     if (strcmp($p_idx, 'tl_title') == 0) {
         $p_value = mb_substr($p_value, 0, 120);
         return true;
     }
     if (strcmp($p_idx, 'tl_desc') == 0) {
         $p_value = mb_substr($p_value, 0, 400);
         return true;
     }
     return true;
 }
 public function from_array($p_array)
 {
     extract($p_array);
     $ret = array();
     $ix = 0;
     $found = 0;
     foreach ($p_array as $r) {
         if (isset(${'form' . $ix}) && isset(${'text' . $ix})) {
             $obj = new Acc_Report_Row(${'text' . $ix}, ${'form' . $ix});
             if (isset(${'pos' . $ix}) && isNumber(${'pos' . $ix}) == 1) {
                 $obj->set_parameter("position", ${'pos' . $ix});
             } else {
                 $obj->set_parameter("position", $found);
                 $found++;
             }
             $obj->fo_id = 0;
             $obj->fo_fr_id = $this->fo_fr_id;
             $obj->db = $this->db;
             $ret[] = clone $obj;
         }
         $ix++;
     }
     return $ret;
 }
Exemple #9
0
function contentNameSort($content, $sType)
{
    $splStr = '';
    $arrayStr = aspArray(99);
    $fileName = '';
    $isOther = '';
    $otherStr = '';
    $id = '';
    $c = '';
    $s = '';
    $i = '';
    $left1 = '';
    $splStr = aspSplit($content, vbCrlf());
    foreach ($splStr as $key => $s) {
        if ($s != '') {
            $fileName = getStrFileName($s);
            $isOther = true;
            $left1 = left($fileName, 1);
            if (inStr($fileName, '、') > 0) {
                $id = replace(left($fileName, 2), '、', '');
                if (isNumber($id)) {
                    $arrayStr[$id] = $arrayStr[$id] . $s . vbCrlf();
                    $isOther = false;
                }
            }
            if (inStr($sType, $left1) == false && $isOther == true) {
                $otherStr = $otherStr . $s . vbCrlf();
            }
        }
    }
    for ($i = 0; $i <= uBound($arrayStr); $i++) {
        $c = $c . $arrayStr[$i];
    }
    $contentNameSort = $c . $otherStr;
    return @$contentNameSort;
}
    echo '<script>window.location="admin_login.php";</script>';
    header("location:admin_login.php");
    //把浏览器重定向
    ob_end_flush();
    //输出全部内容到浏览器
}
if ($_REQUEST['gid'] == NULL) {
    ob_start();
    //打开缓冲区
    echo '<script>window.location="admin_mgr_goods.php";</script>';
    header("location:admin_mgr_goods.php");
    //把浏览器重定向
    ob_end_flush();
    //输出全部内容到浏览器
}
if (isNumber($_REQUEST['gid']) == false) {
    ob_start();
    //打开缓冲区
    echo '<script>window.location="admin_mgr_goods.php";</script>';
    header("location:admin_mgr_goods.php");
    //把浏览器重定向
    ob_end_flush();
    //输出全部内容到浏览器
} else {
    $gid = $_REQUEST['gid'];
}
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Exemple #11
0
}
global $MARKET, $ipc, $action;
InitMarket();
/* Some optimization stuff */
$serv_ipc_procs = '#basket_add#';
if ($ipc != '') {
    $n = count($serv_ipc_procs);
    if (strpos($serv_ipc_procs, $ipc) > 0) {
        /* Execute IPC command */
        ipc_exec($ipc);
        die;
    }
}
if ($action == 'drop') {
    global $id;
    if (isNumber($id)) {
        $MARKET->BASKET->DropById($id);
    }
} else {
    if ($action == 'send') {
        $MARKET->BASKET->Send();
    }
}
if ($action != 'send') {
    $tpl = manage_template_by_name('Магазин / Корзина');
    $script = $tpl->GetText();
    $params = array();
    tpl_srcp($script, $params);
} else {
    $tpl = manage_template_by_name('Магазин / Корзина / Заказ отправлен');
    $script = $tpl->GetText();
 /**
  *Replace a special tag *TAGxxxx with the value from fiche_detail, the xxxx
  * is the ad_value
  * @param $p_qcode qcode of the card
  * @param $p_tag tag to parse
  * @return  the ad_value contained in fiche_detail or for the type "select" the
  *          label
  */
 function replace_special_tag($p_qcode, $p_tag)
 {
     // check if the march exists
     if ($p_qcode == "") {
         return "";
     }
     $f = new Fiche($this->db);
     $found = $f->get_by_qcode($p_qcode, false);
     // if not found exit
     if ($found == 1) {
         return "";
     }
     // get the ad_id
     $attr = preg_replace("/^.*ATTR/", "", $p_tag);
     if (isNumber($attr) == 0) {
         return "";
     }
     $ad_type = $this->db->get_value("select ad_type from attr_def where ad_id=\$1", array($attr));
     // get ad_value
     $ad_value = $this->db->get_value("select ad_value from fiche_detail where f_id=\$1 and ad_id=\$2", array($f->id, $attr));
     // if ad_id is type select execute select and get value
     if ($ad_type == "select") {
         $sql = $this->db->get_value("select ad_extra from attr_def where ad_id=\$1", array($attr));
         $array = $this->db->make_array($sql);
         for ($a = 0; $a < count($array); $a++) {
             if ($array[$a]['value'] == $ad_value) {
                 return $array[$a]['label'];
             }
         }
     }
     // if ad_id is not type select get value
     return $ad_value;
 }
Exemple #13
0
        }
    } catch (Exception $exc) {
        echo $exc->getTraceAsString();
        throw $exc;
    }
}
//**********************************************
// Save_name
// *********************************************
if (isset($_POST['save_name'])) {
    extract($_POST);
    try {
        if (strlen(trim($p_name)) == 0) {
            throw new Exception("Nom ne peut être vide");
        }
        if (isNumber($p_id) == 0) {
            throw new Exception("profile Invalide");
        }
        $wc = isset($with_calc) ? 1 : 0;
        $wd = isset($with_direct_form) ? 1 : 0;
        $p_desc = strlen(trim($p_desc)) == 0 ? null : trim($p_desc);
        if ($p_id != -1) {
            $cn->exec_sql("update profile set p_name=\$1,p_desc=\$2,\n\t\t\t\t\twith_calc=\$3, with_direct_form=\$4 where p_id=\$5", array($p_name, $p_desc, $wc, $wd, $p_id));
        } else {
            $p_id = $cn->get_value("insert into profile (p_name,\n\t\t\t\tp_desc,with_calc,with_direct_form) values\n\t\t\t\t(\$1,\$2,\$3,\$4) returning p_id", array($p_name, $p_desc, $wc, $wd));
        }
    } catch (Exception $e) {
        alert($e->getMessage());
    }
}
//************************************
        // Add a share to the user
        $todo->add_share($p_login);
    } else {
        // remove a share from the user
        $todo->remove_share($p_login);
    }
}
////////////////////////////////////////////////////////////////////////////////
// Remove the share of a note which the connected user doesn't own
//
////////////////////////////////////////////////////////////////////////////////
if ($ac == "remove_share") {
    $id = HtmlInput::default_value_get("todo_id", 0);
    $p_login = HtmlInput::default_value_get("login", "");
    // If note_id is not correct then give an error
    if ($id == 0 || isNumber($id) == 0 || trim($p_login) == "") {
        header('Content-type: text/xml; charset=UTF-8');
        $dom = new DOMDocument('1.0', 'UTF-8');
        $status = $dom->createElement('status', "nok");
        $tl_id = $dom->createElement('content', _("Erreur : paramètre invalide"));
        $dom->appendChild($status);
        $dom->appendChild($tl_id);
        echo $dom->saveXML();
        return;
    }
    $todo = new Todo_List($cn);
    $todo->set_parameter("id", $id);
    $todo->load();
    $todo->remove_share($p_login);
    header('Content-type: text/xml; charset=UTF-8');
    $dom = new DOMDocument('1.0', 'UTF-8');
Exemple #15
0
 * 
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
global $cn, $g_user;
require_once NOALYSS_INCLUDE . '/class_anc_key.php';
$op = HtmlInput::default_value_request("op", "list");
switch ($op) {
    case 'list':
        Anc_Key::display_list();
        Anc_Key::key_add();
        break;
    case 'consult':
        $id = HtmlInput::default_value_request("key", "0");
        if (isNumber($id) == 0 || $id == 0) {
            die(_('Clef invalide'));
        }
        $key = new Anc_Key($id);
        if (isset($_POST['save_key'])) {
            try {
                $key->save($_POST);
                Anc_Key::display_list();
                Anc_Key::key_add();
                break;
            } catch (Exception $e) {
                echo span($e->getMessage(), ' class="notice"');
            }
        }
        $key->input();
        break;
 function Save()
 {
     // if name is empty return immediately
     if (trim(strlen($this->md_name)) == 0) {
         return;
     }
     try {
         // Start transaction
         $this->cn->start();
         // Save data into the table document_modele
         // if $this->md_id == -1 it means it is a new document model
         // so first we have to insert it
         // the name and the type must be set before calling save
         if ($this->md_id == -1) {
             // insert into the table document_modele
             $this->md_id = $this->cn->get_next_seq('document_modele_md_id_seq');
             $sql = "insert into document_modele(md_id,md_name,md_type,md_affect)\n                     values (\$1,\$2,\$3,\$4)";
             $Ret = $this->cn->exec_sql($sql, array($this->md_id, $this->md_name, $this->md_type, $this->md_affect));
             // create the sequence for this modele of document
             $this->md_sequence = "document_" . $this->cn->get_next_seq("document_seq");
             // if start is not equal to 0 and he's a number than the user
             // request a number change
             if ($this->start != 0 && isNumber($this->start) == 1) {
                 $sql = "alter sequence seq_doc_type_" . $this->md_type . " restart " . $this->start;
                 $this->cn->exec_sql($sql);
             }
         }
         // Save the file
         $new_name = tempnam($_ENV['TMP'], 'document_');
         if (strlen($_FILES['doc']['tmp_name']) != 0) {
             if (move_uploaded_file($_FILES['doc']['tmp_name'], $new_name)) {
                 // echo "Image saved";
                 $oid = $this->cn->lo_import($new_name);
                 if ($oid == false) {
                     echo_error('class_document_modele.php', __LINE__, "cannot upload document");
                     $this->cn->rollback();
                     return;
                 }
                 // Remove old document
                 $ret = $this->cn->exec_sql("select md_lob from document_modele where md_id=" . $this->md_id);
                 if (Database::num_row($ret) != 0) {
                     $r = Database::fetch_array($ret, 0);
                     $old_oid = $r['md_lob'];
                     if (strlen($old_oid) != 0) {
                         $this->cn->lo_unlink($old_oid);
                     }
                 }
                 // Load new document
                 $this->cn->exec_sql("update document_modele set md_lob=" . $oid . ", md_mimetype='" . $_FILES['doc']['type'] . "' ,md_filename='" . $_FILES['doc']['name'] . "' where md_id=" . $this->md_id);
                 $this->cn->commit();
             } else {
                 echo "<H1>Error</H1>";
                 $this->cn->rollback();
                 throw new Exception("Erreur" . __FILE__ . __LINE__);
             }
         }
     } catch (Exception $e) {
         rollback($this->cn);
         return;
     }
 }
Exemple #17
0
							</table>
							</form>
						  
					';
}
if ($_REQUEST['act'] == 'edit' && isNumber($_POST['ipoint1'])) {
    $ipoint = $_POST['ipoint1'];
    $query_update = 'update `login` set ipoint = \'' . $ipoint . '\' where account_id = \'' . $account_id . '\'';
    $result = mysql_query($query_update);
    if ($result) {
        echo '<br/><div align="center" style="color:#FF0000">充值成功![ ' . $data['userid'] . ' ] 的商城点数为 [ ' . $ipoint . ' ]</div>';
    } else {
        echo '<br/><div align="center" style="color:#FF0000">充值失败!</div>';
    }
}
if ($_REQUEST['act'] == 'add' && isNumber($_POST['ipoint2'])) {
    $ipoint = $data['ipoint'] + $_POST['ipoint2'];
    $query_update = 'update `login` set ipoint = \'' . $ipoint . '\' where account_id = \'' . $account_id . '\'';
    $result = mysql_query($query_update);
    if ($result) {
        echo '<br/><div align="center" style="color:#FF0000">修改成功![ ' . $data['userid'] . ' ] 的商城点数为 [ ' . $ipoint . ' ]</div>';
    } else {
        echo '<br/><div align="center" style="color:#FF0000">修改失败!</div>';
    }
}
echo '<br/><div align="center"><a href="admin_user.php" class="text1">返回用户充值管理界面</a></div>';
echo '</td>
			</tr>
		  </table>
		  </td>
        </tr>
Exemple #18
0
    die('Appel direct ne sont pas permis');
}
// Security
if ($g_user->check_module('CFGPRO') == 0) {
    die;
}
$type = HtmlInput::default_value_get('type', 'XX');
$p_level = HtmlInput::default_value_get('p_level', 0);
$dep = HtmlInput::default_value_get('dep', 0);
if ($type == 'XX') {
    throw new Exception('invalid call');
    return;
}
// if type == menu the
if ($type == 'me') {
    if (isNumber($p_level) == 0) {
        throw new Exception('invalid call');
    }
    if ($p_level == 0) {
        // There is no dependency
        // Menu which can be added
        $ame_code = $cn->make_array("\nselect me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')\n\t||'('|| case when me_type='SP' then 'Special'\n\t\twhen me_type='PL' then 'Plugin'\n\t\twhen me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'\n\t\twhen me_type='ME' then 'Menu'\n\t\telse\n\t\tme_type\n\t\tend||')'\n\tfrom\n\tmenu_ref\n        where\n        me_type<>'PR'\n\torder by 1\n\t");
    } elseif ($p_level == 1) {
        // dependency is in dep
        // Menu which can be added
        $ame_code = $cn->make_array("\nselect me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')\n\t||'('|| case when me_type='SP' then 'Special'\n\t\twhen me_type='PL' then 'Plugin'\n\t\twhen me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'\n\t\twhen me_type='ME' then 'Menu'\n\t\telse\n\t\tme_type\n\t\tend||')'\n\tfrom\n\tmenu_ref\n        where\n        me_type<>'PR'\n\torder by 1\n\t");
    } elseif ($p_level == 2) {
        // menu can *NOT* have submenu
        // Menu which can be added
        $ame_code = $cn->make_array("\nselect me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')\n\t||'('|| case when me_type='SP' then 'Special'\n\t\twhen me_type='PL' then 'Plugin'\n\t\twhen me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'\n\t\twhen me_type='ME' then 'Menu'\n\t\telse\n\t\tme_type\n\t\tend||')'\n\tfrom\n\tmenu_ref\n        where\n        me_type<>'PR' and\n       (\n          coalesce(me_file,'') <> '' or\n          coalesce(me_url,'') <> '' or\n          coalesce(me_javascript,'') <> ''\n        )\n\torder by 1\n\t");
    } else {
Exemple #19
0
include_once NOALYSS_INCLUDE . '/ac_common.php';
require_once NOALYSS_INCLUDE . '/class_dossier.php';
$gDossier = dossier::id();
if (!isset($_GET['jrn']) || !isset($_GET['jr_grpt_id'])) {
    echo_error("Missing parameters");
}
require_once NOALYSS_INCLUDE . '/class_database.php';
set_language();
$jr_grpt_id = $_GET['jr_grpt_id'];
$cn = new Database($gDossier);
require_once NOALYSS_INCLUDE . '/class_user.php';
global $g_user;
$g_user = new User($cn);
$g_user->Check();
$g_user->check_dossier($gDossier);
if (isNumber($jr_grpt_id) != 1) {
    die(_('Données invalides'));
}
// retrieve the jrn
$r = $cn->exec_sql("select jr_def_id from jrn where jr_grpt_id={$jr_grpt_id}");
if (Database::num_row($r) == 0) {
    echo_error("Invalid operation id jr_grpt_id={$jr_grpt_id}");
    exit;
}
$a = Database::fetch_array($r, 0);
$jrn = $a['jr_def_id'];
if ($g_user->check_jrn($jrn) == 'X') {
    /* Cannot Access */
    NoAccess();
    exit - 1;
}
Exemple #20
0
}
include_once 'class_acc_account_ledger.php';
include_once 'ac_common.php';
require_once NOALYSS_INCLUDE . '/class_database.php';
include_once 'class_impress.php';
require_once NOALYSS_INCLUDE . '/class_own.php';
require_once NOALYSS_INCLUDE . '/class_dossier.php';
require_once NOALYSS_INCLUDE . '/class_user.php';
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="gl_comptes.csv"', FALSE);
header('Pragma: public');
$gDossier = dossier::id();
/* Security */
$cn = new Database($gDossier);
extract($_GET);
if (isset($poste_id) && strlen(trim($poste_id)) != 0 && isNumber($poste_id)) {
    if (isset($poste_fille)) {
        $parent = $poste_id;
        $a_poste = $cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like '{$parent}%' order by pcm_val::text");
    } elseif ($cn->count_sql('select * from tmp_pcmn where pcm_val=' . sql_string($poste_id)) != 0) {
        $a_poste = array('pcm_val' => $poste_id);
    }
} else {
    $cond_poste = '';
    $sql = "select pcm_val from tmp_pcmn ";
    if ($from_poste != '') {
        $cond_poste = '  where ';
        $cond_poste .= " pcm_val >= upper ('" . Database::escape_string($from_poste) . "')";
    }
    if ($to_poste != '') {
        if ($cond_poste == '') {
Exemple #21
0
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<?php 
require_once 'func.php';
$name = xss($_POST['name']);
$pass = encrypt(xss($_POST['pswd']));
$email = xss($_POST['mail']);
$no = xss($_POST['stuno']);
$major = xss($_POST['major']);
$time = date("Y-m-d h:i:s", time());
if (!isNumber($no)) {
    echo '<script>alert(\'学号必须为纯数字\');</script>';
    jump("reg.html");
    die;
}
if (!isEmail($email)) {
    echo '<script>alert(\'错误的E-mail地址\');</script>';
    jump("reg.html");
    die;
}
if (!isEngLength(xss($_POST['pswd']), 6, 15)) {
    echo '<script>alert(\'密码长度必须在6-15位之间!\');</script>';
    jump("reg.html");
    die;
}
require_once 'config.php';
$link = conn_db($hostname, $username, $password, $database);
if (!$link) {
    echo "Mysql Connect ERROR";
}
$query = "SELECT * FROM users WHERE usr_name=" . '"' . $name . '"';
$res = mysql_query($query, $link);
Exemple #22
0
echo _('Creation Dossier');
?>
"> </TD>
                                              <td>
    </td>
    </TR>
    </TABLE>
    </FORM>
    <?php 
?>
</div>
<?php 
//---------------------------------------------------------------------------
// action = del
//---------------------------------------------------------------------------
if ($sa == 'remove' && isNumber($dossier_id) == 1 && $dossier_id != -1) {
    if (!isset($_REQUEST['p_confirm'])) {
        echo _('Désolé, vous n\'avez pas coché la case');
        echo HtmlInput::button_anchor(_('Retour'), '?action=dossier_mgt');
        return;
    }
    $cn = new Database();
    $msg = "dossier";
    $name = $cn->get_value("select dos_name from ac_dossier where dos_id=\$1", array($dossier_id));
    if (strlen(trim($name)) == 0) {
        echo "<h2 class=\"error\"> {$msg} " . _('inexistant') . "</h2>";
        return;
    }
    /**
     * Check if db exists
     */
/**
 * @file
 * @brief show the available distribution keys for analytic activities. Expected
 * parameter are 
 *  - t for the table id
 *  - amount is the amount to distributed
 *
 */
// Copyright (2014) Author Dany De Bontridder danydb@aevalys.eu
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
$amount = HtmlInput::default_value_get("amount", 0);
$table_id = HtmlInput::default_value_get("t", "");
$ledger = HtmlInput::default_value_get('led', 0);
if ($table_id == "" || isNumber($amount) == 0 || isNumber($ledger) == 0) {
    die('Invalid Parameter');
}
require_once 'class_anc_key.php';
ob_start();
echo HtmlInput::title_box(_("Choix d'une clef"), 'div_anc_key_choice');
Anc_Key::display_choice($amount, $table_id, $ledger);
echo HtmlInput::button_close('div_anc_key_choice');
$response = ob_get_clean();
$html = escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl></ctl>
<code>{$html}</code>
 function convert_from_follow($p_ag_id)
 {
     global $g_user;
     if (isNumber($p_ag_id) == 0) {
         return null;
     }
     if (!$g_user->can_read_action($p_ag_id)) {
         die(_('Action non accessible'));
     }
     $array = array();
     // retrieve info from action_gestion
     $tiers_id = $this->db->get_value('select f_id_dest from action_gestion where ag_id=$1', array($p_ag_id));
     if ($this->db->size() != 0) {
         $qcode = $this->db->get_value('select j_qcode from vw_poste_qcode where f_id=$1', array($tiers_id));
     } else {
         $qcode = "";
     }
     $comment = $this->db->get_value('select ag_title from action_gestion where ag_id=$1', array($p_ag_id));
     $array['e_client'] = $qcode;
     $array['e_comm'] = $comment;
     // retrieve info from action_detail
     $a_item = $this->db->get_array('select f_id,ad_text,ad_pu,ad_quant,ad_tva_id,ad_tva_amount,j_qcode 
                 from 
               action_detail 
               left join vw_poste_qcode using(f_id)
               where
                 ag_id=$1', array($p_ag_id));
     $array['nb_item'] = $this->nb > count($a_item) ? $this->nb : count($a_item);
     for ($i = 0; $i < count($a_item); $i++) {
         $array['e_march' . $i] = $a_item[$i]['j_qcode'];
         $array['e_march' . $i . '_label'] = $a_item[$i]['ad_text'];
         $array['e_march' . $i . '_price'] = $a_item[$i]['ad_pu'];
         $array['e_march' . $i . '_tva_id'] = $a_item[$i]['ad_tva_id'];
         $array['e_march' . $i . '_tva_amount'] = $a_item[$i]['ad_tva_amount'];
         $array['e_quant' . $i] = $a_item[$i]['ad_quant'];
     }
     return $array;
 }
 function calcJDofNextPrevRiseSet($next, $rise, $JD, $latitude, $longitude, $tz, $dst)
 {
     $julianday = $JD;
     $increment = $next ? 1.0 : -1.0;
     $time = $this->calcSunriseSetUTC($rise, $julianday, $latitude, $longitude);
     while (!isNumber($time)) {
         $julianday += $increment;
         $time = $this->calcSunriseSetUTC($rise, $julianday, $latitude, $longitude);
     }
     $timeLocal = $time + $tz * 60.0 + ($dst ? 60.0 : 0.0);
     while ($timeLocal < 0.0 || $timeLocal >= 1440.0) {
         $incr = $timeLocal < 0 ? 1 : -1;
         $timeLocal += $incr * 1440.0;
         $julianday -= $incr;
     }
     return $julianday;
 }
Exemple #26
0
 function create_query_histo($p_array)
 {
     global $cn, $g_user;
     $profile = $g_user->get_profile();
     $sql = "\n\t\t\tselect sg_id,\n\t\t\t\tsg.f_id,\n\t\t\t\t(select ad_value from fiche_Detail as fd1 where ad_id=1 and fd1.f_id=jx.f_id) as fname,\n\t\t\t\t(select ad_value from fiche_Detail as fd1 where ad_id=23 and fd1.f_id=jx.f_id) as qcode,\n\t\t\t\tsg_code,\n\t\t\t\tcoalesce(sg_comment,jr_comment) as ccomment,\n\t\t\t\tsg_exercice,\n\t\t\t\tr_name,\n\t\t\t\tsg.r_id,\n\t\t\t\tj_montant,\n\t\t\t\tjr_date,\n\t\t\t\tsg_quantity,\n\t\t\t\tcase when sg_type='c' then 'OUT' when sg_type='d' then 'IN' end as direction,\n\t\t\t\tjr_internal,\n\t\t\t\tjr_id,\n\t\t\t\tcoalesce(sg_date,jr_date) as real_date,\n\t\t\t\tto_char(coalesce(sg_date,jr_date),'DD.MM.YY') as cdate\n\t\t\tfrom stock_goods as sg\n\t\t\tjoin stock_repository as sr on (sg.r_id=sr.r_id)\n\t\t\tleft join jrnx as jx on (sg.j_id=jx.j_id)\n\t\t\tleft join jrn as j on (j.jr_grpt_id=jx.j_grpt)\n\t\t\twhere\n\t\t\tsg.r_id in (select r_id from profile_sec_repository where p_id = {$profile})";
     $and = " and ";
     $clause = "";
     if (isset($p_array['wdate_start']) && $p_array['wdate_start'] != '') {
         $clause = $and . " to_date('" . sql_string($p_array['wdate_start']) . "','DD.MM.YYYY')<=coalesce(sg_date,jr_date) ";
     }
     if (isset($p_array['wdate_end']) && $p_array['wdate_end'] != '') {
         $clause .= $and . " to_date('" . sql_string($p_array['wdate_end']) . "','DD.MM.YYYY')>=coalesce(sg_date,jr_date) ";
     }
     if (isset($p_array['wamount_start']) && $p_array['wamount_start'] != '' && isNumber($p_array['wamount_start']) == 1 && $p_array['wamount_start'] != 0) {
         $clause .= $and . " j_montant >= " . sql_string($p_array['wamount_start']);
     }
     if (isset($p_array['wamount_end']) && $p_array['wamount_end'] != '' && $p_array['wamount_end'] != 0 && isNumber($p_array['wamount_end']) == 1) {
         $clause .= $and . " j_montant <= " . sql_string($p_array['wamount_end']);
     }
     if (isset($p_array['wcard']) && $p_array['wcard'] != '') {
         $f = new Fiche($this->cn);
         $f->get_by_qcode($p_array['wcard'], false);
         if ($f->id != 0) {
             $clause .= $and . " sg.f_id =  " . sql_string($f->id);
         }
     }
     if (isset($p_array['wcode_stock']) && $p_array['wcode_stock'] != "") {
         $clause .= $and . " upper(sg_code) =  upper('" . sql_string(trim($p_array['wcode_stock'])) . "')";
     }
     if (isset($p_array['wrepo']) && $p_array['wrepo'] != -1) {
         $clause .= $and . " sg.r_id = " . sql_string($p_array['wrepo']);
     }
     if (isset($p_array['wdirection']) && $p_array['wdirection'] != -1) {
         $clause .= $and . " sg.sg_type = '" . sql_string($p_array['wdirection']) . "'";
     }
     return $sql . $clause;
 }
 /**
  * fills the this->content, datas are filtered thanks
  * - fil_deb poss values t (debit), f(credit), ' ' (everything)
  * - fil_amount_max max amount
  * - fil_amount_min min amount
  * - $this->start min date
  * - $this->end max date
  * - this->quick_code: quick_code
  */
 public function get_filter($p_jid = 0)
 {
     $filter_deb = '';
     if (isset($this->fil_deb)) {
         switch ($this->fil_deb) {
             case 0:
                 $filter_deb = " and j_debit='t' ";
                 break;
             case 1:
                 $filter_deb = " and j_debit='f' ";
                 break;
             case 2:
                 $filter_deb = " ";
                 break;
         }
     }
     $filter_amount = "";
     if (isset($this->fil_amount_max) && isset($this->fil_amount_min) && isNumber($this->fil_amount_max) == 1 && isNumber($this->fil_amount_min) == 1 && ($this->fil_amount_max != 0 || $this->fil_amount_min != 0)) {
         $filter_amount = " and (j_montant between {$this->fil_amount_min} and {$this->fil_amount_max} or (coalesce(comptaproc.get_letter_jnt({$p_jid}),-1)= coalesce(comptaproc.get_letter_jnt(j_id),-1) and coalesce(comptaproc.get_letter_jnt({$p_jid}),-1) <> -1 )) ";
     }
     $sql = "\n            with let_diff as (select jl_id,deb_amount-cred_amount as diff_letter1\n\t\t\tfrom\n\t\t\t( select jl_id,coalesce(sum(j_montant),0) as cred_amount from letter_cred join jrnx using (j_id) group by jl_id) as CRED\n\t\t\tleft join (select jl_id,coalesce(sum(j_montant),0) as deb_amount from letter_deb join jrnx using (j_id) group by jl_id) as DEB using (jl_id)) ,\n\t\t\tletter_jl as (select jl_id,j_id from letter_cred union all select jl_id,j_id from letter_deb)\n\t\t\tselect distinct j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,\n\t\t\t\t\t\tj_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,\n\t\t\t\t\t\tcoalesce(let_diff.jl_id,-1) as letter,\n\t\t\t\t\tdiff_letter1 as letter_diff\n\t\t\t\t\t\tfrom jrnx join jrn on (j_grpt = jr_grpt_id)\n\t\t\t\t\t\tleft join letter_jl using (j_id)\n\t\t\t\t\t\tleft join let_diff using (jl_id)\n             where j_qcode = upper(\$1) and j_date >= to_date(\$2,'DD.MM.YYYY') and j_date <= to_date (\$3,'DD.MM.YYYY')\n             and {$this->sql_ledger}\n             {$filter_deb}\n             {$filter_amount}\n             order by j_date,j_id";
     $this->content = $this->db->get_array($sql, array($this->quick_code, $this->start, $this->end));
 }
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_document_type.php';
if (isset($_POST['add'])) {
    $catDoc = new Document_Type($cn);
    $catDoc->insert($_POST['cat'], $_POST['prefix']);
}
if (isset($_POST['save'])) {
    $catDoc = new Document_Type($cn, $_POST['dt_id']);
    $catDoc->get();
    $catDoc->dt_value = trim($_POST['dt_name']);
    $catDoc->dt_prefix = trim($_POST['dt_prefix']);
    if ($catDoc->dt_value == "") {
        alert(_("Le nom ne peut pas être vide"));
    } else {
        $catDoc->update();
    }
    if ($_POST['seq'] != 0 && isNumber($_POST['seq']) == 1) {
        $catDoc->set_number($_POST['seq']);
    }
}
$aList = Document_Type::get_list($cn);
$addCat = new IText('cat');
$addPrefix = new IText('prefix');
$str_addCat = $addCat->input();
$str_addPrefix = $addPrefix->input();
$str_submit = HtmlInput::submit('add', _('Ajout'));
echo '<div class="content">';
require_once NOALYSS_INCLUDE . '/template/list_category_document.php';
echo '</div>';
 function remove($jr_id2)
 {
     if (isNumber($this->jr_id) == 0 or isNumber($jr_id2) == 0) {
         return;
     }
     // verify if exists
     if ($this->db->count_sql("select jra_id from jrn_rapt where " . " jra_concerned=" . $this->jr_id . "  and jr_id={$jr_id2}\n                                  union\n                                  select jra_id from jrn_rapt where jra_concerned={$jr_id2} " . " and jr_id=" . $this->jr_id) != 0) {
         /**
          * remove also lettering between both operation
          */
         $sql = " delete from\n\t\t\t\t\tjnt_letter\n\t\t\t\t\twhere jl_id in ( select jl_id from jnt_letter\n\t\t\t\t\t\t\t\t\t\tjoin letter_cred as lc using(jl_id)\n\t\t\t\t\t\t\t\t\t\tjoin letter_deb as ld using (jl_id)\n\t\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\t\t\tlc.j_id in (select j_id\n\t\t\t\t\t\t\t\t\t\t\t\t\tfrom jrnx join jrn on (j_grpt=jr_grpt_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\twhere jr_id in (\$1,\$2))\n\t\t\t\t\t\t\t\t\t\tor\n\t\t\t\t\t\t\t\t\t\tld.j_id in (select j_id\n\t\t\t\t\t\t\t\t\t\t\t\t\tfrom jrnx join jrn on (j_grpt=jr_grpt_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\twhere jr_id in (\$1,\$2))\n\n\n\n\t\t\t\t\t\t\t)";
         $this->db->exec_sql($sql, array($jr_id2, $this->jr_id));
         // Ok we can delete
         $Res = $this->db->exec_sql("delete from jrn_rapt where " . "(jra_concerned={$jr_id2} and jr_id=" . $this->jr_id . ") or\n                                     (jra_concerned=" . $this->jr_id . " and jr_id={$jr_id2}) ");
     }
 }
 * display the submenu of a menu or a module
 * It expects 2 parameters  = p_profile (profile.p_id) and the dep (menu_ref.me_code)
 */
// require_once '.php';
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
// Security
if ($g_user->check_module('CFGPRO') == 0) {
    die;
}
// Check parameter
$module = HtmlInput::default_value_get("dep", "");
$p_level = HtmlInput::default_value_get("p_level", 0);
$p_id = HtmlInput::default_value_get('p_profile', -1);
if ($module == "" || $p_id == -1 || isNumber($p_id) == 0 || isNumber($p_level) == 0) {
    echo _('Paramètre invalide');
    return;
}
require_once NOALYSS_INCLUDE . '/class_profile_menu.php';
$p_level++;
$profile = new Profile_Menu($cn);
$profile->p_id = $p_id;
$profile->display_module_menu($module, $p_level);
////////////////////////////////////////////////////////////////////////////////
// EXAMPLE
////////////////////////////////////////////////////////////////////////////////
/*
if ($ac == 'save') // operation
{