function get_post() { parent::get_post(); extract($_POST); for ($i = 0; $i < $this->operation->nb_item; $i++) { $poste = HtmlInput::default_value_post("poste" . $i, null); $qcode = HtmlInput::default_value_post("qc_" . $i, null); if ($poste == null && $qcode == null) { continue; } if ($poste != null && trim($poste) != "") { $this->{'poste' . $i} = $poste; $this->{'isqc' . $i} = 'f'; } if ($qcode != null && trim($qcode) != "") { $this->{'isqc' . $i} = trim($_POST['qc_' . $i]) != "" ? 't' : 'f'; $this->{'poste' . $i} = trim($qcode); } $this->{"amount" . $i} = $_POST['amount' . $i]; $this->{"ck" . $i} = isset($_POST['ck' . $i]) ? 't' : 'f'; } }
if ($g_parameter->MY_STOCK == 'N') { echo '<h2 class="notice">'; echo _("Vous n'utilisez pas de gestion de stock"); echo '</h2>'; return; } if (isset($_POST['add_stock'])) { $post_name = HtmlInput::default_value_post('r_name', ""); if (strlen(trim($post_name)) != 0) { $st = new Stock_Sql($cn); $st->from_array($_POST); $st->insert(); } } if (isset($_POST['mod_stock'])) { $post_name = HtmlInput::default_value_post('r_name', ""); if (strlen(trim($post_name)) != 0) { $st = new Stock_Sql($cn, $_POST['r_id']); $st->from_array($_POST); $st->update(); } } $tb = new Sort_Table(); $p_url = HtmlInput::get_to_string(array("ac", "gDossier")); $tb->add(_("Nom"), $p_url, " order by r_name asc", "order by r_name desc", "ona", "ond"); $tb->add(_("Adresse"), $p_url, " order by r_adress asc", "order by r_adress desc", "oaa", "oad"); $tb->add(_("Ville"), $p_url, " order by r_city asc", "order by r_city desc", "ova", "ovd"); $tb->add(_("Pays"), $p_url, " order by r_country asc", "order by r_country desc", "opa", "opd"); $tb->add(_("Téléphone"), $p_url, " order by r_phone asc", "order by r_phone desc", "opa", "opd"); $sql = "select * from stock_repository "; $ord = isset($_GET['ord']) ? $_GET['ord'] : "ona";
// compute template name $template_name = domaine . 'mod' . $template; $encoding = $repo->get_value("select encoding from pg_database where " . " datname=\$1", array($template_name)); if ($encoding != 6) { alert(_('Désolé vous devez migrer ce modèle en unicode')); echo '<span class="error">'; echo _('le modele ') . domaine . 'mod' . $_POST["FMOD_ID"] . _(" doit être migré en unicode."); echo _('Pour le passer en unicode, faites-en un backup puis restaurez le fichier reçu') . '</span>'; echo HtmlInput::button_anchor('Retour', 'admin_repo.php?action=dossier_mgt'); return; } } /* * Insert new dossier with description */ $desc = HtmlInput::default_value_post("DESCRIPTION", ""); try { $repo->start(); $Res = $repo->exec_sql("insert into ac_dossier(dos_name,dos_description)\n values (\$1,\$2)", array($dos, $desc)); $l_id = $repo->get_current_seq('dossier_id'); $repo->commit(); } catch (Exception $e) { $msg = _("Desole la creation de ce dossier a echoue,\n la cause la plus probable est" . ' deux fois le même nom de dossier'); alert($msg); $l_id = 0; $repo->rollback(); } // If the id is not null, name successfully inserted // Database created if ($l_id != 0) { /*
//**************************************************** if (isset($_POST['add_menu']) || isset($_POST['add_impress'])) { // type of menu me or pr $p_type = HtmlInput::default_value_post("type", ""); // level $p_level = HtmlInput::default_value_post("p_level", ""); // pm_id of menu parent $p_dep = HtmlInput::default_value_post("dep", ""); // profile id $p_id = HtmlInput::default_value_post("p_id", ""); // display order $p_order = HtmlInput::default_value_post("p_order", 0); // code to add $me_code = HtmlInput::default_value_post("me_code", ""); // tab $tab = HtmlInput::default_value_post("tab", ""); try { $cn->start(); /** * Printing cannot be a menu and do not depend of anything */ $menu_type = $cn->get_value("select me_type from menu_ref\n where me_code=\$1", array($me_code)); if ($menu_type == 'PR') { $p_type = 'P'; $me_code_dep = null; $pm_id_dep = null; } // Module never depends of anything if ($p_type == 'me') { /* * Check variable
*/ if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } // Security if ($g_user->check_module('CFGPRO') == 0) { die; } require_once NOALYSS_INCLUDE . '/class_profile_sql.php'; require_once NOALYSS_INCLUDE . '/class_profile_menu.php'; require_once NOALYSS_INCLUDE . '/class_html_input.php'; $p_id = HtmlInput::default_value_request('p_id', -1); $profile = new Profile_sql($cn, $p_id); $gDossier = Dossier::id(); $add_impression = HtmlInput::button("add", _("Ajout Menu"), "onclick=\"add_menu({dossier:{$gDossier},p_id:{$p_id},type:'pr'})\""); $call_tab = HtmlInput::default_value_post('tab', 'none'); $a_tab = array('profile_gen_div' => 'tabs', 'profile_menu_div' => 'tabs', 'profile_print_div' => 'tabs', 'profile_gestion_div' => 'tabs', 'profile_repo_div' => 'tabs'); $a_tab[$call_tab] = 'tabs_selected'; ?> <h1>Profil <?php echo $profile->p_name; ?> </h1> <?php echo HtmlInput::anchor(_('Retour'), "", " onclick = \" \$('detail_profile').hide();\$('list_profile').show(); \" ", 'class="line"'); if ($p_id > 0) { ?> <ul class="tabs"> <li class="<?php echo $a_tab['profile_gen_div'];
/*******************************************************************************************/ // Remove an attribut /*******************************************************************************************/ if ($action == 'remove_line') { $fiche_def = new Fiche_Def($cn, $_REQUEST['fd_id']); $fiche_def = new Fiche_Def($cn, $_REQUEST['fd_id']); $fiche_def->RemoveAttribut($_REQUEST['chk_remove']); echo $fiche_def->input_detail(); echo $retour; return; } /*******************************************************************************************/ // Try to remove a category /*******************************************************************************************/ if ($action == 'remove_cat') { $post_id = HtmlInput::default_value_post('fd_id', 0); if ($post_id == 0 || $post_id >= 500000) { alert(_('Impossible d\'enlever cette catégorie')); } else { $fd_id = new Fiche_Def($cn, $post_id); $remains = $fd_id->remove(); if ($remains != 0) { /* some card are not removed because it is used */ alert(_('Impossible d\'enlever cette catégorie, certaines fiches sont encore utilisées' . "\n" . 'Les fiches non utilisées ont cependant été effacées')); } } } /*******************************************************************************************/ // Change some basis info /*******************************************************************************************/ if (isset($_POST['change_name'])) {
* Update user changes */ $sbaction = HtmlInput::default_value_post('sbaction', ""); if ($sbaction == "save") { $uid = $_POST['UID']; // Update User $cn = new Database(); $UserChange = new User($cn, $uid); if ($UserChange->load() == -1) { alert(_("Cet utilisateur n'existe pas")); } else { $UserChange->first_name = HtmlInput::default_value_post('fname', null); $UserChange->last_name = HtmlInput::default_value_post('lname', null); $UserChange->active = HtmlInput::default_value_post('Actif', -1); $UserChange->admin = HtmlInput::default_value_post('Admin', -1); $UserChange->email = HtmlInput::default_value_post('email', null); if ($UserChange->active == -1 || $UserChange->admin == -1) { die('Missing data'); } else { if (trim($_POST['password']) != '') { $UserChange->pass = md5($_POST['password']); $UserChange->save(); } else { $UserChange->pass = $UserChange->password; $UserChange->save(); } } } } else { if ($sbaction == "delete") { //
require_once NOALYSS_INCLUDE . '/constant.security.php'; require_once NOALYSS_INCLUDE . '/class_html_input.php'; mb_internal_encoding("UTF-8"); // if gDossier is not set redirect to form to choose a folder if (!isset($_REQUEST['gDossier'])) { redirect('user_login.php'); exit; } if (!isset($_SESSION['g_theme'])) { echo "<h2>" . _('Vous êtes déconnecté') . "</h2>"; $backurl = $_SERVER['REQUEST_URI']; $url = "index.php?" . http_build_query(array('reconnect' => 1, 'backurl' => urlencode($backurl))); redirect($url); exit; } $style_user = HtmlInput::default_value_post("style_user", $_SESSION['g_theme']); html_page_start($style_user); if (DEBUG) { ?> <div id="debug_div" style="border:slategray solid 1px;margin-left: 0px;position:absolute;background:white;display:fixed;top:2px;left:25px;z-index:1000;display:none"> <h2>$_POST</h2> <?php var_dump($_POST); ?> <h2>$_GET</h2> <?php var_dump($_GET); ?> </div> <script> function show_debug_request() {
/** * display screen to enter a new ledger */ function input_new() { $retry = HtmlInput::default_value_post("sa", ""); // if ( $retry == "add") { $default_type = HtmlInput::default_value_post("p_jrn_type", -1); $previous_jrn_def_pj_pref = HtmlInput::default_value_post("jrn_def_pj_pref", ""); $previous_p_description = HtmlInput::default_value_post("p_description", ""); $previous_p_jrn_name = HtmlInput::default_value_post('p_jrn_name', ''); $previous_p_jrn_type = HtmlInput::default_value_post("p_jrn_type", ""); // } global $g_user; $f_add_button = new ISmallButton('add_card'); $f_add_button->label = _('Créer une nouvelle fiche'); $f_add_button->tabindex = -1; $f_add_button->set_attribute('jrn', -1); $f_add_button->javascript = " this.jrn=-1;select_card_type({type_cat:4});"; $str_add_button = ""; if ($g_user->check_action(FICADD) == 1) { $str_add_button = $f_add_button->input(); } $wSearch = new IPoste(); $wSearch->table = 3; $wSearch->set_attribute('ipopup', 'ipop_account'); $wSearch->set_attribute('account', 'p_jrn_class_deb'); $wSearch->set_attribute('no_overwrite', '1'); $wSearch->set_attribute('noquery', '1'); $wSearch->name = "p_jrn_class_deb"; $wSearch->size = 20; $search = $wSearch->input(); // default for ACH $default_deb_purchase = $this->get_default_card('ACH', 'D'); $default_cred_purchase = $this->get_default_card('ACH', 'C'); // default for VEN $default_deb_sale = $this->get_default_card('VEN', 'D'); $default_cred_sale = $this->get_default_card('VEN', 'C'); // default for FIN $default_fin = $this->get_default_card("FIN", ""); //default ods $default_ods = $this->get_default_card("ODS", ""); /* construct all the hidden */ $hidden = HtmlInput::hidden('p_jrn', -1); $hidden .= HtmlInput::hidden('p_action', 'jrn'); $hidden .= HtmlInput::hidden('sa', 'add'); $hidden .= dossier::hidden(); $hidden .= HtmlInput::hidden('p_jrn_deb_max_line', 10); $hidden .= HtmlInput::hidden('p_ech_lib', 'echeance'); /* properties of the ledger */ $name = $previous_p_jrn_name; $code = ""; $wType = new ISelect(); $a_jrn = $this->db->make_array("select '-1',' -- " . _("choix du type de journal") . " -- ' union select jrn_type_id,jrn_desc from jrn_type"); $wType->selected = '-1'; $wType->value = $a_jrn; $wType->name = "p_jrn_type"; $wType->id = "p_jrn_type_select_id"; $wType->javascript = ' onchange="show_ledger_div()"'; $wType->selected = $default_type; $type = $wType->input(); $rcred = $rdeb = array(); $wPjPref = new IText(); $wPjPref->name = 'jrn_def_pj_pref'; $wPjPref->value = $previous_jrn_def_pj_pref; $pj_pref = $wPjPref->input(); $pj_seq = ''; $last_seq = 0; $new = 1; $description = new ITextarea('p_description'); $description->style = 'class="itextarea" style="margin:0px;"'; $description->value = $previous_p_description; $str_description = $description->input(); /* bank card */ $qcode_bank = ''; /* Numbering (only FIN) */ $num_op = new ICheckBox('numb_operation'); echo dossier::hidden(); echo HtmlInput::hidden('ac', $_REQUEST['ac']); echo $hidden; $cn = $this->db; $min_row = new INum("min_row", MAX_ARTICLE); $min_row->prec = 0; require_once NOALYSS_INCLUDE . '/template/param_jrn.php'; }
*/ if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } if ($g_user->check_module('PREDOP') == 0) { exit; } $name = HtmlInput::default_value_post("opd_name", ""); if (trim($name) != '') { $od_id = HtmlInput::default_value_post("od_id", -1); if ($od_id == -1 || isNumber($od_id) == 0) { return; } $cn->exec_sql('delete from op_predef where od_id=$1', array($od_id)); $cn->exec_sql("delete from op_predef_detail where od_id=\$1", array($od_id)); $jrn_type = HtmlInput::default_value_post("jrn_type", null); switch ($jrn_type) { case 'ACH': $operation = new Pre_op_ach($cn); break; case 'VEN': $operation = new Pre_op_ven($cn); break; case 'ODS': $operation = new Pre_Op_Advanced($cn); break; default: throw new Exception(_('Type de journal invalide')); } $operation->get_post(); $operation->save();
$opd->save(); } /* Show button */ echo '<h1 style="float:right;margin-right:20%"> Enregistrement </h1>'; echo $Ledger->confirm($_POST, true); /* Show link for Invoice */ if (isset($Ledger->doc)) { echo '<h2>Document </h2>'; echo $Ledger->doc; } /* Save the additional information into jrn_info */ $obj = new Acc_Ledger_Info($cn); $obj->save_extra($Ledger->jr_id, $_POST); // extourne if (isset($_POST['reverse_ck'])) { $p_date = HtmlInput::default_value_post('reverse_date', ''); if (isDate($p_date) == $p_date) { // reverse the operation try { $Ledger->reverse($p_date); echo '<p>'; echo _('Extourné au ') . $p_date; echo '</p>'; } catch (Exception $e) { echo '<p class="notice">' . _('Opération non extournée') . $e->getMessage() . '</p>'; } } else { // warning because date is invalid echo '<p class="notice">' . _('Date invalide, opération non extournée') . '</p>'; } }
echo HtmlInput::hidden('sa', 'mp'); echo HtmlInput::hidden('sb', 'save'); echo HtmlInput::hidden('id', $row->get_parameter("id")); echo HtmlInput::hidden('delete_ck', 0); echo $row->form(); echo HtmlInput::submit('save', _('Sauve'), ' onclick="$(\'delete_ck\').value=0"'); echo HtmlInput::submit('delete', _('Efface'), ' onclick="$(\'delete_ck\').value=1"'); echo HtmlInput::button_anchor(_('Retour sans sauver'), '?p_action=divers&sa=mp&' . dossier::get() . "&ac=" . $_REQUEST['ac'], "", "", "smallbutton"); echo '</form>'; return; } //---------------------------------------------------------------------- // Save the change // if ($sb == 'save') { $delete = HtmlInput::default_value_post("delete_ck", 0); if ($delete == 0) { $row = new Acc_Payment($cn, $_POST['id']); $row->from_array($_POST); $row->update(); } else { //--------------------------------------------------------------------------- // Delete a card //--------------------------------------------------------------------------- $row = new Acc_Payment($cn, $_POST['id']); $row->from_array($_POST); $row->delete(); } } //--------------------------------------------------------------------------- // Insert a new mod of payment
<?php if ($this->key->getp("id") == -1) { // for a new key $jrn = $cn->get_array('select null as kl_id,jrn_def_id,jrn_def_name,jrn_def_description from jrn_def order by jrn_def_name '); } else { // for an existing one $jrn = $cn->get_array('select kl_id,jrn_def_id,jrn_def_name,jrn_def_description from jrn_def left join key_distribution_ledger using (jrn_def_id) where kd_id=$1 or kd_id is null order by jrn_def_name ', array($this->key->getp('id'))); } $post_jrn = HtmlInput::default_value_post("jrn", -1); ?> <table id="jrn_def_tb" class="result"> <?php for ($i = 0; $i < count($jrn); $i++) { ?> <tr> <td> <?php $checkbox = new ICheckBox("jrn[]"); ?> <?php $checkbox->value = $jrn[$i]['jrn_def_id']; ?> <?php $checkbox->selected = false;
////////////////////////////////////////////////// $owner = new Own($cn); if ($owner->MY_ANALYTIC != "nu" && isset($_POST['op'])) { // for each item, insert into operation_analytique */ $opanc = new Anc_Operation($cn); $opanc->save_update_form($_POST); } ////////////////////////////////////////////////////////////////// //Save other info ////////////////////////////////////////////////////////////////// $op->save_info($_POST['OTHER'], 'OTHER'); $op->save_info($_POST['BON_COMMANDE'], 'BON_COMMANDE'); /////////////////////////////////////////////////////////////////// // Save related ////////////////////////////////////////////////////////////////// $related = HtmlInput::default_value_post("related", "0"); if ($related == "0") { throw new Exception('Parameter not send -> related' . __FILE__ . __LINE__, 10); } $op->insert_related_action($related); } echo _('Opération sauvée'); $cn->commit(); } catch (Exception $e) { if (DEBUG) { echo $e->getMessage(); } alert(_("Changement impossible: on ne peut pas changer la date dans une période fermée")); } $html = ob_get_contents(); ob_end_clean();
function display_form_plan($p_array, $p_null, $p_mode, $p_seq, $p_amount, $p_id = '', $p_add_button = true) { if ($p_array != null) { extract($p_array); } $result = ""; $plan = new Anc_Plan($this->db); $a_plan = $plan->get_list(" order by pa_id "); if (empty($a_plan)) { return ""; } $table_id = "t" . $p_seq; $hidden = new IHidden(); $readonly = $p_mode == 1 ? false : true; $result .= $hidden->input('amount_' . $table_id, $p_amount); if ($p_mode == 1) { $result .= '<table id="' . $p_id . $table_id . '">'; } else { $result .= '<table>'; } $result .= "<tr>" . $plan->header() . "<th>montant</th></tr>"; /* compute the number of rows */ $nb_row = isset($val[$p_seq]) ? count($val[$p_seq]) : 1; $count = 0; $remain = abs($p_amount); $ctrl_remain = "remain" . $this->in_div . $table_id; for ($i = 0; $i < $nb_row; $i++) { $result .= '<tr>'; foreach ($a_plan as $r_plan) { $array = $this->db->make_array("select po_id as value," . " html_quote(po_name) as label from poste_analytique " . " where pa_id = " . $r_plan['id'] . " order by po_name", $p_null); $select = new ISelect("hplan[" . $p_seq . "][]", $array); $select->table = 0; // view only or editables if ($p_mode == 1) { // editable $select->readonly = false; if (isset($hplan) && isset($hplan[$p_seq][$count])) { $select->selected = $hplan[$p_seq][$count]; } } else { if (isset($hplan) && isset($hplan[$p_seq][$count])) { $select->selected = $hplan[$p_seq][$count]; } // view only $select->readOnly = true; } if ($p_mode == 1) { $result .= '<td>' . $select->input() . '</td>'; } else { $result .= '<td>' . $select->display() . '</td>'; } $count++; } $value = new INum(); $value->javascript = 'onchange="format_number(this);anc_refresh_remain(\'' . $this->in_div . $table_id . '\',\'' . $p_seq . '\')"'; $value->name = "val[" . $p_seq . "][]"; $value->size = 6; $value->value = isset($val[$p_seq][$i]) ? $val[$p_seq][$i] : abs($p_amount); $value->readOnly = $p_mode == 1 ? false : true; $remain = bcsub($remain, $value->value); $result .= '<td>' . $value->input() . '</td>'; $result .= "</tr>"; } $result .= "</table>"; if ($p_add_button && $p_mode == 1) { $style_remain = $remain == 0 ? 'style="color:green"' : ' style="color:red"'; $result .= " Reste à imputer = " . '<span class="remain" ' . $style_remain . ' id="' . $ctrl_remain . '">' . $remain . '</span>'; // add a button to add a row $button = new IButton(); $button->javascript = "add_row('" . $p_id . "{$table_id}',{$p_seq});"; $button->name = "js" . $p_id . $p_seq; $button->label = _("Nouvelle ligne"); $result .= "<br>" . $button->input(); /** * Add a button for distribution key * */ $ledger = HtmlInput::default_value_post("p_jrn", 0); if ($ledger == 0) { $ledger = $this->db->get_value('select j_jrn_def from jrnx where j_id=$1', array($this->j_id)); } $gDossier = Dossier::id(); $button_key = new IButton(); $button_key->javascript = "anc_key_choice(" . $gDossier . ",'" . $p_id . "{$table_id}',{$p_amount},'" . $ledger . "');"; $button_key->name = "js" . $p_id . $p_seq; $button_key->label = _("Clef"); $result .= $button_key->input(); } return $result; }
} } } } $nb_plugin = count($a_plugin); /** * available profiles */ $a_profile = $cn->get_array('select p_id,p_name from profile where p_id > 0 order by p_name'); $nb_profile = count($a_profile); /****************************************************************************** * save ******************************************************************************/ if (isset($_POST['save_plugin'])) { // retrieve array of plugin $plugin = HtmlInput::default_value_post('plugin', array()); // for each extension for ($i = 0; $i < $nb_plugin; $i++) { $code = $a_plugin[$i]->me_code; // for each profile for ($e = 0; $e < $nb_profile; $e++) { $profile = $a_profile[$e]['p_id']; if (isset($plugin[$code][$profile])) { // insert or update into db $count = $cn->get_value("select count(*) from menu_ref where me_code=\$1", array($code)); if ($count == 0) { $a_plugin[$i]->insert(); } try { $a_plugin[$i]->insert_profile_menu($profile, 'EXT'); } catch (Exception $exc) {
// Add user /******************************************************/ if (isset($_POST["ADD"])) { $cn = new Database(); $pass5 = md5($_POST['PASS']); $new_user = new User($cn, 0); $new_user->first_name = HtmlInput::default_value_post('FNAME', ''); $new_user->last_name = HtmlInput::default_value_post('LNAME', ''); $login = HtmlInput::default_value_post('LOGIN', ''); $login = str_replace("'", "", $login); $login = str_replace('"', "", $login); $login = str_replace(" ", "", $login); $login = strtolower($login); $new_user->login = $login; $new_user->pass = $pass5; $new_user->email = HtmlInput::default_value_post('EMAIL', ''); if (trim($login) == "") { alert(_("Le login ne peut pas être vide")); } else { $new_user->insert(); $new_user->load(); $_REQUEST['use_id'] = $new_user->id; require_once NOALYSS_INCLUDE . '/user_detail.inc.php'; return; } } //SET login // View user detail if (isset($_REQUEST['det'])) { require_once NOALYSS_INCLUDE . '/user_detail.inc.php'; return;
} require_once NOALYSS_INCLUDE . '/class_dossier.php'; require_once NOALYSS_INCLUDE . '/ac_common.php'; require_once NOALYSS_INCLUDE . '/class_database.php'; require_once NOALYSS_INCLUDE . '/class_user.php'; require_once NOALYSS_INCLUDE . '/user_menu.php'; require_once NOALYSS_INCLUDE . '/class_acc_ledger.php'; $gDossier = dossier::id(); global $cn; $show_menu = 1; $ledger = new Acc_Ledger($cn, -1); $sa = HtmlInput::default_value("sa", "", $_REQUEST); ////////////////////////////////////////////////////////////////////////// // Perform request action : update ////////////////////////////////////////////////////////////////////////// $action_frm = HtmlInput::default_value_post('action_frm', ''); if ($action_frm == 'update') { try { $ledger->id = $_POST['p_jrn']; if ($ledger->load() == -1) { throw new Exception(_('Journal inexistant')); } $ledger->verify_ledger($_POST); $ledger->update($_POST); $show_menu = 1; } catch (Exception $e) { alert($e->getMessage()); } } ////////////////////////////////////////////////////////////////////////// // Perform request action : delete