From cbff238cbd27861ac7e447a3f249363faa021ad0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Oct 2012 16:23:58 +0200 Subject: [PATCH] New: Support property "required" for extra fields. --- .../adherents/admin/adherent_extrafields.php | 12 ++-- htdocs/adherents/fiche.php | 8 ++- htdocs/comm/addpropal.php | 4 +- htdocs/comm/mailing/fiche.php | 12 +++- htdocs/comm/propal.php | 4 +- htdocs/commande/fiche.php | 8 ++- htdocs/compta/facture.php | 8 ++- htdocs/contact/fiche.php | 34 +++++++---- htdocs/core/admin_extrafields.inc.php | 4 +- htdocs/core/class/extrafields.class.php | 4 +- htdocs/core/db/mysql.class.php | 3 +- htdocs/core/db/mysqli.class.php | 3 +- htdocs/core/db/pgsql.class.php | 3 + htdocs/core/tpl/admin_extrafields_add.tpl.php | 18 +++--- .../core/tpl/admin_extrafields_edit.tpl.php | 9 ++- htdocs/product/admin/product_extrafields.php | 43 ++------------ htdocs/product/fiche.php | 8 ++- htdocs/societe/admin/contact_extrafields.php | 43 ++------------ htdocs/societe/admin/societe_extrafields.php | 6 +- htdocs/societe/soc.php | 8 ++- test/soapui/Dolibarr-soapui-project.xml | 57 ++++++++++--------- 21 files changed, 147 insertions(+), 152 deletions(-) diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index 4941cff79c5..59fa9a28b95 100755 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -88,7 +88,8 @@ print ''.$langs->trans("Label").''; print ''.$langs->trans("AttributeCode").''; print ''.$langs->trans("Type").''; print ''.$langs->trans("Size").''; -print ''.$langs->trans("Unique").''; +print ''.$langs->trans("Unique").''; +print ''.$langs->trans("Required").''; print ' '; print "\n"; @@ -101,7 +102,8 @@ foreach($extrafields->attribute_type as $key => $value) print "".$key."\n"; print "".$type2label[$extrafields->attribute_type[$key]]."\n"; print ''.$extrafields->attribute_size[$key]."\n"; - print ''.yn($extrafields->attribute_unique[$key])."\n"; + print ''.yn($extrafields->attribute_unique[$key])."\n"; + print ''.yn($extrafields->attribute_required[$key])."\n"; print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; @@ -149,7 +151,7 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 4807c408d9b..1658e4dd1f0 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -906,7 +906,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?GETPOST('options_'.$key,'alpha'):$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } @@ -1150,7 +1152,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 52f63e172a7..7d03960dd11 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -237,7 +237,9 @@ if ($action == 'create') foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print "".$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 7fa1160d43d..8e3b5064a70 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -650,7 +650,9 @@ if ($action == 'create') foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } @@ -810,7 +812,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print "\n"; } @@ -1044,7 +1048,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print "\n"; } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 0f9d67113fd..0df445e2b28 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1538,7 +1538,9 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print "".$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 641fcbce1ae..aeae2a8e3f5 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1517,7 +1517,9 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print "".$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } @@ -2047,7 +2049,9 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 1d230ad7406..5963d2b13ec 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2003,7 +2003,9 @@ if ($action == 'create') foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } @@ -2970,7 +2972,9 @@ else if ($id > 0 || ! empty($ref)) foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 7beb9e56799..3027eb22026 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -432,30 +432,36 @@ else print ''.$langs->trans("PostOrFunction").'poste).'">'; + $colspan=3; + if ($conf->use_javascript_ajax && $socid > 0) $colspan=2; + // Address if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) $object->address = $objsoc->address; // Predefined with third party print ''.$langs->trans("Address"); - print ''; + print ''; - $rowspan=3; - if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; - - print ''; - if ($conf->use_javascript_ajax && $socid) print ''.$langs->trans('CopyAddressFromSoc').''; - print ''; + if ($conf->use_javascript_ajax && $socid > 0) + { + $rowspan=3; + if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; + + print ''; + print ''.$langs->trans('CopyAddressFromSoc').''; + print ''; + } print ''; // Zip / Town if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) $object->zip = $objsoc->zip; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) $object->town = $objsoc->town; // Predefined with third party - print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); print ''; // Country if (dol_strlen(trim($object->fk_pays)) == 0) $object->fk_pays = $objsoc->country_id; // Predefined with third party - print ''.$langs->trans("Country").''; + print ''.$langs->trans("Country").''; print $form->select_country((isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''; @@ -463,7 +469,7 @@ else // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''.$langs->trans('State').''; + print ''.$langs->trans('State').''; if ($object->country_id) { print $formcompany->select_state(isset($_POST["state_id"])?$_POST["state_id"]:$object->state_id,$object->country_code,'state_id'); @@ -517,7 +523,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:'')); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } @@ -732,7 +740,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print "\n"; } diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index c1a7da31374..84624eda50b 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -64,7 +64,7 @@ if ($action == 'add') // Type et taille non encore pris en compte => varchar(255) if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { - $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0)); + $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0)); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]); @@ -119,7 +119,7 @@ if ($action == 'update') { if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { - $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0)); + $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0)); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index a0eb75b61bc..6a129787f76 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -91,7 +91,7 @@ class ExtraFields if (empty($label)) return -1; // Create field into database - $result=$this->create($attrname,$type,$size,$elementtype, $unique); + $result=$this->create($attrname,$type,$size,$elementtype, $unique, $required); $err1=$this->errno; if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS') { @@ -361,7 +361,7 @@ class ExtraFields private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0) { global $conf; - dol_syslog(get_class($this)."::update_label $attrname,$label,$type,$size"); + dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required); if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) { diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index dc33a4eb17d..86374b94dea 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -1011,7 +1011,8 @@ class DoliDBMysql $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")"; - + if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL"; + dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG); if (! $this->query($sql)) return -1; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 8db96ca32a1..a5e296b5a8b 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1005,7 +1005,8 @@ class DoliDBMysqli $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")"; - + if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL"; + dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG); if (! $this->query($sql)) return -1; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 16f02559e28..e45352c0ed4 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1221,6 +1221,9 @@ class DoliDBPgsql $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")"; + // FIXME May not work with pgsql. May need to run a second request. If it works, just remove the FIXME tag + if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL"; + dol_syslog($sql,LOG_DEBUG); if (! $this->query($sql)) return -1; diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index a4ebedcc54c..c4cacb0b23e 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -23,12 +23,14 @@ function init_typeoffields(type) { var size = jQuery("#size"); - if (type == 'date') { size.val('').attr('disabled','disabled'); } - else if (type == 'datetime') { size.val('').attr('disabled','disabled'); } - else if (type == 'double') { size.val('24,8').removeAttr('disabled'); } - 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'); } + var unique = jQuery("#unique"); + var required = jQuery("#required"); + if (type == 'date') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); } + else if (type == 'datetime') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); } + else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); } + 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 size.val('').attr('disabled','disabled'); } init_typeoffields(''); @@ -55,7 +57,9 @@ trans("Size"); ?> -trans("Unique"); ?>"> +trans("Unique"); ?>> + +trans("Required"); ?>>

">   diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index b93f136bc5d..e63c6856210 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -23,11 +23,13 @@ function init_typeoffields(type) { var size = jQuery("#size"); + var unique = jQuery("#unique"); + var required = jQuery("#required"); if (type == 'date') { size.attr('disabled','disabled'); } else if (type == 'datetime') { size.attr('disabled','disabled'); } else if (type == 'double') { size.removeAttr('disabled'); } else if (type == 'int') { size.removeAttr('disabled'); } - else if (type == 'text') { size.removeAttr('disabled'); } + else if (type == 'text') { size.removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); } else if (type == 'varchar') { size.removeAttr('disabled'); } else size.val('').attr('disabled','disabled'); } @@ -52,6 +54,7 @@ $type=$extrafields->attribute_type[$attrname]; $size=$extrafields->attribute_size[$attrname]; $unique=$extrafields->attribute_unique[$attrname]; +$required=$extrafields->attribute_required[$attrname]; ?> trans("Type"); ?> @@ -60,7 +63,9 @@ $unique=$extrafields->attribute_unique[$attrname]; trans("Size"); ?> -trans("Unique"); ?>"> +trans("Unique"); ?>> + +trans("Required"); ?>> diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index 7c445643881..1671b3cf770 100755 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -101,7 +101,8 @@ print ''.$langs->trans("Label").''; print ''.$langs->trans("AttributeCode").''; print ''.$langs->trans("Type").''; print ''.$langs->trans("Size").''; -print ''.$langs->trans("Unique").''; +print ''.$langs->trans("Unique").''; +print ''.$langs->trans("Required").''; print ' '; print "\n"; @@ -114,7 +115,8 @@ foreach($extrafields->attribute_type as $key => $value) print "".$key."\n"; print "".$type2label[$extrafields->attribute_type[$key]]."\n"; print ''.$extrafields->attribute_size[$key]."\n"; - print ''.yn($extrafields->attribute_unique[$key])."\n"; + print ''.yn($extrafields->attribute_unique[$key])."\n"; + print ''.yn($extrafields->attribute_required[$key])."\n"; print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; @@ -159,42 +161,7 @@ if ($action == 'edit' && ! empty($attrname)) print "
"; print_titre($langs->trans("FieldEdition", $attrname)); - /* - * formulaire d'edition - */ - print '
'; - print ''; - print ''; - print ''; - print ''; - - // Label - print ''; - print ''; - print ''; - // Code - print ''; - print ''; - print ''; - print ''; - // Type - $type=$extrafields->attribute_type[$attrname]; - $size=$extrafields->attribute_size[$attrname]; - print ''; - print ''; - // Size - print ''; - - print '
'.$langs->trans("Label").'
'.$langs->trans("AttributeCode").''.$attrname.' 
'.$langs->trans("Type").''; - print $type2label[$type]; - print ''; - print '
'.$langs->trans("Size").'
'; - - print '

  '; - print '
'; - - print "
"; - + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 42faf7ff7da..ce68665cb69 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -828,7 +828,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(GETPOST('options_'.$key)?GETPOST('options_'.$key):$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } @@ -1037,7 +1039,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index baed4711c32..61f72f29d5c 100755 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -88,7 +88,8 @@ print ''.$langs->trans("Label").''; print ''.$langs->trans("AttributeCode").''; print ''.$langs->trans("Type").''; print ''.$langs->trans("Size").''; -print ''.$langs->trans("Unique").''; +print ''.$langs->trans("Unique").''; +print ''.$langs->trans("Required").''; print ' '; print "\n"; @@ -101,7 +102,8 @@ foreach($extrafields->attribute_type as $key => $value) print "".$key."\n"; print "".$type2label[$extrafields->attribute_type[$key]]."\n"; print ''.$extrafields->attribute_size[$key]."\n"; - print ''.yn($extrafields->attribute_unique[$key])."\n"; + print ''.yn($extrafields->attribute_unique[$key])."\n"; + print ''.yn($extrafields->attribute_required[$key])."\n"; print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; @@ -146,42 +148,7 @@ if ($action == 'edit' && ! empty($attrname)) print "
"; print_titre($langs->trans("FieldEdition", $attrname)); - /* - * formulaire d'edition - */ - print '
'; - print ''; - print ''; - print ''; - print ''; - - // Label - print ''; - print ''; - print ''; - // Code - print ''; - print ''; - print ''; - print ''; - // Type - $type=$extrafields->attribute_type[$attrname]; - $size=$extrafields->attribute_size[$attrname]; - print ''; - print ''; - // Size - print ''; - - print '
'.$langs->trans("Label").'
'.$langs->trans("AttributeCode").''.$attrname.' 
'.$langs->trans("Type").''; - print $type2label[$type]; - print ''; - print '
'.$langs->trans("Size").'
'; - - print '

  '; - print '
'; - - print "
"; - + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 81c60a3cfb4..f093186e1c9 100755 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -88,7 +88,8 @@ print ''.$langs->trans("Label").''; print ''.$langs->trans("AttributeCode").''; print ''.$langs->trans("Type").''; print ''.$langs->trans("Size").''; -print ''.$langs->trans("Unique").''; +print ''.$langs->trans("Unique").''; +print ''.$langs->trans("Required").''; print ' '; print "\n"; @@ -101,7 +102,8 @@ foreach($extrafields->attribute_type as $key => $value) print "".$key."\n"; print "".$type2label[$extrafields->attribute_type[$key]]."\n"; print ''.$extrafields->attribute_size[$key]."\n"; - print ''.yn($extrafields->attribute_unique[$key])."\n"; + print ''.yn($extrafields->attribute_unique[$key])."\n"; + print ''.yn($extrafields->attribute_required[$key])."\n"; print ''.img_edit().''; print "  ".img_delete()."\n"; print ""; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 2a5650aad91..05b0644d4ac 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -957,7 +957,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:'')); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print ''."\n"; } @@ -1379,7 +1381,9 @@ else foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''; print $extrafields->showInputField($key,$value); print "\n"; } diff --git a/test/soapui/Dolibarr-soapui-project.xml b/test/soapui/Dolibarr-soapui-project.xml index 973bfb6e1d0..e74f5181696 100755 --- a/test/soapui/Dolibarr-soapui-project.xml +++ b/test/soapui/Dolibarr-soapui-project.xml @@ -1,5 +1,5 @@ - -http://localhostdolibarr/dolibarrnew/webservices/server_other.php?wsdl + +http://localhostdolibarr/dolibarrnew/webservices/server_other.php?wsdl @@ -522,7 +522,7 @@ dolibarrkey aaa admin - admin + changeme 1 @@ -536,7 +536,7 @@ - dolibarrkey + ? ? admin admin @@ -692,7 +692,7 @@ -]]>http://schemas.xmlsoap.org/wsdl/http://localhostdolibarr/dolibarrnew/webservices/server_productorservice.php<xml-fragment/>UTF-8http://localhostdolibarr/dolibarrnew/webservices/server_productorservice.php +]]>http://schemas.xmlsoap.org/wsdl/http://localhost/dolibarr/htdocs/webservices/server_productorservice.php<xml-fragment/>UTF-8http://localhost/dolibarr/htdocs/webservices/server_productorservice.php @@ -733,14 +733,14 @@ -]]><xml-fragment/>UTF-8http://localhostdolibarr/dolibarrnew/webservices/server_productorservice.php +]]><xml-fragment/>UTF-8http://localhost/dolibarr/htdocs/webservices/server_productorservice.php dolibarrkey - + ? admin admin @@ -750,27 +750,27 @@ -]]><xml-fragment/>UTF-8http://localhostdolibarr/dolibarrnew/webservices/server_productorservice.php +]]>UTF-8http://localhost/dolibarr/htdocs/webservices/server_productorservice.php - dolibarrkey + ? ? - admin - admin - + ? + ? + ? - 0 - - + ? + ? + ? -]]>http://localhostdolibarr/webservices/server_user.php?wsdl +]]>http://localhostdolibarr/webservices/server_user.php?wsdl @@ -1028,21 +1028,24 @@ -]]>http://schemas.xmlsoap.org/wsdl/http://localhostdolibarr/webservices/server_thirdparty.php<xml-fragment/>UTF-8http://localhostdolibarr/webservices/server_thirdparty.php - - - +]]>http://schemas.xmlsoap.org/wsdl/http://localhostdolibarr/webservices/server_thirdparty.php<xml-fragment/>UTF-8http://localhostdolibarr/webservices/server_thirdparty.php + + + + + dolibarrkey - PRESTASHOP + aaa admin admin - + - - - - -]]>UTF-8http://localhostdolibarr/webservices/server_thirdparty.php + 1 + + + + +]]>UTF-8http://localhostdolibarr/webservices/server_thirdparty.php