Merge pull request #1273 from FHenry/develop

Contining task 172
This commit is contained in:
Laurent Destailleur 2013-11-04 10:34:36 -08:00
commit e11b95921f
8 changed files with 74 additions and 20 deletions

View File

@ -87,7 +87,7 @@ if ($action == 'add')
$mesg[]=$langs->trans("ErrorNoValueForRadioType");
$action = 'create';
}
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param'))
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param'))
{
// Construct array for parameter (value of select list)
$parameters = GETPOST('param');
@ -124,11 +124,22 @@ if ($action == 'add')
$default_value = GETPOST('default_value');
$parameters = GETPOST('param');
$parameters_array = explode("\r\n",$parameters);
foreach($parameters_array as $param_ligne)
//In sellist we have only one line and it can have come to do SQL expression
if (GETPOST('type')=='sellist') {
foreach($parameters_array as $param_ligne)
{
$params['options'] = array($parameters=>null);
}
}
else
{
list($key,$value) = explode(',',$param_ligne);
$params['options'][$key] = $value;
}
//Esle it's separated key/value and coma list
foreach($parameters_array as $param_ligne)
{
list($key,$value) = explode(',',$param_ligne);
$params['options'][$key] = $value;
}
}
$result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params);
if ($result > 0)
@ -215,7 +226,7 @@ if ($action == 'update')
$mesg[]=$langs->trans("ErrorNoValueForRadioType");
$action = 'edit';
}
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param'))
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param'))
{
// Construct array for parameter (value of select list)
$parameters = GETPOST('param');
@ -251,10 +262,21 @@ if ($action == 'update')
// Construct array for parameter (value of select list)
$parameters = GETPOST('param');
$parameters_array = explode("\r\n",$parameters);
foreach($parameters_array as $param_ligne)
//In sellist we have only one line and it can have come to do SQL expression
if (GETPOST('type')=='sellist') {
foreach($parameters_array as $param_ligne)
{
$params['options'] = array($parameters=>null);
}
}
else
{
list($key,$value) = explode(',',$param_ligne);
$params['options'][$key] = $value;
//Esle it's separated key/value and coma list
foreach($parameters_array as $param_ligne)
{
list($key,$value) = explode(',',$param_ligne);
$params['options'][$key] = $value;
}
}
$result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params);
if ($result > 0)

View File

@ -693,15 +693,23 @@ class ExtraFields
// 1 2 : label field name Nom du champ contenant le libelle
// 2 3 : key fields name (if differ of rowid)
// 3 4 : key field parent (for dependent lists)
// 4 5 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
$keyList='rowid';
if (count($InfoFieldList)>=3)
$keyList=$InfoFieldList[2].' as rowid';
if (count($InfoFieldList)>=4) {
if (count($InfoFieldList)>=3) {
list($parentName, $parentField) = explode('|', $InfoFieldList[3]);
$keyList.= ', '.$parentField;
}
if (count($InfoFieldList)>=4 && !empty($InfoFieldList[4])) {
if (strpos($InfoFieldList[4], 'extra')!==false) {
$keyList='main.'.$InfoFieldList[2].' as rowid';
}else {
$keyList=$InfoFieldList[2].' as rowid';
}
}
$fields_label = explode('|',$InfoFieldList[1]);
if(is_array($fields_label)) {
@ -717,6 +725,16 @@ class ExtraFields
$sql = 'SELECT '.$keyList;
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
if (!empty($InfoFieldList[4])) {
//We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra')!==false) {
$sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra';
$sql.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
}else {
$sql.= ' WHERE '.$InfoFieldList[4];
}
}
//$sql.= ' WHERE entity = '.$conf->entity;
//print $sql;

View File

@ -325,7 +325,9 @@ create table llx_actioncomm_resources
fk_actioncomm integer NOT NULL,
element_type varchar(50) NOT NULL,
fk_element integer NOT NULL,
fk_element_status varchar(32) NULL
answer_status varchar(50) NULL,
mandatory smallint,
transparent smallint
) ENGINE=innodb;
ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX idx_actioncomm_resources_idx1 (fk_actioncomm, element_type, fk_element);
ALTER TABLE llx_actioncomm_resources ADD INDEX idx_actioncomm_resources_fk_element (fk_element);

View File

@ -26,5 +26,7 @@ create table llx_actioncomm_resources
fk_actioncomm integer NOT NULL,
element_type varchar(50) NOT NULL,
fk_element integer NOT NULL,
fk_element_status varchar(32) NULL
answer_status varchar(50) NULL,
mandatory smallint,
transparent smallint
) ENGINE=innodb;

View File

