Merge remote-tracking branch 'origin/3.6' into develop

Conflicts:
	htdocs/comm/action/listactions.php
	htdocs/compta/prelevement/class/bonprelevement.class.php
	htdocs/core/lib/date.lib.php
	htdocs/fourn/facture/fiche.php
	htdocs/includes/tcpdf/include/tcpdf_static.php
	htdocs/product/price.php
This commit is contained in:
Laurent Destailleur 2014-09-07 13:18:56 +02:00
commit 0cefe5af43
4 changed files with 33 additions and 36 deletions

View File

@ -203,6 +203,7 @@ if ($resql)
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,-1,$actioncode,$usergroup); print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,-1,$actioncode,$usergroup);
dol_fiche_end(); dol_fiche_end();
// Add link to show birthdays // Add link to show birthdays

View File

@ -1216,18 +1216,11 @@ class BonPrelevement extends CommonObject
/** /**
<<<<<<< HEAD
* Generate a withdrawal file. Generation Formats:
* European countries: SEPA
* Others: Warning message
* File is generated with name this->filename
=======
* Generate a withdrawal file. * Generate a withdrawal file.
* Generation Formats: * Generation Formats:
* - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled) * - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled)
* - Others countries: Warning message * - Others countries: Warning message
* File is generated with name this->filename * File is generated with name this->filename
>>>>>>> refs/remotes/origin/3.6
* *
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */

View File

@ -430,7 +430,7 @@ class Product extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('PRODUCT_CREATE',$user); $result=$this->call_trigger('PRODUCT_CREATE',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -602,7 +602,7 @@ class Product extends CommonObject
foreach ($this->stock_warehouse as $idW => $ObjW) foreach ($this->stock_warehouse as $idW => $ObjW)
{ {
$qty_batch = 0; $qty_batch = 0;
foreach ($ObjW->detail_batch as $detail) foreach ($ObjW->detail_batch as $detail)
{ {
$qty_batch += $detail->qty; $qty_batch += $detail->qty;
} }
@ -615,12 +615,12 @@ class Product extends CommonObject
$ObjBatch->qty = $ObjW->real - $qty_batch; $ObjBatch->qty = $ObjW->real - $qty_batch;
$ObjBatch->fk_product_stock = $ObjW->id; $ObjBatch->fk_product_stock = $ObjW->id;
if ($ObjBatch->create($user,1) < 0) if ($ObjBatch->create($user,1) < 0)
{ {
$error++; $error++;
$this->errors=$ObjBatch->errors; $this->errors=$ObjBatch->errors;
} }
} }
} }
} }
// For automatic creation // For automatic creation
if ($this->barcode == -1) $this->barcode = $this->get_barcode($this,$this->barcode_type_code); if ($this->barcode == -1) $this->barcode = $this->get_barcode($this,$this->barcode_type_code);
@ -699,7 +699,7 @@ class Product extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('PRODUCT_MODIFY',$user); $result=$this->call_trigger('PRODUCT_MODIFY',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -796,7 +796,7 @@ class Product extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('PRODUCT_DELETE',$user); $result=$this->call_trigger('PRODUCT_DELETE',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -820,7 +820,7 @@ class Product extends CommonObject
} }
} }
} }
// Delete product // Delete product
if (! $error) if (! $error)
{ {
@ -1257,7 +1257,7 @@ class Product extends CommonObject
$localtax2=get_localtax($newvat,2); $localtax2=get_localtax($newvat,2);
if (empty($localtax1)) $localtax1=0; // If = '' then = 0 if (empty($localtax1)) $localtax1=0; // If = '' then = 0
if (empty($localtax2)) $localtax2=0; // If = '' then = 0 if (empty($localtax2)) $localtax2=0; // If = '' then = 0
$this->db->begin(); $this->db->begin();
// Ne pas mettre de quote sur les numeriques decimaux. // Ne pas mettre de quote sur les numeriques decimaux.
@ -1298,13 +1298,13 @@ class Product extends CommonObject
// Call trigger // Call trigger
$result=$this->call_trigger('PRODUCT_PRICE_MODIFY',$user); $result=$this->call_trigger('PRODUCT_PRICE_MODIFY',$user);
if ($result < 0) if ($result < 0)
{ {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
// End call triggers // End call triggers
$this->db->commit(); $this->db->commit();
} }
else else
@ -1423,8 +1423,8 @@ class Product extends CommonObject
$this->entity = $obj->entity; $this->entity = $obj->entity;
$this->db->free($resql); $this->db->free($resql);
// Retreive all extrafield for thirdparty // Retreive all extrafield for thirdparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
@ -3514,35 +3514,38 @@ class Product extends CommonObject
} }
} }
} }
/** /**
* Return minimum product recommended price * Return minimum product recommended price
* *
* @return void * @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE
*/ */
function min_recommended_price() function min_recommended_price()
{ {
global $conf; global $conf;
if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
$maxpricesupplier=0;
if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
{ {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$product_fourn = new ProductFournisseur($this->db); $product_fourn = new ProductFournisseur($this->db);
$product_fourn_list = $product_fourn->list_product_fournisseur_price($this->id, '', ''); $product_fourn_list = $product_fourn->list_product_fournisseur_price($this->id, '', '');
$maxpricesupplier=0;
if (is_array($product_fourn_list) && count($product_fourn_list)>0) if (is_array($product_fourn_list) && count($product_fourn_list)>0)
{ {
foreach($product_fourn_list as $productfourn) foreach($product_fourn_list as $productfourn)
{ {
if ($productfourn->fourn_unitprice>$maxpricesupplier) if ($productfourn->fourn_unitprice > $maxpricesupplier)
{ {
$maxpricesupplier = $productfourn->fourn_unitprice; $maxpricesupplier = $productfourn->fourn_unitprice;
} }
} }
$maxpricesupplier*=$conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE; $maxpricesupplier *= $conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE;
} }
return $maxpricesupplier;
} }
return $maxpricesupplier;
} }
} }

View File

@ -99,7 +99,7 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit-
$newpsq = empty($newpsq) ? 0 : $newpsq; $newpsq = empty($newpsq) ? 0 : $newpsq;
} }
if ($newprice_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier)
{ {
setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
$error++; $error++;
@ -227,7 +227,7 @@ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->ri
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier)
{ {
setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
$error++; $error++;