From a60516ae0d192d21c974a6096b72030251239a15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Oct 2012 14:16:06 +0200 Subject: [PATCH 01/12] Fix: Show warning only if transaction level not correct --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6416cac14ef..a5b2a8366e8 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)); } From cbff238cbd27861ac7e447a3f249363faa021ad0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Oct 2012 16:23:58 +0200 Subject: [PATCH 02/12] 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 From bc2280e4ab35cc6c1ae14df0befe7b3d3d52869b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 26 Oct 2012 09:12:19 +0200 Subject: [PATCH 03/12] Fix: avoid phpunit warning --- htdocs/exports/class/export.class.php | 2 +- test/phpunit/ExportTest.php | 58 +++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 8e7115137b6..25149294e0d 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -476,7 +476,7 @@ class Export require_once $dir.$file; $objmodel = new $classname($this->db); - if ($sqlquery) $sql = $sqlquery; + if (! empty($sqlquery)) $sql = $sqlquery; else $sql=$this->build_sql($indice, $array_selected, $array_filterValue, $array_filtered); // Run the sql diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 267af4057fc..0d0fcf8186f 100755 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -144,27 +144,77 @@ class ExportTest extends PHPUnit_Framework_TestCase $model='csv'; // Build export file - $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $sql); + $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), array(), $sql); $expectedresult=1; $this->assertEquals($result,$expectedresult); $model='tsv'; // Build export file - $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $sql); + $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), array(), $sql); $expectedresult=1; $this->assertEquals($result,$expectedresult); $model='excel'; // Build export file - $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $sql); + $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), array(), $sql); $expectedresult=1; $this->assertEquals($result,$expectedresult); return true; } + /** + * Test filtered export function + * + * @return void + */ + public function testExportFilteredExport() + { + global $conf,$user,$langs,$db; + + $sql = "SELECT f.facnumber as f_facnumber, f.amount as f_amount, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f"; + + $objexport=new Export($db); + //$objexport->load_arrays($user,$datatoexport); + + // Define properties + $datatoexport='test'; + $array_selected = array("f.facnumber"=>1, "f.amount"=>2, "f.total"=>3, "f.tva"=>4); + $array_export_fields = array("f.facnumber"=>"FacNumber", "f.amount"=>"FacAmount", "f.total"=>"FacTotal", "f.tva"=>"FacVat"); + $array_filtervalue = array("f.amount" => ">100"); + $array_filtered = array("f.amount" => 1); + $array_alias = array("f_facnumber"=>"facnumber", "f_amount"=>"amount", "f_total"=>"total", "f_tva"=>"tva"); + $objexport->array_export_fields[0]=$array_export_fields; + $objexport->array_export_alias[0]=$array_alias; + + dol_mkdir($conf->export->dir_temp); + + $model='csv'; + + // Build export file + $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $array_filtervalue, $array_filtered, $sql); + $expectedresult=1; + $this->assertEquals($result,$expectedresult); + + $model='tsv'; + + // Build export file + $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $array_filtervalue, $array_filtered, $sql); + $expectedresult=1; + $this->assertEquals($result,$expectedresult); + + $model='excel'; + + // Build export file + $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $array_filtervalue, $array_filtered, $sql); + $expectedresult=1; + $this->assertEquals($result,$expectedresult); + + return true; + } + /** * Test export function * @@ -183,7 +233,7 @@ class ExportTest extends PHPUnit_Framework_TestCase $result=$objexport->load_arrays($user,$datatoexport); // Build export file - $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $sql); + $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), array(), $sql); $expectedresult=1; $this->assertEquals($result,$expectedresult); From 4a0336759eb6cdf5742dd4d7224b536c91b8391d Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 26 Oct 2012 09:21:08 +0200 Subject: [PATCH 04/12] Trad: Add ca_ES and es_ES missing translations --- htdocs/langs/ca_ES/admin.lang | 13 +++++++------ htdocs/langs/ca_ES/other.lang | 2 +- htdocs/langs/es_ES/admin.lang | 13 +++++++------ htdocs/langs/es_ES/other.lang | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 48569efa05e..06873ef9f89 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -1059,14 +1059,14 @@ LDAPServerUseTLS=Usuari TLS LDAPServerUseTLSExample=El seu servidor utilitza TLS LDAPServerDn=DN del servidor LDAPAdminDn=DN del administrador -LDAPAdminDnExample=DN complet (ej: cn=adminldap,dc=my-domain,dc=com) +LDAPAdminDnExample=DN complet (ej: cn=adminldap,dc=example,dc=com) LDAPPassword=Contrasenya de l'administrador LDAPUserDn=DN dels usuaris -LDAPUserDnExample=DN complet (ej: ou=users,dc=my-domain,dc=com) +LDAPUserDnExample=DN complet (ej: ou=users,dc=example,dc=com) LDAPGroupDn=DN dels grups -LDAPGroupDnExample=DN complet (ej: ou=groups,dc=my-domain,dc=com) +LDAPGroupDnExample=DN complet (ej: ou=groups,dc=example,dc=com) LDAPServerExample=Adreça del servidor (ej: localhost, 192.168.0.2, ldaps://ldap.example.com/) -LDAPServerDnExample=DN complet (ej: dc=my-domain,dc=com) +LDAPServerDnExample=DN complet (ej: dc=example,dc=com) LDAPPasswordExample=Contrasenya del administrador LDAPDnSynchroActive=Sincronització d'usuaris i grups LDAPDnSynchroActiveExample=Sincronització LDAP vers Dolibarr ó Dolibarr vers LDAP @@ -1076,9 +1076,9 @@ LDAPDnContactActiveExample=Sincronització activada/desactivada LDAPDnMemberActive=Sincronització dels membres LDAPDnMemberActiveExample=Sincronització activada/desactivada LDAPContactDn=DN dels contactes Dolibarr -LDAPContactDnExample=DN complet (ej: ou=contacts,dc=my-domain,dc=com) +LDAPContactDnExample=DN complet (ej: ou=contacts,dc=example,dc=com) LDAPMemberDn=DN dels membres -LDAPMemberDnExample=DN complet (ex: ou=members,dc=society,dc=com) +LDAPMemberDnExample=DN complet (ex: ou=members,dc=example,dc=com) LDAPMemberObjectClassList=Llista de objectClass LDAPMemberObjectClassListExample=Llista de ObjectClass que defineixen els atributs d'un registre (ex: top, inetorgperson o top, user for active directory) LDAPUserObjectClassList=Llista de objectClass @@ -1094,6 +1094,7 @@ LDAPTestSynchroContact=Provar la sincronització de contactes LDAPTestSynchroUser=Provar la sincronització d'usuaris LDAPTestSynchroGroup=Provar la sincronització de grups LDAPTestSynchroMember=Provar la sincronització de membres +LDAPTestSearch=Provar una recerca LDAP LDAPSynchroOK=Prova de sincronització realitzada correctament LDAPSynchroKO=Prova de sincronització errònia LDAPSynchroKOMayBePermissions=Error de la prova de sincronització. Comproveu que la connexió al servidor sigui correcta i que permet les actualitzacions LDAP diff --git a/htdocs/langs/ca_ES/other.lang b/htdocs/langs/ca_ES/other.lang index 2ff868eec4f..45fadd6eefe 100644 --- a/htdocs/langs/ca_ES/other.lang +++ b/htdocs/langs/ca_ES/other.lang @@ -113,7 +113,7 @@ VolumeUnitmm3=mm3 (µl) VolumeUnitounce=unça VolumeUnitlitre=litre VolumeUnitgallon=galó -Size=tamany +Size=Tamany SizeUnitm=m SizeUnitdm=dm SizeUnitcm=cm diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 5d454ea8565..d5a9df404a9 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -1062,12 +1062,12 @@ LDAPServerUseTLS=Usuario TLS LDAPServerUseTLSExample=Su servidor utiliza TLS LDAPServerDn=DN del servidor LDAPAdminDn=DN del administrador -LDAPAdminDnExample=DN completo (ej: cn=adminldap,dc=my-domain,dc=com) +LDAPAdminDnExample=DN completo (ej: cn=adminldap,dc=example,dc=com) LDAPPassword=Contraseña del administrador LDAPUserDn=DN de los usuarios -LDAPUserDnExample=DN completo (ej: ou=users,dc=my-domain,dc=com) +LDAPUserDnExample=DN completo (ej: ou=users,dc=example,dc=com) LDAPGroupDn=DN de los grupos -LDAPGroupDnExample=DN completo (ej: ou=groups,dc=my-domain,dc=com) +LDAPGroupDnExample=DN completo (ej: ou=groups,dc=example,dc=com) LDAPServerExample=Dirección del servidor (ej: localhost, 192.168.0.2, ldaps://ldap.example.com/) LDAPServerDnExample=DN completo (ej: dc=my-domain,dc=com) LDAPPasswordExample=Contraseña del administrador @@ -1079,7 +1079,7 @@ LDAPDnContactActiveExample=Sincronización activada/desactivada LDAPDnMemberActive=Sincronización de los miembros LDAPDnMemberActiveExample=Sincronización activada/desactivada LDAPContactDn=DN de los contactos Dolibarr -LDAPContactDnExample=DN completo (ej: ou=contacts,dc=my-domain,dc=com) +LDAPContactDnExample=DN completo (ej: ou=contacts,dc=example,dc=com) LDAPMemberDn=DN de los miembros LDAPMemberDnExample=DN completo (ex: ou=members,dc=society,dc=com) LDAPMemberObjectClassList=Lista de objectClass @@ -1091,12 +1091,13 @@ LDAPGroupObjectClassListExample=Lista de ObjectClass que definen los atributos d LDAPContactObjectClassList=Lista de objectClass LDAPContactObjectClassListExample=Lista de objectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user for active directory) LDAPMemberTypeDn=DN de los tipos de miembros -LDAPMemberTypeDnExample=DN complet (ej: ou=type_members,dc=society,dc=com) +LDAPMemberTypeDnExample=DN complet (ej: ou=type_members,dc=example,dc=com) LDAPTestConnect=Probar la conexión LDAP LDAPTestSynchroContact=Probar la sincronización de contactos LDAPTestSynchroUser=Probar la sincronización de usuarios LDAPTestSynchroGroup=Probar la sincronización de grupos LDAPTestSynchroMember=Probar la sincronización de miembros +LDAPTestSearch=Probar una búsqueda LDAP LDAPSynchroOK=Prueba de sincronización realizada correctamente LDAPSynchroKO=Prueba de sincronización erronea LDAPSynchroKOMayBePermissions=Error de la prueba de sincronización. Compruebe que la conexión al servidor sea correcta y que permite las actualizaciones LDAP @@ -1129,7 +1130,7 @@ LDAPFieldCommonNameExample=Ejemplo : cn LDAPFieldName=Nombre LDAPFieldNameExample=Ejemplo : sn LDAPFieldFirstName=Nombre -LDAPFieldFirstNameExample=Ejemplo : givenname +LDAPFieldFirstNameExample=Ejemplo : givenName LDAPFieldMail=E-Mail LDAPFieldMailExample=Ejemplo : mail LDAPFieldPhone=Teléfono trabajo diff --git a/htdocs/langs/es_ES/other.lang b/htdocs/langs/es_ES/other.lang index df10df64e11..2b8c16417f0 100644 --- a/htdocs/langs/es_ES/other.lang +++ b/htdocs/langs/es_ES/other.lang @@ -112,7 +112,7 @@ VolumeUnitmm3=mm3 (µl) VolumeUnitounce=onza VolumeUnitlitre=litro VolumeUnitgallon=galón -Size=tamaño +Size=Tamaño SizeUnitm=m SizeUnitdm=dm SizeUnitcm=cm From c521a77e92dc8d162c7b26a95a352ac7095f8d4a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 26 Oct 2012 15:20:47 +0200 Subject: [PATCH 05/12] New: add key generator in webservices admin page --- htdocs/core/modules/modProjet.class.php | 2 ++ htdocs/webservices/admin/webservices.php | 41 +++++++++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 52f2040caff..01b39fadfb0 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -42,6 +42,8 @@ class modProjet extends DolibarrModules */ function __construct($db) { + global $conf; + $this->db = $db; $this->numero = 400; diff --git a/htdocs/webservices/admin/webservices.php b/htdocs/webservices/admin/webservices.php index 85fc5023455..dccfce8ed82 100644 --- a/htdocs/webservices/admin/webservices.php +++ b/htdocs/webservices/admin/webservices.php @@ -1,7 +1,8 @@ - * Copyright (C) 2005-2010 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2012 Regis Houssin * * 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 @@ -28,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $langs->load("admin"); -if (! $user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); $actionsave=GETPOST("save"); -$mesg=''; // Sauvegardes parametres if ($actionsave) @@ -45,12 +46,12 @@ if ($actionsave) if ($i >= 1) { $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -80,7 +81,10 @@ print ""; print ''; print ''.$langs->trans("KeyForWebServicesAccess").''; -print ''; +print ''; +if (! empty($conf->use_javascript_ajax)) + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +print ''; print ' '; print ''; @@ -92,8 +96,6 @@ print ''; print ''; -dol_htmloutput_mesg($mesg); - print '

