Skip to content

Commit

Permalink
FIX #12745
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 23, 2019
1 parent ea93c68 commit 4d12ecb
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions htdocs/fourn/class/fournisseur.product.class.php
Expand Up @@ -434,7 +434,7 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn
$sql .= ")";

$this->product_fourn_price_id = 0;

$resql = $this->db->query($sql);
if ($resql) {
$this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price");
Expand Down Expand Up @@ -939,8 +939,6 @@ public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
*/
public function listProductFournisseurPriceLog($product_fourn_price_id, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0)
{
global $conf;

$sql = "SELECT";
$sql.= " pfpl.rowid, pfp.ref_fourn as supplier_ref, pfpl.datec, u.lastname,";
$sql.= " pfpl.price, pfpl.quantity";
Expand All @@ -961,9 +959,17 @@ public function listProductFournisseurPriceLog($product_fourn_price_id, $sortfie
{
$retarray = array();

while ($record = $this->db->fetch_array($resql))
while ($obj = $this->db->fetch_object($resql))
{
$retarray[]=$record;
$tmparray = array();
$tmparray['rowid'] = $obj->rowid;
$tmparray['supplier_ref'] = $obj->supplier_ref;
$tmparray['datec'] = $this->db->jdate($obj->datec);
$tmparray['lastname'] = $obj->lastname;
$tmparray['price'] = $obj->price;
$tmparray['quantity'] = $obj->quantity;

$retarray[]=$tmparray;
}

$this->db->free($resql);
Expand Down Expand Up @@ -991,7 +997,7 @@ public function displayPriceProductFournisseurLog($productFournLogList = array()
$langs->load("suppliers");
if (count($productFournLogList) > 0) {
$out .= '<table class="nobordernopadding" width="100%">';
$out .= '<tr><td class="liste_titre">'.$langs->trans("Date").'</td>';
$out .= '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Date").'</td>';
$out .= '<td class="liste_titre right">'.$langs->trans("Price").'</td>';
//$out .= '<td class="liste_titre right">'.$langs->trans("QtyMin").'</td>';
$out .= '<td class="liste_titre">'.$langs->trans("User").'</td></tr>';
Expand Down Expand Up @@ -1032,7 +1038,7 @@ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss

$logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here
if (is_array($logPrices) && count($logPrices) > 0) {
$label.= '<br>';
$label.= '<br><br>';
$label.= '<u>' . $langs->trans("History") . '</u>';
$label.= $this->displayPriceProductFournisseurLog($logPrices);
}
Expand Down

0 comments on commit 4d12ecb

Please sign in to comment.