Add boolean (checkbox) standard extrafield feature
This commit is contained in:
parent
22dcb7ee6a
commit
d39368fd36
@ -52,7 +52,8 @@ class ExtraFields
|
||||
'int'=>'Int',
|
||||
'double'=>'Float',
|
||||
'date'=>'Date',
|
||||
'datetime'=>'DateAndTime'
|
||||
'datetime'=>'DateAndTime',
|
||||
'boolean'=>'Boolean'
|
||||
);
|
||||
|
||||
/**
|
||||
@ -135,7 +136,14 @@ class ExtraFields
|
||||
|
||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
||||
{
|
||||
$field_desc = array('type'=>$type, 'value'=>$length, 'null'=>($required?'NOT NULL':'NULL'));
|
||||
if ($type=='boolean') {
|
||||
$typedb='int';
|
||||
$lengthdb='1';
|
||||
} else {
|
||||
$typedb=$type;
|
||||
$lengthdb=$length;
|
||||
}
|
||||
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required?'NOT NULL':'NULL'));
|
||||
$result=$this->db->DDLAddField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -304,7 +312,14 @@ class ExtraFields
|
||||
|
||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
||||
{
|
||||
$field_desc = array('type'=>$type, 'value'=>$length, 'null'=>($required?'NOT NULL':'NULL'));
|
||||
if ($type=='boolean') {
|
||||
$typedb='int';
|
||||
$lengthdb='1';
|
||||
} else {
|
||||
$typedb=$type;
|
||||
$lengthdb=$length;
|
||||
}
|
||||
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required?'NOT NULL':'NULL'));
|
||||
$result=$this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -487,7 +502,7 @@ class ExtraFields
|
||||
function showInputField($key,$value,$moreparam='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$label=$this->attribute_label[$key];
|
||||
$type =$this->attribute_type[$key];
|
||||
$size =$this->attribute_size[$key];
|
||||
@ -534,6 +549,16 @@ class ExtraFields
|
||||
$doleditor=new DolEditor('options_'.$key,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100);
|
||||
$out=$doleditor->Create(1);
|
||||
}
|
||||
else if ($type == 'boolean')
|
||||
{
|
||||
$checked='';
|
||||
if (!empty($value)) {
|
||||
$checked=' checked="checked" value="1" ';
|
||||
} else {
|
||||
$checked=' value="1" ';
|
||||
}
|
||||
$out='<input type="checkbox" name="options_'.$key.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
// Add comments
|
||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
||||
@ -550,6 +575,7 @@ class ExtraFields
|
||||
*/
|
||||
function showOutputField($key,$value,$moreparam='')
|
||||
{
|
||||
|
||||
$label=$this->attribute_label[$key];
|
||||
$type=$this->attribute_type[$key];
|
||||
$size=$this->attribute_size[$key];
|
||||
@ -568,6 +594,14 @@ class ExtraFields
|
||||
{
|
||||
$showsize=10;
|
||||
}
|
||||
elseif ($type == 'boolean')
|
||||
{
|
||||
$checked='';
|
||||
if (!empty($value)) {
|
||||
$checked=' checked="checked" ';
|
||||
}
|
||||
$value='<input type="checkbox" '.$checked.' '.($moreparam?$moreparam:'').' readonly="readonly">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$showsize=round($size);
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
else if (type == 'int') { size.val('10').removeAttr('disabled'); }
|
||||
else if (type == 'text') { size.val('2000').removeAttr('disabled'); }
|
||||
else if (type == 'varchar') { size.val('255').removeAttr('disabled'); }
|
||||
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');}
|
||||
else size.val('').attr('disabled','disabled');
|
||||
}
|
||||
init_typeoffields();
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); }
|
||||
else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); }
|
||||
else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); }
|
||||
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');}
|
||||
else size.val('').attr('disabled','disabled');
|
||||
}
|
||||
init_typeoffields('');
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
else if (type == 'int') { size.removeAttr('disabled'); }
|
||||
else if (type == 'text') { size.removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); }
|
||||
else if (type == 'varchar') { size.removeAttr('disabled'); }
|
||||
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');}
|
||||
else size.val('').attr('disabled','disabled');
|
||||
}
|
||||
init_typeoffields(jQuery("#type").val());
|
||||
|
||||
@ -351,6 +351,7 @@ Int=Integer
|
||||
Float=Float
|
||||
DateAndTime=Date and hour
|
||||
Unique=Unique
|
||||
Boolean=Boolean (Checkbox)
|
||||
LibraryToBuildPDF=Library used to build PDF
|
||||
WarningUsingFPDF=Warning: Your <b>conf.php</b> contains directive <b>dolibarr_pdf_force_fpdf=1</b>. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.<br>To solve this and have a full support of PDF generation, please download <a href="http://www.tcpdf.org/" target="_blank">TCPDF library</a>, then comment or remove the line <b>$dolibarr_pdf_force_fpdf=1</b>, and add instead <b>$dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir'</b>
|
||||
LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:<br>1 : local tax apply on products and services without vat (vat is not applied on local tax)<br>2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)<br>3 : local tax apply on products without vat (vat is not applied on local tax)<br>4 : local tax apply on products before vat (vat is calculated on amount + localtax)<br>5 : local tax apply on services without vat (vat is not applied on local tax)<br>6 : local tax apply on services before vat (vat is calculated on amount + localtax)
|
||||
|
||||
@ -346,6 +346,7 @@ TextLong=Texte long
|
||||
Int=Numérique entier
|
||||
Float=Décimal
|
||||
DateAndTime=Date et heure
|
||||
Boolean=Booleen (Checkbox)
|
||||
LibraryToBuildPDF=Bibliothèque utilisée pour la génération des PDF
|
||||
WarningUsingFPDF=Attention: Votre fichier <b>conf.php</b> contient la directive <b>dolibarr_pdf_force_fpdf=1</b>. Cela signifie que vous utilisez la librairie FPDF pour générer vos fichiers PDF. Cette librairie est ancienne et ne couvre pas de nombreuses fonctionnalitée (Unicode, transparence des images, langues cyrillic, arabes ou asiatiques...), aussi vous pouvez rencontrez des problèmes durant la génération des PDF.<br>Pour résoudre cela et avoir un support complet de PDF, vous pouvez télécharger la <a href="http://www.tcpdf.org/" target="_blank">librairie TCPDF</a> puis commenter ou supprimer la ligne <b>$dolibarr_pdf_force_fpdf=1</b>, et ajouter à la place <b>$dolibarr_lib_TCPDF_PATH='chemin_vers_TCPDF'</b>
|
||||
LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:<br>1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)<br>2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)<br>3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)<br>4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)<br>5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)<br>6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user