'; @@ -154,7 +156,24 @@ print '
'; print '
'; print $langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php'); -$db->close(); +if (! empty($conf->use_javascript_ajax)) +{ + print "\n".''; +} + llxFooter(); +$db->close(); ?> From 970933ec7f7dc2c405108243b675bde0294ca7fc Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 26 Oct 2012 17:29:41 +0200 Subject: [PATCH 06/12] Fix: [ bug #579 ] Multi-Company and imports --- .../modules/import/import_csv.modules.php | 48 +++++++++++++++++-- 1 file changed, 44 insertions(+), 4 deletions(-) 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; + } +} + ?> From 7aec22769449badcb723578a7bcc84f5ee481ecb Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 26 Oct 2012 17:52:53 +0200 Subject: [PATCH 07/12] New: More import options. Products stocks --- htdocs/core/modules/modProduct.class.php | 22 +++++++++++++++++++ htdocs/product/stock/class/entrepot.class.php | 17 ++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) 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/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); From 425ebae8023aa2595d367e1621f355be5bd0c46b Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 26 Oct 2012 18:19:04 +0200 Subject: [PATCH 08/12] New: More import options. Products categories --- htdocs/categories/class/categorie.class.php | 15 +++++- htdocs/core/modules/modCategorie.class.php | 51 +++++++++++++++++++ .../install/mysql/migration/3.2.0-3.3.0.sql | 1 + .../mysql/tables/llx_categorie_product.sql | 6 ++- 4 files changed, 69 insertions(+), 4 deletions(-) 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/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index cb5fe07ee5f..4cdc10e2357 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -178,6 +178,57 @@ 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]="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('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"); + } + + //Customers + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="Clientes por categoría"; // 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('co'=>MAIN_DB_PREFIX.'categorie_societe'); + $this->import_fields_array[$r]=array('co.fk_categorie'=>"Categorie*",'co.fk_societe'=>"Tercero*" + ); + + $this->import_convertvalue_array[$r]=array( + 'co.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), + 'co.fk_societe'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') + ); + $this->import_examplevalues_array[$r]=array('co.fk_categorie'=>"Nombre categoría",'co.fk_societe'=>"Nombre cliente"); + + // Suppliers + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]="Proveedores por categoría"; // 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('co'=>MAIN_DB_PREFIX.'categorie_fournisseur'); + $this->import_fields_array[$r]=array('co.fk_categorie'=>"Categorie*",'co.fk_societe'=>"Tercero*" + ); + + $this->import_convertvalue_array[$r]=array( + 'co.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), + 'co.fk_societe'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') + ); + $this->import_examplevalues_array[$r]=array('co.fk_categorie'=>"Nombre categoria",'co.fk_societe'=>"Nombre proveedor"); } 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..d9dd806d397 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,7 @@ 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; -- Export filter ALTER TABLE llx_export_model ADD COLUMN filter text AFTER field; 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; From d4df585e3c00427b125e320dc307bb107180ce3f Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 26 Oct 2012 18:34:49 +0200 Subject: [PATCH 09/12] New: More import options. Customer and suppliers categories --- htdocs/core/modules/modCategorie.class.php | 70 ++++++++++--------- .../install/mysql/migration/3.2.0-3.3.0.sql | 2 + .../tables/llx_categorie_fournisseur.sql | 4 +- .../mysql/tables/llx_categorie_societe.sql | 4 +- 4 files changed, 46 insertions(+), 34 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 4cdc10e2357..67f10c599d4 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -197,38 +197,44 @@ class modCategorie extends DolibarrModules ); $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456"); } - - //Customers - $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="Clientes por categoría"; // 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('co'=>MAIN_DB_PREFIX.'categorie_societe'); - $this->import_fields_array[$r]=array('co.fk_categorie'=>"Categorie*",'co.fk_societe'=>"Tercero*" - ); - - $this->import_convertvalue_array[$r]=array( - 'co.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), - 'co.fk_societe'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') - ); - $this->import_examplevalues_array[$r]=array('co.fk_categorie'=>"Nombre categoría",'co.fk_societe'=>"Nombre cliente"); - - // Suppliers - $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="Proveedores por categoría"; // 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('co'=>MAIN_DB_PREFIX.'categorie_fournisseur'); - $this->import_fields_array[$r]=array('co.fk_categorie'=>"Categorie*",'co.fk_societe'=>"Tercero*" - ); - - $this->import_convertvalue_array[$r]=array( - 'co.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), - 'co.fk_societe'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') - ); - $this->import_examplevalues_array[$r]=array('co.fk_categorie'=>"Nombre categoria",'co.fk_societe'=>"Nombre proveedor"); + + 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'=>"Categorie*",'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'=>"Categorie*",'co.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/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index d9dd806d397..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 @@ -773,6 +773,8 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN import_key varchar(14) AFTE 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_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; From 9a05bc8e8379ffeb3058f419a1ee5b721afc469b Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 26 Oct 2012 18:38:34 +0200 Subject: [PATCH 10/12] New: More import options. Products categories --- htdocs/core/modules/modCategorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 67f10c599d4..c3252510d8e 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -226,7 +226,7 @@ class modCategorie extends DolibarrModules $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'=>"Categorie*",'co.fk_societe'=>"Supplier*" + $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Categorie*",'cs.fk_societe'=>"Supplier*" ); $this->import_convertvalue_array[$r]=array( From 3821bf8c66a8ac1242c8db44b75a34d037dae2e1 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 26 Oct 2012 18:43:34 +0200 Subject: [PATCH 11/12] New: More import options. Products categories --- htdocs/core/modules/modCategorie.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index c3252510d8e..55277e2a6f1 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -207,7 +207,7 @@ class modCategorie extends DolibarrModules $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'=>"Categorie*",'cs.fk_societe'=>"ThirdParty*" + $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_societe'=>"ThirdParty*" ); $this->import_convertvalue_array[$r]=array( @@ -226,7 +226,7 @@ class modCategorie extends DolibarrModules $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'=>"Categorie*",'cs.fk_societe'=>"Supplier*" + $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_societe'=>"Supplier*" ); $this->import_convertvalue_array[$r]=array( From 9ada60afbc3f00ba5b6afc6d274c0116109c5d95 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 26 Oct 2012 18:53:56 +0200 Subject: [PATCH 12/12] New: More import options. Products categories --- htdocs/core/modules/modCategorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 55277e2a6f1..4f4ecba0714 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -184,7 +184,7 @@ class modCategorie extends DolibarrModules //Products $r++; $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatSupList"; // Translation key + $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');