* You should have received a copy of the GNU General Public License * along with NOALYSS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Copyright Author Dany De Bontridder danydb@aevalys.eu /**\file * \brief display a form to change the name of a predefined operation */ if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } ob_start(); require_once NOALYSS_INCLUDE . '/class_pre_operation.php'; $op = new Pre_Operation($cn, $_GET['id']); $array = $op->load(); echo HtmlInput::anchor_close('mod_predf_op'); echo h2(_('Modification du nom'), ' class="title"'); echo ' <form method="POST" onsubmit="save_predf_op(this);return false;">'; $name = new IText('opd_name'); $name->value = $op->od_name; $name->size = 60; echo "Nom =" . $name->input(); $opd_description = new ITextarea('od_description'); $opd_description->style = ' class="itextarea" style="width:30em;height:4em;vertical-align:top"'; $opd_description->value = $op->od_description; echo '<p>'; echo _("Description (max 50 car.)"); echo $opd_description->input(); echo '</p>'; echo dossier::hidden() . HtmlInput::hidden('od_id', $_GET['id']);
/** * Title for boxes, you can customize the symbol thanks symbol with * the mode "custom" * @param type $name Title * @param type $div element id, except for mode none or custom * @param type $mod hide , close , zoom , custom or none, with * custom , the $name contains all the code * @param type $p_js contains the javascript with "custom" contains button + code * @return type */ static function title_box($name, $div, $mod = "close", $p_js = "") { if ($mod == 'close') { $r = HtmlInput::anchor_close($div, $p_js); } else { if ($mod == 'hide') { $r = HtmlInput::anchor_hide("⨉", "\$('{$div}').hide();{$p_js}"); } else { if ($mod == 'zoom') { $r = '<span id="span_' . $div . '" style="float:right;margin-right:5px">' . HtmlInput::anchor("⬜", "", $p_js, ' name="small' . $div . '" id="close_div" class="input_text" ') . '</span>'; } else { if ($mod == 'custom') { $r = '<span id="span_' . $div . '" style="float:right;margin-right:5px">' . $p_js . "</span>"; } else { if ($mod == 'none') { $r = ""; } else { die(__FILE__ . ":" . __LINE__ . _('Paramètre invaide')); } } } } } $r .= h2($name, ' class="title" '); return $r; }
/** * Should a dialog box when you are disconnected from an ajax call * propose to reload or to connect in another tab */ function ajax_disconnected($div) { /** * if $_SESSION['g_user'] is not set : echo a warning */ if (!isset($_SESSION['g_user'])) { $script = 'var a=$("' . $div . '");a.style.height="70%";a.style.width="60%";'; $script .= 'a.style.top=posY-20+offsetY;a.style.left=posX+offsetX;'; $script = create_script($script); $html = $script; $html .= HtmlInput::anchor_close($div); $html .= '<div>'; $html .= h2(_('Données non disponibles'), 'class="title" style="width:auto"'); $html .= h2(_('Veuillez vous reconnecter soit dans une autre fenêtre soit ' . ' en cliquant sur le lien'), 'class="error"'); // Reload button $reload = new IButton("reload"); $reload->value = _("Se reconnecter pour revenir ici"); $reload->class = "button"; $reload->javascript = 'window.location.reload()'; // Link to log in another tab $html .= '<p style="text-align:center">'; $html .= '<a href="index.php" class="button" target="_blank">' . _('Cliquez ici pour vous reconnecter dans une autre page') . '</a>'; $html .= $reload->input(); $html .= '</p>'; $html = escape_xml($html); header('Content-type: text/xml; charset=UTF-8'); echo <<<EOF <?xml version="1.0" encoding="UTF-8"?> <data> <ctl>{$div}</ctl> <code>{$html}</code> </data> EOF; exit; } }
if (isset(${$i})) { $r .= HtmlInput::hidden($i, ${$i}); $sql_array[$i] = ${$i}; } } /* what is the type of the ledger */ $type = "GL"; if (isset($jrn) && $jrn > 1) { $ledger = new Acc_Ledger($cn, $jrn); $type = $ledger->get_type(); } $fiche = new Fiche($cn); /* Build the SQL and show result */ $sql = $fiche->build_sql($sql_array); if (strpos($sql, " in ()") != 0) { $html = HtmlInput::anchor_close('search_card'); $html .= '<div> ' . h2info(_('Recherche de fiche')) . '</div>'; $html .= '<h3 class="notice">'; $html .= _("Aucune catégorie de fiche ne correspond à" . " votre demande, le journal pourrait n'avoir accès à aucune fiche"); $html .= '</h3>'; break; } /* We limit the search to MAX_SEARCH_CARD records */ $sql = $sql . ' order by vw_name limit ' . MAX_SEARCH_CARD; $a = $cn->get_array($sql); for ($i = 0; $i < count($a); $i++) { $array[$i]['quick_code'] = $a[$i]['quick_code']; $array[$i]['name'] = h($a[$i]['vw_name']); $array[$i]['accounting'] = $a[$i]['accounting']; $array[$i]['first_name'] = h($a[$i]['vw_first_name']); $array[$i]['description'] = h($a[$i]['vw_description']);
<data> <dtid>{$html}</dtid> <message>{$message}</message> </data> EOF; return; break; case 'mod_cat_doc': require_once NOALYSS_INCLUDE . '/template/document_mod_change.php'; break; case 'dsp_tva': $cn = new Database($gDossier); $Res = $cn->exec_sql("select * from tva_rate order by tva_rate desc"); $Max = Database::num_row($Res); $r = ""; $r = HtmlInput::anchor_close('tva_select'); $r .= h2(_('Choisissez la TVA '), 'class="title"'); $r .= '<div >'; $r .= _('Filter') . " " . HtmlInput::filter_table("tva_select_table", '0,1,2,3', 1); $r .= '<TABLE style="width:100%" id="tva_select_table">'; $r .= th(_('code')); $r .= th(_('Taux')); $r .= th(_('Symbole')); $r .= th(_('Explication')); for ($i = 0; $i < $Max; $i++) { $row = Database::fetch_array($Res, $i); if (!isset($compute)) { if (!isset($code)) { $script = "onclick=\"\$('{$ctl}').value='" . $row['tva_id'] . "';removeDiv('tva_select');\""; } else { $script = "onclick=\"\$('{$ctl}').value='" . $row['tva_id'] . "';set_value('{$code}','" . $row['tva_label'] . "');removeDiv('tva_select');\"";
switch ($op) { /*---------------------------------------------------------------------- * Show the form and the result * ----------------------------------------------------------------------*/ case "sf": $ipopup = $ctl; $attr = sprintf('this.ctl=\'%s\';', $ipopup); $ctl .= '_content'; $it = new IText('acc_query'); $it->size = 30; $it->value = isset($q) ? $q : ''; $str_poste = $it->input(); $str_submit = HtmlInput::submit('sf', _('Recherche'), "", "smallbutton"); $r = ''; $r = HtmlInput::anchor_close('search_account'); $r .= '<div> ' . h2(_('Poste Comptable'), ' class="title"') . '</div>'; $r .= '<form id="sp" method="get" onsubmit="' . $attr . 'search_get_poste(this);return false;">'; ob_start(); require_once NOALYSS_INCLUDE . '/template/account_search.php'; $r .= ob_get_contents(); ob_end_clean(); $r .= dossier::hidden(); $r .= isset($c) ? HtmlInput::hidden('account', $c) : ""; $r .= isset($l) ? HtmlInput::hidden('label', $l) : ""; $r .= isset($j) ? HtmlInput::hidden('jrn', $j) : ""; $r .= isset($nover) ? HtmlInput::hidden('nover', '1') : ""; $r .= isset($nosearch) ? HtmlInput::hidden('nosearch', '1') : ""; $r .= isset($bracket) ? HtmlInput::hidden('bracket', '1') : ""; $r .= '</form>'; $sql = "\n\t\tselect pcm_val,pcm_lib,array_to_string(array_agg(j_qcode) , ',') as acode\n\t\tfrom tmp_pcmn left join vw_poste_qcode on (j_poste=pcm_val) ";
$op->get(); /* return an obj. ACH / FIN or VEN or null if nothing is found*/ $obj = $op->get_quant(); $oLedger = new Acc_Ledger($cn, $ledger); if ($obj == null || $obj->signature == 'ODS') { /* only the details */ require_once NOALYSS_INCLUDE . '/template/ledger_detail_misc.php'; } elseif ($obj->signature == 'ACH') { require_once NOALYSS_INCLUDE . '/template/ledger_detail_ach.php'; } elseif ($obj->signature == 'FIN') { require_once NOALYSS_INCLUDE . '/template/ledger_detail_fin.php'; } elseif ($obj->signature == 'VEN') { require_once NOALYSS_INCLUDE . '/template/ledger_detail_ven.php'; } } catch (Exception $e) { echo HtmlInput::anchor_close($div); echo '<h2 class="error">' . _("Désolé il y a une erreur") . '</h2>'; } $html = ob_get_contents(); ob_end_clean(); break; ///////////////////////////////////////////////////////////////////////////// // form for the file ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // form for the file ///////////////////////////////////////////////////////////////////////////// case 'file': $op->get(); $obj = $op->get_quant(); /* return an obj. ACH / FIN or VEN or null if nothing is found*/
$html .= '<table>'; $html .= tr(td(_(' Début période : ')) . td($p_start->input())); $html .= tr(td(_(' Fin période : ')) . td($p_end->input())); $html .= tr(td(_(' Exercice : ')) . td($p_exercice->input())); $html .= '</table>'; $html .= HtmlInput::submit('sauver', _('sauver')); $html .= HtmlInput::button('close', _('fermer'), 'onclick="removeDiv(\'mod_periode\')"'); $html .= HtmlInput::hidden('p_id', $_GET['p_id']); $html .= '</form>'; break; case 'save_per': $per = new Periode($cn, $_POST['p_id']); $per->load(); if (isDate($_POST['p_start']) == null || isDate($_POST['p_end'] == null) || isNumber($_POST['p_exercice']) == 0 || $_POST['p_exercice'] > 2099 || $_POST['p_exercice'] < 2000) { $html = ''; $html .= HtmlInput::anchor_close('mod_periode'); $html .= '<h2 class="info">' . _('Modifier les dates de début et fin de période') . '</h2>'; $html .= "<div class=\"error\">" . _('Erreur date invalide') . "</div>"; $html .= HtmlInput::button('close', _('fermer'), 'onclick="removeDiv(\'mod_periode\')"'); } else { $sql = "update parm_periode set p_start=to_date(\$1,'DD.MM.YYYY'),p_end=to_date(\$2,'DD.MM.YYYY'),p_exercice=\$3 where p_id=\$4"; try { $cn->exec_sql($sql, array($_POST['p_start'], $_POST['p_end'], $_POST['p_exercice'], $_POST['p_id'])); $html = '<h2 class="info"> Modifier les dates de début et fin de période</h2>'; $html .= '<h2 class="notice"> Sauvé </h2>'; $html .= HtmlInput::button('close', _('Fermer'), 'onclick=" refresh_window();"'); } catch (Exception $e) { $html = alert($e->getTrace(), true); } } break;