diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php index 03fd8684f50..5a305d87f2c 100644 --- a/htdocs/accountancy/admin/journaux.php +++ b/htdocs/accountancy/admin/journaux.php @@ -1,10 +1,10 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -48,8 +48,8 @@ $list = array ( 'ACCOUNTING_SELL_JOURNAL', 'ACCOUNTING_PURCHASE_JOURNAL', 'ACCOUNTING_SOCIAL_JOURNAL', - 'ACCOUNTING_CASH_JOURNAL', - 'ACCOUNTING_MISCELLANEOUS_JOURNAL' + 'ACCOUNTING_MISCELLANEOUS_JOURNAL', + 'ACCOUNTING_EXPENSEREPORT_JOURNAL' ); /* diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 561e299b937..d5c78761989 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -543,7 +543,7 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''; - print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',1) . ''; + print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . ''; print ""; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2f85461887e..ad26b0c409d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1539,7 +1539,7 @@ class Commande extends CommonOrder if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; - // Retreive all extrafield for invoice + // Retrieve all extrafields for invoice // fetch optionals attributes and labels require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields=new ExtraFields($this->db); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 7193634af54..254185cc63d 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -37,8 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; -if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -1279,9 +1279,7 @@ else * Lines of contracts */ - if ($conf->product->enabled || $conf->service->enabled) { - $productstatic=new Product($db); - } + $productstatic=new Product($db); $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; @@ -1343,19 +1341,28 @@ else $productstatic->id=$objp->fk_product; $productstatic->type=$objp->ptype; $productstatic->ref=$objp->pref; - print $productstatic->getNomUrl(1,'',20); + $text = $productstatic->getNomUrl(1,'',20); if ($objp->label) { - print ' - '; + $text .= ' - '; $productstatic->ref=$objp->label; - print $productstatic->getNomUrl(0,'',16); + $text .= $productstatic->getNomUrl(0,'',16); } - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($objp->description)) - print '
'.dol_nl2br($objp->description); + $description = $objp->description; + + // Add description in form + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + $text .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'
'.dol_htmlentitiesbr($objp->description):''; + $description = ''; // Already added into main visible desc + } + + echo $form->textwithtooltip($text,$description,3,'','',$cursorline,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + print ''; } else - { + { print ''.dol_htmlentitiesbr($objp->description)."\n"; } // TVA diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index cdf2d789d09..08bc8387387 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -237,8 +237,8 @@ class Contrat extends CommonObject /** * Activate a contract line * - * @param User $user Objet User qui active le contrat - * @param int $line_id Id de la ligne de detail a activer + * @param User $user Objet User who activate contract + * @param int $line_id Id of line to activate * @param int $date Date d'ouverture * @param int|string $date_end Date fin prevue * @param string $comment A comment typed by user @@ -284,9 +284,9 @@ class Contrat extends CommonObject /** * Close a contract line * - * @param User $user Objet User qui active le contrat - * @param int $line_id Id de la ligne de detail a activer - * @param int $date_end Date fin + * @param User $user Objet User who close contract + * @param int $line_id Id of line to close + * @param int $date_end Date end * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ @@ -576,7 +576,7 @@ class Contrat extends CommonObject $result=$this->fetch_lines(); if ($result < 0) { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -3; } @@ -599,7 +599,7 @@ class Contrat extends CommonObject } /** - * Load lignes array into this->lines + * Load lines array into this->lines * * @return ContratLigne[] Return array of contract lines */ @@ -624,7 +624,7 @@ class Contrat extends CommonObject $this->lines=array(); // Selectionne les lignes contrats liees a un produit - $sql = "SELECT p.label, p.description as product_desc, p.ref,"; + $sql = "SELECT p.label as product_label, p.description as product_desc, p.ref as product_ref,"; $sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,"; $sql.= " d.total_ht,"; $sql.= " d.total_tva,"; @@ -684,10 +684,12 @@ class Contrat extends CommonObject $line->fk_user_cloture = $objp->fk_user_cloture; $line->fk_unit = $objp->fk_unit; - $line->ref = $objp->ref; - $line->libelle = $objp->label; // Label produit - $line->label = $objp->label; // For backward compatibility - $line->product_desc = $objp->product_desc; // Description produit + $line->ref = $objp->product_ref; // deprecated + $line->label = $objp->product_label; // deprecated + $line->libelle = $objp->product_label; // deprecated + $line->product_ref = $objp->product_ref; // Ref product + $line->product_desc = $objp->product_desc; // Description product + $line->product_label = $objp->product_label; // Label product $line->description = $objp->description; @@ -2339,7 +2341,10 @@ class ContratLigne extends CommonObjectLine $sql.= " t.fk_contrat,"; $sql.= " t.fk_product,"; $sql.= " t.statut,"; - $sql.= " t.label,"; + $sql.= " t.label,"; // This field is not used. Only label of product + $sql.= " p.ref as product_ref,"; + $sql.= " p.label as product_label,"; + $sql.= " p.description as product_desc,"; $sql.= " t.description,"; $sql.= " t.date_commande,"; $sql.= " t.date_ouverture_prevue as date_ouverture_prevue,"; @@ -2368,7 +2373,7 @@ class ContratLigne extends CommonObjectLine $sql.= " t.fk_user_cloture,"; $sql.= " t.commentaire,"; $sql.= " t.fk_unit"; - $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t"; + $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = t.fk_product"; if ($id) $sql.= " WHERE t.rowid = ".$id; if ($ref) $sql.= " WHERE t.rowid = '".$this->db->escape($ref)."'"; @@ -2387,7 +2392,10 @@ class ContratLigne extends CommonObjectLine $this->fk_contrat = $obj->fk_contrat; $this->fk_product = $obj->fk_product; $this->statut = $obj->statut; - $this->label = $obj->label; + $this->product_ref = $obj->product_ref; + $this->product_label = $obj->product_label; + $this->product_description = $obj->product_description; + $this->label = $obj->label; // deprecated. We do not use this field. Only ref and label of product, and description of contract line $this->description = $obj->description; $this->date_commande = $this->db->jdate($obj->date_commande); $this->date_ouverture_prevue = $this->db->jdate($obj->date_ouverture_prevue); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 71cf0c6577d..a6cac8a5276 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -107,7 +107,7 @@ class ExtraFields * @param string $label label of attribute * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour') * @param int $pos Position of attribute - * @param int $size Size/length of attribute + * @param string $size Size/length of attribute * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not @@ -128,7 +128,7 @@ class ExtraFields // Create field into database except for separator type which is not stored in database if ($type != 'separate') { - $result=$this->create($attrname,$type,$size,$elementtype, $unique, $required, $default_value, $param, $perms, $list); + $result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list); } $err1=$this->errno; if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') @@ -156,7 +156,7 @@ class ExtraFields * * @param string $attrname code of attribute * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour') - * @param int $length Size/length of attribute + * @param string $length Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not @@ -233,7 +233,7 @@ class ExtraFields * @param string $label label of attribute * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float') * @param int $pos Position of attribute - * @param int $size Size/length of attribute + * @param string $size Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 3233b479b6c..9266b8aa3a6 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -773,20 +773,22 @@ class FormOther } /** - * Return HTML combo list of month + * Return HTML combo list of month * - * @param string $selected Preselected value - * @param string $htmlname Nom de la zone select - * @param int $useempty Affiche valeur vide dans liste - * @return string + * @param string $selected Preselected value + * @param string $htmlname Name of HTML select object + * @param int $useempty Show empty in list + * @param int $longlabel Show long label + * @return string */ - function select_month($selected='',$htmlname='monthid',$useempty=0) + function select_month($selected='',$htmlname='monthid',$useempty=0,$longlabel=0) { global $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $montharray = monthArray($langs, 1); // Get array + if ($longlabel) $montharray = monthArray($langs, 0); // Get array + else $montharray = monthArray($langs, 1); $select_month = '