diff --git a/htdocs/comm/askpricesupplier.php b/htdocs/comm/askpricesupplier.php
index cf40e62643e..dc0abc68642 100644
--- a/htdocs/comm/askpricesupplier.php
+++ b/htdocs/comm/askpricesupplier.php
@@ -177,7 +177,7 @@ if (empty($reshook))
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->askpricesupplier->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->askpricesupplier->validate)))
)
- {
+ {
$result = $object->valid($user);
if ($result >= 0)
{
@@ -543,19 +543,6 @@ if (empty($reshook))
}
}
- // Close proposal
- else if ($action == 'setstatut' && $user->rights->askpricesupplier->cloturer && ! GETPOST('cancel')) {
- if (! GETPOST('statut')) {
- setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
- $action = 'statut';
- } else {
- // prevent browser refresh from closing proposal several times
- if ($object->statut == 1) {
- $object->cloture($user, GETPOST('statut'), GETPOST('note'));
- }
- }
- }
-
// Classify billed
else if ($action == 'classifybilled' && $user->rights->askpricesupplier->cloturer) {
$object->cloture($user, 4, '');
@@ -1284,9 +1271,11 @@ if ($action == 'create')
print '
| ' . $langs->trans('Ref') . ' | ' . $langs->trans("Draft") . ' |
';
// Ref customer
+ /* PHFAVRE retrait en temporaire
print '| ' . $langs->trans('RefCustomer') . ' | ';
print ' | ';
print '
';
+ */
// Third party
print '';
@@ -1355,15 +1344,19 @@ if ($action == 'create')
}
// What trigger creation
+ /* PHFAVRE retrait en temporaire
print '
| ' . $langs->trans('Source') . ' | ';
$form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1);
print ' |
';
-
+ */
+
// Delivery delay
+ /* PHFAVRE retrait en temporaire
print '| ' . $langs->trans('AvailabilityPeriod') . ' | ';
$form->selectAvailabilityDelay('', 'availability_id', '', 1);
print ' |
';
-
+ */
+
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '| ' . $langs->trans('SendingMethod') . ' | ';
@@ -1372,6 +1365,7 @@ if ($action == 'create')
}
// Delivery date (or manufacturing)
+ /* PHFAVRE retrait en temporaire
print ' |
| ' . $langs->trans("DeliveryDate") . ' | ';
print '';
if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") {
@@ -1384,7 +1378,8 @@ if ($action == 'create')
$form->select_date(-1, 'liv_', '', '', '', "addask", 1, 1);
}
print ' |
';
-
+ */
+
// Model
print '';
print '| ' . $langs->trans("DefaultModel") . ' | ';
diff --git a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
index 49af98252e4..8ac09582339 100644
--- a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
+++ b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
@@ -31,6 +31,7 @@
* \brief File of class to manage proposals
*/
+require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT .'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php';
@@ -1784,6 +1785,10 @@ class AskPriceSupplier extends CommonObject
$this->db->rollback();
return -2;
}
+ else
+ {
+ $this->updatePriceFournisseur();
+ }
}
if ($statut == 4)
{
@@ -1828,6 +1833,31 @@ class AskPriceSupplier extends CommonObject
}
}
+ function updatePriceFournisseur()
+ {
+ $productsupplier = new ProductFournisseur($this->db);
+
+ dol_syslog(get_class($this)."::updatePriceFournisseur", LOG_DEBUG);
+ foreach ($this->lines as $product) {
+ $idProductFourn = $productsupplier->find_min_price_product_fournisseur($product->fk_product, $product->qty);
+ $res = $productsupplier->fetch($idProductFourn);
+
+ $price=price2num($product->subprice*$product->qty,'MU');
+ //$qty=price2num($product->qty);
+ $unitPrice = price2num($product->subprice,'MU');
+
+ //$sql = 'UPDATE '.MAIN_DB_PREFIX.'product_fournisseur_price SET price ='.$price.', quantity ='.$qty.', unitprice ='.$unitPrice.' WHERE rowid = '.$productsupplier->product_fourn_price_id;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.'product_fournisseur_price SET price ='.$price.', unitprice ='.$unitPrice.' WHERE rowid = '.$productsupplier->product_fourn_price_id;
+
+ $resql=$this->db->query($sql);
+ if (!resql) {
+ $this->error=$this->db->error();
+ $this->db->rollback();
+ return -1;
+ }
+ }
+ }
+
/**
* Class invoiced the Propal
*
diff --git a/htdocs/comm/askpricesupplier/index.php b/htdocs/comm/askpricesupplier/index.php
index ef9a37f145c..7684664c56b 100644
--- a/htdocs/comm/askpricesupplier/index.php
+++ b/htdocs/comm/askpricesupplier/index.php
@@ -152,7 +152,7 @@ else
/*
* Draft proposals
*/
-if (! empty($conf->propal->enabled))
+if (! empty($conf->askpricesupplier->enabled))
{
$sql = "SELECT c.rowid, c.ref, s.nom as socname, s.rowid as socid, s.canvas, s.client";
$sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier as c";
@@ -258,7 +258,7 @@ if ($resql)
print '';
$filename=dol_sanitizeFileName($obj->ref);
- $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
+ $filedir=$conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($askpricesupplierstatic->element, $filename, $filedir);
print ' |
';
@@ -291,7 +291,7 @@ if (! empty($conf->askpricesupplier->enabled) && $user->rights->askpricesupplier
$now=dol_now();
- $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
+ $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as askpricesupplierid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."askpricesupplier as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -325,7 +325,7 @@ if (! empty($conf->askpricesupplier->enabled) && $user->rights->askpricesupplier
// Ref
print '';
- $askpricesupplierstatic->id=$obj->propalid;
+ $askpricesupplierstatic->id=$obj->askpricesupplierid;
$askpricesupplierstatic->ref=$obj->ref;
print '';
diff --git a/htdocs/comm/askpricesupplier/list.php b/htdocs/comm/askpricesupplier/list.php
index 47eb078d401..148156f4da2 100644
--- a/htdocs/comm/askpricesupplier/list.php
+++ b/htdocs/comm/askpricesupplier/list.php
@@ -357,7 +357,7 @@ if ($result)
if (! empty($objp->note_private))
{
print ' ';
- print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'';
+ print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'';
print '';
}
print '';
@@ -365,7 +365,7 @@ if ($result)
// Ref
print '| ';
$filename=dol_sanitizeFileName($objp->ref);
- $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($objp->ref);
+ $filedir=$conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->askpricesupplierid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print ' | ';
|