@ -368,7 +368,7 @@ ExtrafieldRadio=Radio button
ExtrafieldParamHelpselect=Parameters list have to be like key,value<br><br> for exemple : <br>1,value1<br>2,value2<br>3,value3<br>...<br><br>In order to have the list depending on another :<br>1,value1|parent_list_code:parent_key<br>2,value2|parent_list_code:parent_key
ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value<br><br> for exemple : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpradio=Parameters list have to be like key,value<br><br> for exemple : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpsellist=Parameters list have come from table<br><br> for exemple : <br>c_typent:libelle:id<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column
ExtrafieldParamHelpsellist=Parameters list have come from table<br><br> for exemple : <br>c_typent:libelle:id::filter<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter <br> filter can be a simple test (eg active=1) to display only active value <br> if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)
LibraryToBuildPDF=Library used to build PDF
WarningUsingFPDF=Warning: Your <b>conf.php</b> contains directive <b>dolibarr_pdf_force_fpdf=1</b>. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.<br>To solve this and have a full support of PDF generation, please download <a href="http://www.tcpdf.org/" target="_blank">TCPDF library</a>, then comment or remove the line <b>$dolibarr_pdf_force_fpdf=1</b>, and add instead <b>$dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir'</b>
LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:<br>1 : local tax apply on products and services without vat (vat is not applied on local tax)<br>2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)<br>3 : local tax apply on products without vat (vat is not applied on local tax)<br>4 : local tax apply on products before vat (vat is calculated on amount + localtax)<br>5 : local tax apply on services without vat (vat is not applied on local tax)<br>6 : local tax apply on services before vat (vat is calculated on amount + localtax)

View File

@ -368,7 +368,7 @@ ExtrafieldRadio=Bouton radio
ExtrafieldParamHelpselect=La liste doit être de la forme clef,valeur<br><br> par exemple : <br>1,valeur1<br>2,valeur2<br>3,valeur3<br>...<br><br>Pour que la liste soit dépendante d'une autre :<br>1,valeur1|code_liste_parent:clef_parent<br>2,valeur2|code_liste_parent:clef_parent
ExtrafieldParamHelpcheckbox=La liste doit être de la forme clef,valeur<br><br> par exemple : <br>1,valeur1<br>2,valeur2<br>3,valeur3<br>...
ExtrafieldParamHelpradio=La liste doit être de la forme clef,valeur<br><br> par exemple : <br>1,valeur1<br>2,valeur2<br>3,valeur3<br>...
ExtrafieldParamHelpsellist=La liste vient d'une table<br><br> par exemple : <br>c_typent:libelle:id<br><br>Pour que la liste soit dépendante d'une autre :<br>c_typent:libelle:id:code_liste_parent|colonne_parent
ExtrafieldParamHelpsellist=La liste vient d'une table<br><br> par exemple : <br>c_typent:libelle:id::filter<br><br>Pour que la liste soit dépendante d'une autre :<br>c_typent:libelle:id:code_liste_parent|colonne_parent:filter<br> filter peux être un test simple active=1 pour ne proposer que les valeur active<br> si vous voulez faire un filtre sur des attributs supplémentaires utiliser la syntax extra.champ=...(où champ est la code de l'attribut supplémentaire)
LibraryToBuildPDF=Bibliothèque utilisée pour la génération des PDF
WarningUsingFPDF=Attention : votre fichier <b>conf.php</b> contient la directive <b>dolibarr_pdf_force_fpdf=1</b>. Cela signifie que vous utilisez la librairie FPDF pour générer vos fichiers PDF. Cette librairie est ancienne et ne couvre pas de nombreuses fonctionnalités (Unicode, transparence des images, langues cyrilliques, arabes ou asiatiques...), aussi vous pouvez rencontrer des problèmes durant la génération des PDF.<br>Pour résoudre cela et avoir une prise en charge complète de PDF, vous pouvez télécharger la <a href="http://www.tcpdf.org/" target="_blank">bibliothèque TCPDF</a> puis commenter ou supprimer la ligne <b>$dolibarr_pdf_force_fpdf=1</b>, et ajouter à la place <b>$dolibarr_lib_TCPDF_PATH='chemin_vers_TCPDF'</b>
LocalTaxDesc=Certains pays appliquent 2 voire 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:<br>1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)<br>2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)<br>3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)<br>4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)<br>5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)<br>6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale)

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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
@ -46,6 +47,9 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productdocuments'));
// Get parameters
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@ -68,6 +72,10 @@ if ($id > 0 || ! empty($ref))
}
$modulepart='produit';
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
/*
* Action envoie fichier
*/
@ -106,6 +114,8 @@ if ($object->id)
$picto=($object->type==1?'service':'product');
dol_fiche_head($head, 'documents', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);

View File

@ -1518,22 +1518,22 @@ class Societe extends CommonObject
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut6').' '.$langs->trans("ActivityCeased");
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8').' '.$langs->trans("ActivityCeased");
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity");
}
if ($mode == 3)
{
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut6');
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8');
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4');
}
if ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut6').' '.$langs->trans("ActivityCeased");
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8').' '.$langs->trans("ActivityCeased");
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity");
}
if ($mode == 5)
{
if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut6');
if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut8');
if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4');
}
}