function report_results() { $department = get_form_value('department', 0); $order = get_form_value('order', 'upc'); $dir = get_form_value('dir', 'ASC'); $excel = get_form_value('excel', False); $dbc = op_connect(); $query = "SELECT upc, description, normal_price, modified\n\t\t\tFROM products WHERE department={$department}\n\t\t\tORDER BY {$order} {$dir}"; $columns = array('UPC' => array('col' => 'upc'), 'Description' => array('col' => 'description'), 'Price' => array('col' => 'normal_price', 'align' => 'right', 'format' => '%.2f'), 'Last Modified' => array('col' => 'modified', 'date' => 'm/d/Y')); $report = get_sortable_table($dbc, $query, $columns, $this->module_url(), $order, $excel); if ($excel) { $this->download('report.xls', 'excel'); } $dbc->close(); return $report; }
use Galette\Core\L10n; use Zend\Db\Sql\Expression; /** @ignore */ require_once 'includes/galette.inc.php'; if (!$login->isLogged()) { header('location: index.php'); die; } if (!$login->isAdmin() && !$login->isStaff()) { header('location: voir_adherent.php'); die; } elseif (!$login->isAdmin()) { header('location: gestion_adherents.php'); die; } $text_orig = get_form_value('text_orig', ''); if (isset($_POST['trans']) && isset($text_orig)) { if (isset($_POST['new']) && $_POST['new'] == 'true') { //create translation if it does not exists yet $res = addDynamicTranslation($_POST['text_orig'], $error_detected); } // Validate form while (list($key, $value) = each($_POST)) { if (substr($key, 0, 11) == 'text_trans_') { $trans_lang = substr($key, 11); $trans_lang = str_replace('_utf8', '.utf8', $trans_lang); $res = updateDynamicTranslation($text_orig, $trans_lang, $value, $error_detected); if ($res !== true) { $error_detected[] = preg_replace(array('/%label/', '/%lang/'), array($text_orig, $trans_lang), _T("An error occured saving label `%label` for language `%lang`")); } }
include WEB_ROOT . "includes/database.inc.php"; include WEB_ROOT . "includes/session.inc.php"; if ($_SESSION["logged_status"] == 0) { header("location: index.php"); die; } if ($_SESSION["admin_status"] == 0) { header("location: voir_adherent.php"); die; } include WEB_ROOT . "includes/functions.inc.php"; include WEB_ROOT . "includes/i18n.inc.php"; include WEB_ROOT . "includes/smarty.inc.php"; include WEB_ROOT . "includes/dynamic_fields.inc.php"; $error_detected = array(); $form_name = get_form_value('form', ''); if (!isset($all_forms[$form_name])) { $form_name = ''; } $form_not_set = $form_name == ''; if ($form_name == '') { $form_title = ''; $tpl->assign("all_forms", $all_forms); } else { $form_title = $all_forms[$form_name]; $quoted_form_name = $DB->qstr($form_name, get_magic_quotes_gpc()); if (isset($_POST["valid"])) { if ($_POST["field_type"] != $field_type_separator && (!isset($_POST["field_name"]) || $_POST["field_name"] == "")) { $error_detected[] = _T("- The name field cannot be void."); } else { $field_name = $_POST["field_name"];
{ if (is_numeric($trans_id)) { $total_amount = db_get_one($DB, "SELECT trans_amount\n\t\t\t\t\t\t\t FROM " . PREFIX_DB . "transactions\n\t\t\t\t\t\t\t WHERE trans_id={$trans_id}", $error_detected); $current_amount = $DB->GetOne("SELECT SUM(montant_cotis)\n\t\t\t\t\t\t\tFROM " . PREFIX_DB . "cotisations\n\t\t\t\t\t\t\tWHERE trans_id={$trans_id}"); return $total_amount - $current_amount; } return 0; } // new or edit $contribution['id_cotis'] = get_numeric_form_value("id_cotis", ''); $contribution['id_type_cotis'] = get_numeric_form_value("id_type_cotis", ''); $contribution['id_adh'] = get_numeric_form_value("id_adh", ''); $contribution['trans_id'] = get_numeric_form_value("trans_id", ''); $adh_selected = isset($contribution['id_adh']); $tpl->assign("adh_selected", $adh_selected); $type_selected = $contribution['id_cotis'] != '' || get_form_value("type_selected", 0); $tpl->assign("type_selected", $type_selected); $cotis_extension = 0; if (isset($contribution['id_type_cotis'])) { $request = "SELECT cotis_extension\n\t\t\t FROM " . PREFIX_DB . "types_cotisation\n\t\t\t WHERE id_type_cotis = " . $contribution['id_type_cotis']; $cotis_extension = $DB->GetOne($request); } // initialize warning $error_detected = array(); // flagging required fields $required = array('montant_cotis' => 1, 'date_debut_cotis' => 1, 'date_fin_cotis' => $cotis_extension, 'id_type_cotis' => 1, 'id_adh' => 1); // Validation $contribution['dyn'] = array(); if (isset($_POST["valid"])) { $contribution['dyn'] = extract_posted_dynamic_fields($DB, $_POST, array()); $update_string = '';
/** * Get a numeric value sent by a form, either in POST and GET arrays * * @param string $name property name * @param string $defval default rollback value * * @return numeric value retrieved from : * - GET array if defined and numeric, * - POST array if defined and numéric * - $defval otherwise */ function get_numeric_form_value($name, $defval) { $val = get_form_value($name, $defval); if (!is_numeric($val)) { Analog::log('[get_numeric_form_value] not a numeric value! (value was: `' . $val . '`)', Analog::INFO); $val = $defval; } return $val; }
/** * Creates a radio button * @param string or array * @param string * @param string * @param array * @return string */ function select($name, $label = '', $value = '', $options = array()) { if (is_array($name)) { $opts = $name; $name = $opts['name']; $options = $opts['options']; $label = $opts['label']; foreach (array('hint', 'required') as $v) { if (isset($opts[$v])) { ${$v} = $opts[$v]; unset($opts['hint']); } } } $html = '<div class="input">'; $html .= "<label>{$label}</label>"; $html .= "<select name=\"{$name}\" id=\"{$name}\">"; if (trim($value) == '') { $value = get_form_value($name); } $html .= '<option></option>'; foreach ($options as $k => $v) { $checked = $value == $k ? 'selected="true" ' : ''; $html .= "<option value='{$k}' {$checked} />{$v}</option>"; } $html .= '</select>'; $html .= form_error($name); if (isset($hint)) { $html .= "<br /><quote>{$hint}</quote>"; } $html .= '</div>'; return $html; }
function get_numeric_form_value($name, $defval) { $val = get_form_value($name, $defval); if (!is_numeric($val)) { $val = ''; } return $val; }
if (!$login->isAdmin() && !$login->isStaff()) { header('location: voir_adherent.php'); die; } $contrib = new Contribution(); //TODO: dynamic fields should be handled by Contribution object $dyn_fields = new DynamicFields(); $id_cotis = get_numeric_form_value('id_cotis', ''); //first/second step: select member $id_adh = get_numeric_form_value('id_adh', ''); //first/second step: select contribution type $selected_type = get_form_value('id_type_cotis', 1); //first/second step: transaction id $trans_id = get_numeric_form_value('trans_id', ''); //mark first step has been passed $type_selected = $id_cotis != null || get_form_value('type_selected', 0); // flagging required fields for first step only $required = array('id_type_cotis' => 1, 'id_adh' => 1, 'date_enreg' => 1); $cotis_extension = 0; // TODO: remove and remplace with $contrib->isCotis() $disabled = array(); if ($type_selected && !($id_adh || $id_cotis)) { $error_detected[] = _T("You have to select a member."); $type_selected = false; } else { if ($id_cotis != '' || $type_selected || $trans_id || $id_adh) { if ($id_cotis != '') { $contrib = new Contribution((int) $id_cotis); if ($contrib->id == '') { //not possible to load contribution, exit header('location: index.php');
header('location: index.php'); die; } if (!$login->isAdmin() && !$login->isStaff()) { header('location: voir_adherent.php'); die; } $trans = new Transaction(); //TODO: dynamic fields should be handled by Transaction object $dyn_fields = new DynamicFields(); // new or edit $trans_id = get_numeric_form_value("trans_id", ''); $transaction['trans_id'] = get_numeric_form_value("trans_id", ''); $transaction['trans_amount'] = get_numeric_form_value("trans_amount", ''); $transaction['trans_date'] = get_form_value("trans_date", ''); $transaction['trans_desc'] = get_form_value("trans_desc", ''); $transaction['id_adh'] = get_numeric_form_value("id_adh", ''); // flagging required fields $required = array('trans_amount' => 1, 'trans_date' => 1, 'trans_desc' => 1, 'id_adh' => 1); $disabled = array(); if (isset($_GET['detach'])) { if (!Contribution::unsetTransactionPart($trans_id, $_GET['detach'])) { $error_detected[] = _T("Unable to detach contribution from transaction"); } else { $success_detected[] = _T("Contribution has been successfully detached from current transaction"); } } if (isset($_GET['cid']) && $_GET['cid'] != null) { if (!Contribution::setTransactionPart($trans_id, $_GET['cid'])) { $error_detected[] = _T("Unable to attach contribution to transaction"); } else {
die; } $df = $dyn_fields->loadFieldType($field_id); if ($df === false) { $error_detected[] = _T("Unable to retrieve field informations."); } $data = array('id' => $field_id); if (isset($_POST['valid'])) { $field_name = $_POST['field_name']; $field_perm = get_numeric_posted_value('field_perm', ''); $field_required = get_numeric_posted_value('field_required', '0'); $field_width = get_numeric_posted_value('field_width', null); $field_height = get_numeric_posted_value('field_height', null); $field_size = get_numeric_posted_value('field_size', null); $field_repeat = get_numeric_posted_value('field_repeat', new Expression('NULL')); $fixed_values = get_form_value('fixed_values', ''); if ($field_id != '' && $field_perm != '') { $duplicated = $dyn_fields->isDuplicate($zdb, $form_name, $field_name, $field_id); if ($duplicated) { $error_detected[] = _T("- Field name already used."); } else { $select = $zdb->select(DynamicFieldType::TABLE); $select->columns(array('field_name'))->where(array('field_id' => $field_id)); $results = $zdb->execute($select); $result = $results->current(); $old_field_name = $result->field_name; if ($old_field_name && $field_name != $old_field_name) { addDynamicTranslation($field_name, $error_detected); deleteDynamicTranslation($old_field_name, $error_detected); } }
if ($field_id == '') { header("location: configurer_fiches.php?form={$form_name}"); } $field_type = $DB->GetOne("SELECT field_type FROM {$field_types_table} WHERE field_id={$field_id}"); $properties = $field_properties[$field_type]; $data = array('id' => $field_id); if (isset($_POST["valid"])) { $field_name = $_POST["field_name"]; $field_perm = get_numeric_posted_value("field_perm", ''); $field_pos = get_numeric_posted_value("field_pos", 0); $field_required = get_numeric_posted_value("field_required", '0'); $field_width = get_numeric_posted_value("field_width", 'NULL'); $field_height = get_numeric_posted_value("field_height", 'NULL'); $field_size = get_numeric_posted_value("field_size", 'NULL'); $field_repeat = get_numeric_posted_value("field_repeat", 'NULL'); $fixed_values = get_form_value("fixed_values", ''); if ($field_id != '' && $field_perm != '') { $quoted_form_name = $DB->qstr($form_name, get_magic_quotes_gpc()); $quoted_field_name = $DB->qstr($field_name, get_magic_quotes_gpc()); $DB->StartTrans(); $query = "SELECT COUNT(field_id)\n\t\t\t\t FROM {$field_types_table}\n\t\t\t\t WHERE NOT field_id={$field_id} AND field_form={$quoted_form_name} AND\n\t\t\t\t \tfield_name={$quoted_field_name}"; $duplicate = $DB->GetOne($query); if ($duplicate != 0) { $error_detected[] = _T("- Field name already used."); } $query = "SELECT field_name\n\t\t\t\t FROM {$field_types_table}\n\t\t\t\t WHERE field_id={$field_id}"; $old_field_name = db_get_one($DB, $query, $error_detected); if ($old_field_name && $field_name != $old_field_name) { add_dynamic_translation($DB, $field_name, $error_detected); delete_dynamic_translation($DB, $old_field_name, $error_detected); }
<span id="grid_step2_autogen_content_additional_data" class="grid_step2_additional_options"> starting from <input type="text" size="10" name="grid_step2_autogen_content_seq_start" value="<?php display_form_value($grid_step2_column_data, "grid_step2_column" . $current_column . "_autogen_content_seq_start"); ?> " /> </span> suffix: <input type="text" size="10" name="grid_step2_autogen_suffix" value="<?php display_form_value($grid_step2_column_data, "grid_step2_column" . $current_column . "_autogen_suffix"); ?> "/> <span class="tip">[you can leave prefix and suffix empty; 1 will taken as default value is starting from field is emtpy]</span> </p> </div> <div class="grid_step2_additional_options" id="grid_step2_lookup_div"> <p>which column in this grid : <?php displaySelectBox($currentColumns, "grid_step2_lookup_fromcolumn", "grid_step2_lookup_fromcolumn", get_form_value($grid_step2_column_data, "grid_step2_column" . $current_column . "_lookup_fromcolumn")); ?> </p> <p>length of field : <input type="text" size="2" name="grid_step2_lookup_size" /></p> <p>select grid : <select id="grid_step2_lookup_gridname" name="grid_step2_lookup_gridname"></select> </p> <p>select column : <select id="grid_step2_lookup_columnname" name="grid_step2_lookup_columnname"></select> </p> <p>partial match? <input type="checkbox" name="grid_step2_lookup_partial" /></p> <p>match mandatory? <input type="checkbox" name="grid_step2_lookup_mandatory" /></p> </div> </fieldset> <input type="hidden" id="grid_step2_column_datatype_val" value="<?php echo $grid_step2_column_datatype; ?> "/> <input type="hidden" name="grid_step2_column_no" value="<?php