Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
195af1f2bd
@ -134,7 +134,7 @@ abstract class CommonDocGenerator
|
||||
$object->state=getState($object->state_code,0);
|
||||
}
|
||||
|
||||
return array(
|
||||
$array_thirdparty = array(
|
||||
'company_name'=>$object->name,
|
||||
'company_email'=>$object->email,
|
||||
'company_phone'=>$object->phone,
|
||||
@ -163,6 +163,25 @@ abstract class CommonDocGenerator
|
||||
'company_idprof6'=>$object->idprof6,
|
||||
'company_note'=>$object->note
|
||||
);
|
||||
|
||||
// Retrieve extrafields
|
||||
if(is_array($object->array_options) && count($object->array_options))
|
||||
{
|
||||
if(!class_exists('Extrafields'))
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('company',true);
|
||||
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
if($extrafields->attribute_type[$key] == 'price')
|
||||
{
|
||||
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key]).' '.$outputlangs->getCurrencySymbol($conf->currency);
|
||||
}
|
||||
$array_thirdparty=array_merge($array_thirdparty,array('company_options_'.$key => $object->array_options['options_'.$key]));
|
||||
}
|
||||
}
|
||||
return $array_thirdparty;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -44,6 +44,10 @@ class ExtraFields
|
||||
var $attribute_unique;
|
||||
// Array to store if attribute is required or not
|
||||
var $attribute_required;
|
||||
// Array to store parameters of attribute (used in select type)
|
||||
var $attribute_param;
|
||||
// Int to store position of attribute
|
||||
var $attribute_pos;
|
||||
|
||||
var $error;
|
||||
var $errno;
|
||||
@ -669,7 +673,7 @@ class ExtraFields
|
||||
*/
|
||||
function showOutputField($key,$value,$moreparam='')
|
||||
{
|
||||
global $conf;
|
||||
global $conf,$langs;
|
||||
|
||||
$label=$this->attribute_label[$key];
|
||||
$type=$this->attribute_type[$key];
|
||||
|
||||
@ -47,9 +47,9 @@ DictionnarySetup= Dictionnaires
|
||||
Dictionnary= Dictionnaires
|
||||
DisableJavascript= Désactiver les fonctions Javascript et Ajax
|
||||
ConfirmAjax= Utiliser les popups de confirmation Ajax
|
||||
UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
|
||||
UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de tiers (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
|
||||
ActivityStateToSelectCompany= Ajouter une option de filtrage lors des recherches pour afficher/masquer les tiers en exercice ou ayant cessés d'exercer
|
||||
UseSearchToSelectContact= Utiliser un champ avec autocomplétion pour choisir un contact (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante CONTACT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
|
||||
UseSearchToSelectContact= Utiliser un champ avec autocomplétion pour choisir un contact (plutôt qu'une liste déroulante).<br><br>Notez que si vous avez un nombre important de contacts (> 100 000), vous pouvez améliorer les performances en définissant la constante CONTACT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
|
||||
SearchFilter=Options des filtres de recherche
|
||||
NumberOfKeyToSearch=Nb carac. déclenchant recherche: %s
|
||||
ViewFullDateActions= Visualiser les dates des actions en entier dans la fiche tiers
|
||||
@ -931,11 +931,11 @@ MAIN_PROXY_PORT=Port du serveur proxy mandataire
|
||||
MAIN_PROXY_USER=Login pour passer le serveur proxy mandataire
|
||||
MAIN_PROXY_PASS=Mot de passe pour passer le serveur proxy mandataire
|
||||
DefineHereComplementaryAttributes=Définissez ici la liste des attributs supplémentaires, non disponibles en standard, et que vous voulez voir gérer sur les %s.
|
||||
ExtraFields=Attributs suplémentaires
|
||||
ExtraFieldsThirdParties=Attributs suplémentaires (tiers)
|
||||
ExtraFieldsContacts=Attributs suplémentaires (contacts/adresses)
|
||||
ExtraFieldsMember=Attributs suplémentaires (adhérents)
|
||||
ExtraFieldsMemberType=Attributs suplémentaires (type d'adhérents)
|
||||
ExtraFields=Attributs supplémentaires
|
||||
ExtraFieldsThirdParties=Attributs supplémentaires (tiers)
|
||||
ExtraFieldsContacts=Attributs supplémentaires (contacts/adresses)
|
||||
ExtraFieldsMember=Attributs supplémentaires (adhérents)
|
||||
ExtraFieldsMemberType=Attributs supplémentaires (type d'adhérents)
|
||||
ExtraFieldHasWrongValue=L'attribut %s a une valeur incorrecte.
|
||||
AlphaNumOnlyCharsAndNoSpace=uniquement caractères alphanumériques sans espace
|
||||
SendingMailSetup=Configuration de l'envoi par mail
|
||||
@ -973,7 +973,7 @@ NotificationsDesc= La fonction des notifications par emails permet d'envoyer aut
|
||||
ModelModules=Modèle de documents
|
||||
DocumentModelOdt=Genération depuis des modèles OpenDocument (Fichier .ODT OpenOffice, KOffice, TextEdit...)
|
||||
WatermarkOnDraft=Filigrane sur les documents brouillons
|
||||
CompanyIdProfChecker=Id professionel unique
|
||||
CompanyIdProfChecker=Id professionnel unique
|
||||
MustBeUnique=Doit être unique ?
|
||||
MustBeMandatory=Doit être obligatoire?
|
||||
Miscellanous=Divers
|
||||
|
||||
@ -139,6 +139,8 @@ class Societe extends CommonObject
|
||||
var $logo;
|
||||
var $logo_small;
|
||||
var $logo_mini;
|
||||
|
||||
var $array_options;
|
||||
|
||||
var $oldcopy;
|
||||
|
||||
@ -852,6 +854,19 @@ class Societe extends CommonObject
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
$result = 1;
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('company',true);
|
||||
if (count($extralabels)>0) {
|
||||
$this->array_options = array();
|
||||
}
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$this->array_options['options_'.$key]=$label;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -222,19 +222,20 @@ if (empty($reshook))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel);
|
||||
$action = ($action=='add'?'create':'edit');
|
||||
$action = (($action=='add'||$action=='create')?'create':'edit');
|
||||
}
|
||||
}
|
||||
|
||||
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
|
||||
|
||||
if (! $vallabel && ! empty($conf->global->$idprof_mandatory))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
$errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code));
|
||||
$action = ($action=='add'?'create':'edit');
|
||||
$action = (($action=='add'||$action=='create')?'create':'edit');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -712,8 +713,7 @@ else
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
|
||||
dol_htmloutput_errors($error,$errors);
|
||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
||||
|
||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
||||
|
||||
@ -998,14 +998,25 @@ else
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
$e=0;
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$colspan='3';
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:''));
|
||||
print '<tr><td';
|
||||
if (($e % 2) == 0)
|
||||
{
|
||||
print '<tr>';
|
||||
$colspan='0';
|
||||
}
|
||||
print '<td';
|
||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||
print '>'.$label.'</td><td colspan="3">';
|
||||
print '>'.$label.'</td>';
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
print $extrafields->showInputField($key,$value);
|
||||
print '</td></tr>'."\n";
|
||||
print '</td>';
|
||||
|
||||
if (($e % 2) == 1) print '</tr>'."\n";
|
||||
$e++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1426,23 +1437,38 @@ else
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
$old_pos=0;
|
||||
$e=0;
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$colspan = '3';
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
print '<tr><td';
|
||||
|
||||
if (($e % 2) == 0)
|
||||
{
|
||||
print '<tr>'."\n";
|
||||
$colspan = '0';
|
||||
}
|
||||
print '<td';
|
||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||
print '>'.$label.'</td><td colspan="3">';
|
||||
print '>'.$label.'</td>'."\n";
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
print $extrafields->showInputField($key,$value);
|
||||
print "</td></tr>\n";
|
||||
print "</td>"."\n";
|
||||
|
||||
if (($e % 2) == 1 )
|
||||
{
|
||||
print "</tr>\n";
|
||||
}
|
||||
$old_pos = $extrafields->attribute_pos[$key];
|
||||
$e++;
|
||||
}
|
||||
}
|
||||
|
||||
// Logo
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Logo").'</td>';
|
||||
@ -1756,12 +1782,23 @@ else
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
$e=0;
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$colspan='3';
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
|
||||
print '<tr><td>'.$label.'</td><td colspan="3">';
|
||||
if (($e % 2) == 0)
|
||||
{
|
||||
print '<tr>';
|
||||
$colspan='0';
|
||||
}
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
print $extrafields->showOutputField($key,$value);
|
||||
print "</td></tr>\n";
|
||||
print "</td>";
|
||||
|
||||
if (($e % 2) == 1) print '</tr>';
|
||||
$e++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user