Skip to content

Commit

Permalink
Added LBF option for description as default text for new or empty fie…
Browse files Browse the repository at this point in the history
…lds.
  • Loading branch information
sunsetsystems committed Nov 8, 2013
1 parent 3678233 commit cd0a2ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion interface/super/edit_layout.php
Expand Up @@ -484,7 +484,7 @@ function writeFieldLine($linedata) {
echo " <td align='center' class='optcell' title='C = " . xl('Capitalize') .
", D = " . xl('Dup Check') . ", G = " . xl('Graphable') .
", N = " . xl('New Patient Form') . ", O = " . xl('Order Processor') .
", V = " . xl('Vendor') . "'>";
", T = " . xl('Description is default text') . ", V = " . xl('Vendor') . "'>";
echo "<input type='text' name='fld[$fld_line_no][edit_options]' value='" .
htmlspecialchars($linedata['edit_options'], ENT_QUOTES) . "' size='3' maxlength='36' class='optin' />";
echo "</td>\n";
Expand Down
13 changes: 11 additions & 2 deletions library/options.inc.php
@@ -1,5 +1,5 @@
<?php
// Copyright (C) 2007-2010 Rod Roark <rod@sunsetsystems.com>
// Copyright (C) 2007-2013 Rod Roark <rod@sunsetsystems.com>
// Copyright © 2010 by Andrew Moore <amoore@cpan.org>
// Copyright © 2010 by "Boyd Stephen Smith Jr." <bss@iguanasuicide.net>
//
Expand All @@ -26,6 +26,7 @@
// N = Show in New Patient form
// O = Procedure Order ("ord_*") types only (address book)
// R = Distributor types only (address book)
// T = Use description as default Text
// U = Capitalize all letters (text fields)
// V = Vendor types only (address book)
// 1 = Write Once (not editable when not empty) (text fields)
Expand Down Expand Up @@ -117,7 +118,15 @@ function generate_form_field($frow, $currvalue) {

// Added 5-09 by BM - Translate description if applicable
$description = (isset($frow['description']) ? htmlspecialchars(xl_layout_label($frow['description']), ENT_QUOTES) : '');


// Support edit option T which assigns the (possibly very long) description as
// the default value.
if (strpos($frow['edit_options'], 'T') !== FALSE) {
if (strlen($currescaped) == 0) $currescaped = $description;
// Description used in this way is not suitable as a title.
$description = '';
}

// added 5-2009 by BM to allow modification of the 'empty' text title field.
// Can pass $frow['empty_title'] with this variable, otherwise
// will default to 'Unassigned'.
Expand Down

0 comments on commit cd0a2ea

Please sign in to comment.