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/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index c7ffdc63753..acf708005d3 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -63,13 +63,24 @@ class Categorie * Load category into memory from database * * @param int $id Id of category + * @param strin $label Label of category * @return int <0 if KO, >0 if OK */ - function fetch($id) + function fetch($id,$label='') { + global $conf; + $sql = "SELECT rowid, fk_parent, entity, label, description, fk_soc, visible, type"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; - $sql.= " WHERE rowid = ".$id; + if ($id) + { + $sql.= " WHERE rowid = '".$id."'"; + } + + else + { + if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity=".$conf->entity;; + } dol_syslog(get_class($this)."::fetch sql=".$sql); $resql = $this->db->query($sql); 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 9cfc131f979..3f77370edf5 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/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d3e80221e12..69c5b37ce69 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -654,7 +654,7 @@ class Form * @param int $showempty Add an empty field * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box - * @param array $event Event options + * @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return string HTML string with */ function select_company($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array()) @@ -2315,8 +2315,8 @@ class Form $autoOpen=false; $dialogconfirm.='-'.$button; } - $pageyes=$page.'&action='.$action.'&confirm=yes'; - $pageno=($useajax == 2?$page.'&confirm=no':''); + $pageyes=(preg_match('/\?/',$page)?'&':'?').'action='.$action.'&confirm=yes'; + $pageno=($useajax == 2 ? (preg_match('/\?/',$page)?'&':'?').'confirm=no':''); // Add input fields into list of fields to read during submit (inputok and inputko) if (is_array($formquestion)) { @@ -2823,17 +2823,17 @@ class Form } /** - * Output html select to select thirdparty + * Output html select to select thirdparty * - * @param string $page Page - * @param string $selected Id preselected - * @param string $htmlname Name of HTML select + * @param string $page Page + * @param string $selected Id preselected + * @param string $htmlname Name of HTML select * @param string $filter Optionnal filters criteras * @param int $showempty Add an empty field * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box - * @param array $event Event options - * @return void + * @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @return void */ function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array()) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d4f22200fdb..b67e05defc7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -576,7 +576,7 @@ class FormFile * @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this * @param Object $object Object on which document is linked to * @param string $modulepart Value for modulepart used by download or viewimage wrapper - * @param string $param Parameters on sort links + * @param string $param Parameters on sort links (param must start with &, example &aaa=bbb&ccc=ddd) * @param int $forcedownload Force to open dialog box "Save As" when clicking on file * @param string $relativepath Relative path of docs (autodefined if not provided) * @param int $permtodelete Permission to delete @@ -678,9 +678,10 @@ class FormFile print ''; } // Delete or view link + // ($param must start with &) print ''; - if ($useinecm) print ''.img_view().'   '; - if ($permtodelete) print ''.img_delete().''; + if ($useinecm) print ''.img_view().'   '; + if ($permtodelete) print ''.img_delete().''; else print ' '; print ""; print "\n"; 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/js/lib_head.js b/htdocs/core/js/lib_head.js index 62427857749..d9088ba83ba 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -757,8 +757,11 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, }); } -/* This is to allow to transform all select box into ajax autocomplete box - * with just one line: $(function() { $( "#listmotifcons" ).combobox(); }); +/* + * ================================================================= + * This is to allow to transform all select box into ajax autocomplete box + * with just one line: $(function() { $( "#idofmylist" ).combobox(); }); + * ================================================================= */ (function( $ ) { $.widget( "ui.combobox", { diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index e5b8a1d5f12..82a6dadcfb8 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -290,10 +290,10 @@ function ajax_dialog($title,$message,$w=350,$h=150) } /** - * Convert a select html field into an ajax combobox + * Convert a html select field into an ajax combobox * - * @param string $htmlname Name of html field - * @param array $event Event options + * @param string $htmlname Name of html select field + * @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return string Return html string to convert a select field into a combo */ function ajax_combobox($htmlname, $event=array()) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 24d1cccd4f1..92c69a97728 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -159,7 +159,7 @@ function dol_shutdown() global $conf,$user,$langs,$db; $disconnectdone=false; $depth=0; if (is_object($db) && ! empty($db->connected)) { $depth=$db->transaction_opened; $disconnectdone=$db->close(); } - dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].($disconnectdone?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), ($disconnectdone?LOG_WARNING:LOG_DEBUG)); + dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_DEBUG)); } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 1861e974576..da2493264be 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2012 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -583,10 +584,19 @@ class ImportCsv extends ModeleImports //var_dump($objimport->array_import_convertvalue); exit; // Build SQL request - $sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key'; - if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias]; - $sql.=') VALUES('.$listvalues.", '".$importid."'"; - if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$user->id; + if (! tablewithentity($tablename)) + { + $sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key'; + if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias]; + $sql.=') VALUES('.$listvalues.", '".$importid."'"; + } + else + { + $sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key, entity'; + if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias]; + $sql.=') VALUES('.$listvalues.", '".$importid."', ".$conf->entity ; + } + if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$user->id; $sql.=')'; dol_syslog("import_csv.modules sql=".$sql); @@ -637,4 +647,34 @@ function cleansep($value) return str_replace(',','/',$value); }; +/** + * Returns if a table contains entity column + * + * @param string $table Table name + * @return int 1 if table contains entity, 0 if not and -1 if error + */ +function tablewithentity($table) +{ + global $db; + $sql = "SHOW COLUMNS FROM ".$table." LIKE 'entity'"; + + $resql=$db->query($sql); + if ($resql) + { + $numrows=$db->num_rows($resql); + if ($numrows) + { + return 1; + } + else + { + return 0; + } + } + else + { + return -1; + } +} + ?> diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index cb5fe07ee5f..4f4ecba0714 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -178,6 +178,63 @@ class modCategorie extends DolibarrModules $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); $this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>"1",'ca.description'=>"Imported category"); + + if (! empty($conf->product->enabled)) + { + //Products + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="CatProdList"; // Translation key + $this->import_icon[$r]=$this->picto; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product'); + $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*" + ); + + $this->import_convertvalue_array[$r]=array( + 'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), + 'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product') + ); + $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456"); + } + + if (! empty($conf->societe->enabled)) + { + //Customers + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="CatCusList"; // Translation key + $this->import_icon[$r]=$this->picto; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); + $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_societe'=>"ThirdParty*" + ); + + $this->import_convertvalue_array[$r]=array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), + 'cs.fk_societe'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') + ); + $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_societe'=>"MyBigCompany"); + } + + if (! empty($conf->fournisseur->enabled)) + { + // Suppliers + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="CatSupList"; // Translation key + $this->import_icon[$r]=$this->picto; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); + $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_societe'=>"Supplier*" + ); + + $this->import_convertvalue_array[$r]=array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), + 'cs.fk_societe'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') + ); + $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_societe'=>"MyBigCompany"); + } } diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index ec6971689b7..87114427243 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -223,6 +223,28 @@ class modProduct extends DolibarrModules 'sp.remise_percent'=>'0' ); } + + if (! empty($conf->stock->enabled)) + { + // Import stocks + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="Stocks"; // Translation key + $this->import_icon[$r]='stock'; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('ps'=>MAIN_DB_PREFIX.'product_stock'); + $this->import_fields_array[$r]=array('ps.fk_product'=>"Product*",'ps.fk_entrepot'=>"Warehouse*", + 'ps.reel'=>"Stock*",'ps.pmp'=>"PMP" + ); + + $this->import_convertvalue_array[$r]=array( + 'ps.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product'), + 'ps.fk_entrepot'=>array('rule'=>'fetchidfromref','classfile'=>'/product/stock/class/entrepot.class.php','class'=>'Entrepot','method'=>'fetch','element'=>'label') + ); + $this->import_examplevalues_array[$r]=array('ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001", + 'ps.reel'=>"10",'ps.pmp'=>"25" + ); + } } 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/ecm/index.php b/htdocs/ecm/index.php index af33f004067..304e9718637 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -168,7 +168,7 @@ if ($action == 'confirm_deletefile') { $langs->load("other"); $result=$ecmdir->fetch($section); - if (! $result > 0) + if (! ($result > 0)) { dol_print_error($db,$ecmdir->error); exit; @@ -396,7 +396,7 @@ print $langs->trans("ECMAreaDesc")."
"; print $langs->trans("ECMAreaDesc2")."
"; print "
\n"; -// Confirm remove file +// Confirm remove file (for non javascript users) if ($action == 'delete' && empty($conf->use_javascript_ajax)) { $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1); diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 259726d354c..16b325b5376 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -772,6 +772,9 @@ ALTER TABLE llx_entrepot ADD COLUMN import_key varchar(14) AFTER fk_user_author; ALTER TABLE llx_product_fournisseur_price ADD COLUMN import_key varchar(14) AFTER fk_user; ALTER TABLE llx_product_stock ADD COLUMN import_key varchar(14) AFTER pmp; ALTER TABLE llx_societe_rib ADD COLUMN import_key varchar(14) AFTER adresse_proprio; +ALTER TABLE llx_categorie_product ADD COLUMN import_key varchar(14) AFTER fk_product; +ALTER TABLE llx_categorie_societe ADD COLUMN import_key varchar(14) AFTER fk_societe; +ALTER TABLE llx_categorie_fournisseur ADD COLUMN import_key varchar(14) AFTER fk_societe; -- Export filter ALTER TABLE llx_export_model ADD COLUMN filter text AFTER field; diff --git a/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql b/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql index 535972686c2..36b1e7ab37b 100644 --- a/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_categorie_fournisseur.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2006 Rodolphe Quiedeville -- Copyright (C) 2012 Laurent Destailleur -- Copyright (C) 2012 Regis Houssin +-- Copyright (C) 2012 Juanjo Menent -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -21,5 +22,6 @@ create table llx_categorie_fournisseur ( fk_categorie integer NOT NULL, - fk_societe integer NOT NULL + fk_societe integer NOT NUL, + import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_categorie_product.sql b/htdocs/install/mysql/tables/llx_categorie_product.sql index f10a5e32c61..2cdcf6802e4 100644 --- a/htdocs/install/mysql/tables/llx_categorie_product.sql +++ b/htdocs/install/mysql/tables/llx_categorie_product.sql @@ -1,6 +1,7 @@ -- ============================================================================ -- Copyright (C) 2005 Brice Davoleau --- Copyright (C) 2005 Matthieu Valleton +-- Copyright (C) 2005 Matthieu Valleton +-- Copyright (C) 2012 Juanjo Menent -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -20,5 +21,6 @@ create table llx_categorie_product ( fk_categorie integer NOT NULL, - fk_product integer NOT NULL + fk_product integer NOT NULL, + import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_categorie_societe.sql b/htdocs/install/mysql/tables/llx_categorie_societe.sql index 1e9da3f158e..46d5a51ea06 100644 --- a/htdocs/install/mysql/tables/llx_categorie_societe.sql +++ b/htdocs/install/mysql/tables/llx_categorie_societe.sql @@ -1,5 +1,6 @@ -- ============================================================================ -- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2012 Juanjo Menent -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -19,5 +20,6 @@ create table llx_categorie_societe ( fk_categorie integer NOT NULL, - fk_societe integer NOT NULL + fk_societe integer NOT NULL, + import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index f8faa8f59e6..c8f340e735b 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -67,7 +67,7 @@ create table llx_product volume_units tinyint DEFAULT NULL, stock integer, -- Current physical stock (dernormalized field) pmp double(24,8) DEFAULT 0 NOT NULL, - canvas varchar(32) DEFAULT 'default@product', + canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, hidden tinyint DEFAULT 0, -- Need permission see also hidden products import_key varchar(14) -- Import key 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/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 30a590016e5..eec0b8b22cf 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -240,13 +240,26 @@ class Entrepot extends CommonObject * Load warehouse data * * @param int $id Warehouse id + * @param string $ref Warehouse label * @return int >0 if OK, <0 if KO */ - function fetch($id) + function fetch($id, $ref='') { + global $conf; + $sql = "SELECT rowid, label, description, statut, lieu, address, cp as zip, ville as town, fk_pays as country_id"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; - $sql .= " WHERE rowid = ".$id; + + if ($id) + { + $sql.= " WHERE rowid = '".$id."'"; + } + + else + { + $sql.= " WHERE entity = " .$conf->entity; + if ($ref) $sql.= " AND label = '".$this->db->escape($ref)."'"; + } dol_syslog(get_class($this)."::fetch sql=".$sql); $result = $this->db->query($sql); 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/class/societe.class.php b/htdocs/societe/class/societe.class.php index f985c1ec674..8b2d9284824 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1757,7 +1757,7 @@ class Societe extends CommonObject $dirsociete=array_merge(array('/core/modules/societe/'),$conf->societe_modules); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$conf->global->SOCIETE_FOURNISSEUR_ADDON.'.php'); + $res=dol_include_once($dirroot.$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON.'.php'); if ($res) break; } $var = $conf->global->SOCIETE_CODEFOURNISSEUR_ADDON; 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