'.$langs->trans('PaymentConditionsShort').' ';
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 316c589f046..c77aea4178e 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1871,10 +1871,12 @@ if ($action == 'create')
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
$soc = $objectsrc->thirdparty;
- $cond_reglement_id = (! empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (! empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 1));
- $mode_reglement_id = (! empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (! empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
- $remise_percent = (! empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (! empty($soc->remise_percent) ? $soc->remise_percent : 0));
- $remise_absolue = (! empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (! empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
+
+ $cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
+ $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
+ $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
+ $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
+ $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
@@ -1884,11 +1886,11 @@ if ($action == 'create')
}
else
{
- $cond_reglement_id = $soc->cond_reglement_id;
- $mode_reglement_id = $soc->mode_reglement_id;
- $remise_percent = $soc->remise_percent;
- $remise_absolue = 0;
- $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : ''; // Do not set 0 here (0 for a date is 1970)
+ $cond_reglement_id = $soc->cond_reglement_id;
+ $mode_reglement_id = $soc->mode_reglement_id;
+ $remise_percent = $soc->remise_percent;
+ $remise_absolue = 0;
+ $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; // Do not set 0 here (0 for a date is 1970)
}
$absolute_discount = $soc->getAvailableDiscounts();
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index b99467c20f0..b6065909ade 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -363,7 +363,8 @@ class FormOther
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
- if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.fk_societe = ".($user->societe_id?$user->societe_id:0);
+ if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
+ if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_societe = ".$user->societe_id;
// Add existing sales representatives of thirdparty of external user
if (empty($user->rights->user->user->lire) && $user->societe_id)
{
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 9e0d78118b0..2c371d4afcd 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -194,6 +194,7 @@ class FormProjets
if (!empty($this->societe->id)) {
$sql.= " AND fk_soc=".$this->societe->id;
}
+ $sql.= ' AND entity='.$conf->entity;
$sql.= " ORDER BY ref DESC";
dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG);
diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php
index be898d8a114..ab9d6e5850e 100644
--- a/htdocs/core/db/mysql.class.php
+++ b/htdocs/core/db/mysql.class.php
@@ -825,8 +825,16 @@ class DoliDBMysql extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
- dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
- return -1;
+ if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
+ {
+ dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
+ return -1;
+ }
+ else
+ {
+ // If user already exists, we continue to set permissions
+ dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
+ }
}
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 09199f84318..40061a4fa1a 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -829,8 +829,16 @@ class DoliDBMysqli extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
- dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
- return -1;
+ if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
+ {
+ dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
+ return -1;
+ }
+ else
+ {
+ // If user already exists, we continue to set permissions
+ dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
+ }
}
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index d2d380ad45c..bb55e57f86b 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -39,7 +39,7 @@
* @param string $filterd Filter of done by user
* @param int $pid Product id
* @param int $socid Third party id
- * @param array $showextcals Array with list of external calendars, or -1 to show no legend
+ * @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
* @param string $actioncode Preselected value of actioncode for filter on type
* @return void
*/
@@ -136,7 +136,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '});' . "\n";
print '' . "\n";
print '';
- if (! empty($conf->global->MAIN_JS_SWITCH_AGENDA))
+ if (! empty($conf->use_javascript_ajax))
{
if (count($showextcals) > 0)
{
@@ -147,7 +147,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '';
print '' . "\n";
print ' ' . $val ['name'];
@@ -434,9 +437,9 @@ function actions_prepare_head($object)
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;
-
+
complete_head_from_modules($conf,$langs,$object,$head,$h,'action');
-
+
complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove');
return $head;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index a8609af05bd..a22c38834cf 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3694,6 +3694,7 @@ function dol_textishtml($msg,$option=0)
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
+ elseif (preg_match('//i',$msg)) return true;
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
elseif (preg_match('/[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
return false;
@@ -4588,4 +4589,3 @@ function natural_search($fields, $value)
}
return " AND " . ($end > 1? '(' : '') . $res;
}
-
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 6f8a86389bc..09b39f22812 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1036,10 +1036,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
if (empty($hideref))
{
- if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
+ if ($issupplierline) $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref
else $ref_prodserv = $prodser->ref; // Show local ref only
- $ref_prodserv .= " - ";
+ if (! empty($libelleproduitservice)) $ref_prodserv .= " - ";
}
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 35b3f78c5e7..e3a6f79210d 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -773,16 +773,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Suppliers
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
{
- if (! empty($conf->facture->enabled))
- {
- $langs->load("bills");
- $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
- $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
- $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
- $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
+ $langs->load("bills");
+ $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
+ $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
+ $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
+ $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
- $newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
- }
+ $newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
}
// Orders
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index d75e8d203e5..30c753bf1dc 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville
* Copyright (C) 2005-2012 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2014 Marcos García
*
* 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
@@ -179,9 +180,10 @@ class pdf_rouget extends ModelePdfExpedition
$tab_height = 130;
$tab_height_newpage = 150;
- if (! empty($object->note_public) || ! empty($object->tracking_number))
+ if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id)))
{
$tab_top = 88;
+ $tab_top_alt = $tab_top;
// Tracking number
if (! empty($object->tracking_number))
@@ -196,7 +198,9 @@ class pdf_rouget extends ModelePdfExpedition
$label=$outputlangs->trans("LinkToTrackYourPackage")." ";
$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
$pdf->SetFont('','B', $default_font_size - 2);
- $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
+ $pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
+
+ $tab_top_alt += 7;
}
}
}
@@ -205,7 +209,7 @@ class pdf_rouget extends ModelePdfExpedition
if (! empty($object->note_public))
{
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
- $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
+ $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1);
}
$nexY = $pdf->GetY();
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 549a9caed32..e10a39128a2 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -444,7 +444,7 @@ class FactureFournisseur extends CommonInvoice
*/
function fetch_lines()
{
- $sql = 'SELECT f.rowid, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
+ $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
@@ -452,7 +452,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
$sql.= ' WHERE fk_facture_fourn='.$this->id;
- dol_syslog("FactureFournisseur::fetch_lines sql=".$sql, LOG_DEBUG);
+ dol_syslog(get_class($this)."::fetch_lines sql=".$sql, LOG_DEBUG);
$resql_rows = $this->db->query($sql);
if ($resql_rows)
{
@@ -467,11 +467,11 @@ class FactureFournisseur extends CommonInvoice
$this->lines[$i] = new stdClass();
$this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->description = $obj->description;
- $this->lines[$i]->ref = $obj->product_ref; // TODO deprecated
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
- //$this->lines[$i]->ref_fourn = $obj->ref_fourn; // Reference fournisseur du produit
- $this->lines[$i]->libelle = $obj->label; // Label du produit
- $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
+ $this->lines[$i]->ref = $obj->product_ref; // deprecated.
+ $this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline
+ $this->lines[$i]->libelle = $obj->label; // This field may contains label of product (when invoice create from order)
+ $this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
$this->lines[$i]->pu_ht = $obj->pu_ht;
$this->lines[$i]->pu_ttc = $obj->pu_ttc;
$this->lines[$i]->tva_tx = $obj->tva_tx;
@@ -498,7 +498,7 @@ class FactureFournisseur extends CommonInvoice
else
{
$this->error=$this->db->error();
- dol_syslog('FactureFournisseur::fetch_lines: Error '.$this->error,LOG_ERR);
+ dol_syslog(get_class($this).'::fetch_lines: Error '.$this->error,LOG_ERR);
return -3;
}
}
@@ -1059,6 +1059,8 @@ class FactureFournisseur extends CommonInvoice
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue).
*
+ * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
+ *
* @param string $desc Description de la ligne
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note)
* @param double $txtva Taux de tva force, sinon -1
@@ -1152,7 +1154,7 @@ class FactureFournisseur extends CommonInvoice
* Update a line detail into database
*
* @param int $id Id of line invoice
- * @param string $label Description of line
+ * @param string $desc Description of line
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
* @param double $vatrate VAT Rate
* @param double $txlocaltax1 LocalTax1 Rate
@@ -1166,9 +1168,9 @@ class FactureFournisseur extends CommonInvoice
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
- function updateline($id, $label, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false)
+ function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false)
{
- dol_syslog(get_class($this)."::updateline $id,$label,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
+ dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$pu = price2num($pu);
@@ -1194,7 +1196,7 @@ class FactureFournisseur extends CommonInvoice
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$this->thirdparty);
- $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty,$localtaxes_type);
+ $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@@ -1217,7 +1219,7 @@ class FactureFournisseur extends CommonInvoice
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
- $sql.= " description ='".$this->db->escape($label)."'";
+ $sql.= " description ='".$this->db->escape($desc)."'";
$sql.= ", pu_ht = ".price2num($pu_ht);
$sql.= ", pu_ttc = ".price2num($pu_ttc);
$sql.= ", qty = ".price2num($qty);
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 4aeb265a41c..b642926f802 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -40,8 +40,13 @@ class ProductFournisseur extends Product
var $product_fourn_price_id; // id of ligne product-supplier
var $id; // product id
- var $fourn_ref; // ref supplier
- var $fourn_qty; // quantity for price
+ var $fourn_ref; // deprecated
+ var $ref_supplier; // ref supplier (can be set by get_buyprice)
+ var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
+
+ var $fourn_qty; // quantity for price (can be set by get_buyprice)
+ var $fourn_pu; // unit price for quantity (can be set by get_buyprice)
+
var $fourn_price; // price for quantity
var $fourn_remise_percent; // discount for quantity (percent)
var $fourn_remise; // discount for quantity (amount)
diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php
index f6f634ec7ea..9e0c12ecf5f 100644
--- a/htdocs/fourn/commande/liste.php
+++ b/htdocs/fourn/commande/liste.php
@@ -3,6 +3,7 @@
* Copyright (C) 2004-2014 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2013 Cédric Salvador
+ * Copyright (C) 2014 Marcos García
*
* 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
@@ -115,7 +116,8 @@ if ($sall)
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
-if (GETPOST('statut')!='')
+//Required triple check because statut=0 means draft filter
+if (GETPOST('statut', 'int') !== '')
{
$sql .= " AND fk_statut IN (".GETPOST('statut').")";
}
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index ccd32ce1e68..e70d78d1ea6 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -363,6 +363,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
+ // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
$result = $object->addline(
$desc,
$lines[$i]->subprice,
@@ -604,6 +605,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
$type = $productsupplier->type;
+ // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first)
$result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr);
}
if ($idprod == -2 || $idprod == 0)
@@ -1150,10 +1152,10 @@ if ($action == 'create')
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
- $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
+ $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
- $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
+ $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp);
}
@@ -1163,7 +1165,7 @@ if ($action == 'create')
$cond_reglement_id = $societe->cond_reglement_supplier_id;
$mode_reglement_id = $societe->mode_reglement_supplier_id;
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
- $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
+ $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp);
}
diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php
index 40799e2bcb9..4b2c61c02a5 100644
--- a/htdocs/fourn/facture/impayees.php
+++ b/htdocs/fourn/facture/impayees.php
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
-if (! $user->rights->facture->lire) accessforbidden();
+if (! $user->rights->fournisseur->facture->lire) accessforbidden();
$langs->load("companies");
$langs->load("bills");
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 8502e13834d..f02e48a9be5 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -243,7 +243,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$object->fetch($facid);
$datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
- $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture);
+ $dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture);
$sql = 'SELECT s.nom, s.rowid as socid,';
$sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total';
diff --git a/htdocs/holiday/admin/holiday.php b/htdocs/holiday/admin/holiday.php
index 174adbdf725..2b265711fa1 100644
--- a/htdocs/holiday/admin/holiday.php
+++ b/htdocs/holiday/admin/holiday.php
@@ -60,18 +60,18 @@ $cp = new Holiday($db);
if ($action == "add")
{
$message = '';
- $error = false;
+ $error = 0;
// Option du groupe de validation
/*if (!$cp->updateConfCP('userGroup',$_POST['userGroup']))
{
- $error = true;
+ $error++;
}*/
// Option du délai pour faire une demande de congés payés
if (!$cp->updateConfCP('delayForRequest',$_POST['delayForRequest']))
{
- $error = true;
+ $error++;
}
// Option du nombre de jours à ajouter chaque mois
@@ -79,67 +79,69 @@ if ($action == "add")
if(!$cp->updateConfCP('nbHolidayEveryMonth',$nbHolidayEveryMonth))
{
- $error = true;
+ $error++;
}
// Option du nombre de jours pour un mariage
$OptMariageCP = price2num($_POST['OptMariage'],5);
if(!$cp->updateConfCP('OptMariage',$OptMariageCP)) {
- $error = true;
+ $error++;
}
// Option du nombre de jours pour un décés d'un proche
$OptDecesProcheCP = price2num($_POST['OptDecesProche'],5);
if(!$cp->updateConfCP('OptDecesProche',$OptDecesProcheCP)) {
- $error = true;
+ $error++;
}
// Option du nombre de jours pour un mariage d'un enfant
$OptMariageProcheCP = price2num($_POST['OptMariageProche'],5);
if(!$cp->updateConfCP('OptMariageProche',$OptMariageProcheCP)) {
- $error = true;
+ $error++;
}
// Option du nombre de jours pour un décés d'un parent
$OptDecesParentsCP = price2num($_POST['OptDecesParents'],5);
if(!$cp->updateConfCP('OptDecesParents',$OptDecesParentsCP)) {
- $error = true;
+ $error++;
}
// Option pour avertir le valideur si délai de demande incorrect
if(isset($_POST['AlertValidatorDelay'])) {
if(!$cp->updateConfCP('AlertValidatorDelay','1')) {
- $error = true;
+ $error++;
}
} else {
if(!$cp->updateConfCP('AlertValidatorDelay','0')) {
- $error = true;
+ $error++;
}
}
// Option pour avertir le valideur si solde des congés de l'utilisateur inccorect
if(isset($_POST['AlertValidatorSolde'])) {
if(!$cp->updateConfCP('AlertValidatorSolde','1')) {
- $error = true;
+ $error++;
}
} else {
if(!$cp->updateConfCP('AlertValidatorSolde','0')) {
- $error = true;
+ $error++;
}
}
// Option du nombre de jours à déduire pour 1 jour de congés
$nbHolidayDeducted = price2num($_POST['nbHolidayDeducted'],2);
- if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) {
- $error = true;
+ if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted))
+ {
+ $error++;
}
- if ($error) {
+ if ($error)
+ {
$message = ''.$langs->trans('ErrorUpdateConfCP').'
';
} else {
$message = ''.$langs->trans('UpdateConfCPOK').'
';
@@ -151,8 +153,8 @@ if ($action == "add")
$result = $db->query($sql);
$num = $db->num_rows($sql);
-
- if($num < 1) {
+ if($num < 1)
+ {
$cp->createCPusers();
$message.= ''.$langs->trans('AddCPforUsers').'
';
}
@@ -202,7 +204,7 @@ elseif ($action == 'create_event')
}
elseif($action == 'event' && isset($_POST['update_event']))
{
- $error = false;
+ $error = 0;
$eventId = array_keys($_POST['update_event']);
$eventId = $eventId[0];
@@ -213,19 +215,21 @@ elseif($action == 'event' && isset($_POST['update_event']))
$eventValue = $optValue;
$eventValue = $eventValue[$eventId];
- if(!empty($eventName)) {
+ if (!empty($eventName))
+ {
$eventName = trim($eventName);
} else {
- $error = true;
+ $error++;
}
- if(!empty($eventValue)) {
+ if (!empty($eventValue))
+ {
$eventValue = price2num($eventValue,2);
} else {
- $error = true;
+ $error++;
}
- if(!$error)
+ if (!$error)
{
// Mise à jour des congés de l'utilisateur
$update = $cp->updateEventCP($eventId,$eventName,$eventValue);
diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php
index 1cf37e77d6f..f167422f503 100644
--- a/htdocs/holiday/define_holiday.php
+++ b/htdocs/holiday/define_holiday.php
@@ -82,7 +82,7 @@ if ($action == 'update' && isset($_POST['update_cp']))
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
$sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init.
dol_syslog('define_holiday update lastUpdate entry sql='.$sql);
- $result = $db->query($sql);
+ $result = $db->query($sql);
$mesg=''.$langs->trans('UpdateConfCPOK').'
';
@@ -91,21 +91,24 @@ if ($action == 'update' && isset($_POST['update_cp']))
}
elseif($action == 'add_event')
{
- $error = false;
+ $error = 0;
if(!empty($_POST['list_event']) && $_POST['list_event'] > 0) {
$event = $_POST['list_event'];
- } else { $error = true;
+ } else { $error++;
}
if(!empty($_POST['userCP']) && $_POST['userCP'] > 0) {
$userCP = $_POST['userCP'];
- } else { $error = true;
+ } else { $erro++;
}
- if($error) {
+ if ($error)
+ {
$message = ''.$langs->trans('ErrorAddEventToUserCP').'
';
- } else {
+ }
+ else
+ {
$nb_holiday = $holiday->getCPforUser($userCP);
$add_holiday = $holiday->getValueEventCp($event);
$new_holiday = $nb_holiday + $add_holiday;
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 5eaf183428d..a2d2ee36d9c 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1043,14 +1043,14 @@ class Product extends CommonObject
/**
- * Lit le prix pratique par un fournisseur
- * On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref
+ * Read price used by a provider
+ * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref
*
* @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price
* @param double $qty Quantity asked
* @param int $product_id Filter on a particular product id
* @param string $fourn_ref Filter on a supplier ref
- * @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve
+ * @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...)
*/
function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0)
{
@@ -1081,7 +1081,7 @@ class Product extends CommonObject
{
// We do same select again but searching with qty, ref and id product
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,";
- $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.tva_tx";
+ $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.ref_fourn = '".$fourn_ref."'";
$sql.= " AND pfp.fk_product = ".$product_id;
@@ -1096,9 +1096,11 @@ class Product extends CommonObject
$obj = $this->db->fetch_object($resql);
if ($obj && $obj->quantity > 0) // If found
{
- $this->buyprice = $obj->price; // \deprecated
+ $this->buyprice = $obj->price; // deprecated
+ $this->fourn_qty = $obj->quantity; // min quantity for price
$this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id
- $this->ref_fourn = $obj->ref_fourn; // Ref supplier
+ $this->ref_fourn = $obj->ref_supplier; // deprecated
+ $this->ref_supplier = $obj->ref_supplier; // Ref supplier
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$result=$obj->fk_product;
return $result;
diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php
index 2eccb9095a5..40e99a2d2ee 100644
--- a/htdocs/product/liste.php
+++ b/htdocs/product/liste.php
@@ -445,11 +445,15 @@ else
if (! empty($conf->service->enabled) && $type != 0)
{
print '';
- if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
- elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
- elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
- elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
- else print $objp->duration;
+ if (preg_match('/([0-9]+)[a-z]/i',$objp->duration))
+ {
+ if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
+ elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
+ elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
+ elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
+ //elseif (preg_match('/([0-9]+)h/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
+ else print $objp->duration;
+ }
print ' ';
}
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index b35f89dd1a7..04164a38579 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -317,7 +317,7 @@ foreach ($listofreferent as $key => $value)
}
if ($key == 'invoice' && ! empty($conf->facture->enabled) && $user->rights->facture->creer)
{
- print ''.$langs->trans("AddCustomerInvoice").' ';
+ print ''.$langs->trans("AddCustomerInvoice").' ';
}
}
if ($project->societe->fournisseur)
diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php
index 94e05ece06a..d019a629bdd 100644
--- a/htdocs/projet/tasks/index.php
+++ b/htdocs/projet/tasks/index.php
@@ -126,7 +126,7 @@ print ' ';
print ' ';
print " \n";
-if (count($tasksarray) > (empty($conf->global->PROJECT_MAX_NB_TASKS)?1000:$conf->global->PROJECT_MAX_NB_TASKS))
+if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
{
print '';
print '';
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index a1bec8fe86c..63b789a4597 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -2270,6 +2270,8 @@ li.cal_event { border: none; list-style-type: none; }
/* Ajax - Liste deroulante de l'autocompletion */
/* ============================================================================== */
+.ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff; }
+
.ui-autocomplete-loading { background: white url() right center no-repeat; }
.ui-autocomplete {
position:absolute;
@@ -2483,7 +2485,7 @@ A.none, A.none:active, A.none:visited, A.none:hover {
{
line-height: 1em !important;
}
-.ui-autocomplete-input { margin: 0; }
+.ui-autocomplete-input { margin: 0; padding: 2px; }
/* ============================================================================== */
diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php
index 11035d148d5..2178ad6fb5a 100755
--- a/test/phpunit/FunctionsLibTest.php
+++ b/test/phpunit/FunctionsLibTest.php
@@ -186,6 +186,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$input='xxx ';
$after=dol_textishtml($input);
$this->assertTrue($after);
+ $input='abc ';
+ $after=dol_textishtml($input);
+ $this->assertTrue($after);
// False
$input='xxx < br>';
@@ -594,16 +597,16 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
public function testVerifCond()
{
$verifcond=verifCond('1==1');
- $this->assertTrue($verifcond);
+ $this->assertTrue($verifcond,'Test a true comparison');
$verifcond=verifCond('1==2');
- $this->assertFalse($verifcond);
+ $this->assertFalse($verifcond,'Test a false comparison');
$verifcond=verifCond('$conf->facture->enabled');
- $this->assertTrue($verifcond);
+ $this->assertTrue($verifcond,'Test that conf property of a module report true when enabled');
$verifcond=verifCond('$conf->moduledummy->enabled');
- $this->assertFalse($verifcond);
+ $this->assertFalse($verifcond,'Test that conf property of a module report false when disabled');
$verifcond=verifCond('');
$this->assertTrue($verifcond);