Merge pull request #9885 from frederic34/patch-15

code comment html form class
This commit is contained in:
Laurent Destailleur 2018-10-30 12:27:19 +01:00 committed by GitHub
commit bddd658ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3283,17 +3283,17 @@ class Form
if ($empty && empty($arraytypes['code'])) continue; if ($empty && empty($arraytypes['code'])) continue;
if ($format == 0) print '<option value="'.$id.'"'; if ($format == 0) print '<option value="'.$id.'"';
if ($format == 1) print '<option value="'.$arraytypes['code'].'"'; elseif ($format == 1) print '<option value="'.$arraytypes['code'].'"';
if ($format == 2) print '<option value="'.$arraytypes['code'].'"'; elseif ($format == 2) print '<option value="'.$arraytypes['code'].'"';
if ($format == 3) print '<option value="'.$id.'"'; elseif ($format == 3) print '<option value="'.$id.'"';
// Si selected est text, on compare avec code, sinon avec id // Si selected est text, on compare avec code, sinon avec id
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) print ' selected'; if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) print ' selected';
elseif ($selected == $id) print ' selected'; elseif ($selected == $id) print ' selected';
print '>'; print '>';
if ($format == 0) $value=($maxlength?dol_trunc($arraytypes['label'],$maxlength):$arraytypes['label']); if ($format == 0) $value=($maxlength?dol_trunc($arraytypes['label'],$maxlength):$arraytypes['label']);
if ($format == 1) $value=$arraytypes['code']; elseif ($format == 1) $value=$arraytypes['code'];
if ($format == 2) $value=($maxlength?dol_trunc($arraytypes['label'],$maxlength):$arraytypes['label']); elseif ($format == 2) $value=($maxlength?dol_trunc($arraytypes['label'],$maxlength):$arraytypes['label']);
if ($format == 3) $value=$arraytypes['code']; elseif ($format == 3) $value=$arraytypes['code'];
print $value?$value:'&nbsp;'; print $value?$value:'&nbsp;';
print '</option>'; print '</option>';
} }
@ -4589,6 +4589,7 @@ class Form
* *
* @param string $selected preselected currency code * @param string $selected preselected currency code
* @param string $htmlname name of HTML select list * @param string $htmlname name of HTML select list
* @deprecated
* @return void * @return void
*/ */
function select_currency($selected='',$htmlname='currency_id') function select_currency($selected='',$htmlname='currency_id')
@ -4976,7 +4977,7 @@ class Form
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field.
* @param datetime $adddateof Add a link "Date of invoice" using the following date. * @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @return string|null Nothing or string if nooutput is 1 * @return string|void Nothing or string if nooutput is 1
* @deprecated * @deprecated
* @see form_date, select_month, select_year, select_dayofweek * @see form_date, select_month, select_year, select_dayofweek
*/ */
@ -5374,7 +5375,7 @@ class Form
* if 'textselect' input hour is in text and input min is a combo * if 'textselect' input hour is in text and input min is a combo
* @param integer $minunderhours If 1, show minutes selection under the hours * @param integer $minunderhours If 1, show minutes selection under the hours
* @param int $nooutput Do not output html string but return it * @param int $nooutput Do not output html string but return it
* @return string|null * @return string|void
*/ */
function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0)
{ {